Index: modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/GifDecoder.java =================================================================== --- modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/GifDecoder.java (revision 620708) +++ modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/GifDecoder.java (working copy) @@ -79,6 +79,8 @@ private byte screenBuffer[]; private int screenRGBBuffer[]; + ColorModel gcm; + public GifDecoder(DecodingImageSource src, InputStream is) { super(src, is); try { @@ -140,7 +142,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 +301,7 @@ gb.imageTop, gb.imageWidth, gb.imageHeight, - null, + gcm, gb.imageData, 0, gb.imageWidth @@ -463,7 +466,7 @@ imageTop + currY, imageWidth, numLines, - null, + gcm, imageData, currY*imageWidth, imageWidth @@ -546,7 +549,7 @@ imageTop, imageWidth, imageHeight, - null, + gcm, data, 0, imageWidth @@ -664,7 +667,7 @@ imageTop, imageWidth, imageHeight, - null, + gcm, (byte [])toSend, offset, imageWidth Index: modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/OffscreenImage.java =================================================================== --- modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/OffscreenImage.java (revision 620708) +++ modules/awt/src/main/java/common/org/apache/harmony/awt/gl/image/OffscreenImage.java (working copy) @@ -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,15 +261,16 @@ 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) { for (int sx = x, idx = 0; sx < x + w; sx++, idx++) {