2002/06/23 21:35:23
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 06:48:24 +0000 (06:48 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 06:48:24 +0000 (06:48 +0000)
darcs-hash:20040130064824-2ba56-8c897bd31212b49d7e679c860463f4a06b813537.gz

CHANGES
src/org/xwt/plat/Java12.java

diff --git a/CHANGES b/CHANGES
index bc3dc68..b4b926d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
 
 23-Jun megacz SpecialBoxProperty.java: fixedaspect, warning about non-self-redirect root boxes
 
+23-Jun megacz Java12.java: removed wierd BufferedImage hackaround;
+              jdk1.4 doesn't need it and it was causing wierd rendering glitches
+
index 694a9eb..734b20e 100644 (file)
@@ -165,41 +165,9 @@ public class Java12 extends AWT {
     /** used to avoid garbage creation with getClipBounds() */
     private static Rectangle clipBounds = new Rectangle();
     
-    // FEATURE: performance hits here are a result of getSubimage() -- if we don't call it, Graphics2D will. It creates tons of int[]s, as well as
-    // BufferedImage instances which get stored in an array deep inside Graphics2D, which the JDK does a LINEAR SCAN through. Aarrgh.
-    // This is rumored to be fixed in JDK 1.4.
     protected static void _doDrawImage(Graphics g, Image i, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, ImageObserver o) {
-        
         if (dx1 == dx2 || dy1 == dy2) return;
-
-        if (dx2 - dx1 != sx2 - sx1 || dy2 - dy1 != sy2 - sy1)
-            g.drawImage(i, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, o);
-        else {
-            // fastpath for images that do not need to be scaled
-            if (i instanceof BufferedImage) {
-                BufferedImage b = (BufferedImage)i;
-                
-                if (dx2 - dx1 != b.getWidth(null) || dy2 - dy1 != b.getHeight(null)) {
-                    b = b.getSubimage(sx1, sy1, sx2 - sx1, sy2 - sy1);
-                    sx2 = sx2 - sx1;
-                    sy2 = sy2 - sy1;
-                    sx1 = 0;
-                    sy1 = 0;
-                }
-                g.drawImage(b, dx1, dy1, o);
-                
-            } else {
-
-                // workaround for a wierd JDK bug
-                boolean skip = false;
-                try { g.getClipBounds(clipBounds); } catch (NullPointerException n) { skip = true; }
-
-                g.clipRect(dx1, dy1, dx2 - dx1, dy2 - dy1);
-                g.drawImage(i, dx1 - sx1, dy1 - sy1, o);
-
-                if (!skip) g.setClip(clipBounds.x, clipBounds.y, clipBounds.x + clipBounds.width, clipBounds.y + clipBounds.height);
-            }
-        }
+        g.drawImage(i, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2, o);
     }
 
     protected org.xwt.Weak _getWeak(Object o) { return new Java12Weak(o); }