Revision: 3227
          http://vexi.svn.sourceforge.net/vexi/?rev=3227&view=rev
Author:   clrg
Date:     2008-11-20 23:56:58 +0000 (Thu, 20 Nov 2008)

Log Message:
-----------
Remove redundant calls to dirty (reduction of 80%+)

Modified Paths:
--------------
    trunk/core/org.vexi.core/src/org/vexi/core/Surface.java

Modified: trunk/core/org.vexi.core/src/org/vexi/core/Surface.java
===================================================================
--- trunk/core/org.vexi.core/src/org/vexi/core/Surface.java     2008-11-19 
14:58:18 UTC (rev 3226)
+++ trunk/core/org.vexi.core/src/org/vexi/core/Surface.java     2008-11-20 
23:56:58 UTC (rev 3227)
@@ -443,8 +443,8 @@
         PixelBuffer buff = getPixelBuffer();
         if (dirt!=null) {
             for(int i = 0; dirt != null && i < numregions; i++) {
-                if (dirt[(4*i)]<0) continue;
-                int x = dirt[(4*i)], y = dirt[(4*i)+1], w = dirt[(4*i)+2], h = 
dirt[(4*i)+3];
+                if (dirt[4*i]<0) continue;
+                int x = dirt[4*i], y = dirt[4*i+1], w = dirt[4*i+2], h = 
dirt[4*i+3];
                 if (x < 0) x = 0;
                 if (y < 0) y = 0;
                 if (w > root.width) w = root.width;
@@ -452,18 +452,18 @@
                 if (w <= x || h <= y) continue;
 
                 root.render(0, 0, x, y, w, h, buff);
-                if (scarImage != null){
-                    int yscarstart = root.height-scarImage.height;
-                    if(scarImage.width > x && yscarstart < y+h)
-                        buff.drawPicture(scarImage, 0, yscarstart, x, y, w, h);
+                if (scarImage != null) {
+                    if (scarImage.width > x && root.height-scarImage.height < 
h)
+                        buff.drawPicture(scarImage, 0, 
root.height-scarImage.height, x, y, w, h);
                 }
+
                 if (abort) {
                     // x,y,w,h is only partially reconstructed, so we must be 
careful not to re-blit it
                     dirtyRegions.dirty(x, y, w, h);
                     // put back all the dirty regions we haven't yet processed 
(including the current one)
                     for(int j=i; j<numregions; j++)
-                        if (dirt[(4*j)]>=0)
-                            dirtyRegions.dirty(dirt[4*j], dirt[(4*j)+1], 
dirt[(4*j)+2], dirt[(4*j)+3]);
+                        if (dirt[4*j]>=0)
+                            dirtyRegions.dirty(dirt[4*j], dirt[4*j+1], 
dirt[4*j+2], dirt[4*j+3]);
                     return;
                 }
             }
@@ -489,14 +489,13 @@
         public DoubleBufferedSurface(Box root) { super(root); }
         public PixelBuffer getPixelBuffer() { return this; }
         protected PixelBuffer backbuffer = 
Platform.createPixelBuffer(Platform.getScreenWidth(), 
Platform.getScreenHeight(), this);
-        DirtyList screenDirtyRegions = new DirtyList();
+        private DirtyList screenDirtyRegions = new DirtyList();
 
         /** draw an unscaled image onto the backbuffer where:
          *  (dx,dy) is the offset within the picture from where to start 
sampling
          *  (cx1,cy1) to (cx2,cy2) describe the clipping box on the backbuffer 
which to draw
          */
         public void drawPicture(Picture source, int dx, int dy, int cx1, int 
cy1, int cx2, int cy2) {
-            screenDirtyRegions.dirty(cx1, cy1, cx2, cy2);
             backbuffer.drawPicture(source, dx, dy, cx1, cy1, cx2, cy2);
         }
 
@@ -505,17 +504,14 @@
          *  (sx1,sy1) to (sx2,sy2) describe the source area from which to 
sample from the image
          */
         public void drawPicture(Picture source, int dx1, int dy1, int dx2, int 
dy2, int sx1, int sy1, int sx2, int sy2) {
-            screenDirtyRegions.dirty(dx1, dy1, dx2, dy2);
             backbuffer.drawPicture(source, dx1, dy1, dx2, dy2, sx1, sy1, sx2, 
sy2);
         }
 
         public void drawGlyph(Font.Glyph source, int dx, int dy, int cx1, int 
cy1, int cx2, int cy2, int argb) {
-            screenDirtyRegions.dirty(cx1, cy1, cx2, cy2);
             backbuffer.drawGlyph(source, dx, dy, cx1, cy1, cx2, cy2, argb);
         }
 
         public void fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int 
y2, int color) {
-            screenDirtyRegions.dirty(Math.min(x1, x3), y1, Math.max(x2, x4), 
y2);
             backbuffer.fillTrapezoid(x1, x2, y1, x3, x4, y2, color);
         }
 
@@ -524,11 +520,11 @@
             int numregions = screenDirtyRegions.num();
             int[] dirt = screenDirtyRegions.flush();
             for(int i = 0; dirt != null && i < numregions; i++) {
-                if (dirt[(4*i)]<0) continue;
-                int x = dirt[(4*i)];
-                int y = dirt[(4*i)+1];
-                int w = dirt[(4*i)+2];
-                int h = dirt[(4*i)+3];
+                if (dirt[4*i]<0) continue;
+                int x = dirt[4*i];
+                int y = dirt[4*i+1];
+                int w = dirt[4*i+2];
+                int h = dirt[4*i+3];
                 if (x < 0) x = 0;
                 if (y < 0) y = 0;
                 if (w > root.width) w = root.width;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Vexi-svn mailing list
Vexi-svn@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vexi-svn

Reply via email to