harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r471393 - /incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
Date Sun, 05 Nov 2006 10:33:37 GMT
Author: apetrenko
Date: Sun Nov  5 02:33:37 2006
New Revision: 471393

URL: http://svn.apache.org/viewvc?view=rev&rev=471393
Log:
Patch for HARMONY-1961 "[classlib][awt] performance improvement for clip and setClip methods
of Graphics"

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java?view=diff&rev=471393&r1=471392&r2=471393
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
Sun Nov  5 02:33:37 2006
@@ -209,10 +209,19 @@
         MultiRectArea mra = null;
         if (s instanceof MultiRectArea) {
             mra = new MultiRectArea((MultiRectArea)s);
-            mra.translate(Math.round((float)transform.getTranslateX()), Math.round((float)transform.getTranslateY()));
+            mra.translate((int)transform.getTranslateX(), (int)transform.getTranslateY());
         } else {
-            s = transform.createTransformedShape(s);
-            mra = jsr.rasterize(s, 0.5);
+            int type = transform.getType();
+            if(s instanceof Rectangle && (type & (AffineTransform.TYPE_IDENTITY
|
+                AffineTransform.TYPE_TRANSLATION)) != 0){
+                    mra = new MultiRectArea((Rectangle)s);
+                    if(type == AffineTransform.TYPE_TRANSLATION){
+                        mra.translate((int)transform.getTranslateX(), (int)transform.getTranslateY());
+                    }
+            } else {
+                s = transform.createTransformedShape(s);
+                mra = jsr.rasterize(s, 0.5);
+            }
         }
 
         if (clip == null) {
@@ -952,8 +961,18 @@
             nclip.translate(Math.round((float)transform.getTranslateX()), Math.round((float)transform.getTranslateY()));
             setTransformedClip(nclip);
         } else {
-            s = transform.createTransformedShape(s);
-            setTransformedClip(jsr.rasterize(s, 0.5));
+            int type = transform.getType();
+            if(s instanceof Rectangle && (type & (AffineTransform.TYPE_IDENTITY
|
+                AffineTransform.TYPE_TRANSLATION)) != 0){
+                    MultiRectArea nclip = new MultiRectArea((Rectangle)s);
+                    if(type == AffineTransform.TYPE_TRANSLATION){
+                        nclip.translate((int)transform.getTranslateX(), (int)transform.getTranslateY());
+                    }
+                    setTransformedClip(nclip);
+            } else {
+                s = transform.createTransformedShape(s);
+                setTransformedClip(jsr.rasterize(s, 0.5));
+            }
         }
     }
 



Mime
View raw message