harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r574948 - /harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/OffscreenImage.java
Date Wed, 12 Sep 2007 13:20:10 GMT
Author: apetrenko
Date: Wed Sep 12 06:20:10 2007
New Revision: 574948

URL: http://svn.apache.org/viewvc?rev=574948&view=rev
Log:
Patch for HARMONY-4776 "[classlib][awt] Harmony fails while loading png images with transparency"

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

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/OffscreenImage.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/OffscreenImage.java?rev=574948&r1=574947&r2=574948&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/OffscreenImage.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/OffscreenImage.java
Wed Sep 12 06:20:10 2007
@@ -28,6 +28,7 @@
 import java.awt.Image;
 import java.awt.image.BufferedImage;
 import java.awt.image.ColorModel;
+import java.awt.image.ComponentColorModel;
 import java.awt.image.DataBuffer;
 import java.awt.image.DataBufferByte;
 import java.awt.image.DataBufferInt;
@@ -285,7 +286,17 @@
                 line++, lineOff += scansize, rof += scanline){
                 System.arraycopy(pixels, lineOff, data, rof, w);
             }
-        }else{
+        }else if(model == cm && model.getTransferType() == DataBuffer.TYPE_BYTE &&
+                cm instanceof ComponentColorModel){
+
+            int nc = cm.getNumComponents();
+            byte stride[] = new byte[scansize];
+            for (int sy = y, sOff = off; sy < y + h; sy++, sOff += scansize) {
+                System.arraycopy(pixels, sOff, stride, 0, scansize);
+                
+                raster.setDataElements(x, sy, w, 1, stride);
+            }
+        }else {
             for (int sy = y, sOff = off; sy < y + h; sy++, sOff += scansize) {
                 for (int sx = x, idx = 0; sx < x + w; sx++, idx++) {
                     int rgb = model.getRGB(pixels[sOff + idx] & 0xff);



Mime
View raw message