renamed utility getPixels/putPixels methods

This commit is contained in:
codeanticode
2012-12-16 17:01:21 +00:00
parent dc7bab1628
commit 1b71df25c6
2 changed files with 74 additions and 20 deletions
+72 -18
View File
@@ -2215,6 +2215,24 @@ public class PGL {
}
protected static void getByteArray(ByteBuffer buf, byte[] arr) {
if (!buf.hasArray() || buf.array() != arr) {
buf.position(0);
buf.get(arr);
buf.rewind();
}
}
protected static void putByteArray(ByteBuffer buf, byte[] arr) {
if (!buf.hasArray() || buf.array() != arr) {
buf.position(0);
buf.put(arr);
buf.rewind();
}
}
protected static void fillByteBuffer(ByteBuffer buf, int i0, int i1,
byte val) {
int n = i1 - i0;
@@ -2276,6 +2294,24 @@ public class PGL {
}
protected static void getShortArray(ShortBuffer buf, short[] arr) {
if (!buf.hasArray() || buf.array() != arr) {
buf.position(0);
buf.get(arr);
buf.rewind();
}
}
protected static void putShortArray(ShortBuffer buf, short[] arr) {
if (!buf.hasArray() || buf.array() != arr) {
buf.position(0);
buf.put(arr);
buf.rewind();
}
}
protected static void fillShortBuffer(ShortBuffer buf, int i0, int i1,
short val) {
int n = i1 - i0;
@@ -2337,6 +2373,24 @@ public class PGL {
}
protected static void getIntArray(IntBuffer buf, int[] arr) {
if (!buf.hasArray() || buf.array() != arr) {
buf.position(0);
buf.get(arr);
buf.rewind();
}
}
protected static void putIntArray(IntBuffer buf, int[] arr) {
if (!buf.hasArray() || buf.array() != arr) {
buf.position(0);
buf.put(arr);
buf.rewind();
}
}
protected static void fillIntBuffer(IntBuffer buf, int i0, int i1, int val) {
int n = i1 - i0;
int[] temp = new int[n];
@@ -2397,6 +2451,24 @@ public class PGL {
}
protected static void getFloatArray(FloatBuffer buf, float[] arr) {
if (!buf.hasArray() || buf.array() != arr) {
buf.position(0);
buf.get(arr);
buf.rewind();
}
}
protected static void putFloatArray(FloatBuffer buf, float[] arr) {
if (!buf.hasArray() || buf.array() != arr) {
buf.position(0);
buf.put(arr);
buf.rewind();
}
}
protected static void fillFloatBuffer(FloatBuffer buf, int i0, int i1,
float val) {
int n = i1 - i0;
@@ -2408,24 +2480,6 @@ public class PGL {
}
protected static void getPixels(IntBuffer buf, int[] arr) {
if (USE_DIRECT_BUFFERS) {
buf.position(0);
buf.get(arr);
buf.rewind();
}
}
protected static void putPixels(IntBuffer buf, int[] arr) {
if (USE_DIRECT_BUFFERS) {
buf.position(0);
buf.put(arr);
buf.rewind();
}
}
///////////////////////////////////////////////////////////
// Android specific stuff
@@ -5067,7 +5067,7 @@ public class PGraphicsOpenGL extends PGraphics {
endPixelsOp();
try {
// Idem...
PGL.getPixels(pixelBuffer, pixels);
PGL.getIntArray(pixelBuffer, pixels);
PGL.nativeToJavaARGB(pixels, width, height);
} catch (ArrayIndexOutOfBoundsException e) {
}
@@ -5100,7 +5100,7 @@ public class PGraphicsOpenGL extends PGraphics {
PGL.javaToNativeARGB(nativePixels, w, h);
} catch (ArrayIndexOutOfBoundsException e) {
}
PGL.putPixels(nativePixelBuffer, nativePixels);
PGL.putIntArray(nativePixelBuffer, nativePixels);
// Copying pixel buffer to screen texture...
if (primarySurface && !pgl.isFBOBacked()) {
// First making sure that the screen texture is valid. Only in the case