jdk/src/share/classes/sun/awt/image/ShortInterleavedRaster.java

Print this page
rev 5697 : 8001972: Improve image processing
Reviewed-by: prr, ahgross

*** 169,179 **** "have PixelInterleavedSampleModel, SinglePixelPackedSampleModel"+ " or 1 band ComponentSampleModel. Sample model is "+ sampleModel); } this.bandOffset = this.dataOffsets[0]; ! verify(false); } /** * Returns a copy of the data offsets array. For each band the data offset * is the index into the band's data array, of the first sample of the --- 169,179 ---- "have PixelInterleavedSampleModel, SinglePixelPackedSampleModel"+ " or 1 band ComponentSampleModel. Sample model is "+ sampleModel); } this.bandOffset = this.dataOffsets[0]; ! verify(); } /** * Returns a copy of the data offsets array. For each band the data offset * is the index into the band's data array, of the first sample of the
*** 760,796 **** */ public WritableRaster createCompatibleWritableRaster() { return createCompatibleWritableRaster(width,height); } - /** - * Verify that the layout parameters are consistent with - * the data. If strictCheck - * is false, this method will check for ArrayIndexOutOfBounds conditions. If - * strictCheck is true, this method will check for additional error - * conditions such as line wraparound (width of a line greater than - * the scanline stride). - * @return String Error string, if the layout is incompatible with - * the data. Otherwise returns null. - */ - private void verify (boolean strictCheck) { - int maxSize = 0; - int size; - - for (int i=0; i < numDataElements; i++) { - size = (height-1)*scanlineStride + (width-1)*pixelStride + - dataOffsets[i]; - if (size > maxSize) { - maxSize = size; - } - } - if (data.length < maxSize) { - throw new RasterFormatException("Data array too small (should be "+ - maxSize+" )"); - } - } - public String toString() { return new String ("ShortInterleavedRaster: width = "+width +" height = " + height +" #numDataElements "+numDataElements); // +" xOff = "+xOffset+" yOff = "+yOffset); --- 760,769 ----