From 7bbb1273d01400188c0b1a44c92613d2476d667c Mon Sep 17 00:00:00 2001 From: Tristan Campbell Date: Sun, 23 Mar 2003 01:13:43 +0000 Subject: [PATCH] Fixed some bugs that were not allowing bulk adds and some binary incompatibilities. Fixed error involving incorrectly setting strides when the stride is 0. --- src/java/org/lwjgl/Math.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/java/org/lwjgl/Math.java b/src/java/org/lwjgl/Math.java index 50fcf751..0c80606f 100644 --- a/src/java/org/lwjgl/Math.java +++ b/src/java/org/lwjgl/Math.java @@ -905,7 +905,10 @@ public final class Math { return this; else return MATRIXOP_UNSAFE; - } else { + } else if (leftSourceElements == 1 && rightSourceElements == 1) { + return this; // even though this seems silly it is needed + } + else { return MATRIXOP_UNSAFE; } } @@ -994,7 +997,7 @@ public final class Math { // Calculate actual strides if (sourceStride == 0) - sourceStride = sourceWidth * sourceHeight; + sourceStride = (sourceWidth * sourceHeight) << 2; if (destStride == 0) destStride = sourceStride; @@ -1087,9 +1090,9 @@ public final class Math { // Calculate actual strides if (leftSourceStride == 0) - leftSourceStride = leftSourceWidth * leftSourceHeight; + leftSourceStride = (leftSourceWidth * leftSourceHeight) << 2; if (rightSourceStride == 0) - rightSourceStride = rightSourceWidth * rightSourceHeight; + rightSourceStride = (rightSourceWidth * rightSourceHeight) << 2; // Ensure the source and destination matrices are compatible int minStride = operation.checkCompatibility( @@ -1097,7 +1100,7 @@ public final class Math { leftSourceHeight, transposeLeftSource, rightSourceWidth, - rightSourceWidth, + rightSourceHeight, transposeRightSource, transposeDest);