2002/06/05 19:50:56
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 06:47:54 +0000 (06:47 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 06:47:54 +0000 (06:47 +0000)
darcs-hash:20040130064754-2ba56-32799559c8d7bd318f8b83b1a6d914a15de97e8b.gz

src/org/xwt/Box.java

index ff243cc..51315b9 100644 (file)
@@ -825,16 +825,16 @@ public final class Box extends JSObject {
         if (w <= 0 || h <= 0) return;
 
         if (border != null) renderBorder(x, y, w, h, buf);
-
         if ((color & 0xFF000000) != 0x00000000 || getParent() == null) {
             int bw = border == null ? 0 : border[2].getWidth();
             int bh = border == null ? 0 : border[0].getHeight();
+            int x1 = max(x, pos(0) + bw);
+            int y1 = max(y, pos(1) + bh);
+            int x2 = min(x + w, pos(0) + size(0) - bw);
+            int y2 = min(y + h, pos(1) + size(1) - 2);
             buf.setClip(0, 0, buf.getWidth(), buf.getHeight());
-            buf.fillRect(max(x, pos(0) + bw),
-                         max(y, pos(1) + bh),
-                         min(x + w, pos(0) + size(0) - bw),
-                         min(y + h, pos(1) + size(1) - bh),
-                         (color & 0xFF000000) != 0 ? color : SpecialBoxProperty.lightGray);
+            if (y2 - y1 > 0 && x2 - x1 > 0)
+                buf.fillRect(x1,y1,x2,y2,(color & 0xFF000000) != 0 ? color : SpecialBoxProperty.lightGray);
         }
 
         if (image != null) {