src/share/classes/java/awt/image/SinglePixelPackedSampleModel.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2010, 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, 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
*** 147,157 **** dataType != DataBuffer.TYPE_INT) { throw new IllegalArgumentException("Unsupported data type "+ dataType); } this.dataType = dataType; ! this.bitMasks = (int[]) bitMasks.clone(); this.scanlineStride = scanlineStride; this.bitOffsets = new int[numBands]; this.bitSizes = new int[numBands]; --- 147,157 ---- dataType != DataBuffer.TYPE_INT) { throw new IllegalArgumentException("Unsupported data type "+ dataType); } this.dataType = dataType; ! this.bitMasks = bitMasks.clone(); this.scanlineStride = scanlineStride; this.bitOffsets = new int[numBands]; this.bitSizes = new int[numBands];
*** 274,291 **** /** Returns the bit offsets into the data array element representing * a pixel for all bands. * @return the bit offsets representing a pixel for all bands. */ public int [] getBitOffsets() { ! return (int[])bitOffsets.clone(); } /** Returns the bit masks for all bands. * @return the bit masks for all bands. */ public int [] getBitMasks() { ! return (int[])bitMasks.clone(); } /** Returns the scanline stride of this SinglePixelPackedSampleModel. * @return the scanline stride of this * <code>SinglePixelPackedSampleModel</code>. --- 274,291 ---- /** Returns the bit offsets into the data array element representing * a pixel for all bands. * @return the bit offsets representing a pixel for all bands. */ public int [] getBitOffsets() { ! return bitOffsets.clone(); } /** Returns the bit masks for all bands. * @return the bit masks for all bands. */ public int [] getBitMasks() { ! return bitMasks.clone(); } /** Returns the scanline stride of this SinglePixelPackedSampleModel. * @return the scanline stride of this * <code>SinglePixelPackedSampleModel</code>.
*** 744,754 **** for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { int value = data.getElem(lineOffset+j); value &= ~bitMasks[b]; int sample = iArray[srcOffset++]; ! value |= ((int)sample << bitOffsets[b]) & bitMasks[b]; data.setElem(lineOffset+j,value); } lineOffset += scanlineStride; } } --- 744,754 ---- for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { int value = data.getElem(lineOffset+j); value &= ~bitMasks[b]; int sample = iArray[srcOffset++]; ! value |= (sample << bitOffsets[b]) & bitMasks[b]; data.setElem(lineOffset+j,value); } lineOffset += scanlineStride; } }