From 852aefc9840030ee6581c5470b9f34da47481589 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 23 Feb 2012 21:18:01 +0100 Subject: Enhance GLProfile's profile tests - compare the final String references, instead of String comparison. GLProfile's 'profile' string reference is final and one of the static final GL* string references, with which it is compared. Hence only the references can be used here. Impact: Performance. --- src/jogl/classes/javax/media/opengl/GLProfile.java | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index 86df385b2..d573fd3b1 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -922,52 +922,52 @@ public class GLProfile { /** Indicates whether this profile is capable of GL4bc.

Includes [ GL4bc ].

*/ public final boolean isGL4bc() { - return GL4bc.equals(profile); + return GL4bc == profile; } /** Indicates whether this profile is capable of GL4.

Includes [ GL4bc, GL4 ].

*/ public final boolean isGL4() { - return isGL4bc() || GL4.equals(profile); + return isGL4bc() || GL4 == profile; } /** Indicates whether this profile is capable of GL3bc.

Includes [ GL4bc, GL3bc ].

*/ public final boolean isGL3bc() { - return isGL4bc() || GL3bc.equals(profile); + return isGL4bc() || GL3bc == profile; } /** Indicates whether this profile is capable of GL3.

Includes [ GL4bc, GL4, GL3bc, GL3 ].

*/ public final boolean isGL3() { - return isGL4() || isGL3bc() || GL3.equals(profile); + return isGL4() || isGL3bc() || GL3 == profile; } /** Indicates whether this context is a GL2 context

Includes [ GL4bc, GL3bc, GL2 ].

*/ public final boolean isGL2() { - return isGL3bc() || GL2.equals(profile); + return isGL3bc() || GL2 == profile; } /** Indicates whether this profile is capable of GLES1.

Includes [ GLES1 ].

*/ public final boolean isGLES1() { - return GLES1.equals(profile); + return GLES1 == profile; } /** Indicates whether this profile is capable of GLES2.

Includes [ GLES2 ].

*/ public final boolean isGLES2() { - return GLES2.equals(profile); + return GLES2 == profile; } /** Indicates whether this profile is capable of GL2ES1.

Includes [ GL4bc, GL3bc, GL2, GLES1, GL2ES1 ].

*/ public final boolean isGL2ES1() { - return GL2ES1.equals(profile) || isGLES1() || isGL2(); - } - - /** Indicates whether this profile is capable os GL2ES2.

Includes [ GL4bc, GL4, GL3bc, GL3, GL2, GL2GL3, GL2ES2, GLES2 ].

*/ - public final boolean isGL2ES2() { - return GL2ES2.equals(profile) || isGLES2() || isGL2GL3(); + return GL2ES1 == profile || isGLES1() || isGL2(); } /** Indicates whether this profile is capable os GL2GL3.

Includes [ GL4bc, GL4, GL3bc, GL3, GL2, GL2GL3 ].

*/ public final boolean isGL2GL3() { - return GL2GL3.equals(profile) || isGL3() || isGL2(); + return GL2GL3 == profile || isGL3() || isGL2(); + } + + /** Indicates whether this profile is capable os GL2ES2.

Includes [ GL4bc, GL4, GL3bc, GL3, GL2, GL2GL3, GL2ES2, GLES2 ].

*/ + public final boolean isGL2ES2() { + return GL2ES2 == profile || isGLES2() || isGL2GL3(); } /** Indicates whether this profile supports GLSL, ie. {@link #isGL2ES2()}. */ @@ -977,12 +977,12 @@ public class GLProfile { /** Indicates whether this profile uses the native OpenGL ES1 implementations. */ public final boolean usesNativeGLES1() { - return GLES1.equals(getImplName()); + return GLES1 == getImplName(); } /** Indicates whether this profile uses the native OpenGL ES2 implementations. */ public final boolean usesNativeGLES2() { - return GLES2.equals(getImplName()); + return GLES2 == getImplName(); } /** Indicates whether this profile uses either of the native OpenGL ES implementations. */ @@ -1858,7 +1858,7 @@ public class GLProfile { this.isHardwareRasterizer = isHardwareRasterizer; } - private GLProfile profileImpl; - private String profile; - private boolean isHardwareRasterizer; + private final GLProfile profileImpl; + private final String profile; + private final boolean isHardwareRasterizer; } -- cgit v1.2.3