2003/09/27 07:08:02
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:38:22 +0000 (07:38 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:38:22 +0000 (07:38 +0000)
darcs-hash:20040130073822-2ba56-146a5defef9e4582ef1ff09f725a033ceacd21a3.gz

src/org/xwt/Surface.java
src/org/xwt/VectorGraphics.java

index 6ed2377..e4cf92d 100644 (file)
@@ -284,6 +284,8 @@ public abstract class Surface extends PixelBuffer {
         Refresh();
     }
 
+    private static VectorGraphics.Affine identity = VectorGraphics.Affine.identity();
+
     /** runs the prerender() and render() pipelines in the root Box to regenerate the backbuffer, then blits it to the screen */
     public synchronized void render() {
 
@@ -309,7 +311,7 @@ public abstract class Surface extends PixelBuffer {
             if (y+h > root.height) h = root.height - y;
             if (w <= 0 || h <= 0) continue;
 
-            root.render(0, 0, x, y, w, h, this);
+            root.render(0, 0, x, y, w, h, this, identity);
             
             if (abort) {
 
@@ -326,7 +328,6 @@ public abstract class Surface extends PixelBuffer {
                 return;
             }
         }
-
     }
 
     // FEATURE: reinstate recycler
index fc19ba4..e028caa 100644 (file)
@@ -20,7 +20,7 @@ import java.util.*;
         - mitre    (hard)
         - bevel    (easy)
         - bump     (easy, but requires 'round' Paint)
-    - subtree sharing? otherwise the memory consumption might be outrageous...  clone="" attribute?
+    - subtree sharing? otherwise the memory consumption might be outrageous... clone="" attribute?
     - better clipping
         - intersect clip regions (linearity)
         - clip on trapezoids, not pixels
@@ -191,6 +191,20 @@ public final class VectorGraphics {
        static final byte TYPE_CUBIC = 3;
        static final byte TYPE_QUADRADIC = 4;
 
+        // FEATURE: make this faster and cache it; also deal with negative coordinates
+        public int boundingBoxWidth() {
+            int ret = 0;
+            for(int i=0; i<numvertices; i++) ret = Math.max(ret, (int)Math.ceil(x[i]));
+            return ret;
+        }
+
+        // FEATURE: make this faster and cache it; also deal with negative coordinates
+        public int boundingBoxHeight() {
+            int ret = 0;
+            for(int i=0; i<numvertices; i++) ret = Math.max(ret, (int)Math.ceil(y[i]));
+            return ret;
+        }
+
         /** Creates a concrete vector path transformed through the given matrix. */
        public RasterPath realize(Affine a) {