harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r577258 - /harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PixelGrabber.java
Date Wed, 19 Sep 2007 11:53:50 GMT
Author: apetrenko
Date: Wed Sep 19 04:53:50 2007
New Revision: 577258

URL: http://svn.apache.org/viewvc?rev=577258&view=rev
Log:
Patch for HARMONY-4802 "[classlib][awt][image] PixelGrabber does not work"

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PixelGrabber.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PixelGrabber.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PixelGrabber.java?rev=577258&r1=577257&r2=577258&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PixelGrabber.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/image/PixelGrabber.java
Wed Sep 19 04:53:50 2007
@@ -204,32 +204,31 @@
         }
         int realOff = offset + (srcY - Y) * scanline + (srcX - X);
 
+        int mask = 0xFF;
+
         switch(dataType){
         case DATA_TYPE_UNDEFINED:
             cm = model;
             iData = new int[width * height];
             dataType = DATA_TYPE_INT;
-            if(cm == ColorModel.getRGBdefault()) {
-                isRGB = true;
-            } else {
-                isRGB = false;
-            }
+            isRGB = (cm == ColorModel.getRGBdefault());
 
         case DATA_TYPE_INT:
             if(cm == model){
                 for(int y = 0; y < srcH; y++){
-                    System.arraycopy(pixels, srcOff, bData, realOff, srcW);
+                    System.arraycopy(pixels, srcOff, iData, realOff, srcW);
                     srcOff += srcScan;
                     realOff += scanline;
                 }
                 break;
             }
+            mask = 0xFFFFFFFF;
 
         case DATA_TYPE_BYTE:
             forceToRGB();
             for(int y = 0; y < srcH; y++){
                 for(int x = 0; x < srcW; x++){
-                    iData[realOff++] = cm.getRGB(pixels[srcOff++] & 0xff);
+                    iData[realOff+x] = cm.getRGB(pixels[srcOff+x] & mask);
                 }
                 srcOff += srcScan;
                 realOff += scanline;
@@ -379,6 +378,9 @@
      * Force pixels to INT RGB mode
      */
     private void forceToRGB(){
+        if (isRGB)
+            return;
+    
         switch(dataType){
         case DATA_TYPE_BYTE:
             iData = new int[width * height];



Mime
View raw message