changeset 92:bf4a46f80851

Avoid reflection in the rendering code.
author Mikhail Kryshen <mikhail@kryshen.net>
date Wed, 08 Dec 2010 23:40:41 +0300
parents f87363889015
children 017f5f14b876
files src/net/kryshen/indyvon/async.clj src/net/kryshen/indyvon/component.clj
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/net/kryshen/indyvon/async.clj	Mon Dec 06 19:57:22 2010 +0300
+++ b/src/net/kryshen/indyvon/async.clj	Wed Dec 08 23:40:41 2010 +0300
@@ -111,7 +111,7 @@
 (defn- draw-offscreen [async-layer]
   ;;(Thread/sleep 1000)
   (with-buffer async-layer :back [b]
-    (let [g (.getGraphics ^Image (:image b))]
+    (let [g (.createGraphics ^BufferedImage (:image b))]
       ;; Clear the buffer.
       (.setComposite g AlphaComposite/Clear)
       (.fillRect g 0 0 (:width async-layer) (:height async-layer))
--- a/src/net/kryshen/indyvon/component.clj	Mon Dec 06 19:57:22 2010 +0300
+++ b/src/net/kryshen/indyvon/component.clj	Wed Dec 08 23:40:41 2010 +0300
@@ -23,7 +23,7 @@
    net.kryshen.indyvon.core)
   (:import
    (net.kryshen.indyvon.core Size Bounds)
-   (java.awt Graphics2D Component Dimension Color)
+   (java.awt Graphics Component Dimension Color)
    (java.awt.geom Rectangle2D$Double)
    (javax.swing JFrame JPanel)))
 
@@ -36,7 +36,7 @@
   ([layer event-dispatcher]
      (let [panel
            (proxy [JPanel] []
-             (paintComponent [g]
+             (paintComponent [^Graphics g]
                (let [size (.getSize ^Component this)]
                  (.setColor g (:back-color *theme*))
                  (.fillRect g 0 0 (.width size) (.height size))