< prev index next >

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

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2017, 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
*** 242,252 **** 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; } --- 242,252 ---- 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; }
*** 316,336 **** 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; } int pixbits = pixelBitStride; int scanbit = dataBitOffset + (x-minX) * pixbits; int index = (y-minY) * scanlineStride; int outindex = 0; ! byte data[] = this.data; for (int j = 0; j < h; j++) { int bitnum = scanbit; for (int i = 0; i < w; i++) { int shift = shiftOffset - (bitnum & 7); --- 316,336 ---- 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; } int pixbits = pixelBitStride; int scanbit = dataBitOffset + (x-minX) * pixbits; int index = (y-minY) * scanlineStride; int outindex = 0; ! byte[] data = this.data; for (int j = 0; j < h; j++) { int bitnum = scanbit; for (int i = 0; i < w; i++) { int shift = shiftOffset - (bitnum & 7);
*** 397,407 **** } int pixbits = pixelBitStride; int scanbit = dataBitOffset + (x-minX) * pixbits; int index = (y-minY) * scanlineStride; int outindex = 0; ! byte data[] = this.data; for (int j = 0; j < h; j++) { int bitnum = scanbit; int element; --- 397,407 ---- } int pixbits = pixelBitStride; int scanbit = dataBitOffset + (x-minX) * pixbits; int index = (y-minY) * scanlineStride; int outindex = 0; ! byte[] data = this.data; for (int j = 0; j < h; j++) { int bitnum = scanbit; int element;
*** 504,514 **** 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 bitnum = dataBitOffset + (x-minX) * pixelBitStride; int index = (y-minY) * scanlineStride + (bitnum >> 3); int shift = shiftOffset - (bitnum & 7); byte element = data[index]; --- 504,514 ---- 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 bitnum = dataBitOffset + (x-minX) * pixelBitStride; int index = (y-minY) * scanlineStride + (bitnum >> 3); int shift = shiftOffset - (bitnum & 7); byte element = data[index];
*** 915,925 **** int pixbits = pixelBitStride; int scanbit = dataBitOffset + (x - minX) * pixbits; int index = (y - minY) * scanlineStride; int outindex = 0; ! byte data[] = this.data; for (int j = 0; j < h; j++) { int bitnum = scanbit; int element; // Process initial portion of scanline --- 915,925 ---- int pixbits = pixelBitStride; int scanbit = dataBitOffset + (x - minX) * pixbits; int index = (y - minY) * scanlineStride; int outindex = 0; ! byte[] data = this.data; for (int j = 0; j < h; j++) { int bitnum = scanbit; int element; // Process initial portion of scanline
*** 1023,1033 **** * @param w Width of the pixel rectangle * @param h Height of the pixel rectangle * @param iArray An optionally pre-allocated int array * @return the samples for the specified rectangle of pixels. */ ! public int[] getPixels(int x, int y, int w, int h, int iArray[]) { if ((x < this.minX) || (y < this.minY) || (x + w > this.maxX) || (y + h > this.maxY)) { throw new ArrayIndexOutOfBoundsException ("Coordinate out of bounds!"); } --- 1023,1033 ---- * @param w Width of the pixel rectangle * @param h Height of the pixel rectangle * @param iArray An optionally pre-allocated int array * @return the samples for the specified rectangle of pixels. */ ! public int[] getPixels(int x, int y, int w, int h, int[] iArray) { if ((x < this.minX) || (y < this.minY) || (x + w > this.maxX) || (y + h > this.maxY)) { throw new ArrayIndexOutOfBoundsException ("Coordinate out of bounds!"); }
*** 1036,1046 **** } int pixbits = pixelBitStride; int scanbit = dataBitOffset + (x-minX) * pixbits; int index = (y-minY) * scanlineStride; int outindex = 0; ! byte data[] = this.data; for (int j = 0; j < h; j++) { int bitnum = scanbit; int element; --- 1036,1046 ---- } int pixbits = pixelBitStride; int scanbit = dataBitOffset + (x-minX) * pixbits; int index = (y-minY) * scanlineStride; int outindex = 0; ! byte[] data = this.data; for (int j = 0; j < h; j++) { int bitnum = scanbit; int element;
*** 1136,1156 **** * @param y The Y coordinate of the upper left pixel location. * @param w Width of the pixel rectangle. * @param h Height of the pixel rectangle. * @param iArray The input int pixel array. */ ! public void setPixels(int x, int y, int w, int h, int iArray[]) { if ((x < this.minX) || (y < this.minY) || (x + w > this.maxX) || (y + h > this.maxY)) { throw new ArrayIndexOutOfBoundsException ("Coordinate out of bounds!"); } int pixbits = pixelBitStride; int scanbit = dataBitOffset + (x - minX) * pixbits; int index = (y - minY) * scanlineStride; int outindex = 0; ! byte data[] = this.data; for (int j = 0; j < h; j++) { int bitnum = scanbit; int element; // Process initial portion of scanline --- 1136,1156 ---- * @param y The Y coordinate of the upper left pixel location. * @param w Width of the pixel rectangle. * @param h Height of the pixel rectangle. * @param iArray The input int pixel array. */ ! public void setPixels(int x, int y, int w, int h, int[] iArray) { if ((x < this.minX) || (y < this.minY) || (x + w > this.maxX) || (y + h > this.maxY)) { throw new ArrayIndexOutOfBoundsException ("Coordinate out of bounds!"); } int pixbits = pixelBitStride; int scanbit = dataBitOffset + (x - minX) * pixbits; int index = (y - minY) * scanlineStride; int outindex = 0; ! byte[] data = this.data; for (int j = 0; j < h; j++) { int bitnum = scanbit; int element; // Process initial portion of scanline
< prev index next >