src/java.desktop/share/classes/java/awt/image/DataBufferFloat.java
changeset 52248 2e330da7cbf4
parent 47216 71c04702a3d5
equal deleted inserted replaced
52247:f775f83d6b60 52248:2e330da7cbf4
     1 /*
     1 /*
     2  * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2000, 2018, 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
    50  */
    50  */
    51 
    51 
    52 public final class DataBufferFloat extends DataBuffer {
    52 public final class DataBufferFloat extends DataBuffer {
    53 
    53 
    54     /** The array of data banks. */
    54     /** The array of data banks. */
    55     float bankdata[][];
    55     float[][] bankdata;
    56 
    56 
    57     /** A reference to the default data bank. */
    57     /** A reference to the default data bank. */
    58     float data[];
    58     float[] data;
    59 
    59 
    60     /**
    60     /**
    61      * Constructs a {@code float}-based {@code DataBuffer}
    61      * Constructs a {@code float}-based {@code DataBuffer}
    62      * with a specified size.
    62      * with a specified size.
    63      *
    63      *
   103      *
   103      *
   104      * @param dataArray An array of {@code float}s to be used as the
   104      * @param dataArray An array of {@code float}s to be used as the
   105      *                  first and only bank of this {@code DataBuffer}.
   105      *                  first and only bank of this {@code DataBuffer}.
   106      * @param size The number of elements of the array to be used.
   106      * @param size The number of elements of the array to be used.
   107      */
   107      */
   108     public DataBufferFloat(float dataArray[], int size) {
   108     public DataBufferFloat(float[] dataArray, int size) {
   109         super(UNTRACKABLE, TYPE_FLOAT, size);
   109         super(UNTRACKABLE, TYPE_FLOAT, size);
   110         data = dataArray;
   110         data = dataArray;
   111         bankdata = new float[1][];
   111         bankdata = new float[1][];
   112         bankdata[0] = data;
   112         bankdata[0] = data;
   113     }
   113     }
   129      *                  first and only bank of this {@code DataBuffer}.
   129      *                  first and only bank of this {@code DataBuffer}.
   130      * @param size The number of elements of the array to be used.
   130      * @param size The number of elements of the array to be used.
   131      * @param offset The offset of the first element of the array
   131      * @param offset The offset of the first element of the array
   132      *               that will be used.
   132      *               that will be used.
   133      */
   133      */
   134     public DataBufferFloat(float dataArray[], int size, int offset) {
   134     public DataBufferFloat(float[] dataArray, int size, int offset) {
   135         super(UNTRACKABLE, TYPE_FLOAT, size, 1, offset);
   135         super(UNTRACKABLE, TYPE_FLOAT, size, 1, offset);
   136         data = dataArray;
   136         data = dataArray;
   137         bankdata = new float[1][];
   137         bankdata = new float[1][];
   138         bankdata[0] = data;
   138         bankdata[0] = data;
   139     }
   139     }
   152      *
   152      *
   153      * @param dataArray An array of arrays of {@code float}s to be
   153      * @param dataArray An array of arrays of {@code float}s to be
   154      *                  used as the banks of this {@code DataBuffer}.
   154      *                  used as the banks of this {@code DataBuffer}.
   155      * @param size The number of elements of each array to be used.
   155      * @param size The number of elements of each array to be used.
   156      */
   156      */
   157     public DataBufferFloat(float dataArray[][], int size) {
   157     public DataBufferFloat(float[][] dataArray, int size) {
   158         super(UNTRACKABLE, TYPE_FLOAT, size, dataArray.length);
   158         super(UNTRACKABLE, TYPE_FLOAT, size, dataArray.length);
   159         bankdata = dataArray.clone();
   159         bankdata = dataArray.clone();
   160         data = bankdata[0];
   160         data = bankdata[0];
   161     }
   161     }
   162 
   162 
   176      * @param dataArray An array of arrays of {@code float}s to be
   176      * @param dataArray An array of arrays of {@code float}s to be
   177      *                  used as the banks of this {@code DataBuffer}.
   177      *                  used as the banks of this {@code DataBuffer}.
   178      * @param size The number of elements of each array to be used.
   178      * @param size The number of elements of each array to be used.
   179      * @param offsets An array of integer offsets, one for each bank.
   179      * @param offsets An array of integer offsets, one for each bank.
   180      */
   180      */
   181     public DataBufferFloat(float dataArray[][], int size, int offsets[]) {
   181     public DataBufferFloat(float[][] dataArray, int size, int[] offsets) {
   182         super(UNTRACKABLE, TYPE_FLOAT, size,dataArray.length, offsets);
   182         super(UNTRACKABLE, TYPE_FLOAT, size,dataArray.length, offsets);
   183         bankdata = dataArray.clone();
   183         bankdata = dataArray.clone();
   184         data = bankdata[0];
   184         data = bankdata[0];
   185     }
   185     }
   186 
   186