From 0f2936e709b49ac3234cdd967520e0091228b624 Mon Sep 17 00:00:00 2001 From: Caspian Rychlik-Prince Date: Fri, 23 Aug 2002 16:14:38 +0000 Subject: [PATCH] Mainly Javadoc fixes and Math stuff --- src/java/org/lwjgl/Display.java | 4 +-- src/java/org/lwjgl/DisplayMode.java | 6 ++--- src/java/org/lwjgl/Math.java | 37 +++++++++++++++------------ src/java/org/lwjgl/Sys.java | 4 +-- src/java/org/lwjgl/opengl/BaseGL.java | 6 ++--- 5 files changed, 30 insertions(+), 27 deletions(-) diff --git a/src/java/org/lwjgl/Display.java b/src/java/org/lwjgl/Display.java index 69577cb6..a43b3870 100644 --- a/src/java/org/lwjgl/Display.java +++ b/src/java/org/lwjgl/Display.java @@ -83,7 +83,7 @@ public final class Display { * @param displayMode a display mode to choose * @param fullscreen whether to create the display fullscreen * @throws Exception if the display mode could not be set - * @see destroy() + * @see #destroy() */ public static void create( DisplayMode displayMode, @@ -108,7 +108,7 @@ public final class Display { * Native method to create the display. This will set the handle if it is * successful. * @return true if the display was successfully created - * @see create() + * @see #create(org.lwjgl.DisplayMode, boolean) */ private static native boolean nCreate( int width, diff --git a/src/java/org/lwjgl/DisplayMode.java b/src/java/org/lwjgl/DisplayMode.java index 99daefb3..0ca23af0 100644 --- a/src/java/org/lwjgl/DisplayMode.java +++ b/src/java/org/lwjgl/DisplayMode.java @@ -43,18 +43,18 @@ package org.lwjgl; public final class DisplayMode { - public final int width, height, freq, bpp; + public final int width, height, bpp, freq; /** * Construct a display mode. * * @see Display */ - public DisplayMode(int width, int height, int freq, int bpp) { + public DisplayMode(int width, int height, int bpp, int freq) { this.width = width; this.height = height; - this.freq = freq; this.bpp = bpp; + this.freq = freq; } diff --git a/src/java/org/lwjgl/Math.java b/src/java/org/lwjgl/Math.java index 72546ccc..c6636d93 100644 --- a/src/java/org/lwjgl/Math.java +++ b/src/java/org/lwjgl/Math.java @@ -119,7 +119,7 @@ public final class Math { }; /** Straight copy */ - public static final class MatrixOpCopy extends UnaryMatrixOperation { + private static final class MatrixOpCopy extends UnaryMatrixOperation { MatrixOpCopy() { super(0, "copy"); @@ -183,7 +183,7 @@ public final class Math { public static final MatrixOpCopy MATRIXOP_COPY = new MatrixOpCopy(); /** Negate the vector */ - public static final class MatrixOpNegate extends UnaryMatrixOperation { + private static final class MatrixOpNegate extends UnaryMatrixOperation { MatrixOpNegate() { super(1, "negate"); @@ -247,7 +247,7 @@ public final class Math { public static final MatrixOpNegate MATRIXOP_NEGATE = new MatrixOpNegate(); /** Normalise the vector (set to length 1) */ - public static final class MatrixOpNormalise extends UnaryMatrixOperation { + private static final class MatrixOpNormalise extends UnaryMatrixOperation { MatrixOpNormalise() { super(2, "normalise"); @@ -311,7 +311,7 @@ public final class Math { public static final MatrixOpNormalise MATRIXOP_NORMALISE = new MatrixOpNormalise(); /** Compute the inverse matrix */ - public static final class MatrixOpInvert extends UnaryMatrixOperation { + private static final class MatrixOpInvert extends UnaryMatrixOperation { MatrixOpInvert() { super(3, "invert"); @@ -392,10 +392,11 @@ public final class Math { /** * Check the compatibility of a binary matrix operation. + * @return the miniumum stride, in bytes * @throws IllegalArgumentException if the source and destinations are not * compatible */ - abstract void checkCompatibility( + abstract int checkCompatibility( int leftSourceWidth, int leftSourceHeight, boolean transposeLeftSource, @@ -410,13 +411,13 @@ public final class Math { /** Multiply left source by right source */ - public static final class MatrixOpMultiply extends BinaryMatrixOperation { + private static final class MatrixOpMultiply extends BinaryMatrixOperation { MatrixOpMultiply() { super(0, "multiply"); } - void checkCompatibility( + int checkCompatibility( int leftSourceWidth, int leftSourceHeight, boolean transposeLeftSource, @@ -430,6 +431,9 @@ public final class Math { int rightHeight = transposeRightSource ? rightSourceWidth : rightSourceHeight; if (leftWidth != rightHeight) throw new IllegalArgumentException("Left and right matrices are not compatible."); + int leftHeight = transposeLeftSource ? leftSourceWidth : leftSourceHeight; + int rightWidth = transposeRightSource ? rightSourceHeight : rightSourceWidth; + return (rightWidth * leftHeight) << 2; } MatrixOpClassification classify() { return MATRIXOP_NONE; @@ -502,13 +506,13 @@ public final class Math { public static final MatrixOpMultiply MATRIXOP_MULTIPLY = new MatrixOpMultiply(); /** Add right source to left source */ - public static final class MatrixOpAdd extends BinaryMatrixOperation { + private static final class MatrixOpAdd extends BinaryMatrixOperation { MatrixOpAdd() { super(1, "add"); } - void checkCompatibility( + int checkCompatibility( int leftSourceWidth, int leftSourceHeight, boolean transposeLeftSource, @@ -526,6 +530,7 @@ public final class Math { if (leftSourceWidth != rightSourceHeight || leftSourceHeight != rightSourceWidth) throw new IllegalArgumentException("Left and right matrices are not the same size."); } + return (leftSourceWidth * leftSourceHeight) << 2; } MatrixOpClassification classify() { @@ -599,13 +604,13 @@ public final class Math { public static final MatrixOpAdd MATRIXOP_ADD = new MatrixOpAdd(); /** Subtract right source from left source */ - public static final class MatrixOpSubtract extends BinaryMatrixOperation { + private static final class MatrixOpSubtract extends BinaryMatrixOperation { MatrixOpSubtract() { super(2, "subtract"); } - void checkCompatibility( + int checkCompatibility( int leftSourceWidth, int leftSourceHeight, boolean transposeLeftSource, @@ -615,7 +620,7 @@ public final class Math { boolean transposeDest) { // Same as for add, obviously... - MATRIXOP_ADD.checkCompatibility( + return MATRIXOP_ADD.checkCompatibility( leftSourceWidth, leftSourceHeight, transposeLeftSource, @@ -994,7 +999,7 @@ public final class Math { rightSourceStride = rightSourceWidth * rightSourceHeight; // Ensure the source and destination matrices are compatible - operation.checkCompatibility( + int minStride = operation.checkCompatibility( leftSourceWidth, leftSourceHeight, transposeLeftSource, @@ -1003,10 +1008,8 @@ public final class Math { transposeRightSource, transposeDest); - if (destStride == 0) { - // Calculate the destination stride from the input matrix sizes - - } + if (destStride == 0) + destStride = minStride; // Check unary matrix operation type MatrixOpClassification op = operation.classify().check(leftSourceAddress, leftSourceStride, leftElements, destAddress, destStride); diff --git a/src/java/org/lwjgl/Sys.java b/src/java/org/lwjgl/Sys.java index 57d606ff..9e420dcb 100644 --- a/src/java/org/lwjgl/Sys.java +++ b/src/java/org/lwjgl/Sys.java @@ -54,7 +54,7 @@ public final class Sys { * inside a process which is already a different priority then this will not * be the initial priority. * - * @see #setProcessPriority() + * @see #setProcessPriority(int) */ public static final int NORMAL_PRIORITY = 0; @@ -70,7 +70,7 @@ public final class Sys { * * This priority is not recommended for gaming applications. * - * @see #setProcessPriority() + * @see #setProcessPriority(int) */ public static final int REALTIME_PRIORITY = 2; diff --git a/src/java/org/lwjgl/opengl/BaseGL.java b/src/java/org/lwjgl/opengl/BaseGL.java index fcb56f17..0f3374d6 100644 --- a/src/java/org/lwjgl/opengl/BaseGL.java +++ b/src/java/org/lwjgl/opengl/BaseGL.java @@ -88,7 +88,7 @@ abstract class BaseGL { * @param alphaBits the number of alpha bits (eg. 0 or 8) * @param depthBits the number of depth bits (eg. 16 or 24) * @param stencilBits the number of stencil bits (eg. 0 or 8) - * @see create() + * @see #create() */ public BaseGL(int colorBits, int alphaBits, int depthBits, int stencilBits) { this.colorBits = colorBits; @@ -125,7 +125,7 @@ abstract class BaseGL { * created by calling its setDisplayMode() method. * * @return true if the GL was created successfully - * @see org.lwjgl.Display#create() + * @see org.lwjgl.Display#create(org.lwjgl.DisplayMode, boolean) */ private native boolean nCreate(int colorBits, int alphaBits, int depthBits, int stencilBits); @@ -157,7 +157,7 @@ abstract class BaseGL { * Finalizer, marked final. To perform specialized cleanup override the * cleanup() method. * - * @see cleanup() + * @see #cleanup() */ public final void finalize() throws Throwable { super.finalize();