< prev index next >

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

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 69,79 **** * @param sampleModel The SampleModel that specifies the layout. * @param origin The Point that specified the origin. */ public ShortInterleavedRaster(SampleModel sampleModel, Point origin) { this(sampleModel, ! sampleModel.createDataBuffer(), new Rectangle(origin.x, origin.y, sampleModel.getWidth(), sampleModel.getHeight()), origin, --- 69,79 ---- * @param sampleModel The SampleModel that specifies the layout. * @param origin The Point that specified the origin. */ public ShortInterleavedRaster(SampleModel sampleModel, Point origin) { this(sampleModel, ! (DataBufferUShort) sampleModel.createDataBuffer(), new Rectangle(origin.x, origin.y, sampleModel.getWidth(), sampleModel.getHeight()), origin,
*** 90,101 **** * @param sampleModel The SampleModel that specifies the layout. * @param dataBuffer The DataBufferUShort that contains the image data. * @param origin The Point that specifies the origin. */ public ShortInterleavedRaster(SampleModel sampleModel, ! DataBuffer dataBuffer, ! Point origin) { this(sampleModel, dataBuffer, new Rectangle(origin.x, origin.y, sampleModel.getWidth(), --- 90,102 ---- * @param sampleModel The SampleModel that specifies the layout. * @param dataBuffer The DataBufferUShort that contains the image data. * @param origin The Point that specifies the origin. */ public ShortInterleavedRaster(SampleModel sampleModel, ! DataBufferUShort dataBuffer, ! Point origin) ! { this(sampleModel, dataBuffer, new Rectangle(origin.x, origin.y, sampleModel.getWidth(),
*** 121,146 **** * @param aRegion The Rectangle that specifies the image area. * @param origin The Point that specifies the origin. * @param parent The parent (if any) of this raster. */ public ShortInterleavedRaster(SampleModel sampleModel, ! DataBuffer dataBuffer, Rectangle aRegion, Point origin, ! ShortInterleavedRaster parent) { super(sampleModel, dataBuffer, aRegion, origin, parent); this.maxX = minX + width; this.maxY = minY + height; ! if(!(dataBuffer instanceof DataBufferUShort)) { ! throw new RasterFormatException("ShortInterleavedRasters must "+ ! "have ushort DataBuffers"); ! } ! ! DataBufferUShort dbus = (DataBufferUShort)dataBuffer; ! this.data = stealData(dbus, 0); // REMIND: need case for interleaved ComponentSampleModel if ((sampleModel instanceof PixelInterleavedSampleModel) || (sampleModel instanceof ComponentSampleModel && sampleModel.getNumBands() == 1)) { --- 122,142 ---- * @param aRegion The Rectangle that specifies the image area. * @param origin The Point that specifies the origin. * @param parent The parent (if any) of this raster. */ public ShortInterleavedRaster(SampleModel sampleModel, ! DataBufferUShort dataBuffer, Rectangle aRegion, Point origin, ! ShortInterleavedRaster parent) ! { super(sampleModel, dataBuffer, aRegion, origin, parent); this.maxX = minX + width; this.maxY = minY + height; ! this.data = stealData(dataBuffer, 0); // REMIND: need case for interleaved ComponentSampleModel if ((sampleModel instanceof PixelInterleavedSampleModel) || (sampleModel instanceof ComponentSampleModel && sampleModel.getNumBands() == 1)) {
*** 158,168 **** SinglePixelPackedSampleModel sppsm = (SinglePixelPackedSampleModel)sampleModel; this.scanlineStride = sppsm.getScanlineStride(); this.pixelStride = 1; this.dataOffsets = new int[1]; ! this.dataOffsets[0] = dbus.getOffset(); int xOffset = aRegion.x - origin.x; int yOffset = aRegion.y - origin.y; dataOffsets[0] += xOffset+yOffset*scanlineStride; } else { throw new RasterFormatException("ShortInterleavedRasters must "+ --- 154,164 ---- SinglePixelPackedSampleModel sppsm = (SinglePixelPackedSampleModel)sampleModel; this.scanlineStride = sppsm.getScanlineStride(); this.pixelStride = 1; this.dataOffsets = new int[1]; ! this.dataOffsets[0] = dataBuffer.getOffset(); int xOffset = aRegion.x - origin.x; int yOffset = aRegion.y - origin.y; dataOffsets[0] += xOffset+yOffset*scanlineStride; } else { throw new RasterFormatException("ShortInterleavedRasters must "+
*** 728,738 **** int deltaX = x0 - x; int deltaY = y0 - y; return new ShortInterleavedRaster(sm, ! dataBuffer, new Rectangle(x0, y0, width, height), new Point(sampleModelTranslateX+deltaX, sampleModelTranslateY+deltaY), this); } --- 724,734 ---- int deltaX = x0 - x; int deltaY = y0 - y; return new ShortInterleavedRaster(sm, ! (DataBufferUShort) dataBuffer, new Rectangle(x0, y0, width, height), new Point(sampleModelTranslateX+deltaX, sampleModelTranslateY+deltaY), this); }
< prev index next >