harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odea...@apache.org
Subject svn commit: r590683 - in /harmony/enhanced/classlib/trunk/modules/awt/src/main/java: common/org/apache/harmony/awt/gl/render/JavaBlitter.java unix/org/apache/harmony/awt/gl/linux/XBlitter.java
Date Wed, 31 Oct 2007 14:45:41 GMT
Author: odeakin
Date: Wed Oct 31 07:45:41 2007
New Revision: 590683

URL: http://svn.apache.org/viewvc?rev=590683&view=rev
Log:
Apply patch HARMONY-5044 ([classlib][awt] Drawing Images with Affine Transformation on BufferedImage
works incorrectly)

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/render/JavaBlitter.java
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XBlitter.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/render/JavaBlitter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/render/JavaBlitter.java?rev=590683&r1=590682&r2=590683&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/render/JavaBlitter.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/render/JavaBlitter.java
Wed Oct 31 07:45:41 2007
@@ -34,6 +34,7 @@
 import java.awt.image.Raster;
 import java.awt.image.WritableRaster;
 
+import org.apache.harmony.awt.gl.ImageSurface;
 import org.apache.harmony.awt.gl.MultiRectArea;
 import org.apache.harmony.awt.gl.Surface;
 import org.apache.harmony.awt.gl.XORComposite;
@@ -134,6 +135,10 @@
 
                 transformedBlit(srcCM, srcR, 0, 0, dstCM, dstR, dstX, dstY, w, h,
                         sysxform, comp, bgcolor, clip);
+                
+                Rectangle dirtyReg = JavaBlitter.getBounds2D(sysxform, new Rectangle(dstX,
dstY, w, h)).getBounds();
+                Rectangle bounds = new Rectangle(dstSurf.getWidth(), dstSurf.getHeight()).getBounds();
+                dstSurf.addDirtyRegion(bounds.intersection(dirtyReg));
 
         }
     }
@@ -148,6 +153,8 @@
                 dstSurf.getColorModel(), dstSurf.getRaster(),
                 width, height, comp, bgcolor, clip);
 
+        dstSurf.addDirtyRegion(new Rectangle(dstX, dstY, width, height));
+
     }
     public void javaBlt(int srcX, int srcY, int srcW, int srcH,
             ColorModel srcCM, Raster srcRast, int dstX, int dstY,
@@ -353,11 +360,11 @@
             int width, int height, AffineTransform at, Composite comp,
             Color bgcolor,MultiRectArea clip) {
 
-        Rectangle srcBounds = new Rectangle(width, height);
-        Rectangle dstBlitBounds = new Rectangle(dstX, dstY, srcR.getWidth(), srcR.getHeight());
+        Rectangle srcBounds = new Rectangle(srcX, srcY, width, height);
+        Rectangle dstBlitBounds = new Rectangle(dstX, dstY, width, height);
 
         Rectangle transSrcBounds = getBounds2D(at, srcBounds).getBounds();
-        Rectangle transDstBlitBounds = new Rectangle(0, 0, dstR.getWidth(), dstR.getHeight());
+        Rectangle transDstBlitBounds = getBounds2D(at, dstBlitBounds).getBounds();
 
         int translateX = transDstBlitBounds.x - transSrcBounds.x;
         int translateY = transDstBlitBounds.y - transSrcBounds.y;

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XBlitter.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XBlitter.java?rev=590683&r1=590682&r2=590683&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XBlitter.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/XBlitter.java
Wed Oct 31 07:45:41 2007
@@ -168,16 +168,6 @@
                  );
                 break;
             default:
-                XSurface xDstSurf = (XSurface) dstSurf;
-
-                AffineTransform at = (AffineTransform) sysxform.clone();
-
-                Rectangle transDstBounds = JavaBlitter.getBounds2D(at, new Rectangle(dstX,
dstY, width, height)).getBounds();
-                int tWidth = transDstBounds.width;
-                int tHeight = transDstBounds.height;
-                dstX = transDstBounds.x;
-                dstY = transDstBounds.y;
-
                 ColorModel cm = srcSurf.getColorModel();
                 WritableRaster compRaster = srcSurf.getRaster();
                 BufferedImage compIm = new BufferedImage(
@@ -187,28 +177,21 @@
                         null
                 );
 
-                BufferedImage transformed = new BufferedImage(tWidth, tHeight, BufferedImage.TYPE_INT_ARGB);
+                Rectangle transDstBounds = JavaBlitter.getBounds2D(sysxform, new Rectangle(dstX,
dstY, width, height)).getBounds();
+                int tWidth = transDstBounds.width;
+                int tHeight = transDstBounds.height;
+                int tX = transDstBounds.x;
+                int tY = transDstBounds.y;
+
+                if(tWidth <= 0 || tHeight <= 0) return;
+                BufferedImage transformed = new BufferedImage(dstSurf.getWidth(), dstSurf.getHeight(),
BufferedImage.TYPE_INT_ARGB);
 
                 Surface transfSurf = Surface.getImageSurface(transformed);
                 JavaBlitter.getInstance().blit(srcX, srcY, Surface.getImageSurface(compIm),

-                        0, 0, transfSurf, width, height, at, AlphaComposite.Src, null, null);
-
-                if (dstX < 0){
-                    tWidth += dstX;
-                    srcX = -dstX;
-                    dstX = 0;
-                }
-
-                if (dstY < 0){
-                    tHeight += dstY;
-                    srcY = -dstY;
-                    dstY = 0;
-                }
-
-                if(tWidth <= 0 || tHeight <= 0 || srcX >= tWidth || srcY >= tHeight)
return;
+                        dstX, dstY, transfSurf, width, height, sysxform, AlphaComposite.Src,
null, null);
                 blit(
-                        srcX, srcY, transfSurf,
-                        dstX, dstY, dstSurf,
+                        tX, tY, transfSurf,
+                        tX, tY, dstSurf,
                         tWidth, tHeight,
                         comp, bgcolor, clip
                 );



Mime
View raw message