Author: noelgrandin
Date: Thu Oct 20 07:32:54 2011
New Revision: 1186639

URL: http://svn.apache.org/viewvc?rev=1186639&view=rev
Log:
fix for volatile image caching, need to create the image at the size of the 
screen, not the clip

Modified:
    pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java?rev=1186639&r1=1186638&r2=1186639&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/ApplicationContext.java Thu Oct 20 
07:32:54 2011
@@ -93,6 +93,7 @@ public abstract class ApplicationContext
         private boolean disableVolatileBuffer = false;
         private boolean debugPaint = false;
         private java.awt.image.VolatileImage volatileImage = null;
+        private java.awt.image.VolatileImage volatileImageClipBounds = null;
 
         private Random random = null;
 
@@ -511,9 +512,9 @@ public abstract class ApplicationContext
 
             // Paint the display into a volatile offscreen buffer
             GraphicsConfiguration gc = graphics.getDeviceConfiguration();
-            java.awt.Rectangle clipBounds = graphics.getClipBounds();
+            java.awt.Rectangle gcBounds = gc.getBounds();
             if (volatileImage == null) {
-                volatileImage = 
gc.createCompatibleVolatileImage(clipBounds.width, clipBounds.height,
+                volatileImage = 
gc.createCompatibleVolatileImage(gcBounds.width, gcBounds.height,
                     Transparency.OPAQUE);
             }
 
@@ -524,13 +525,16 @@ public abstract class ApplicationContext
 
                 if (valid == java.awt.image.VolatileImage.IMAGE_OK
                     || valid == java.awt.image.VolatileImage.IMAGE_RESTORED) {
+                    java.awt.Rectangle clipBounds = graphics.getClipBounds();
                     Graphics2D volatileImageGraphics = 
volatileImage.createGraphics();
-                    volatileImageGraphics.setClip(0, 0, clipBounds.width, 
clipBounds.height);
-                    volatileImageGraphics.translate(-clipBounds.x, 
-clipBounds.y);
+                    volatileImageGraphics.setClip(clipBounds.x, clipBounds.y, 
clipBounds.width, clipBounds.height);
 
                     try {
                         paintDisplay(volatileImageGraphics);
-                        graphics.drawImage(volatileImage, clipBounds.x, 
clipBounds.y, this);
+                        graphics.drawImage(volatileImage,
+                            clipBounds.x, clipBounds.y, clipBounds.width, 
clipBounds.height,
+                            clipBounds.x, clipBounds.y, clipBounds.width, 
clipBounds.height,
+                            this);
                     } finally {
                         volatileImageGraphics.dispose();
                     }


Reply via email to