2003/09/21 10:26:54
[org.ibex.core.git] / src / org / xwt / Surface.java
index d044eee..5f44098 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright 2002 Adam Megacz, see the COPYING file for licensing [GPL]
+// Copyright 2003 Adam Megacz, see the COPYING file for licensing [GPL]
 package org.xwt;
 
 import org.bouncycastle.util.encoders.Base64;
@@ -118,6 +118,7 @@ public abstract class Surface {
 
     /** Sets the surface's x and y position. */
     public abstract void setLocation(int x, int y);
+    public void setLocation() { setLocation(root.x, root.y); }
 
     /** Sets the surface's title bar text, if applicable */
     public abstract void setTitleBarText(String s);
@@ -126,7 +127,7 @@ public abstract class Surface {
     public abstract void setIcon(Picture i);
 
     /** copies a region from the doublebuffer to this surface */
-    public abstract void blit(DoubleBuffer source, int sx, int sy, int dx, int dy, int dx2, int dy2);
+    public abstract void blit(PixelBuffer source, int sx, int sy, int dx, int dy, int dx2, int dy2);
 
     /** Destroy the surface */
     public abstract void _dispose();
@@ -215,7 +216,7 @@ public abstract class Surface {
             outer: for(int i=0; i<keywatchers.size(); i++) {
                 Box b = (Box)keywatchers.elementAt(i);
                 for(Box cur = b; cur != null; cur = cur.getParent())
-                    if (cur.invisible) continue outer;
+                    if ((cur.flags & cur.INVISIBLE_FLAG) != 0) continue outer;
                 b.put("KeyPressed", key);
             }
             Platform.clipboardReadEnabled = false;
@@ -232,7 +233,7 @@ public abstract class Surface {
             outer: for(int i=0; i<keywatchers.size(); i++) {
                 Box b = (Box)keywatchers.elementAt(i);
                 for(Box cur = b; cur != null; cur = cur.getParent())
-                    if (cur.invisible) continue outer;
+                    if ((cur.flags & cur.INVISIBLE_FLAG) != 0) continue outer;
                 b.put("KeyReleased", key);
             }
         }});
@@ -304,7 +305,7 @@ public abstract class Surface {
     // Private Instance Data /////////////////////////////////////////////////////////////////////////////////////////////
 
     /** The automatic double buffer for the root box */
-    DoubleBuffer backbuffer = null;
+    PixelBuffer backbuffer = null;
 
     /** Dirty regions on the backbuffer which need to be rebuilt using Box.render() */
     private DirtyList backbufferDirtyRegions = new DirtyList();
@@ -319,10 +320,10 @@ public abstract class Surface {
     static volatile boolean abort = false;
 
     /** a solid red 10x10 double buffer */
-    private DoubleBuffer showRenderBuf = null;
+    private PixelBuffer showRenderBuf = null;
 
     /** a striped 100x100 double buffer */
-    private DoubleBuffer showRenderBuf2 = null;
+    private PixelBuffer showRenderBuf2 = null;
 
     /** true iff this window should be scarred */
     private boolean scarred = true;
@@ -398,7 +399,7 @@ public abstract class Surface {
         } while(abort);
 
         // this is a bit dangerous since we're passing ourselves to another method before subclasses' ctors have run...        
-        backbuffer = Platform.createDoubleBuffer(Platform.getScreenWidth(), Platform.getScreenHeight(), this);
+        backbuffer = Platform.createPixelBuffer(Platform.getScreenWidth(), Platform.getScreenHeight(), this);
 
         root.dirty();
         Refresh();
@@ -517,9 +518,9 @@ public abstract class Surface {
             
             if (Main.showRenders) {
                 if (showRenderBuf == null) {
-                    showRenderBuf = Platform.createDoubleBuffer(10, 10, this);
+                    showRenderBuf = Platform.createPixelBuffer(10, 10, this);
                     showRenderBuf.fillRect(0, 0, 10, 10, 0x00FF0000);
-                    showRenderBuf2 = Platform.createDoubleBuffer(100, 100, this);
+                    showRenderBuf2 = Platform.createPixelBuffer(100, 100, this);
                     for(int y1 = 0; y1<100; y1++)
                         for(int x1 = 0; x1<100; x1++)
                             if ((x1 + y1) % 5 == 0)