jdk/src/share/classes/java/awt/image/ComponentSampleModel.java
changeset 22584 eed64ee05369
parent 21283 b24d2a6e59b8
equal deleted inserted replaced
22583:e7d5af0b11e9 22584:eed64ee05369
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   145                                 int bandOffsets[]) {
   145                                 int bandOffsets[]) {
   146         super(dataType, w, h, bandOffsets.length);
   146         super(dataType, w, h, bandOffsets.length);
   147         this.dataType = dataType;
   147         this.dataType = dataType;
   148         this.pixelStride = pixelStride;
   148         this.pixelStride = pixelStride;
   149         this.scanlineStride  = scanlineStride;
   149         this.scanlineStride  = scanlineStride;
   150         this.bandOffsets = (int[])bandOffsets.clone();
   150         this.bandOffsets = bandOffsets.clone();
   151         numBands = this.bandOffsets.length;
   151         numBands = this.bandOffsets.length;
   152         if (pixelStride < 0) {
   152         if (pixelStride < 0) {
   153             throw new IllegalArgumentException("Pixel stride must be >= 0");
   153             throw new IllegalArgumentException("Pixel stride must be >= 0");
   154         }
   154         }
   155         // TODO - bug 4296691 - remove this check
   155         // TODO - bug 4296691 - remove this check
   209                                 int bandOffsets[]) {
   209                                 int bandOffsets[]) {
   210         super(dataType, w, h, bandOffsets.length);
   210         super(dataType, w, h, bandOffsets.length);
   211         this.dataType = dataType;
   211         this.dataType = dataType;
   212         this.pixelStride = pixelStride;
   212         this.pixelStride = pixelStride;
   213         this.scanlineStride  = scanlineStride;
   213         this.scanlineStride  = scanlineStride;
   214         this.bandOffsets = (int[])bandOffsets.clone();
   214         this.bandOffsets = bandOffsets.clone();
   215         this.bankIndices = (int[]) bankIndices.clone();
   215         this.bankIndices = bankIndices.clone();
   216         if (pixelStride < 0) {
   216         if (pixelStride < 0) {
   217             throw new IllegalArgumentException("Pixel stride must be >= 0");
   217             throw new IllegalArgumentException("Pixel stride must be >= 0");
   218         }
   218         }
   219         // TODO - bug 4296691 - remove this check
   219         // TODO - bug 4296691 - remove this check
   220         if (scanlineStride < 0) {
   220         if (scanlineStride < 0) {
   524 
   524 
   525     /** Returns the bank indices for all bands.
   525     /** Returns the bank indices for all bands.
   526      *  @return the bank indices for all bands.
   526      *  @return the bank indices for all bands.
   527      */
   527      */
   528     public final int [] getBankIndices() {
   528     public final int [] getBankIndices() {
   529         return (int[]) bankIndices.clone();
   529         return bankIndices.clone();
   530     }
   530     }
   531 
   531 
   532     /** Returns the band offset for all bands.
   532     /** Returns the band offset for all bands.
   533      *  @return the band offsets for all bands.
   533      *  @return the band offsets for all bands.
   534      */
   534      */
   535     public final int [] getBandOffsets() {
   535     public final int [] getBandOffsets() {
   536         return (int[])bandOffsets.clone();
   536         return bandOffsets.clone();
   537     }
   537     }
   538 
   538 
   539     /** Returns the scanline stride of this ComponentSampleModel.
   539     /** Returns the scanline stride of this ComponentSampleModel.
   540      *  @return the scanline stride of this <code>ComponentSampleModel</code>.
   540      *  @return the scanline stride of this <code>ComponentSampleModel</code>.
   541      */
   541      */