jdk/src/share/classes/sun/awt/image/ShortInterleavedRaster.java
changeset 16093 b305a8dc867f
parent 5506 202f599c92aa
child 22584 eed64ee05369
equal deleted inserted replaced
16092:129d7d8a7399 16093:b305a8dc867f
   169               "have PixelInterleavedSampleModel, SinglePixelPackedSampleModel"+
   169               "have PixelInterleavedSampleModel, SinglePixelPackedSampleModel"+
   170               " or 1 band ComponentSampleModel.  Sample model is "+
   170               " or 1 band ComponentSampleModel.  Sample model is "+
   171               sampleModel);
   171               sampleModel);
   172         }
   172         }
   173         this.bandOffset = this.dataOffsets[0];
   173         this.bandOffset = this.dataOffsets[0];
   174         verify(false);
   174         verify();
   175     }
   175     }
   176 
   176 
   177     /**
   177     /**
   178      * Returns a copy of the data offsets array. For each band the data offset
   178      * Returns a copy of the data offsets array. For each band the data offset
   179      * is the index into the band's data array, of the first sample of the
   179      * is the index into the band's data array, of the first sample of the
   760      */
   760      */
   761     public WritableRaster createCompatibleWritableRaster() {
   761     public WritableRaster createCompatibleWritableRaster() {
   762         return createCompatibleWritableRaster(width,height);
   762         return createCompatibleWritableRaster(width,height);
   763     }
   763     }
   764 
   764 
   765     /**
       
   766      * Verify that the layout parameters are consistent with
       
   767      * the data.  If strictCheck
       
   768      * is false, this method will check for ArrayIndexOutOfBounds conditions.  If
       
   769      * strictCheck is true, this method will check for additional error
       
   770      * conditions such as line wraparound (width of a line greater than
       
   771      * the scanline stride).
       
   772      * @return   String   Error string, if the layout is incompatible with
       
   773      *                    the data.  Otherwise returns null.
       
   774      */
       
   775     private void verify (boolean strictCheck) {
       
   776         int maxSize = 0;
       
   777         int size;
       
   778 
       
   779         for (int i=0; i < numDataElements; i++) {
       
   780             size = (height-1)*scanlineStride + (width-1)*pixelStride +
       
   781                 dataOffsets[i];
       
   782             if (size > maxSize) {
       
   783                 maxSize = size;
       
   784             }
       
   785         }
       
   786         if (data.length < maxSize) {
       
   787             throw new RasterFormatException("Data array too small (should be "+
       
   788                                           maxSize+" )");
       
   789         }
       
   790     }
       
   791 
       
   792     public String toString() {
   765     public String toString() {
   793         return new String ("ShortInterleavedRaster: width = "+width
   766         return new String ("ShortInterleavedRaster: width = "+width
   794                            +" height = " + height
   767                            +" height = " + height
   795                            +" #numDataElements "+numDataElements);
   768                            +" #numDataElements "+numDataElements);
   796                            // +" xOff = "+xOffset+" yOff = "+yOffset);
   769                            // +" xOff = "+xOffset+" yOff = "+yOffset);