From 4d493ac36bd5d763d2af3243e799bbaef3679594 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 17 Oct 2009 13:44:12 -0700 Subject: 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 --- .../config/jogl/gl-impl-CustomJavaCode-embedded.java | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'make/config/jogl/gl-impl-CustomJavaCode-embedded.java') diff --git a/make/config/jogl/gl-impl-CustomJavaCode-embedded.java b/make/config/jogl/gl-impl-CustomJavaCode-embedded.java index 2d4cd1372..c803a06a4 100644 --- a/make/config/jogl/gl-impl-CustomJavaCode-embedded.java +++ b/make/config/jogl/gl-impl-CustomJavaCode-embedded.java @@ -3,10 +3,10 @@ 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 = w; + int rowLength; int alignment = 1; if (pack) { @@ -17,10 +17,12 @@ private int imageSizeInBytes(int bytesPerElement, alignment = imageSizeTemp[0]; } // Try to deal somewhat correctly with potentially invalid values - rowLength = Math.max(0, rowLength); + height = Math.max(0, height); alignment = Math.max(1, alignment); - h = Math.max(0, h); + + rowLength = Math.max(0, width); // > 0 && >= width int rowLengthInBytes = rowLength * bytesPerElement; + if (alignment > 1) { int modulus = rowLengthInBytes % alignment; if (modulus > 0) { @@ -28,10 +30,10 @@ private int imageSizeInBytes(int bytesPerElement, } } - int size = 0; - if (dimensions == 1) { - return rowLengthInBytes; - } else { - return h * rowLengthInBytes; + int size = height * rowLengthInBytes; // height == 1 for 1D + if(dimensions==3) { + size *= depth; } + + return size; } -- cgit v1.2.3