Revision: 743
Author: allain.lalonde
Date: Mon Oct 19 08:03:51 2009
Log: Made disabling double buffering free up the backBuffer.
http://code.google.com/p/piccolo2d/source/detail?r=743

Modified:
   
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTCanvas.java

=======================================
---  
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTCanvas.java 
 
Mon Oct 19 08:01:47 2009
+++  
/piccolo2d.java/trunk/swt/src/main/java/edu/umd/cs/piccolox/swt/PSWTCanvas.java 
 
Mon Oct 19 08:03:51 2009
@@ -323,6 +323,10 @@
       */
      public void setDoubleBuffered(final boolean doubleBuffered) {
          this.doubleBuffered = doubleBuffered;
+        if (!doubleBuffered && backBuffer != null) {
+            backBuffer.dispose();
+            backBuffer = null;
+        }
      }

      /**
@@ -494,16 +498,16 @@
          if (backBuffer != null) {
              backBuffer.dispose();
          }
-
+
          System.out.println("new size: " + newWidth);
-
+
          backBuffer = new Image(getDisplay(), newWidth, newHeight);
      }

      private boolean backBufferNeedsResizing(final int newWidth, final int  
newHeight) {
          if (!doubleBuffered)
              return false;
-
+
          if (backBuffer == null)
              return true;


--~--~---------~--~----~------------~-------~--~----~
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to