From 7da1cdaa524e763a4dd63c6a6c481b9d4a9d54c9 Mon Sep 17 00:00:00 2001 From: oakes Date: Tue, 8 Apr 2014 16:36:14 -0400 Subject: [PATCH] Add type hints to screenshot! function --- src/play_clj/core_utils.clj | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/play_clj/core_utils.clj b/src/play_clj/core_utils.clj index c741150..513acbe 100644 --- a/src/play_clj/core_utils.clj +++ b/src/play_clj/core_utils.clj @@ -16,7 +16,8 @@ specified path. Note that when a `pixmap` is no longer needed, you must call (screenshot! \"out.png\") (screenshot! (files! :external \"out.png\"))" ([] - (let [pic (Pixmap. (game :width) (game :height) (Pixmap$Format/RGBA8888)) + (let [^Pixmap$Format pic-f (Pixmap$Format/RGBA8888) + ^Pixmap pic (Pixmap. ^long (game :width) ^long (game :height) pic-f) pixel-data (ScreenUtils/getFrameBufferPixels true) pixels (.getPixels pic)] (doto pixels @@ -30,7 +31,7 @@ specified path. Note that when a `pixmap` is no longer needed, you must call (files! :local path) path)] (PixmapIO/writePNG handle pic) - (.dispose pic)))) + (pixmap! pic :dispose)))) ; static fields