< prev index next >

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

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 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) 1997, 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
*** 28,38 **** import java.awt.image.WritableRaster; import java.awt.image.RasterFormatException; import java.awt.image.SampleModel; import java.awt.image.ComponentSampleModel; import java.awt.image.SinglePixelPackedSampleModel; - import java.awt.image.DataBuffer; import java.awt.image.DataBufferUShort; import java.awt.Rectangle; import java.awt.Point; /** --- 28,37 ----
*** 92,102 **** * @param sampleModel The SampleModel that specifies the layout. * @param origin The Point that specified the origin. */ public ShortComponentRaster(SampleModel sampleModel, Point origin) { this(sampleModel, ! sampleModel.createDataBuffer(), new Rectangle(origin.x, origin.y, sampleModel.getWidth(), sampleModel.getHeight()), origin, --- 91,101 ---- * @param sampleModel The SampleModel that specifies the layout. * @param origin The Point that specified the origin. */ public ShortComponentRaster(SampleModel sampleModel, Point origin) { this(sampleModel, ! (DataBufferUShort)sampleModel.createDataBuffer(), new Rectangle(origin.x, origin.y, sampleModel.getWidth(), sampleModel.getHeight()), origin,
*** 113,123 **** * @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 ShortComponentRaster(SampleModel sampleModel, ! DataBuffer dataBuffer, Point origin) { this(sampleModel, dataBuffer, new Rectangle(origin.x, origin.y, --- 112,122 ---- * @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 ShortComponentRaster(SampleModel sampleModel, ! DataBufferUShort dataBuffer, Point origin) { this(sampleModel, dataBuffer, new Rectangle(origin.x, origin.y,
*** 144,175 **** * @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 ShortComponentRaster(SampleModel sampleModel, ! DataBuffer dataBuffer, Rectangle aRegion, Point origin, ShortComponentRaster parent) { super(sampleModel, dataBuffer, aRegion, origin, parent); this.maxX = minX + width; this.maxY = minY + height; ! if(!(dataBuffer instanceof DataBufferUShort)) { ! throw new RasterFormatException("ShortComponentRasters must have "+ ! "short DataBuffers"); ! } ! ! DataBufferUShort dbus = (DataBufferUShort)dataBuffer; ! this.data = stealData(dbus, 0); ! if (dbus.getNumBanks() != 1) { throw new RasterFormatException("DataBuffer for ShortComponentRasters"+ " must only have 1 bank."); } ! int dbOffset = dbus.getOffset(); if (sampleModel instanceof ComponentSampleModel) { ComponentSampleModel csm = (ComponentSampleModel)sampleModel; this.type = IntegerComponentRaster.TYPE_USHORT_SAMPLES; this.scanlineStride = csm.getScanlineStride(); --- 143,168 ---- * @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 ShortComponentRaster(SampleModel sampleModel, ! DataBufferUShort dataBuffer, Rectangle aRegion, Point origin, ShortComponentRaster parent) { super(sampleModel, dataBuffer, aRegion, origin, parent); this.maxX = minX + width; this.maxY = minY + height; ! this.data = stealData(dataBuffer, 0); ! if (dataBuffer.getNumBanks() != 1) { throw new RasterFormatException("DataBuffer for ShortComponentRasters"+ " must only have 1 bank."); } ! int dbOffset = dataBuffer.getOffset(); if (sampleModel instanceof ComponentSampleModel) { ComponentSampleModel csm = (ComponentSampleModel)sampleModel; this.type = IntegerComponentRaster.TYPE_USHORT_SAMPLES; this.scanlineStride = csm.getScanlineStride();
*** 756,766 **** int deltaX = x0 - x; int deltaY = y0 - y; return new ShortComponentRaster(sm, ! dataBuffer, new Rectangle(x0, y0, width, height), new Point(sampleModelTranslateX+deltaX, sampleModelTranslateY+deltaY), this); } --- 749,759 ---- int deltaX = x0 - x; int deltaY = y0 - y; return new ShortComponentRaster(sm, ! (DataBufferUShort)dataBuffer, new Rectangle(x0, y0, width, height), new Point(sampleModelTranslateX+deltaX, sampleModelTranslateY+deltaY), this); }
< prev index next >