< prev index next >
src/java.desktop/share/classes/java/awt/image/DataBuffer.java
Print this page
*** 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
--- 1,7 ----
/*
! * Copyright (c) 1997, 2018, 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
*** 101,117 ****
/** Usable size of all banks. */
protected int size;
/** Offsets into all banks. */
! protected int offsets[];
/* The current StateTrackable state. */
StateTrackableDelegate theTrackable;
/** Size of the data types indexed by DataType tags defined above. */
! private static final int dataTypeSize[] = {8,16,16,32,32,64};
/** Returns the size (in bits) of the data type, given a datatype tag.
* @param type the value of one of the defined datatype tags
* @return the size of the data type
* @throws IllegalArgumentException if {@code type} is less than
--- 101,117 ----
/** Usable size of all banks. */
protected int size;
/** Offsets into all banks. */
! protected int[] offsets;
/* The current StateTrackable state. */
StateTrackableDelegate theTrackable;
/** Size of the data types indexed by DataType tags defined above. */
! private static final int[] dataTypeSize = {8,16,16,32,32,64};
/** Returns the size (in bits) of the data type, given a datatype tag.
* @param type the value of one of the defined datatype tags
* @return the size of the data type
* @throws IllegalArgumentException if {@code type} is less than
*** 244,254 ****
* {@code DataBuffer}
* @param offsets an array containing an offset for each bank.
* @throws ArrayIndexOutOfBoundsException if {@code numBanks}
* does not equal the length of {@code offsets}
*/
! protected DataBuffer(int dataType, int size, int numBanks, int offsets[]) {
this(UNTRACKABLE, dataType, size, numBanks, offsets);
}
/**
* Constructs a DataBuffer which contains the specified number
--- 244,254 ----
* {@code DataBuffer}
* @param offsets an array containing an offset for each bank.
* @throws ArrayIndexOutOfBoundsException if {@code numBanks}
* does not equal the length of {@code offsets}
*/
! protected DataBuffer(int dataType, int size, int numBanks, int[] offsets) {
this(UNTRACKABLE, dataType, size, numBanks, offsets);
}
/**
* Constructs a DataBuffer which contains the specified number
*** 266,276 ****
* @throws ArrayIndexOutOfBoundsException if {@code numBanks}
* does not equal the length of {@code offsets}
* @since 1.7
*/
DataBuffer(State initialState,
! int dataType, int size, int numBanks, int offsets[])
{
if (numBanks != offsets.length) {
throw new ArrayIndexOutOfBoundsException("Number of banks" +
" does not match number of bank offsets");
}
--- 266,276 ----
* @throws ArrayIndexOutOfBoundsException if {@code numBanks}
* does not equal the length of {@code offsets}
* @since 1.7
*/
DataBuffer(State initialState,
! int dataType, int size, int numBanks, int[] offsets)
{
if (numBanks != offsets.length) {
throw new ArrayIndexOutOfBoundsException("Number of banks" +
" does not match number of bank offsets");
}
*** 496,514 ****
if (obj instanceof int[]) {
return (int[])obj;
} else if (obj == null) {
return null;
} else if (obj instanceof short[]) {
! short sdata[] = (short[])obj;
! int idata[] = new int[sdata.length];
for (int i = 0; i < sdata.length; i++) {
idata[i] = (int)sdata[i] & 0xffff;
}
return idata;
} else if (obj instanceof byte[]) {
! byte bdata[] = (byte[])obj;
! int idata[] = new int[bdata.length];
for (int i = 0; i < bdata.length; i++) {
idata[i] = 0xff & (int)bdata[i];
}
return idata;
}
--- 496,514 ----
if (obj instanceof int[]) {
return (int[])obj;
} else if (obj == null) {
return null;
} else if (obj instanceof short[]) {
! short[] sdata = (short[])obj;
! int[] idata = new int[sdata.length];
for (int i = 0; i < sdata.length; i++) {
idata[i] = (int)sdata[i] & 0xffff;
}
return idata;
} else if (obj instanceof byte[]) {
! byte[] bdata = (byte[])obj;
! int[] idata = new int[bdata.length];
for (int i = 0; i < bdata.length; i++) {
idata[i] = 0xff & (int)bdata[i];
}
return idata;
}
< prev index next >