harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r620732 - in /harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image: GifDecoder.java OffscreenImage.java
Date Tue, 12 Feb 2008 09:41:18 GMT
Author: tellison
Date: Tue Feb 12 01:41:15 2008
New Revision: 620732

URL: http://svn.apache.org/viewvc?rev=620732&view=rev
Log:
Apply patch HARMONY-5491 ([classlib][awt] GifDecoder not always passes ColorModel through
setPixels method)

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/GifDecoder.java
    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/GifDecoder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/GifDecoder.java?rev=620732&r1=620731&r2=620732&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/GifDecoder.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/GifDecoder.java
Tue Feb 12 01:41:15 2008
@@ -14,13 +14,7 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-/**
- * @author Oleg V. Khaschansky
- * @version $Revision$
- */
-/*
-* Created on 27.01.2005
-*/
+
 package org.apache.harmony.awt.gl.image;
 
 import java.awt.image.ColorModel;
@@ -79,6 +73,8 @@
     private byte screenBuffer[];
     private int screenRGBBuffer[];
 
+    ColorModel gcm;
+
     public GifDecoder(DecodingImageSource src, InputStream is) {
         super(src, is);
         try {
@@ -140,7 +136,8 @@
         if (forceRGB) {
             setColorModel(ColorModel.getRGBdefault());
         } else {
-            setColorModel(gls.globalColorTable.getColorModel(currBlock.transparentColor));
+            gcm = gls.globalColorTable.getColorModel(currBlock.transparentColor);
+            setColorModel(gcm);
         }
 
         // Fill screen buffer with the background or transparent color
@@ -298,7 +295,7 @@
                                 gb.imageTop,
                                 gb.imageWidth,
                                 gb.imageHeight,
-                                null,
+                                gcm, 
                                 gb.imageData,
                                 0,
                                 gb.imageWidth
@@ -463,7 +460,7 @@
                         imageTop + currY,
                         imageWidth,
                         numLines,
-                        null,
+                        gcm, 
                         imageData,
                         currY*imageWidth,
                         imageWidth
@@ -546,7 +543,7 @@
                                 imageTop,
                                 imageWidth,
                                 imageHeight,
-                                null,
+                                gcm, 
                                 data,
                                 0,
                                 imageWidth
@@ -664,7 +661,7 @@
                         imageTop,
                         imageWidth,
                         imageHeight,
-                        null,
+                        gcm, 
                         (byte [])toSend,
                         offset,
                         imageWidth

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=620732&r1=620731&r2=620732&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
Tue Feb 12 01:41:15 2008
@@ -238,7 +238,6 @@
 
     public void setPixels(int x, int y, int w, int h, ColorModel model,
             byte[] pixels, int off, int scansize) {
-
         if(raster == null){
             if(cm == null){
                 if(model == null) {
@@ -252,7 +251,7 @@
         if(model == null) {
             model = cm;
         }
-        if(model != cm){
+        if(model != cm && cm != rgbCM){
             forceToIntARGB();
         }
 
@@ -262,14 +261,15 @@
         synchronized(surfData){
             if(isIntRGB){
                 int buff[] = new int[w];
-                IndexColorModel icm = (IndexColorModel) model;
-                int colorMap[] = new int[icm.getMapSize()];
-                icm.getRGBs(colorMap);
                 int data[] = (int[])surfData;
                 int scanline = raster.getWidth();
                 DataBufferInt dbi = (DataBufferInt) db;
                 int rof = dbi.getOffset() + y * scanline + x;
                 if(model instanceof IndexColorModel){
+
+                    IndexColorModel icm = (IndexColorModel) model;
+                    int colorMap[] = new int[icm.getMapSize()];
+                    icm.getRGBs(colorMap);
 
                     for (int sy = y, sOff = off; sy < y + h; sy++, sOff += scansize,
                         rof += scanline) {



Mime
View raw message