< prev index next >
src/java.desktop/share/classes/sun/awt/image/ByteBandedRaster.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
*** 134,146 ****
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 byte[bankIndices.length][];
int xOffset = aRegion.x - origin.x;
int yOffset = aRegion.y - origin.y;
for (int i = 0; i < bankIndices.length; i++) {
--- 134,146 ----
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 byte[bankIndices.length][];
int xOffset = aRegion.x - origin.x;
int yOffset = aRegion.y - origin.y;
for (int i = 0; i < bankIndices.length; i++) {
*** 226,236 ****
if ((x < this.minX) || (y < this.minY) ||
(x >= this.maxX) || (y >= this.maxY)) {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
! byte outData[];
if (obj == null) {
outData = new byte[numDataElements];
} else {
outData = (byte[])obj;
}
--- 226,236 ----
if ((x < this.minX) || (y < this.minY) ||
(x >= this.maxX) || (y >= this.maxY)) {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
! byte[] outData;
if (obj == null) {
outData = new byte[numDataElements];
} else {
outData = (byte[])obj;
}
*** 273,283 ****
if ((x < this.minX) || (y < this.minY) ||
(x + w > this.maxX) || (y + h > this.maxY)) {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
! byte outData[];
if (obj == null) {
outData = new byte[numDataElements*w*h];
} else {
outData = (byte[])obj;
}
--- 273,283 ----
if ((x < this.minX) || (y < this.minY) ||
(x + w > this.maxX) || (y + h > this.maxY)) {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
! byte[] outData;
if (obj == null) {
outData = new byte[numDataElements*w*h];
} else {
outData = (byte[])obj;
}
*** 413,423 ****
if ((x < this.minX) || (y < this.minY) ||
(x >= this.maxX) || (y >= this.maxY)) {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
! byte inData[] = (byte[])obj;
int off = (y-minY)*scanlineStride + (x-minX);
for (int i = 0; i < numDataElements; i++) {
data[i][dataOffsets[i] + off] = inData[i];
}
markDirty();
--- 413,423 ----
if ((x < this.minX) || (y < this.minY) ||
(x >= this.maxX) || (y >= this.maxY)) {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
! byte[] inData = (byte[])obj;
int off = (y-minY)*scanlineStride + (x-minX);
for (int i = 0; i < numDataElements; i++) {
data[i][dataOffsets[i] + off] = inData[i];
}
markDirty();
*** 507,517 ****
if ((x < this.minX) || (y < this.minY) ||
(x + w > this.maxX) || (y + h > this.maxY)) {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
! byte inData[] = (byte[])obj;
int yoff = (y-minY)*scanlineStride + (x-minX);
for (int c = 0; c < numDataElements; c++) {
int off = c;
byte[] bank = data[c];
--- 507,517 ----
if ((x < this.minX) || (y < this.minY) ||
(x + w > this.maxX) || (y + h > this.maxY)) {
throw new ArrayIndexOutOfBoundsException
("Coordinate out of bounds!");
}
! byte[] inData = (byte[])obj;
int yoff = (y-minY)*scanlineStride + (x-minX);
for (int c = 0; c < numDataElements; c++) {
int off = c;
byte[] bank = data[c];
*** 637,647 ****
* 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) {
--- 637,647 ----
* 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 >