src/java.desktop/share/classes/java/awt/image/DataBufferByte.java
changeset 52248 2e330da7cbf4
parent 47216 71c04702a3d5
equal deleted inserted replaced
52247:f775f83d6b60 52248:2e330da7cbf4
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 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
    58  * </a>
    58  * </a>
    59  */
    59  */
    60 public final class DataBufferByte extends DataBuffer
    60 public final class DataBufferByte extends DataBuffer
    61 {
    61 {
    62     /** The default data bank. */
    62     /** The default data bank. */
    63     byte data[];
    63     byte[] data;
    64 
    64 
    65     /** All data banks */
    65     /** All data banks */
    66     byte bankdata[][];
    66     byte[][] bankdata;
    67 
    67 
    68     /**
    68     /**
    69      * Constructs a byte-based {@code DataBuffer} with a single bank and the
    69      * Constructs a byte-based {@code DataBuffer} with a single bank and the
    70      * specified size.
    70      * specified size.
    71      *
    71      *
   107      * an associated image in video memory).
   107      * an associated image in video memory).
   108      *
   108      *
   109      * @param dataArray The byte array for the {@code DataBuffer}.
   109      * @param dataArray The byte array for the {@code DataBuffer}.
   110      * @param size The size of the {@code DataBuffer} bank.
   110      * @param size The size of the {@code DataBuffer} bank.
   111      */
   111      */
   112     public DataBufferByte(byte dataArray[], int size) {
   112     public DataBufferByte(byte[] dataArray, int size) {
   113         super(UNTRACKABLE, TYPE_BYTE, size);
   113         super(UNTRACKABLE, TYPE_BYTE, size);
   114         data = dataArray;
   114         data = dataArray;
   115         bankdata = new byte[1][];
   115         bankdata = new byte[1][];
   116         bankdata[0] = data;
   116         bankdata[0] = data;
   117     }
   117     }
   131      * @param dataArray The byte array for the {@code DataBuffer}.
   131      * @param dataArray The byte array for the {@code DataBuffer}.
   132      * @param size The size of the {@code DataBuffer} bank.
   132      * @param size The size of the {@code DataBuffer} bank.
   133      * @param offset The offset into the {@code dataArray}. {@code dataArray}
   133      * @param offset The offset into the {@code dataArray}. {@code dataArray}
   134      * must have at least {@code offset} + {@code size} elements.
   134      * must have at least {@code offset} + {@code size} elements.
   135      */
   135      */
   136     public DataBufferByte(byte dataArray[], int size, int offset){
   136     public DataBufferByte(byte[] dataArray, int size, int offset){
   137         super(UNTRACKABLE, TYPE_BYTE, size, 1, offset);
   137         super(UNTRACKABLE, TYPE_BYTE, size, 1, offset);
   138         data = dataArray;
   138         data = dataArray;
   139         bankdata = new byte[1][];
   139         bankdata = new byte[1][];
   140         bankdata[0] = data;
   140         bankdata[0] = data;
   141     }
   141     }
   152      * an associated image in video memory).
   152      * an associated image in video memory).
   153      *
   153      *
   154      * @param dataArray The byte arrays for the {@code DataBuffer}.
   154      * @param dataArray The byte arrays for the {@code DataBuffer}.
   155      * @param size The size of the banks in the {@code DataBuffer}.
   155      * @param size The size of the banks in the {@code DataBuffer}.
   156      */
   156      */
   157     public DataBufferByte(byte dataArray[][], int size) {
   157     public DataBufferByte(byte[][] dataArray, int size) {
   158         super(UNTRACKABLE, TYPE_BYTE, size, dataArray.length);
   158         super(UNTRACKABLE, TYPE_BYTE, size, dataArray.length);
   159         bankdata = dataArray.clone();
   159         bankdata = dataArray.clone();
   160         data = bankdata[0];
   160         data = bankdata[0];
   161     }
   161     }
   162 
   162 
   177      *
   177      *
   178      * @param dataArray The byte arrays for the {@code DataBuffer}.
   178      * @param dataArray The byte arrays for the {@code DataBuffer}.
   179      * @param size The size of the banks in the {@code DataBuffer}.
   179      * @param size The size of the banks in the {@code DataBuffer}.
   180      * @param offsets The offsets into each array.
   180      * @param offsets The offsets into each array.
   181      */
   181      */
   182     public DataBufferByte(byte dataArray[][], int size, int offsets[]) {
   182     public DataBufferByte(byte[][] dataArray, int size, int[] offsets) {
   183         super(UNTRACKABLE, TYPE_BYTE, size, dataArray.length, offsets);
   183         super(UNTRACKABLE, TYPE_BYTE, size, dataArray.length, offsets);
   184         bankdata = dataArray.clone();
   184         bankdata = dataArray.clone();
   185         data = bankdata[0];
   185         data = bankdata[0];
   186     }
   186     }
   187 
   187