< prev index next >
src/java.desktop/share/classes/sun/awt/image/ShortBandedRaster.java
Print this page
*** 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
--- 1,7 ----
/*
! * Copyright (c) 1997, 2018, 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
*** 132,144 ****
this.maxY = minY + height;
if (sampleModel instanceof BandedSampleModel) {
BandedSampleModel bsm = (BandedSampleModel)sampleModel;
this.scanlineStride = bsm.getScanlineStride();
! int bankIndices[] = bsm.getBankIndices();
! int bandOffsets[] = bsm.getBandOffsets();
! int dOffsets[] = dataBuffer.getOffsets();
dataOffsets = new int[bankIndices.length];
data = new short[bankIndices.length][];
int xOffset = aRegion.x - origin.x;
int yOffset = aRegion.y - origin.y;
for (int i = 0; i < bankIndices.length; i++) {
--- 132,144 ----
this.maxY = minY + height;
if (sampleModel instanceof BandedSampleModel) {
BandedSampleModel bsm = (BandedSampleModel)sampleModel;
this.scanlineStride = bsm.getScanlineStride();
! int[] bankIndices = bsm.getBankIndices();
! int[] bandOffsets = bsm.getBandOffsets();
! int[] dOffsets = dataBuffer.getOffsets();
dataOffsets = new int[bankIndices.length];
data = new short[bankIndices.length][];
int xOffset = aRegion.x - origin.x;
int yOffset = aRegion.y - origin.y;
for (int i = 0; i < bankIndices.length; i++) {
*** 223,233 ****
if ((x < this.minX) || (y < this.minY) ||
(x >= this.maxX) || (y >= this.maxY)) {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
! short outData[];
if (obj == null) {
outData = new short[numDataElements];
} else {
outData = (short[])obj;
}
--- 223,233 ----
if ((x < this.minX) || (y < this.minY) ||
(x >= this.maxX) || (y >= this.maxY)) {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
! short[] outData;
if (obj == null) {
outData = new short[numDataElements];
} else {
outData = (short[])obj;
}
*** 269,279 ****
if ((x < this.minX) || (y < this.minY) ||
(x + w > this.maxX) || (y + h > this.maxY)) {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
! short outData[];
if (obj == null) {
outData = new short[numDataElements*w*h];
} else {
outData = (short[])obj;
}
--- 269,279 ----
if ((x < this.minX) || (y < this.minY) ||
(x + w > this.maxX) || (y + h > this.maxY)) {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
! short[] outData;
if (obj == null) {
outData = new short[numDataElements*w*h];
} else {
outData = (short[])obj;
}
*** 409,419 ****
if ((x < this.minX) || (y < this.minY) ||
(x >= this.maxX) || (y >= this.maxY)) {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
! short inData[] = (short[])obj;
int off = (y-minY)*scanlineStride + (x-minX);
for (int i = 0; i < numDataElements; i++) {
data[i][dataOffsets[i] + off] = inData[i];
}
--- 409,419 ----
if ((x < this.minX) || (y < this.minY) ||
(x >= this.maxX) || (y >= this.maxY)) {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
! short[] inData = (short[])obj;
int off = (y-minY)*scanlineStride + (x-minX);
for (int i = 0; i < numDataElements; i++) {
data[i][dataOffsets[i] + off] = inData[i];
}
*** 506,516 ****
if ((x < this.minX) || (y < this.minY) ||
(x + w > this.maxX) || (y + h > this.maxY)) {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
! short inData[] = (short[])obj;
int yoff = (y-minY)*scanlineStride + (x-minX);
for (int c = 0; c < numDataElements; c++) {
int off = c;
short[] bank = data[c];
--- 506,516 ----
if ((x < this.minX) || (y < this.minY) ||
(x + w > this.maxX) || (y + h > this.maxY)) {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
! short[] inData = (short[])obj;
int yoff = (y-minY)*scanlineStride + (x-minX);
for (int c = 0; c < numDataElements; c++) {
int off = c;
short[] bank = data[c];
*** 636,646 ****
* if the specified bounding box is outside of the parent Raster.
*/
public WritableRaster createWritableChild(int x, int y,
int width, int height,
int x0, int y0,
! int bandList[]) {
if (x < this.minX) {
throw new RasterFormatException("x lies outside raster");
}
if (y < this.minY) {
--- 636,646 ----
* if the specified bounding box is outside of the parent Raster.
*/
public WritableRaster createWritableChild(int x, int y,
int width, int height,
int x0, int y0,
! int[] bandList) {
if (x < this.minX) {
throw new RasterFormatException("x lies outside raster");
}
if (y < this.minY) {
*** 692,702 ****
* if the specified bounding box is outside of the parent raster.
*/
public Raster createChild (int x, int y,
int width, int height,
int x0, int y0,
! int bandList[]) {
return createWritableChild(x, y, width, height, x0, y0, bandList);
}
/**
* Creates a Raster with the same layout but using a different
--- 692,702 ----
* if the specified bounding box is outside of the parent raster.
*/
public Raster createChild (int x, int y,
int width, int height,
int x0, int y0,
! int[] bandList) {
return createWritableChild(x, y, width, height, x0, y0, bandList);
}
/**
* Creates a Raster with the same layout but using a different
< prev index next >