questionable patch: merge of a lot of stuff from the svg branch
[org.ibex.core.git] / src / org / ibex / graphics / Surface.java
index 0799267..6e2bcc9 100644 (file)
@@ -266,9 +266,9 @@ public abstract class Surface implements Callable {
             }
             int rootwidth = root.test(root.HSHRINK) ? root.contentwidth : root.maxwidth;
             int rootheight = root.test(root.VSHRINK) ? root.contentheight : root.maxheight;
-            if (rootwidth != root.width || rootheight != root.height) {
+            if (rootwidth != root.getRootWidth() || rootheight != root.getRootHeight()) {
                 // dirty the place where the scar used to be and where it is now
-                dirty(0, root.height - scarImage.height, scarImage.width, scarImage.height);
+                dirty(0, root.getRootHeight() - scarImage.height, scarImage.width, scarImage.height);
                 dirty(0, rootheight - scarImage.height, scarImage.width, scarImage.height);
             }
             root.reflow();
@@ -286,15 +286,17 @@ public abstract class Surface implements Callable {
             int x = dirt[i][0], y = dirt[i][1], w = dirt[i][2], h = dirt[i][3];
             if (x < 0) x = 0;
             if (y < 0) y = 0;
-            if (x+w > root.width) w = root.width - x;
-            if (y+h > root.height) h = root.height - y;
+            if (x+w > root.getRootWidth()) w = root.getRootWidth() - x;
+            if (y+h > root.getRootHeight()) h = root.getRootHeight() - y;
             if (w <= 0 || h <= 0) continue;
         */
             // FIXME: set clip to -- x, y, x + w, y + h, 
 
             root.render(this.getPixelBuffer(), identity, null);
+
+            //try { Thread.sleep(500); } catch (Exception e) { }
             /*
-            //getPixelBuffer().drawPicture(scarImage, 0, root.height - scarImage.height, x, y, x+w, y+h);
+            //getPixelBuffer().drawPicture(scarImage, 0, root.getRootHeight() - scarImage.height, x, y, x+w, y+h);
             
             if (abort) {
                 // x,y,w,h is only partially reconstructed, so we must be careful not to re-blit it
@@ -395,7 +397,7 @@ public abstract class Surface implements Callable {
             screenDirtyRegions.dirty(x1, y1, x2, y2);
             backbuffer.drawLine(x1, y1, x2, y2, color);
         }
-
+        /*
         public abstract void _fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int color);
         public void fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int color) {
             // we don't dirty trapezoid-fills since it's faster to just do them directly than to copy from the backbuffer
@@ -403,10 +405,11 @@ public abstract class Surface implements Callable {
             backbuffer.fillTrapezoid(x1, x2, y1, x3, x4, y2, color);
             //_fillTrapezoid(x1, x2, y1, x3, x4, y2, color);
         }
-
+        */
         public void render() {
             super.render();
             if (abort) return;
+            /*
             int[][] dirt = screenDirtyRegions.flush();
             for(int i = 0; dirt != null && i < dirt.length; i++) {
                 if (dirt[i] == null) continue;
@@ -416,12 +419,15 @@ public abstract class Surface implements Callable {
                 int h = dirt[i][3];
                 if (x < 0) x = 0;
                 if (y < 0) y = 0;
-                if (x+w > root.width) w = root.width - x;
-                if (y+h > root.height) h = root.height - y;
+                if (x+w > root.getRootWidth()) w = root.getRootWidth() - x;
+                if (y+h > root.getRootHeight()) h = root.getRootHeight() - y;
                 if (w <= 0 || h <= 0) continue;
                 if (abort) return;
                 blit(backbuffer, x, y, x, y, w + x, h + y);
             }
+            */
+            System.out.println("blit");
+            blit(backbuffer, 0, 0, 0, 0, root.getRootWidth(), root.getRootHeight());
         }
 
         // This is how subclasses signal a 'shallow dirty', indicating that although the backbuffer is valid, the screen is not