aboutsummaryrefslogtreecommitdiffstats
path: root/make/config/jogl/gl-impl-CustomJavaCode-desktop.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2009-10-17 13:44:12 -0700
committerSven Gothel <[email protected]>2009-10-17 13:44:12 -0700
commit4d493ac36bd5d763d2af3243e799bbaef3679594 (patch)
tree3017bab34a8824f706e3ba63f835aaffd3317222 /make/config/jogl/gl-impl-CustomJavaCode-desktop.java
parent5ae314adc19c660f26f32839b2cc224cdccfbb59 (diff)
All tracker are aggregated in the GLContext now
and used within the GL*Impl. New GLStateTracker: - Tracking client/server states - Currently supports PixelStorei - Prologued in glPixelStorei and glGetIntegerv, the latter will return the tracked state if available and not call the GL method. Impacts performance and ES1 compatibility (supports ALIGNMENT). Fixed 'imageSizeInBytes' calculation: - skipPixels and skipRows is a static one time offset
Diffstat (limited to 'make/config/jogl/gl-impl-CustomJavaCode-desktop.java')
-rw-r--r--make/config/jogl/gl-impl-CustomJavaCode-desktop.java32
1 files changed, 19 insertions, 13 deletions
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-desktop.java b/make/config/jogl/gl-impl-CustomJavaCode-desktop.java
index 0d01aaec4..bd4659b88 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-desktop.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-desktop.java
@@ -3,7 +3,7 @@ private int[] imageSizeTemp = new int[1];
/** Helper for more precise computation of number of bytes that will
be touched by a pixel pack or unpack operation. */
private int imageSizeInBytes(int bytesPerElement,
- int w, int h, int d,
+ int width, int height, int depth,
int dimensions,
boolean pack) {
int rowLength = 0;
@@ -45,14 +45,16 @@ private int imageSizeInBytes(int bytesPerElement,
}
}
// Try to deal somewhat correctly with potentially invalid values
- rowLength = Math.max(0, rowLength);
+ height = Math.max(0, height);
skipRows = Math.max(0, skipRows);
skipPixels = Math.max(0, skipPixels);
alignment = Math.max(1, alignment);
imageHeight = Math.max(0, imageHeight);
skipImages = Math.max(0, skipImages);
- rowLength = Math.max(rowLength, w + skipPixels);
+
+ rowLength = Math.max(Math.max(0, rowLength), width); // > 0 && >= width
int rowLengthInBytes = rowLength * bytesPerElement;
+
if (alignment > 1) {
int modulus = rowLengthInBytes % alignment;
if (modulus > 0) {
@@ -60,15 +62,19 @@ private int imageSizeInBytes(int bytesPerElement,
}
}
- int size = 0;
- if (dimensions == 1) {
- return (w + skipPixels) * bytesPerElement;
- } else {
- int size2D = ((skipRows + h - 1) * rowLengthInBytes) + (w + skipPixels) * bytesPerElement;
- if (dimensions == 2) {
- return size2D;
- }
- int imageSizeInBytes = imageHeight * rowLength;
- return ((skipImages + d - 1) * imageSizeInBytes) + size2D;
+ /**
+ * skipPixels and skipRows is a static one time offset
+ *
+ * rowlenght is the actual repeating offset
+ * from line-start to the next line-start.
+ */
+ int size = height * rowLengthInBytes; // height == 1 for 1D
+ if(dimensions==3) {
+ size *= (skipImages + depth);
}
+
+ int skipOffset = skipPixels * bytesPerElement +
+ skipRows * rowLengthInBytes;
+
+ return size + skipOffset;
}