Hi, java.awt.image.BufferedImage has a small bug, where it assumes that its sample model is a ComponentSampleModel when copying blocks of pixels. This is not always true. The attached patch fixes this problem.
ok to commit? -graydon 2003-09-16 Graydon Hoare <[EMAIL PROTECTED]> * java/awt/BufferedImage.java (setData): Support non-component sample models. (getData): Same. --- java/awt/image/BufferedImage.java +++ java/awt/image/BufferedImage.java @@ -267,9 +267,17 @@ raster.createWritableChild(x, y, w, h, x, y, null // same bands ); - - // Refer to ComponentDataBlitOp for optimized data blitting: - ComponentDataBlitOp.INSTANCE.filter(src, dest); + if (src.getSampleModel () instanceof ComponentSampleModel && + dest.getSampleModel () instanceof ComponentSampleModel) + // Refer to ComponentDataBlitOp for optimized data blitting: + ComponentDataBlitOp.INSTANCE.filter(src, dest); + else + { + // slower path + int samples[] = null; + samples = src.getPixels (x, y, w, h, samples); + dest.setPixels (x, y, w, h, samples); + } return dest; } @@ -540,9 +548,19 @@ raster.createWritableChild(x, y, w, h, x, y, null // same bands ); - - // Refer to ComponentDataBlitOp for optimized data blitting: - ComponentDataBlitOp.INSTANCE.filter(src, dest); + + if (src.getSampleModel () instanceof ComponentSampleModel && + dest.getSampleModel () instanceof ComponentSampleModel) + + // Refer to ComponentDataBlitOp for optimized data blitting: + ComponentDataBlitOp.INSTANCE.filter(src, dest); + else + { + // slower path + int samples[] = null; + samples = src.getPixels (x, y, w, h, samples); + dest.setPixels (x, y, w, h, samples); + } } public void setRGB(int x, int y, int argb) _______________________________________________ Classpath mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/classpath