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

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * 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,11 +147,11 @@
             dataType != DataBuffer.TYPE_INT) {
             throw new IllegalArgumentException("Unsupported data type "+
                                                dataType);
         }
         this.dataType = dataType;
-        this.bitMasks = (int[]) bitMasks.clone();
+        this.bitMasks = bitMasks.clone();
         this.scanlineStride = scanlineStride;
 
         this.bitOffsets = new int[numBands];
         this.bitSizes = new int[numBands];
 

@@ -274,18 +274,18 @@
     /** 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();
+      return bitOffsets.clone();
     }
 
     /** Returns the bit masks for all bands.
      *  @return the bit masks for all bands.
      */
     public int [] getBitMasks() {
-      return (int[])bitMasks.clone();
+      return bitMasks.clone();
     }
 
     /** Returns the scanline stride of this SinglePixelPackedSampleModel.
      *  @return the scanline stride of this
      *          <code>SinglePixelPackedSampleModel</code>.

@@ -744,11 +744,11 @@
         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];
+              value |= (sample << bitOffsets[b]) & bitMasks[b];
               data.setElem(lineOffset+j,value);
            }
            lineOffset += scanlineStride;
         }
     }