From 556d92b63555a085b25e32b1cd55afce24edd07a Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 3 Jul 2014 16:21:36 +0200 Subject: Code Clean-Up based on our Recommended Settings (jogamp-scripting c47bc86ae2ee268a1f38c5580d11f93d7f8d6e74) - Change non static accesses to static members using declaring type - Change indirect accesses to static members to direct accesses (accesses through subtypes) - Add final modifier to private fields - Add final modifier to method parameters - Add final modifier to local variables - Remove unnecessary casts - Remove unnecessary '$NON-NLS$' tags - Remove trailing white spaces on all lines --- .../com/jogamp/audio/windows/waveout/Audio.java | 6 +- .../com/jogamp/audio/windows/waveout/Mixer.java | 72 +- .../jogamp/audio/windows/waveout/SoundBuffer.java | 24 +- .../com/jogamp/audio/windows/waveout/Track.java | 20 +- .../com/jogamp/audio/windows/waveout/Vec3f.java | 58 +- .../gluegen/opengl/BuildComposablePipeline.java | 188 ++--- .../jogamp/gluegen/opengl/BuildStaticGLInfo.java | 64 +- .../com/jogamp/gluegen/opengl/GLConfiguration.java | 92 +-- .../com/jogamp/gluegen/opengl/GLEmitter.java | 106 +-- .../gluegen/opengl/GLJavaMethodBindingEmitter.java | 26 +- .../jogamp/gluegen/opengl/ant/StaticGLGenTask.java | 22 +- .../opengl/nativesig/NativeSignatureEmitter.java | 54 +- .../NativeSignatureJavaMethodBindingEmitter.java | 46 +- .../gluegen/runtime/opengl/GLNameResolver.java | 28 +- .../runtime/opengl/GLProcAddressResolver.java | 8 +- .../com/jogamp/graph/curve/OutlineShape.java | 40 +- .../classes/com/jogamp/graph/curve/Region.java | 28 +- .../com/jogamp/graph/curve/opengl/GLRegion.java | 4 +- .../jogamp/graph/curve/opengl/RegionRenderer.java | 16 +- .../com/jogamp/graph/curve/opengl/RenderState.java | 41 +- .../jogamp/graph/curve/opengl/TextRegionUtil.java | 20 +- .../classes/com/jogamp/graph/font/FontFactory.java | 8 +- .../classes/com/jogamp/graph/geom/Outline.java | 18 +- .../classes/com/jogamp/graph/geom/SVertex.java | 22 +- .../classes/com/jogamp/graph/geom/Triangle.java | 4 +- src/jogl/classes/com/jogamp/opengl/FBObject.java | 166 ++-- .../com/jogamp/opengl/GLAutoDrawableDelegate.java | 6 +- .../com/jogamp/opengl/GLEventListenerState.java | 22 +- .../com/jogamp/opengl/GLRendererQuirks.java | 24 +- .../classes/com/jogamp/opengl/JoglVersion.java | 26 +- .../opengl/cg/CgDynamicLibraryBundleInfo.java | 4 +- .../classes/com/jogamp/opengl/cg/CgException.java | 6 +- .../classes/com/jogamp/opengl/math/Binary16.java | 24 +- .../classes/com/jogamp/opengl/math/Binary32.java | 2 +- .../classes/com/jogamp/opengl/math/Binary64.java | 6 +- .../classes/com/jogamp/opengl/math/FixedPoint.java | 8 +- .../classes/com/jogamp/opengl/math/Quaternion.java | 8 +- .../com/jogamp/opengl/math/geom/AABBox.java | 10 +- .../com/jogamp/opengl/math/geom/Frustum.java | 36 +- .../classes/com/jogamp/opengl/swt/GLCanvas.java | 42 +- .../com/jogamp/opengl/util/AWTAnimatorImpl.java | 40 +- .../classes/com/jogamp/opengl/util/Animator.java | 20 +- .../com/jogamp/opengl/util/AnimatorBase.java | 34 +- .../jogamp/opengl/util/DefaultAnimatorImpl.java | 12 +- .../com/jogamp/opengl/util/FPSAnimator.java | 14 +- .../com/jogamp/opengl/util/GLArrayDataClient.java | 76 +- .../com/jogamp/opengl/util/GLArrayDataServer.java | 146 ++-- .../com/jogamp/opengl/util/GLArrayDataWrapper.java | 58 +- .../classes/com/jogamp/opengl/util/GLBuffers.java | 145 ++-- .../com/jogamp/opengl/util/GLDrawableUtil.java | 16 +- .../com/jogamp/opengl/util/GLPixelBuffer.java | 30 +- .../jogamp/opengl/util/GLPixelStorageModes.java | 12 +- .../com/jogamp/opengl/util/GLReadBufferUtil.java | 18 +- src/jogl/classes/com/jogamp/opengl/util/Gamma.java | 4 +- .../com/jogamp/opengl/util/ImmModeSink.java | 255 +++--- .../classes/com/jogamp/opengl/util/PMVMatrix.java | 15 +- .../com/jogamp/opengl/util/PNGPixelRect.java | 2 +- .../com/jogamp/opengl/util/RandomTileRenderer.java | 10 +- .../classes/com/jogamp/opengl/util/TGAWriter.java | 18 +- .../com/jogamp/opengl/util/TileRenderer.java | 20 +- .../classes/com/jogamp/opengl/util/TimeFrameI.java | 6 +- .../com/jogamp/opengl/util/av/AudioSink.java | 20 +- .../jogamp/opengl/util/av/AudioSinkFactory.java | 4 +- .../com/jogamp/opengl/util/av/GLMediaPlayer.java | 6 +- .../opengl/util/av/GLMediaPlayerFactory.java | 4 +- .../jogamp/opengl/util/awt/AWTGLPixelBuffer.java | 27 +- .../opengl/util/awt/AWTGLReadBufferUtil.java | 6 +- .../com/jogamp/opengl/util/awt/ImageUtil.java | 16 +- .../com/jogamp/opengl/util/awt/Overlay.java | 14 +- .../com/jogamp/opengl/util/awt/Screenshot.java | 98 +-- .../com/jogamp/opengl/util/awt/TextRenderer.java | 416 +++++----- .../jogamp/opengl/util/awt/TextureRenderer.java | 133 +-- .../com/jogamp/opengl/util/gl2/BitmapCharRec.java | 12 +- .../com/jogamp/opengl/util/gl2/BitmapFontRec.java | 8 +- .../com/jogamp/opengl/util/gl2/CoordRec.java | 2 +- .../classes/com/jogamp/opengl/util/gl2/GLUT.java | 371 ++++----- .../opengl/util/gl2/GLUTStrokeMonoRoman.java | 680 +++++++-------- .../jogamp/opengl/util/gl2/GLUTStrokeRoman.java | 618 +++++++------- .../com/jogamp/opengl/util/gl2/StrokeCharRec.java | 8 +- .../com/jogamp/opengl/util/gl2/StrokeFontRec.java | 10 +- .../com/jogamp/opengl/util/gl2/StrokeRec.java | 4 +- .../com/jogamp/opengl/util/glsl/ShaderCode.java | 90 +- .../com/jogamp/opengl/util/glsl/ShaderProgram.java | 40 +- .../com/jogamp/opengl/util/glsl/ShaderState.java | 129 +-- .../com/jogamp/opengl/util/glsl/ShaderUtil.java | 86 +- .../opengl/util/glsl/fixedfunc/FixedFuncUtil.java | 6 +- .../jogamp/opengl/util/glsl/sdk/CompileShader.java | 48 +- .../opengl/util/glsl/sdk/CompileShaderNVidia.java | 4 +- .../com/jogamp/opengl/util/packrect/Level.java | 54 +- .../com/jogamp/opengl/util/packrect/LevelSet.java | 52 +- .../com/jogamp/opengl/util/packrect/Rect.java | 14 +- .../opengl/util/packrect/RectanglePacker.java | 54 +- .../jogamp/opengl/util/texture/ImageSequence.java | 8 +- .../com/jogamp/opengl/util/texture/Texture.java | 134 +-- .../jogamp/opengl/util/texture/TextureCoords.java | 14 +- .../jogamp/opengl/util/texture/TextureData.java | 129 +-- .../com/jogamp/opengl/util/texture/TextureIO.java | 333 ++++---- .../opengl/util/texture/TextureSequence.java | 4 +- .../jogamp/opengl/util/texture/TextureState.java | 14 +- .../opengl/util/texture/awt/AWTTextureData.java | 52 +- .../opengl/util/texture/awt/AWTTextureIO.java | 28 +- .../jogamp/opengl/util/texture/spi/DDSImage.java | 143 ++-- .../jogamp/opengl/util/texture/spi/JPEGImage.java | 20 +- .../opengl/util/texture/spi/LEDataInputStream.java | 48 +- .../util/texture/spi/LEDataOutputStream.java | 30 +- .../util/texture/spi/NetPbmTextureWriter.java | 22 +- .../jogamp/opengl/util/texture/spi/SGIImage.java | 128 +-- .../jogamp/opengl/util/texture/spi/TGAImage.java | 76 +- .../util/texture/spi/awt/IIOTextureProvider.java | 36 +- .../util/texture/spi/awt/IIOTextureWriter.java | 26 +- src/jogl/classes/javax/media/opengl/DebugGL2.java | 2 +- src/jogl/classes/javax/media/opengl/DebugGL3.java | 2 +- .../classes/javax/media/opengl/DebugGL3bc.java | 2 +- src/jogl/classes/javax/media/opengl/DebugGL4.java | 2 +- .../classes/javax/media/opengl/DebugGLES2.java | 2 +- .../media/opengl/DefaultGLCapabilitiesChooser.java | 16 +- .../classes/javax/media/opengl/GLCapabilities.java | 44 +- src/jogl/classes/javax/media/opengl/GLContext.java | 148 ++-- .../classes/javax/media/opengl/GLDebugMessage.java | 90 +- .../javax/media/opengl/GLDrawableFactory.java | 21 +- .../classes/javax/media/opengl/GLException.java | 6 +- .../javax/media/opengl/GLPipelineFactory.java | 26 +- src/jogl/classes/javax/media/opengl/GLProfile.java | 170 ++-- .../classes/javax/media/opengl/GLUniformData.java | 28 +- src/jogl/classes/javax/media/opengl/Threading.java | 4 +- src/jogl/classes/javax/media/opengl/TraceGL2.java | 2 +- src/jogl/classes/javax/media/opengl/TraceGL3.java | 2 +- .../classes/javax/media/opengl/TraceGL3bc.java | 2 +- src/jogl/classes/javax/media/opengl/TraceGL4.java | 2 +- .../classes/javax/media/opengl/TraceGLES2.java | 2 +- .../classes/javax/media/opengl/awt/GLCanvas.java | 118 +-- .../classes/javax/media/opengl/awt/GLJPanel.java | 185 ++--- .../media/opengl/fixedfunc/GLPointerFuncUtil.java | 4 +- .../opengl/glu/GLUtessellatorCallbackAdapter.java | 30 +- .../graph/curve/opengl/VBORegion2PMSAAES2.java | 28 +- .../graph/curve/opengl/VBORegion2PVBAAES2.java | 31 +- .../jogamp/graph/curve/opengl/VBORegionSPES2.java | 14 +- .../jogamp/graph/curve/tess/CDTriangulator2D.java | 4 +- .../jogamp/graph/curve/tess/GraphOutline.java | 6 +- .../jogamp/graph/curve/tess/GraphVertex.java | 22 +- .../classes/jogamp/graph/curve/tess/HEdge.java | 22 +- src/jogl/classes/jogamp/graph/curve/tess/Loop.java | 42 +- .../classes/jogamp/graph/font/JavaFontLoader.java | 8 +- .../jogamp/graph/font/UbuntuFontLoader.java | 12 +- .../jogamp/graph/font/typecast/TypecastFont.java | 40 +- .../font/typecast/TypecastFontConstructor.java | 6 +- .../jogamp/graph/font/typecast/TypecastGlyph.java | 2 +- .../graph/font/typecast/TypecastHMetrics.java | 12 +- .../graph/font/typecast/TypecastRenderer.java | 16 +- .../graph/font/typecast/ot/Disassembler.java | 22 +- .../jogamp/graph/font/typecast/ot/Fixed.java | 10 +- .../jogamp/graph/font/typecast/ot/Mnemonic.java | 4 +- .../jogamp/graph/font/typecast/ot/OTFont.java | 28 +- .../graph/font/typecast/ot/OTFontCollection.java | 26 +- .../jogamp/graph/font/typecast/ot/OTGlyph.java | 14 +- .../jogamp/graph/font/typecast/ot/Point.java | 2 +- .../graph/font/typecast/ot/mac/ResourceData.java | 6 +- .../graph/font/typecast/ot/mac/ResourceFile.java | 14 +- .../graph/font/typecast/ot/mac/ResourceHeader.java | 10 +- .../graph/font/typecast/ot/mac/ResourceMap.java | 24 +- .../font/typecast/ot/mac/ResourceReference.java | 18 +- .../graph/font/typecast/ot/mac/ResourceType.java | 16 +- .../graph/font/typecast/ot/table/BaseTable.java | 136 +-- .../graph/font/typecast/ot/table/CffTable.java | 180 ++-- .../font/typecast/ot/table/CharstringType2.java | 52 +- .../graph/font/typecast/ot/table/ClassDef.java | 4 +- .../font/typecast/ot/table/ClassDefFormat1.java | 8 +- .../font/typecast/ot/table/ClassDefFormat2.java | 6 +- .../graph/font/typecast/ot/table/CmapFormat.java | 10 +- .../graph/font/typecast/ot/table/CmapFormat0.java | 8 +- .../graph/font/typecast/ot/table/CmapFormat2.java | 24 +- .../graph/font/typecast/ot/table/CmapFormat4.java | 32 +- .../graph/font/typecast/ot/table/CmapFormat6.java | 6 +- .../font/typecast/ot/table/CmapFormatUnknown.java | 6 +- .../font/typecast/ot/table/CmapIndexEntry.java | 14 +- .../graph/font/typecast/ot/table/CmapTable.java | 18 +- .../graph/font/typecast/ot/table/Coverage.java | 4 +- .../font/typecast/ot/table/CoverageFormat1.java | 8 +- .../font/typecast/ot/table/CoverageFormat2.java | 10 +- .../graph/font/typecast/ot/table/CvtTable.java | 10 +- .../graph/font/typecast/ot/table/Device.java | 10 +- .../font/typecast/ot/table/DirectoryEntry.java | 12 +- .../graph/font/typecast/ot/table/DsigEntry.java | 8 +- .../graph/font/typecast/ot/table/DsigTable.java | 16 +- .../graph/font/typecast/ot/table/Feature.java | 10 +- .../graph/font/typecast/ot/table/FeatureList.java | 16 +- .../font/typecast/ot/table/FeatureRecord.java | 6 +- .../graph/font/typecast/ot/table/FpgmTable.java | 4 +- .../graph/font/typecast/ot/table/GaspRange.java | 8 +- .../graph/font/typecast/ot/table/GaspTable.java | 12 +- .../font/typecast/ot/table/GlyfCompositeComp.java | 24 +- .../typecast/ot/table/GlyfCompositeDescript.java | 62 +- .../graph/font/typecast/ot/table/GlyfDescript.java | 18 +- .../font/typecast/ot/table/GlyfSimpleDescript.java | 38 +- .../graph/font/typecast/ot/table/GlyfTable.java | 30 +- .../graph/font/typecast/ot/table/GposTable.java | 12 +- .../graph/font/typecast/ot/table/GsubTable.java | 30 +- .../graph/font/typecast/ot/table/HdmxTable.java | 26 +- .../graph/font/typecast/ot/table/HeadTable.java | 40 +- .../graph/font/typecast/ot/table/HheaTable.java | 30 +- .../graph/font/typecast/ot/table/HmtxTable.java | 18 +- .../jogamp/graph/font/typecast/ot/table/ID.java | 8 +- .../graph/font/typecast/ot/table/KernSubtable.java | 10 +- .../typecast/ot/table/KernSubtableFormat0.java | 14 +- .../typecast/ot/table/KernSubtableFormat2.java | 12 +- .../graph/font/typecast/ot/table/KernTable.java | 12 +- .../graph/font/typecast/ot/table/KerningPair.java | 8 +- .../graph/font/typecast/ot/table/LangSys.java | 14 +- .../font/typecast/ot/table/LangSysRecord.java | 6 +- .../graph/font/typecast/ot/table/Ligature.java | 10 +- .../graph/font/typecast/ot/table/LigatureSet.java | 8 +- .../font/typecast/ot/table/LigatureSubst.java | 4 +- .../typecast/ot/table/LigatureSubstFormat1.java | 14 +- .../graph/font/typecast/ot/table/LocaTable.java | 16 +- .../graph/font/typecast/ot/table/Lookup.java | 14 +- .../graph/font/typecast/ot/table/LookupList.java | 16 +- .../graph/font/typecast/ot/table/LtshTable.java | 12 +- .../graph/font/typecast/ot/table/MaxpTable.java | 8 +- .../graph/font/typecast/ot/table/NameRecord.java | 22 +- .../graph/font/typecast/ot/table/NameTable.java | 20 +- .../graph/font/typecast/ot/table/Os2Table.java | 70 +- .../graph/font/typecast/ot/table/Panose.java | 4 +- .../graph/font/typecast/ot/table/PcltTable.java | 34 +- .../graph/font/typecast/ot/table/PostTable.java | 32 +- .../graph/font/typecast/ot/table/PrepTable.java | 4 +- .../graph/font/typecast/ot/table/Program.java | 2 +- .../graph/font/typecast/ot/table/RangeRecord.java | 12 +- .../graph/font/typecast/ot/table/Script.java | 10 +- .../graph/font/typecast/ot/table/ScriptList.java | 14 +- .../graph/font/typecast/ot/table/ScriptRecord.java | 6 +- .../font/typecast/ot/table/SignatureBlock.java | 12 +- .../graph/font/typecast/ot/table/SingleSubst.java | 4 +- .../font/typecast/ot/table/SingleSubstFormat1.java | 12 +- .../font/typecast/ot/table/SingleSubstFormat2.java | 14 +- .../graph/font/typecast/ot/table/TTCHeader.java | 20 +- .../font/typecast/ot/table/TableDirectory.java | 10 +- .../font/typecast/ot/table/TableException.java | 2 +- .../graph/font/typecast/ot/table/TableFactory.java | 8 +- .../graph/font/typecast/ot/table/VdmxTable.java | 48 +- .../graph/font/typecast/ot/table/VheaTable.java | 30 +- .../graph/font/typecast/ot/table/VmtxTable.java | 18 +- .../graph/font/typecast/t2/T2Interpreter.java | 372 ++++----- .../graph/font/typecast/tt/engine/Interpreter.java | 188 ++--- .../graph/font/typecast/tt/engine/Parser.java | 40 +- .../jogamp/graph/geom/plane/AffineTransform.java | 70 +- .../classes/jogamp/graph/geom/plane/Crossing.java | 206 ++--- .../geom/plane/IllegalPathStateException.java | 2 +- .../plane/NoninvertibleTransformException.java | 2 +- .../classes/jogamp/graph/geom/plane/Path2D.java | 76 +- src/jogl/classes/jogamp/opengl/Debug.java | 4 +- .../opengl/DesktopGLDynamicLibraryBundleInfo.java | 2 +- .../opengl/DesktopGLDynamicLookupHelper.java | 4 +- .../jogamp/opengl/ExtensionAvailabilityCache.java | 21 +- src/jogl/classes/jogamp/opengl/FPSCounterImpl.java | 6 +- .../classes/jogamp/opengl/GLAutoDrawableBase.java | 46 +- .../jogamp/opengl/GLBufferObjectTracker.java | 9 +- .../jogamp/opengl/GLBufferStateTracker.java | 21 +- src/jogl/classes/jogamp/opengl/GLContextImpl.java | 148 ++-- .../classes/jogamp/opengl/GLContextShareSet.java | 10 +- .../jogamp/opengl/GLDebugMessageHandler.java | 37 +- .../jogamp/opengl/GLDrawableFactoryImpl.java | 84 +- .../classes/jogamp/opengl/GLDrawableHelper.java | 90 +- src/jogl/classes/jogamp/opengl/GLDrawableImpl.java | 16 +- .../jogamp/opengl/GLDynamicLookupHelper.java | 2 +- .../classes/jogamp/opengl/GLFBODrawableImpl.java | 57 +- .../opengl/GLGraphicsConfigurationFactory.java | 6 +- .../jogamp/opengl/GLGraphicsConfigurationUtil.java | 30 +- .../jogamp/opengl/GLOffscreenAutoDrawableImpl.java | 18 +- src/jogl/classes/jogamp/opengl/GLPbufferImpl.java | 2 +- src/jogl/classes/jogamp/opengl/GLRunnableTask.java | 8 +- src/jogl/classes/jogamp/opengl/GLStateTracker.java | 4 +- .../classes/jogamp/opengl/GLVersionNumber.java | 12 +- src/jogl/classes/jogamp/opengl/GLWorkerThread.java | 26 +- .../jogamp/opengl/ListenerSyncedImplStub.java | 6 +- src/jogl/classes/jogamp/opengl/MemoryObject.java | 8 +- src/jogl/classes/jogamp/opengl/ProjectFloat.java | 54 +- .../jogamp/opengl/SharedResourceRunner.java | 36 +- src/jogl/classes/jogamp/opengl/SystemUtil.java | 4 +- src/jogl/classes/jogamp/opengl/ThreadingImpl.java | 17 +- .../android/av/AndroidGLMediaPlayerAPI14.java | 62 +- .../jogamp/opengl/awt/AWTThreadingPlugin.java | 2 +- .../classes/jogamp/opengl/awt/AWTTilePainter.java | 36 +- src/jogl/classes/jogamp/opengl/awt/AWTUtil.java | 6 +- src/jogl/classes/jogamp/opengl/awt/Java2D.java | 97 +-- .../classes/jogamp/opengl/awt/VersionApplet.java | 34 +- .../egl/DesktopES2DynamicLibraryBundleInfo.java | 6 +- src/jogl/classes/jogamp/opengl/egl/EGLContext.java | 40 +- .../classes/jogamp/opengl/egl/EGLDisplayUtil.java | 28 +- .../classes/jogamp/opengl/egl/EGLDrawable.java | 6 +- .../jogamp/opengl/egl/EGLDrawableFactory.java | 104 +-- .../opengl/egl/EGLDummyUpstreamSurfaceHook.java | 6 +- .../opengl/egl/EGLDynamicLibraryBundleInfo.java | 11 +- .../jogamp/opengl/egl/EGLExternalContext.java | 2 +- .../jogamp/opengl/egl/EGLGLCapabilities.java | 14 +- .../opengl/egl/EGLGraphicsConfiguration.java | 26 +- .../egl/EGLGraphicsConfigurationFactory.java | 46 +- .../jogamp/opengl/egl/EGLOnscreenDrawable.java | 6 +- .../jogamp/opengl/egl/EGLPbufferDrawable.java | 6 +- .../jogamp/opengl/egl/EGLUpstreamSurfaceHook.java | 14 +- .../jogamp/opengl/egl/EGLWrappedSurface.java | 4 +- .../classes/jogamp/opengl/gl2/ProjectDouble.java | 270 +++--- .../classes/jogamp/opengl/glu/GLUquadricImpl.java | 110 +-- src/jogl/classes/jogamp/opengl/glu/Glue.java | 4 +- .../classes/jogamp/opengl/glu/error/Error.java | 2 +- .../opengl/glu/gl2/nurbs/GL2CurveEvaluator.java | 51 +- .../opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java | 63 +- .../opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java | 96 +-- .../jogamp/opengl/glu/mipmap/BuildMipmap.java | 920 +++++++++++---------- .../jogamp/opengl/glu/mipmap/Extract1010102.java | 12 +- .../jogamp/opengl/glu/mipmap/Extract1555rev.java | 12 +- .../opengl/glu/mipmap/Extract2101010rev.java | 12 +- .../jogamp/opengl/glu/mipmap/Extract233rev.java | 12 +- .../jogamp/opengl/glu/mipmap/Extract332.java | 12 +- .../jogamp/opengl/glu/mipmap/Extract4444.java | 12 +- .../jogamp/opengl/glu/mipmap/Extract4444rev.java | 12 +- .../jogamp/opengl/glu/mipmap/Extract5551.java | 12 +- .../jogamp/opengl/glu/mipmap/Extract565.java | 10 +- .../jogamp/opengl/glu/mipmap/Extract565rev.java | 10 +- .../jogamp/opengl/glu/mipmap/Extract8888.java | 12 +- .../jogamp/opengl/glu/mipmap/Extract8888rev.java | 12 +- .../jogamp/opengl/glu/mipmap/ExtractFloat.java | 4 +- .../jogamp/opengl/glu/mipmap/ExtractSByte.java | 6 +- .../jogamp/opengl/glu/mipmap/ExtractSInt.java | 6 +- .../jogamp/opengl/glu/mipmap/ExtractSShort.java | 6 +- .../jogamp/opengl/glu/mipmap/ExtractUByte.java | 6 +- .../jogamp/opengl/glu/mipmap/ExtractUInt.java | 6 +- .../jogamp/opengl/glu/mipmap/ExtractUShort.java | 6 +- .../jogamp/opengl/glu/mipmap/HalveImage.java | 311 +++---- .../classes/jogamp/opengl/glu/mipmap/Image.java | 325 ++++---- .../classes/jogamp/opengl/glu/mipmap/Mipmap.java | 346 ++++---- .../opengl/glu/mipmap/PixelStorageModes.java | 32 +- .../jogamp/opengl/glu/mipmap/ScaleInternal.java | 188 +++-- .../jogamp/opengl/glu/mipmap/Type_Widget.java | 34 +- src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java | 8 +- .../jogamp/opengl/glu/nurbs/ArcSdirSorter.java | 4 +- .../jogamp/opengl/glu/nurbs/ArcTdirSorter.java | 4 +- .../jogamp/opengl/glu/nurbs/ArcTesselator.java | 8 +- .../classes/jogamp/opengl/glu/nurbs/Backend.java | 20 +- src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java | 6 +- .../jogamp/opengl/glu/nurbs/CArrayOfArcs.java | 24 +- .../jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java | 16 +- .../jogamp/opengl/glu/nurbs/CArrayOfFloats.java | 24 +- .../opengl/glu/nurbs/CArrayOfQuiltspecs.java | 18 +- .../classes/jogamp/opengl/glu/nurbs/Curve.java | 28 +- .../classes/jogamp/opengl/glu/nurbs/Curvelist.java | 2 +- .../jogamp/opengl/glu/nurbs/DisplayList.java | 2 +- .../classes/jogamp/opengl/glu/nurbs/Flist.java | 6 +- .../classes/jogamp/opengl/glu/nurbs/Knotspec.java | 74 +- .../jogamp/opengl/glu/nurbs/Knotvector.java | 8 +- .../classes/jogamp/opengl/glu/nurbs/Mapdesc.java | 34 +- .../classes/jogamp/opengl/glu/nurbs/Maplist.java | 16 +- .../jogamp/opengl/glu/nurbs/O_nurbscurve.java | 2 +- .../jogamp/opengl/glu/nurbs/O_nurbssurface.java | 4 +- .../classes/jogamp/opengl/glu/nurbs/Patch.java | 2 +- .../classes/jogamp/opengl/glu/nurbs/Patchlist.java | 6 +- .../classes/jogamp/opengl/glu/nurbs/Property.java | 2 +- .../classes/jogamp/opengl/glu/nurbs/PwlArc.java | 6 +- .../classes/jogamp/opengl/glu/nurbs/Quilt.java | 36 +- .../jogamp/opengl/glu/nurbs/Renderhints.java | 2 +- .../jogamp/opengl/glu/nurbs/Splinespec.java | 22 +- .../jogamp/opengl/glu/nurbs/Subdivider.java | 198 ++--- .../jogamp/opengl/glu/registry/Registry.java | 4 +- .../jogamp/opengl/glu/tessellator/Dict.java | 26 +- .../jogamp/opengl/glu/tessellator/GLUhalfEdge.java | 2 +- .../opengl/glu/tessellator/GLUtessellatorImpl.java | 44 +- .../jogamp/opengl/glu/tessellator/Geom.java | 46 +- .../jogamp/opengl/glu/tessellator/Mesh.java | 96 +-- .../jogamp/opengl/glu/tessellator/Normal.java | 25 +- .../jogamp/opengl/glu/tessellator/PriorityQ.java | 4 +- .../opengl/glu/tessellator/PriorityQHeap.java | 34 +- .../opengl/glu/tessellator/PriorityQSort.java | 24 +- .../jogamp/opengl/glu/tessellator/Render.java | 48 +- .../jogamp/opengl/glu/tessellator/Sweep.java | 158 ++-- .../jogamp/opengl/glu/tessellator/TessMono.java | 14 +- .../jogamp/opengl/macosx/cgl/MacOSXCGLContext.java | 107 +-- .../opengl/macosx/cgl/MacOSXCGLDrawable.java | 12 +- .../macosx/cgl/MacOSXCGLDrawableFactory.java | 56 +- .../cgl/MacOSXCGLDynamicLibraryBundleInfo.java | 2 +- .../macosx/cgl/MacOSXCGLGraphicsConfiguration.java | 26 +- .../cgl/MacOSXCGLGraphicsConfigurationFactory.java | 12 +- .../macosx/cgl/MacOSXExternalCGLContext.java | 22 +- .../macosx/cgl/MacOSXOffscreenCGLDrawable.java | 6 +- .../macosx/cgl/MacOSXOnscreenCGLDrawable.java | 4 +- .../macosx/cgl/MacOSXPbufferCGLDrawable.java | 24 +- .../MacOSXAWTCGLGraphicsConfigurationFactory.java | 14 +- .../jogamp/opengl/openal/av/ALAudioSink.java | 121 +-- .../jogamp/opengl/openal/av/ALDummyUsage.java | 6 +- .../opengl/util/GLArrayHandlerInterleaved.java | 10 +- .../jogamp/opengl/util/GLDataArrayHandler.java | 8 +- .../jogamp/opengl/util/GLFixedArrayHandler.java | 8 +- .../opengl/util/GLFixedArrayHandlerFlat.java | 8 +- .../jogamp/opengl/util/GLVBOArrayHandler.java | 4 +- .../jogamp/opengl/util/av/AudioSampleFormat.java | 2 +- .../jogamp/opengl/util/av/EGLMediaPlayerImpl.java | 14 +- .../jogamp/opengl/util/av/GLMediaPlayerImpl.java | 117 +-- .../jogamp/opengl/util/av/JavaSoundAudioSink.java | 18 +- .../jogamp/opengl/util/av/NullAudioSink.java | 10 +- .../jogamp/opengl/util/av/NullGLMediaPlayer.java | 24 +- .../jogamp/opengl/util/av/VideoPixelFormat.java | 2 +- .../av/impl/FFMPEGDynamicLibraryBundleInfo.java | 14 +- .../opengl/util/av/impl/FFMPEGMediaPlayer.java | 51 +- .../jogamp/opengl/util/av/impl/FFMPEGNatives.java | 2 +- .../opengl/util/av/impl/FFMPEGStaticNatives.java | 2 +- .../opengl/util/av/impl/OMXGLMediaPlayer.java | 22 +- .../jogamp/opengl/util/glsl/GLSLArrayHandler.java | 12 +- .../opengl/util/glsl/GLSLArrayHandlerFlat.java | 8 +- .../util/glsl/GLSLArrayHandlerInterleaved.java | 10 +- .../jogamp/opengl/util/glsl/GLSLTextureRaster.java | 14 +- .../opengl/util/glsl/fixedfunc/FixedFuncHook.java | 148 ++-- .../util/glsl/fixedfunc/FixedFuncPipeline.java | 135 +-- .../jogamp/opengl/util/jpeg/JPEGDecoder.java | 109 +-- .../jogamp/opengl/util/pngj/FilterType.java | 6 +- .../opengl/util/pngj/FilterWriteStrategy.java | 16 +- .../classes/jogamp/opengl/util/pngj/ImageInfo.java | 8 +- .../classes/jogamp/opengl/util/pngj/ImageLine.java | 18 +- .../jogamp/opengl/util/pngj/ImageLineHelper.java | 94 +-- .../jogamp/opengl/util/pngj/ImageLines.java | 14 +- .../jogamp/opengl/util/pngj/PngDeinterlacer.java | 28 +- .../jogamp/opengl/util/pngj/PngHelperInternal.java | 108 +-- .../opengl/util/pngj/PngIDatChunkInputStream.java | 22 +- .../opengl/util/pngj/PngIDatChunkOutputStream.java | 8 +- .../classes/jogamp/opengl/util/pngj/PngReader.java | 114 +-- .../classes/jogamp/opengl/util/pngj/PngWriter.java | 102 +-- .../opengl/util/pngj/PngjBadCrcException.java | 6 +- .../jogamp/opengl/util/pngj/PngjException.java | 6 +- .../opengl/util/pngj/PngjExceptionInternal.java | 6 +- .../opengl/util/pngj/PngjInputException.java | 6 +- .../opengl/util/pngj/PngjOutputException.java | 6 +- .../opengl/util/pngj/PngjUnsupportedException.java | 6 +- .../opengl/util/pngj/ProgressiveOutputStream.java | 12 +- .../opengl/util/pngj/chunks/ChunkHelper.java | 64 +- .../jogamp/opengl/util/pngj/chunks/ChunkRaw.java | 10 +- .../jogamp/opengl/util/pngj/chunks/ChunksList.java | 20 +- .../util/pngj/chunks/ChunksListForWrite.java | 24 +- .../jogamp/opengl/util/pngj/chunks/PngChunk.java | 36 +- .../opengl/util/pngj/chunks/PngChunkBKGD.java | 16 +- .../opengl/util/pngj/chunks/PngChunkCHRM.java | 12 +- .../opengl/util/pngj/chunks/PngChunkGAMA.java | 16 +- .../opengl/util/pngj/chunks/PngChunkHIST.java | 12 +- .../opengl/util/pngj/chunks/PngChunkICCP.java | 20 +- .../opengl/util/pngj/chunks/PngChunkIDAT.java | 6 +- .../opengl/util/pngj/chunks/PngChunkIEND.java | 8 +- .../opengl/util/pngj/chunks/PngChunkIHDR.java | 26 +- .../opengl/util/pngj/chunks/PngChunkITXT.java | 26 +- .../opengl/util/pngj/chunks/PngChunkMultiple.java | 2 +- .../opengl/util/pngj/chunks/PngChunkOFFS.java | 16 +- .../opengl/util/pngj/chunks/PngChunkPHYS.java | 24 +- .../opengl/util/pngj/chunks/PngChunkPLTE.java | 28 +- .../opengl/util/pngj/chunks/PngChunkSBIT.java | 14 +- .../opengl/util/pngj/chunks/PngChunkSPLT.java | 26 +- .../opengl/util/pngj/chunks/PngChunkSRGB.java | 10 +- .../opengl/util/pngj/chunks/PngChunkSTER.java | 14 +- .../opengl/util/pngj/chunks/PngChunkSingle.java | 6 +- .../opengl/util/pngj/chunks/PngChunkSkipped.java | 6 +- .../opengl/util/pngj/chunks/PngChunkTEXT.java | 12 +- .../opengl/util/pngj/chunks/PngChunkTIME.java | 16 +- .../opengl/util/pngj/chunks/PngChunkTRNS.java | 20 +- .../opengl/util/pngj/chunks/PngChunkTextVar.java | 4 +- .../opengl/util/pngj/chunks/PngChunkUNKNOWN.java | 14 +- .../opengl/util/pngj/chunks/PngChunkZTXT.java | 22 +- .../opengl/util/pngj/chunks/PngMetadata.java | 45 +- .../opengl/windows/wgl/WGLGLCapabilities.java | 10 +- .../classes/jogamp/opengl/windows/wgl/WGLUtil.java | 14 +- .../windows/wgl/WindowsBitmapWGLDrawable.java | 10 +- .../windows/wgl/WindowsExternalWGLContext.java | 12 +- .../windows/wgl/WindowsExternalWGLDrawable.java | 12 +- .../windows/wgl/WindowsOnscreenWGLDrawable.java | 4 +- .../windows/wgl/WindowsPbufferWGLDrawable.java | 30 +- .../opengl/windows/wgl/WindowsWGLContext.java | 76 +- .../opengl/windows/wgl/WindowsWGLDrawable.java | 12 +- .../windows/wgl/WindowsWGLDrawableFactory.java | 90 +- .../wgl/WindowsWGLDynamicLibraryBundleInfo.java | 4 +- .../wgl/WindowsWGLGraphicsConfiguration.java | 116 +-- .../WindowsWGLGraphicsConfigurationFactory.java | 62 +- .../WindowsAWTWGLGraphicsConfigurationFactory.java | 28 +- .../classes/jogamp/opengl/x11/glx/GLXUtil.java | 30 +- .../opengl/x11/glx/X11ExternalGLXContext.java | 22 +- .../opengl/x11/glx/X11ExternalGLXDrawable.java | 22 +- .../jogamp/opengl/x11/glx/X11GLCapabilities.java | 8 +- .../jogamp/opengl/x11/glx/X11GLXContext.java | 84 +- .../jogamp/opengl/x11/glx/X11GLXDrawable.java | 6 +- .../opengl/x11/glx/X11GLXDrawableFactory.java | 126 +-- .../x11/glx/X11GLXDynamicLibraryBundleInfo.java | 4 +- .../x11/glx/X11GLXGraphicsConfiguration.java | 60 +- .../glx/X11GLXGraphicsConfigurationFactory.java | 78 +- .../opengl/x11/glx/X11OnscreenGLXDrawable.java | 8 +- .../opengl/x11/glx/X11PbufferGLXDrawable.java | 10 +- .../opengl/x11/glx/X11PixmapGLXDrawable.java | 26 +- 488 files changed, 9607 insertions(+), 9585 deletions(-) (limited to 'src/jogl/classes') diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/Audio.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Audio.java index 83f5e4ebd..fef9d61dd 100644 --- a/src/jogl/classes/com/jogamp/audio/windows/waveout/Audio.java +++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Audio.java @@ -36,7 +36,7 @@ import java.io.*; public class Audio { private static Audio instance = null; - private Mixer mixer; + private final Mixer mixer; public synchronized static Audio getInstance() { if (instance == null) { @@ -53,9 +53,9 @@ public class Audio { return mixer; } - public Track newTrack(File file) throws IOException + public Track newTrack(final File file) throws IOException { - Track res = new Track(file); + final Track res = new Track(file); mixer.add(res); return res; } diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java index b36fd2637..a84da723f 100644 --- a/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java +++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Mixer.java @@ -48,12 +48,12 @@ public class Mixer { private volatile boolean shutdownDone; // Windows Event object - private long event; + private final long event; private volatile ArrayList tracks = new ArrayList(); - private Vec3f leftSpeakerPosition = new Vec3f(-1, 0, 0); - private Vec3f rightSpeakerPosition = new Vec3f( 1, 0, 0); + private final Vec3f leftSpeakerPosition = new Vec3f(-1, 0, 0); + private final Vec3f rightSpeakerPosition = new Vec3f( 1, 0, 0); private float falloffFactor = 1.0f; @@ -64,7 +64,7 @@ public class Mixer { private Mixer() { event = CreateEvent(); new FillerThread().start(); - MixerThread m = new MixerThread(); + final MixerThread m = new MixerThread(); m.setPriority(Thread.MAX_PRIORITY - 1); m.start(); } @@ -73,14 +73,14 @@ public class Mixer { return mixer; } - synchronized void add(Track track) { - ArrayList newTracks = new ArrayList(tracks); + synchronized void add(final Track track) { + final ArrayList newTracks = new ArrayList(tracks); newTracks.add(track); tracks = newTracks; } - synchronized void remove(Track track) { - ArrayList newTracks = new ArrayList(tracks); + synchronized void remove(final Track track) { + final ArrayList newTracks = new ArrayList(tracks); newTracks.remove(track); tracks = newTracks; } @@ -88,14 +88,14 @@ public class Mixer { // NOTE: due to a bug on the APX device, we only have mono sounds, // so we currently only pay attention to the position of the left // speaker - public void setLeftSpeakerPosition(float x, float y, float z) { + public void setLeftSpeakerPosition(final float x, final float y, final float z) { leftSpeakerPosition.set(x, y, z); } // NOTE: due to a bug on the APX device, we only have mono sounds, // so we currently only pay attention to the position of the left // speaker - public void setRightSpeakerPosition(float x, float y, float z) { + public void setRightSpeakerPosition(final float x, final float y, final float z) { rightSpeakerPosition.set(x, y, z); } @@ -109,7 +109,7 @@ public class Mixer { falloffFactor + r^2 */ - public void setFalloffFactor(float factor) { + public void setFalloffFactor(final float factor) { falloffFactor = factor; } @@ -119,7 +119,7 @@ public class Mixer { SetEvent(event); try { shutdownLock.wait(); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { } } } @@ -132,13 +132,13 @@ public class Mixer { @Override public void run() { while (!shutdown) { - List curTracks = tracks; + final List curTracks = tracks; - for (Iterator iter = curTracks.iterator(); iter.hasNext(); ) { - Track track = iter.next(); + for (final Iterator iter = curTracks.iterator(); iter.hasNext(); ) { + final Track track = iter.next(); try { track.fill(); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); remove(track); } @@ -147,7 +147,7 @@ public class Mixer { try { // Run ten times per second Thread.sleep(100); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } } @@ -158,7 +158,7 @@ public class Mixer { // Temporary mixing buffer // Interleaved left and right channels float[] mixingBuffer; - private Vec3f temp = new Vec3f(); + private final Vec3f temp = new Vec3f(); MixerThread() { super("Mixer Thread"); @@ -171,7 +171,7 @@ public class Mixer { public void run() { while (!shutdown) { // Get the next buffer - long mixerBuffer = getNextMixerBuffer(); + final long mixerBuffer = getNextMixerBuffer(); if (mixerBuffer != 0) { ByteBuffer buf = getMixerBufferData(mixerBuffer); @@ -203,27 +203,27 @@ public class Mixer { // This assertion should be in place if we have stereo if ((mixingBuffer.length % 2) != 0) { - String msg = "FATAL ERROR: odd number of samples in the mixing buffer"; + final String msg = "FATAL ERROR: odd number of samples in the mixing buffer"; System.out.println(msg); throw new InternalError(msg); } // Run down all of the registered tracks mixing them in - List curTracks = tracks; + final List curTracks = tracks; - for (Iterator iter = curTracks.iterator(); iter.hasNext(); ) { - Track track = iter.next(); + for (final Iterator iter = curTracks.iterator(); iter.hasNext(); ) { + final Track track = iter.next(); // Consider only playing tracks if (track.isPlaying()) { // First recompute its gain - Vec3f pos = track.getPosition(); - float leftGain = gain(pos, leftSpeakerPosition); - float rightGain = gain(pos, rightSpeakerPosition); + final Vec3f pos = track.getPosition(); + final float leftGain = gain(pos, leftSpeakerPosition); + final float rightGain = gain(pos, rightSpeakerPosition); // Now mix it in int i = 0; while (i < mixingBuffer.length) { if (track.hasNextSample()) { - float sample = track.nextSample(); + final float sample = track.nextSample(); mixingBuffer[i++] = sample * leftGain; mixingBuffer[i++] = sample * rightGain; } else { @@ -240,7 +240,7 @@ public class Mixer { // Now that we have our data, send it down to the card int outPos = 0; for (int i = 0; i < mixingBuffer.length; i++) { - short val = (short) mixingBuffer[i]; + final short val = (short) mixingBuffer[i]; buf.put(outPos++, (byte) val); buf.put(outPos++, (byte) (val >> 8)); } @@ -279,9 +279,9 @@ public class Mixer { // falloffFactor // ------------------- // falloffFactor + r^2 - private float gain(Vec3f pos, Vec3f speakerPos) { + private float gain(final Vec3f pos, final Vec3f speakerPos) { temp.sub(pos, speakerPos); - float dotp = temp.dot(temp); + final float dotp = temp.dot(temp); return (falloffFactor / (falloffFactor + dotp)); } } @@ -321,8 +321,8 @@ public class Mixer { private static Constructor directByteBufferConstructor; private static Map createdBuffers = new HashMap(); // Map Long, ByteBuffer - private static ByteBuffer newDirectByteBuffer(long address, long capacity) { - Long key = new Long(address); + private static ByteBuffer newDirectByteBuffer(final long address, final long capacity) { + final Long key = new Long(address); ByteBuffer buf = (ByteBuffer) createdBuffers.get(key); if (buf == null) { buf = newDirectByteBufferImpl(address, capacity); @@ -332,17 +332,17 @@ public class Mixer { } return buf; } - private static ByteBuffer newDirectByteBufferImpl(long address, long capacity) { + private static ByteBuffer newDirectByteBufferImpl(final long address, final long capacity) { if (directByteBufferClass == null) { try { directByteBufferClass = Class.forName("java.nio.DirectByteBuffer"); - byte[] tmp = new byte[0]; + final byte[] tmp = new byte[0]; directByteBufferConstructor = directByteBufferClass.getDeclaredConstructor(new Class[] { Integer.TYPE, tmp.getClass(), Integer.TYPE }); directByteBufferConstructor.setAccessible(true); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } @@ -355,7 +355,7 @@ public class Mixer { null, new Integer((int) address) }); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/SoundBuffer.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/SoundBuffer.java index 01346553c..18698f5ea 100644 --- a/src/jogl/classes/com/jogamp/audio/windows/waveout/SoundBuffer.java +++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/SoundBuffer.java @@ -35,16 +35,16 @@ package com.jogamp.audio.windows.waveout; import java.io.*; class SoundBuffer { - private byte[] data; - private boolean needsByteSwap; + private final byte[] data; + private final boolean needsByteSwap; private int numBytes; - private int bytesPerSample; + private final int bytesPerSample; private int numSamples; private boolean playing; private boolean empty; // Note: needsByteSwap argument makes assumptions about the format - SoundBuffer(int size, int bytesPerSample, boolean needsByteSwap) { + SoundBuffer(final int size, final int bytesPerSample, final boolean needsByteSwap) { this.bytesPerSample = bytesPerSample; this.needsByteSwap = needsByteSwap; data = new byte[size * bytesPerSample]; @@ -55,7 +55,7 @@ class SoundBuffer { return playing; } - void playing(boolean playing) { + void playing(final boolean playing) { this.playing = playing; } @@ -63,11 +63,11 @@ class SoundBuffer { return empty; } - void empty(boolean empty) { + void empty(final boolean empty) { this.empty = empty; } - void fill(InputStream input) throws IOException { + void fill(final InputStream input) throws IOException { synchronized(this) { if (playing) { throw new IllegalStateException("Can not fill a buffer that is playing"); @@ -75,7 +75,7 @@ class SoundBuffer { } empty(true); - int num = input.read(data); + final int num = input.read(data); if (num > 0) { numBytes = num; numSamples = numBytes / bytesPerSample; @@ -96,8 +96,8 @@ class SoundBuffer { // This is called by the mixer and must be extremely fast // FIXME: may want to reconsider use of floating point at this point // FIXME: assumes all sounds are of the same format to avoid normalization - float getSample(int sample) { - int startByte = sample * bytesPerSample; + float getSample(final int sample) { + final int startByte = sample * bytesPerSample; // FIXME: assumes no more than 4 bytes per sample int res = 0; if (needsByteSwap) { @@ -106,7 +106,7 @@ class SoundBuffer { res |= (data[i] & 0xff); } } else { - int endByte = startByte + bytesPerSample - 1; + final int endByte = startByte + bytesPerSample - 1; for (int i = startByte; i <= endByte; i++) { res <<= 8; res |= (data[i] & 0xff); @@ -119,6 +119,6 @@ class SoundBuffer { res = (byte) res; } - return (float) res; + return res; } } diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/Track.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Track.java index 98a787478..5e55786ac 100644 --- a/src/jogl/classes/com/jogamp/audio/windows/waveout/Track.java +++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Track.java @@ -56,7 +56,7 @@ public class Track { // If we're playing the file, this is its input stream private InputStream input; // Keep around the file name - private File file; + private final File file; // Whether we're playing this sound private boolean playing; // Whether we're looping this sound @@ -64,7 +64,7 @@ public class Track { // The position of this sound; defaults to being at the origin private volatile Vec3f position = new Vec3f(); - Track(File file) throws IOException { + Track(final File file) throws IOException { if (!file.getName().endsWith(".rawsound")) { throw new IOException("Unsupported file format (currently supports only raw sounds)"); } @@ -96,7 +96,7 @@ public class Track { openInput(); // Fill it immediately fill(); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); return; } @@ -109,7 +109,7 @@ public class Track { return playing; } - public synchronized void setLooping(boolean looping) { + public synchronized void setLooping(final boolean looping) { this.looping = looping; } @@ -117,7 +117,7 @@ public class Track { return looping; } - public void setPosition(float x, float y, float z) { + public void setPosition(final float x, final float y, final float z) { position = new Vec3f(x, y, z); } @@ -125,7 +125,7 @@ public class Track { if (input == null) { return; } - SoundBuffer curBuffer = fillingBuffer; + final SoundBuffer curBuffer = fillingBuffer; if (!curBuffer.empty()) { return; } @@ -152,7 +152,7 @@ public class Track { private float leftGain; private float rightGain; - void setLeftGain(float leftGain) { + void setLeftGain(final float leftGain) { this.leftGain = leftGain; } @@ -160,7 +160,7 @@ public class Track { return leftGain; } - void setRightGain(float rightGain) { + void setRightGain(final float rightGain) { this.rightGain = rightGain; } @@ -180,7 +180,7 @@ public class Track { // This is called by the mixer and must be extremely fast float nextSample() { - float res = activeBuffer.getSample(samplePosition++); + final float res = activeBuffer.getSample(samplePosition++); ++samplesRead; if (!hasNextSample()) { swapBuffers(); @@ -193,7 +193,7 @@ public class Track { } synchronized void swapBuffers() { - SoundBuffer tmp = activeBuffer; + final SoundBuffer tmp = activeBuffer; activeBuffer = fillingBuffer; fillingBuffer = tmp; fillingBuffer.empty(true); diff --git a/src/jogl/classes/com/jogamp/audio/windows/waveout/Vec3f.java b/src/jogl/classes/com/jogamp/audio/windows/waveout/Vec3f.java index 79fb80169..831b25c91 100644 --- a/src/jogl/classes/com/jogamp/audio/windows/waveout/Vec3f.java +++ b/src/jogl/classes/com/jogamp/audio/windows/waveout/Vec3f.java @@ -48,11 +48,11 @@ class Vec3f { public Vec3f() {} - public Vec3f(Vec3f arg) { + public Vec3f(final Vec3f arg) { set(arg); } - public Vec3f(float x, float y, float z) { + public Vec3f(final float x, final float y, final float z) { set(x, y, z); } @@ -60,18 +60,18 @@ class Vec3f { return new Vec3f(this); } - public void set(Vec3f arg) { + public void set(final Vec3f arg) { set(arg.x, arg.y, arg.z); } - public void set(float x, float y, float z) { + public void set(final float x, final float y, final float z) { this.x = x; this.y = y; this.z = z; } /** Sets the ith component, 0 <= i < 3 */ - public void set(int i, float val) { + public void set(final int i, final float val) { switch (i) { case 0: x = val; break; case 1: y = val; break; @@ -81,7 +81,7 @@ class Vec3f { } /** Gets the ith component, 0 <= i < 3 */ - public float get(int i) { + public float get(final int i) { switch (i) { case 0: return x; case 1: return y; @@ -94,11 +94,11 @@ class Vec3f { public float y() { return y; } public float z() { return z; } - public void setX(float x) { this.x = x; } - public void setY(float y) { this.y = y; } - public void setZ(float z) { this.z = z; } + public void setX(final float x) { this.x = x; } + public void setY(final float y) { this.y = y; } + public void setZ(final float z) { this.z = z; } - public float dot(Vec3f arg) { + public float dot(final Vec3f arg) { return x * arg.x + y * arg.y + z * arg.z; } @@ -111,87 +111,87 @@ class Vec3f { } public void normalize() { - float len = length(); + final float len = length(); if (len == 0.0f) return; scale(1.0f / len); } /** Returns this * val; creates new vector */ - public Vec3f times(float val) { - Vec3f tmp = new Vec3f(this); + public Vec3f times(final float val) { + final Vec3f tmp = new Vec3f(this); tmp.scale(val); return tmp; } /** this = this * val */ - public void scale(float val) { + public void scale(final float val) { x *= val; y *= val; z *= val; } /** Returns this + arg; creates new vector */ - public Vec3f plus(Vec3f arg) { - Vec3f tmp = new Vec3f(); + public Vec3f plus(final Vec3f arg) { + final Vec3f tmp = new Vec3f(); tmp.add(this, arg); return tmp; } /** this = this + b */ - public void add(Vec3f b) { + public void add(final Vec3f b) { add(this, b); } /** this = a + b */ - public void add(Vec3f a, Vec3f b) { + public void add(final Vec3f a, final Vec3f b) { x = a.x + b.x; y = a.y + b.y; z = a.z + b.z; } /** Returns this + s * arg; creates new vector */ - public Vec3f addScaled(float s, Vec3f arg) { - Vec3f tmp = new Vec3f(); + public Vec3f addScaled(final float s, final Vec3f arg) { + final Vec3f tmp = new Vec3f(); tmp.addScaled(this, s, arg); return tmp; } /** this = a + s * b */ - public void addScaled(Vec3f a, float s, Vec3f b) { + public void addScaled(final Vec3f a, final float s, final Vec3f b) { x = a.x + s * b.x; y = a.y + s * b.y; z = a.z + s * b.z; } /** Returns this - arg; creates new vector */ - public Vec3f minus(Vec3f arg) { - Vec3f tmp = new Vec3f(); + public Vec3f minus(final Vec3f arg) { + final Vec3f tmp = new Vec3f(); tmp.sub(this, arg); return tmp; } /** this = this - b */ - public void sub(Vec3f b) { + public void sub(final Vec3f b) { sub(this, b); } /** this = a - b */ - public void sub(Vec3f a, Vec3f b) { + public void sub(final Vec3f a, final Vec3f b) { x = a.x - b.x; y = a.y - b.y; z = a.z - b.z; } /** Returns this cross arg; creates new vector */ - public Vec3f cross(Vec3f arg) { - Vec3f tmp = new Vec3f(); + public Vec3f cross(final Vec3f arg) { + final Vec3f tmp = new Vec3f(); tmp.cross(this, arg); return tmp; } /** this = a cross b. NOTE: "this" must be a different vector than both a and b. */ - public void cross(Vec3f a, Vec3f b) { + public void cross(final Vec3f a, final Vec3f b) { x = a.y * b.z - a.z * b.y; y = a.z * b.x - a.x * b.z; z = a.x * b.y - a.y * b.x; @@ -200,7 +200,7 @@ class Vec3f { /** Sets each component of this vector to the product of the component with the corresponding component of the argument vector. */ - public void componentMul(Vec3f arg) { + public void componentMul(final Vec3f arg) { x *= arg.x; y *= arg.y; z *= arg.z; diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java index 023913d7b..f082f358f 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildComposablePipeline.java @@ -106,37 +106,37 @@ public class BuildComposablePipeline { // Desktop OpenGL and GLES1 have GL_STACK_OVERFLOW and GL_STACK_UNDERFLOW errors private boolean hasGL2ES1StackOverflow; - public static Class getClass(String name) { + public static Class getClass(final String name) { Class clazz = null; try { clazz = Class.forName(name); - } catch (Exception e) { + } catch (final Exception e) { throw new RuntimeException( "Could not find class \"" + name + "\"", e); } return clazz; } - public static Method getMethod(Class clazz, Method m) { + public static Method getMethod(final Class clazz, final Method m) { Method res = null; try { res = clazz.getMethod(m.getName(), m.getParameterTypes()); - } catch (Exception e) { + } catch (final Exception e) { } return res; } - public static void main(String[] args) { - String classToComposeAroundName = args[0]; + public static void main(final String[] args) { + final String classToComposeAroundName = args[0]; Class classPrologOpt, classDownstream; - Class classToComposeAround = getClass(classToComposeAroundName); + final Class classToComposeAround = getClass(classToComposeAroundName); - String outputDir = args[1]; + final String outputDir = args[1]; String outputPackage, outputName; int mode; if (args.length > 2) { - String outputClazzName = args[2]; + final String outputClazzName = args[2]; outputPackage = getPackageName(outputClazzName); outputName = getBaseClassName(outputClazzName); classPrologOpt = getClass(args[3]); @@ -159,19 +159,19 @@ public class BuildComposablePipeline { mode = GEN_DEBUG | GEN_TRACE ; } - BuildComposablePipeline composer = + final BuildComposablePipeline composer = new BuildComposablePipeline(mode, outputDir, outputPackage, outputName, classToComposeAround, classPrologOpt, classDownstream); try { composer.emit(); - } catch (IOException e) { + } catch (final IOException e) { throw new RuntimeException( "Error generating composable pipeline source files", e); } } - protected BuildComposablePipeline(int mode, String outputDir, String outputPackage, String outputName, - Class classToComposeAround, Class classPrologOpt, Class classDownstream) { + protected BuildComposablePipeline(final int mode, final String outputDir, final String outputPackage, final String outputName, + final Class classToComposeAround, final Class classPrologOpt, final Class classDownstream) { this.mode = mode; this.outputDir = outputDir; this.outputPackage = outputPackage; @@ -188,13 +188,13 @@ public class BuildComposablePipeline { try { hasImmediateMode = (classToComposeAround.getMethod("glBegin", new Class[]{Integer.TYPE}) != null); - } catch (Exception e) { + } catch (final Exception e) { } try { hasGL2ES1StackOverflow = hasImmediateMode && (classToComposeAround.getField("GL_STACK_OVERFLOW") != null); - } catch (Exception e) { + } catch (final Exception e) { } } @@ -207,7 +207,7 @@ public class BuildComposablePipeline { final List publicMethodsRaw = Arrays.asList(classToComposeAround.getMethods()); final Set publicMethodsPlain = new HashSet(); - for (Iterator iter = publicMethodsRaw.iterator(); iter.hasNext();) { + for (final Iterator iter = publicMethodsRaw.iterator(); iter.hasNext();) { final Method method = iter.next(); // Don't hook methods which aren't real GL methods, // such as the synthetic "isGL2ES2" "getGL2ES2" @@ -232,8 +232,8 @@ public class BuildComposablePipeline { } } - public static String getPackageName(String clazzName) { - int lastDot = clazzName.lastIndexOf('.'); + public static String getPackageName(final String clazzName) { + final int lastDot = clazzName.lastIndexOf('.'); if (lastDot == -1) { // no package, class is at root level return null; @@ -241,8 +241,8 @@ public class BuildComposablePipeline { return clazzName.substring(0, lastDot); } - public static String getBaseClassName(String clazzName) { - int lastDot = clazzName.lastIndexOf('.'); + public static String getBaseClassName(final String clazzName) { + final int lastDot = clazzName.lastIndexOf('.'); if (lastDot == -1) { // no package, class is at root level return clazzName; @@ -256,7 +256,7 @@ public class BuildComposablePipeline { Method m; boolean runHooks; - PlainMethod(Method m, boolean runHooks) { + PlainMethod(final Method m, final boolean runHooks) { this.m = m; this.runHooks = runHooks; } @@ -270,10 +270,10 @@ public class BuildComposablePipeline { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (obj instanceof PlainMethod) { - PlainMethod b = (PlainMethod) obj; - boolean res = + final PlainMethod b = (PlainMethod) obj; + final boolean res = m.getName().equals(b.m.getName()) && m.getModifiers() == b.m.getModifiers() && m.getReturnType().equals(b.m.getReturnType()) @@ -286,7 +286,7 @@ public class BuildComposablePipeline { @Override public int hashCode() { int hash = m.getName().hashCode() ^ m.getModifiers() ^ m.getReturnType().hashCode(); - Class[] args = m.getParameterTypes(); + final Class[] args = m.getParameterTypes(); for (int i = 0; i < args.length; i++) { hash ^= args[i].hashCode(); } @@ -295,8 +295,8 @@ public class BuildComposablePipeline { @Override public String toString() { - Class[] args = m.getParameterTypes(); - StringBuilder argsString = new StringBuilder(); + final Class[] args = m.getParameterTypes(); + final StringBuilder argsString = new StringBuilder(); argsString.append("("); for (int i = 0; i < args.length; i++) { if (i > 0) { @@ -340,7 +340,7 @@ public class BuildComposablePipeline { * @exception IllegalArgumentException if classToComposeAround is not an * interface. */ - PipelineEmitter(String outputDir, String outputPackage, Class baseInterfaceClass, Class prologClassOpt, Class downstreamClass) { + PipelineEmitter(final String outputDir, final String outputPackage, final Class baseInterfaceClass, final Class prologClassOpt, final Class downstreamClass) { this.outputDir = outputDir; this.outputPackage = outputPackage; this.baseInterfaceClass = baseInterfaceClass; @@ -357,31 +357,31 @@ public class BuildComposablePipeline { } } - public void emit(Iterator methodsToWrap) throws IOException { - String outputClassName = getOutputName(); + public void emit(final Iterator methodsToWrap) throws IOException { + final String outputClassName = getOutputName(); this.file = new File(outputDir + File.separatorChar + outputClassName + ".java"); - String parentDir = file.getParent(); + final String parentDir = file.getParent(); if (parentDir != null) { - File pDirFile = new File(parentDir); + final File pDirFile = new File(parentDir); pDirFile.mkdirs(); } - PrintWriter output = new PrintWriter(new BufferedWriter(new FileWriter(file))); + final PrintWriter output = new PrintWriter(new BufferedWriter(new FileWriter(file))); - List> baseInterfaces = Arrays.asList(baseInterfaceClass.getInterfaces()); - HashSet> clazzList = new HashSet>(); + final List> baseInterfaces = Arrays.asList(baseInterfaceClass.getInterfaces()); + final HashSet> clazzList = new HashSet>(); clazzList.add(baseInterfaceClass); clazzList.addAll(baseInterfaces); - int ifNamesNumber = clazzList.size(); + final int ifNamesNumber = clazzList.size(); // keep original order .. clazzList.clear(); - String[] ifNames = new String[ifNamesNumber]; + final String[] ifNames = new String[ifNamesNumber]; { int i = 0; - for (Iterator> iter = baseInterfaces.iterator(); iter.hasNext();) { - Class ifClass = iter.next(); + for (final Iterator> iter = baseInterfaces.iterator(); iter.hasNext();) { + final Class ifClass = iter.next(); if (!clazzList.contains(ifClass)) { ifNames[i++] = ifClass.getName(); clazzList.add(ifClass); @@ -399,12 +399,12 @@ public class BuildComposablePipeline { clazzList.add(prologClassOpt); } - ArrayList imports = new ArrayList(); + final ArrayList imports = new ArrayList(); imports.add("java.io.*"); imports.add("javax.media.opengl.*"); imports.add("com.jogamp.gluegen.runtime.*"); imports.add(Buffer.class.getPackage().getName()+".*"); - for (Class clasS : clazzList) { + for (final Class clasS : clazzList) { imports.add(clasS.getName()); } @@ -418,7 +418,7 @@ public class BuildComposablePipeline { null, new CodeGenUtils.EmissionCallback() { @Override - public void emit(PrintWriter w) { + public void emit(final PrintWriter w) { emitClassDocComment(w); } }); @@ -431,8 +431,8 @@ public class BuildComposablePipeline { emitGLGetMethods(output); while (methodsToWrap.hasNext()) { - PlainMethod pm = methodsToWrap.next(); - Method m = pm.getWrappedMethod(); + final PlainMethod pm = methodsToWrap.next(); + final Method m = pm.getWrappedMethod(); emitMethodDocComment(output, m); emitSignature(output, m); emitBody(output, m, pm.runHooks()); @@ -467,25 +467,25 @@ public class BuildComposablePipeline { return null; } - protected void emitMethodDocComment(PrintWriter output, Method m) { + protected void emitMethodDocComment(final PrintWriter output, final Method m) { } - protected void emitSignature(PrintWriter output, Method m) { + protected void emitSignature(final PrintWriter output, final Method m) { output.format(" @Override%n public %s %s(%s)%n", JavaType.createForClass(m.getReturnType()).getName(), m.getName(), getArgListAsString(m, true, true)); } - protected void emitBody(PrintWriter output, Method m, boolean runHooks) { + protected void emitBody(final PrintWriter output, final Method m, final boolean runHooks) { output.println(" {"); - Class retType = m.getReturnType(); + final Class retType = m.getReturnType(); - boolean callPreDownstreamHook = runHooks && hasPreDownstreamCallHook(m); - boolean callPostDownstreamHook = runHooks && hasPostDownstreamCallHook(m); - boolean callDownstream = (null != getMethod(downstreamClass, m)) + final boolean callPreDownstreamHook = runHooks && hasPreDownstreamCallHook(m); + final boolean callPostDownstreamHook = runHooks && hasPostDownstreamCallHook(m); + final boolean callDownstream = (null != getMethod(downstreamClass, m)) && !(0 != (GEN_PROLOG_XOR_DOWNSTREAM & getMode()) && callPreDownstreamHook); - boolean hasResult = (retType != Void.TYPE); + final boolean hasResult = (retType != Void.TYPE); if (!callDownstream) { if (!emptyDownstreamAllowed()) { @@ -546,14 +546,14 @@ public class BuildComposablePipeline { } - protected String getArgListAsString(Method m, boolean includeArgTypes, boolean includeArgNames) { - StringBuilder buf = new StringBuilder(256); + protected String getArgListAsString(final Method m, final boolean includeArgTypes, final boolean includeArgNames) { + final StringBuilder buf = new StringBuilder(256); if (!includeArgNames && !includeArgTypes) { throw new IllegalArgumentException( "Cannot generate arglist without both arg types and arg names"); } - Class[] argTypes = m.getParameterTypes(); + final Class[] argTypes = m.getParameterTypes(); for (int i = 0; i < argTypes.length; ++i) { if (includeArgTypes) { buf.append(JavaType.createForClass(argTypes[i]).getName()); @@ -588,7 +588,7 @@ public class BuildComposablePipeline { * Called after the class headers have been generated, but before any * method wrappers have been generated. */ - protected void preMethodEmissionHook(PrintWriter output) { + protected void preMethodEmissionHook(final PrintWriter output) { output.println(" public static final boolean DEBUG = jogamp.opengl.Debug.debug(\"" + getOutputName() + "\");"); } @@ -601,7 +601,7 @@ public class BuildComposablePipeline { * Called after the method wrappers have been generated, but before the * closing parenthesis of the class is emitted. */ - protected void postMethodEmissionHook(PrintWriter output) { + protected void postMethodEmissionHook(final PrintWriter output) { output.println(" @Override"); output.println(" public String toString() {"); output.println(" StringBuilder sb = new StringBuilder();"); @@ -641,7 +641,7 @@ public class BuildComposablePipeline { /** * Emits one of the isGL* methods. */ - protected void emitGLIsMethod(PrintWriter output, String type) { + protected void emitGLIsMethod(final PrintWriter output, final String type) { output.println(" @Override"); output.println(" public final boolean is" + type + "() {"); if( 0 != (GEN_GL_IDENTITY_BY_ASSIGNABLE_CLASS & getMode() ) ) { @@ -660,7 +660,7 @@ public class BuildComposablePipeline { /** * Emits all of the isGL* methods. */ - protected void emitGLIsMethods(PrintWriter output) { + protected void emitGLIsMethods(final PrintWriter output) { output.println(" @Override"); output.println(" public final boolean isGL() {"); output.println(" return true;"); @@ -712,7 +712,7 @@ public class BuildComposablePipeline { /** * Emits one of the getGL* methods. */ - protected void emitGLGetMethod(PrintWriter output, String type) { + protected void emitGLGetMethod(final PrintWriter output, final String type) { output.println(" @Override"); output.println(" public final javax.media.opengl." + type + " get" + type + "() {"); final Class clazz = BuildComposablePipeline.getClass("javax.media.opengl." + type); @@ -732,7 +732,7 @@ public class BuildComposablePipeline { /** * Emits all of the getGL* methods. */ - protected void emitGLGetMethods(PrintWriter output) { + protected void emitGLGetMethods(final PrintWriter output) { output.println(" @Override"); output.println(" public final javax.media.opengl.GL getGL() {"); output.println(" return this;"); @@ -768,7 +768,7 @@ public class BuildComposablePipeline { String className; int mode; - CustomPipeline(int mode, String outputDir, String outputPackage, String outputName, Class baseInterfaceClass, Class prologClassOpt, Class downstreamClass) { + CustomPipeline(final int mode, final String outputDir, final String outputPackage, final String outputName, final Class baseInterfaceClass, final Class prologClassOpt, final Class downstreamClass) { super(outputDir, outputPackage, baseInterfaceClass, prologClassOpt, downstreamClass); className = outputName; this.mode = mode; @@ -795,12 +795,12 @@ public class BuildComposablePipeline { } @Override - protected void preMethodEmissionHook(PrintWriter output) { + protected void preMethodEmissionHook(final PrintWriter output) { super.preMethodEmissionHook(output); } @Override - protected void constructorHook(PrintWriter output) { + protected void constructorHook(final PrintWriter output) { output.print(" public " + getOutputName() + "("); output.print(downstreamName + " " + getDownstreamObjectName()); if (null != prologNameOpt) { @@ -823,7 +823,7 @@ public class BuildComposablePipeline { } @Override - protected void postMethodEmissionHook(PrintWriter output) { + protected void postMethodEmissionHook(final PrintWriter output) { super.postMethodEmissionHook(output); if (null != prologNameOpt) { output.print(" private " + prologNameOpt + " " + getPrologObjectNameOpt() + ";"); @@ -831,7 +831,7 @@ public class BuildComposablePipeline { } @Override - protected void emitClassDocComment(PrintWriter output) { + protected void emitClassDocComment(final PrintWriter output) { output.println("/**"); output.println(" * Composable pipeline {@link " + outputPackage + "." + outputName + "}, implementing the interface"); output.println(" * {@link " + baseInterfaceClass.getName() + "}"); @@ -866,12 +866,12 @@ public class BuildComposablePipeline { } @Override - protected boolean hasPreDownstreamCallHook(Method m) { + protected boolean hasPreDownstreamCallHook(final Method m) { return null != getMethod(prologClassOpt, m); } @Override - protected void preDownstreamCallHook(PrintWriter output, Method m) { + protected void preDownstreamCallHook(final PrintWriter output, final Method m) { if (null != prologNameOpt) { output.print(getPrologObjectNameOpt()); output.print('.'); @@ -883,12 +883,12 @@ public class BuildComposablePipeline { } @Override - protected boolean hasPostDownstreamCallHook(Method m) { + protected boolean hasPostDownstreamCallHook(final Method m) { return false; } @Override - protected void postDownstreamCallHook(PrintWriter output, Method m) { + protected void postDownstreamCallHook(final PrintWriter output, final Method m) { } } // end class CustomPipeline @@ -896,7 +896,7 @@ public class BuildComposablePipeline { String className; - DebugPipeline(String outputDir, String outputPackage, Class baseInterfaceClass, Class downstreamClass) { + DebugPipeline(final String outputDir, final String outputPackage, final Class baseInterfaceClass, final Class downstreamClass) { super(outputDir, outputPackage, baseInterfaceClass, null, downstreamClass); className = "Debug" + getBaseInterfaceName(); } @@ -922,12 +922,12 @@ public class BuildComposablePipeline { } @Override - protected void preMethodEmissionHook(PrintWriter output) { + protected void preMethodEmissionHook(final PrintWriter output) { super.preMethodEmissionHook(output); } @Override - protected void constructorHook(PrintWriter output) { + protected void constructorHook(final PrintWriter output) { output.print(" public " + getOutputName() + "("); output.println(downstreamName + " " + getDownstreamObjectName() + ")"); output.println(" {"); @@ -947,7 +947,7 @@ public class BuildComposablePipeline { } @Override - protected void postMethodEmissionHook(PrintWriter output) { + protected void postMethodEmissionHook(final PrintWriter output) { super.postMethodEmissionHook(output); output.println(" private int checkGLError() {"); if (hasImmediateMode) { @@ -1005,7 +1005,7 @@ public class BuildComposablePipeline { } @Override - protected void emitClassDocComment(PrintWriter output) { + protected void emitClassDocComment(final PrintWriter output) { output.println("/**"); output.println(" *

"); output.println(" * Composable pipeline which wraps an underlying {@link GL} implementation,"); @@ -1023,22 +1023,22 @@ public class BuildComposablePipeline { } @Override - protected boolean hasPreDownstreamCallHook(Method m) { + protected boolean hasPreDownstreamCallHook(final Method m) { return true; } @Override - protected void preDownstreamCallHook(PrintWriter output, Method m) { + protected void preDownstreamCallHook(final PrintWriter output, final Method m) { output.println(" checkContext();"); } @Override - protected boolean hasPostDownstreamCallHook(Method m) { + protected boolean hasPostDownstreamCallHook(final Method m) { return true; } @Override - protected void postDownstreamCallHook(PrintWriter output, Method m) { + protected void postDownstreamCallHook(final PrintWriter output, final Method m) { if (m.getName().equals("glBegin")) { output.println(" insideBeginEndPair = true;"); output.println(" // NOTE: can't check glGetError(); it's not allowed inside glBegin/glEnd pair"); @@ -1050,12 +1050,12 @@ public class BuildComposablePipeline { output.println(" final int err = checkGLError();"); output.println(" if (err != GL_NO_ERROR) {"); - StringBuilder fmtsb = new StringBuilder(); - StringBuilder argsb = new StringBuilder(); + final StringBuilder fmtsb = new StringBuilder(); + final StringBuilder argsb = new StringBuilder(); fmtsb.append("\"%s("); argsb.append("\"").append(m.getName()).append("\""); - Class[] params = m.getParameterTypes(); + final Class[] params = m.getParameterTypes(); for (int i = 0; i < params.length; i++) { if (i > 0) { fmtsb.append(", "); @@ -1089,7 +1089,7 @@ public class BuildComposablePipeline { String className; - TracePipeline(String outputDir, String outputPackage, Class baseInterfaceClass, Class downstreamClass) { + TracePipeline(final String outputDir, final String outputPackage, final Class baseInterfaceClass, final Class downstreamClass) { super(outputDir, outputPackage, baseInterfaceClass, null, downstreamClass); className = "Trace" + getBaseInterfaceName(); } @@ -1115,12 +1115,12 @@ public class BuildComposablePipeline { } @Override - protected void preMethodEmissionHook(PrintWriter output) { + protected void preMethodEmissionHook(final PrintWriter output) { super.preMethodEmissionHook(output); } @Override - protected void constructorHook(PrintWriter output) { + protected void constructorHook(final PrintWriter output) { output.print(" public " + getOutputName() + "("); output.println(downstreamName + " " + getDownstreamObjectName() + ", PrintStream " + getOutputStreamName() + ")"); output.println(" {"); @@ -1136,7 +1136,7 @@ public class BuildComposablePipeline { } @Override - protected void postMethodEmissionHook(PrintWriter output) { + protected void postMethodEmissionHook(final PrintWriter output) { super.postMethodEmissionHook(output); output.println("private PrintStream " + getOutputStreamName() + ";"); output.println("private int indent = 0;"); @@ -1171,7 +1171,7 @@ public class BuildComposablePipeline { } @Override - protected void emitClassDocComment(PrintWriter output) { + protected void emitClassDocComment(final PrintWriter output) { output.println("/**"); output.println(" *

"); output.println(" * Composable pipeline which wraps an underlying {@link GL} implementation,"); @@ -1189,12 +1189,12 @@ public class BuildComposablePipeline { } @Override - protected boolean hasPreDownstreamCallHook(Method m) { + protected boolean hasPreDownstreamCallHook(final Method m) { return true; } @Override - protected void preDownstreamCallHook(PrintWriter output, Method m) { + protected void preDownstreamCallHook(final PrintWriter output, final Method m) { if (m.getName().equals("glEnd") || m.getName().equals("glEndList")) { output.println(" indent-=2;"); output.println(" printIndent();"); @@ -1208,13 +1208,13 @@ public class BuildComposablePipeline { } @Override - protected boolean hasPostDownstreamCallHook(Method m) { + protected boolean hasPostDownstreamCallHook(final Method m) { return true; } @Override - protected void postDownstreamCallHook(PrintWriter output, Method m) { - Class ret = m.getReturnType(); + protected void postDownstreamCallHook(final PrintWriter output, final Method m) { + final Class ret = m.getReturnType(); if (ret != Void.TYPE) { output.println(" println(\" = \"+_res);"); } else { @@ -1230,8 +1230,8 @@ public class BuildComposablePipeline { } } // end class TracePipeline - public static final void printFunctionCallString(PrintWriter output, Method m) { - Class[] params = m.getParameterTypes(); + public static final void printFunctionCallString(final PrintWriter output, final Method m) { + final Class[] params = m.getParameterTypes(); output.print(" \"" + m.getName() + "(\""); for (int i = 0; i < params.length; i++) { output.print("+\"<" + params[i].getName() + ">"); diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java index a5a26d18f..f9719c232 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/BuildStaticGLInfo.java @@ -138,41 +138,41 @@ public class BuildStaticGLInfo { * classes reside, and the remaining arguments are paths to the C header * files that should be parsed */ - public static void main(String[] args) throws IOException { + public static void main(final String[] args) throws IOException { if (args.length > 0 && args[0].equals("-test")) { - BuildStaticGLInfo builder = new BuildStaticGLInfo(); + final BuildStaticGLInfo builder = new BuildStaticGLInfo(); builder.setDebug(true); - String[] newArgs = new String[args.length - 1]; + final String[] newArgs = new String[args.length - 1]; System.arraycopy(args, 1, newArgs, 0, args.length - 1); builder.parse(newArgs); builder.dump(); System.exit(0); } - String packageName = args[0]; - String packageDir = args[1]; + final String packageName = args[0]; + final String packageDir = args[1]; - String[] cHeaderFilePaths = new String[args.length - 2]; + final String[] cHeaderFilePaths = new String[args.length - 2]; System.arraycopy(args, 2, cHeaderFilePaths, 0, cHeaderFilePaths.length); - BuildStaticGLInfo builder = new BuildStaticGLInfo(); + final BuildStaticGLInfo builder = new BuildStaticGLInfo(); try { builder.parse(cHeaderFilePaths); - File file = new File(packageDir + File.separatorChar + "StaticGLInfo.java"); - String parentDir = file.getParent(); + final File file = new File(packageDir + File.separatorChar + "StaticGLInfo.java"); + final String parentDir = file.getParent(); if (parentDir != null) { - File pDirFile = new File(parentDir); + final File pDirFile = new File(parentDir); pDirFile.mkdirs(); } - PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(file))); + final PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(file))); builder.emitJavaCode(writer, packageName); writer.flush(); writer.close(); - } catch (Exception e) { - StringBuilder buf = new StringBuilder("{ "); + } catch (final Exception e) { + final StringBuilder buf = new StringBuilder("{ "); for (int i = 0; i < cHeaderFilePaths.length; ++i) { buf.append(cHeaderFilePaths[i]); buf.append(" "); @@ -183,13 +183,13 @@ public class BuildStaticGLInfo { } } - public void setDebug(boolean v) { + public void setDebug(final boolean v) { DEBUG = v; } /** Parses the supplied C header files and adds the function associations contained therein to the internal map. */ - public void parse(String[] cHeaderFilePaths) throws IOException { + public void parse(final String[] cHeaderFilePaths) throws IOException { for (int i = 0; i < cHeaderFilePaths.length; i++) { parse(cHeaderFilePaths[i]); } @@ -197,8 +197,8 @@ public class BuildStaticGLInfo { /** Parses the supplied C header file and adds the function associations contained therein to the internal map. */ - public void parse(String cHeaderFilePath) throws IOException { - BufferedReader reader = new BufferedReader(new FileReader(cHeaderFilePath)); + public void parse(final String cHeaderFilePath) throws IOException { + final BufferedReader reader = new BufferedReader(new FileReader(cHeaderFilePath)); String line, activeAssociation = null; Matcher m = null; int block = 0; @@ -264,23 +264,23 @@ public class BuildStaticGLInfo { } public void dump() { - for (String name : extensionToDeclarationMap.keySet()) { - Set decls = extensionToDeclarationMap.get(name); + for (final String name : extensionToDeclarationMap.keySet()) { + final Set decls = extensionToDeclarationMap.get(name); System.out.println("<" + name + "> :"); - List l = new ArrayList(); + final List l = new ArrayList(); l.addAll(decls); Collections.sort(l); - for (String str : l) { + for (final String str : l) { System.out.println(" <" + str + ">"); } } } - public Set getExtension(String identifier) { + public Set getExtension(final String identifier) { return declarationToExtensionMap.get(identifier); } - public Set getDeclarations(String extension) { + public Set getDeclarations(final String extension) { return extensionToDeclarationMap.get(extension); } @@ -288,7 +288,7 @@ public class BuildStaticGLInfo { return extensionToDeclarationMap.keySet(); } - public void emitJavaCode(PrintWriter output, String packageName) { + public void emitJavaCode(final PrintWriter output, final String packageName) { output.println("package " + packageName + ";"); output.println(); output.println("import java.util.*;"); @@ -340,7 +340,7 @@ public class BuildStaticGLInfo { // Compute max capacity int maxCapacity = 0; - for (String name : declarationToExtensionMap.keySet()) { + for (final String name : declarationToExtensionMap.keySet()) { if (!name.startsWith("GL")) { ++maxCapacity; } @@ -348,17 +348,17 @@ public class BuildStaticGLInfo { output.println(" funcToAssocMap = new HashMap(" + maxCapacity + "); // approximate max capacity"); output.println(" String group;"); - ArrayList sets = new ArrayList(extensionToDeclarationMap.keySet()); + final ArrayList sets = new ArrayList(extensionToDeclarationMap.keySet()); Collections.sort(sets); - for (String groupName : sets) { - Set funcs = extensionToDeclarationMap.get(groupName); - List l = new ArrayList(); + for (final String groupName : sets) { + final Set funcs = extensionToDeclarationMap.get(groupName); + final List l = new ArrayList(); l.addAll(funcs); Collections.sort(l); - Iterator funcIter = l.iterator(); + final Iterator funcIter = l.iterator(); boolean printedHeader = false; while (funcIter.hasNext()) { - String funcName = funcIter.next(); + final String funcName = funcIter.next(); if (!funcName.startsWith("GL")) { if (!printedHeader) { output.println(); @@ -380,7 +380,7 @@ public class BuildStaticGLInfo { //---------------------------------------------------------------------- // Internals only below this point // - protected void addAssociation(String identifier, String association) { + protected void addAssociation(final String identifier, final String association) { Set extensions = declarationToExtensionMap.get(identifier); if(null == extensions) { extensions = new HashSet(); diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java index f1a32fa9c..5da45abfe 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLConfiguration.java @@ -59,17 +59,17 @@ import java.util.StringTokenizer; public class GLConfiguration extends ProcAddressConfiguration { // The following data members support ignoring an entire extension at a time - private List glHeaders = new ArrayList(); - private Set ignoredExtensions = new HashSet(); - private Set forcedExtensions = new HashSet(); - private Set extensionsRenamedIntoCore = new HashSet(); + private final List glHeaders = new ArrayList(); + private final Set ignoredExtensions = new HashSet(); + private final Set forcedExtensions = new HashSet(); + private final Set extensionsRenamedIntoCore = new HashSet(); private BuildStaticGLInfo glInfo; // Maps function names to the kind of buffer object it deals with - private Map bufferObjectKinds = new HashMap(); - private Set bufferObjectOnly = new HashSet(); - private GLEmitter emitter; - private Set dropUniqVendorExtensions = new HashSet(); + private final Map bufferObjectKinds = new HashMap(); + private final Set bufferObjectOnly = new HashSet(); + private final GLEmitter emitter; + private final Set dropUniqVendorExtensions = new HashSet(); // This directive is off by default but can help automatically // indicate which extensions have been folded into the core OpenGL @@ -77,52 +77,52 @@ public class GLConfiguration extends ProcAddressConfiguration { private boolean autoUnifyExtensions = false; private boolean allowNonGLExtensions = false; - public GLConfiguration(GLEmitter emitter) { + public GLConfiguration(final GLEmitter emitter) { super(); this.emitter = emitter; try { setProcAddressNameExpr("PFN $UPPERCASE({0}) PROC"); - } catch (NoSuchElementException e) { + } catch (final NoSuchElementException e) { throw new RuntimeException("Error configuring ProcAddressNameExpr", e); } } @Override - protected void dispatch(String cmd, StringTokenizer tok, File file, String filename, int lineNo) throws IOException { + protected void dispatch(final String cmd, final StringTokenizer tok, final File file, final String filename, final int lineNo) throws IOException { if (cmd.equalsIgnoreCase("IgnoreExtension")) { - String sym = readString("IgnoreExtension", tok, filename, lineNo); + final String sym = readString("IgnoreExtension", tok, filename, lineNo); ignoredExtensions.add(sym); } else if (cmd.equalsIgnoreCase("ForceExtension")) { - String sym = readString("ForceExtension", tok, filename, lineNo); + final String sym = readString("ForceExtension", tok, filename, lineNo); forcedExtensions.add(sym); } else if (cmd.equalsIgnoreCase("RenameExtensionIntoCore")) { - String sym = readString("RenameExtensionIntoCore", tok, filename, lineNo); + final String sym = readString("RenameExtensionIntoCore", tok, filename, lineNo); extensionsRenamedIntoCore.add(sym); } else if (cmd.equalsIgnoreCase("AllowNonGLExtensions")) { allowNonGLExtensions = readBoolean("AllowNonGLExtensions", tok, filename, lineNo).booleanValue(); } else if (cmd.equalsIgnoreCase("AutoUnifyExtensions")) { autoUnifyExtensions = readBoolean("AutoUnifyExtensions", tok, filename, lineNo).booleanValue(); } else if (cmd.equalsIgnoreCase("GLHeader")) { - String sym = readString("GLHeader", tok, filename, lineNo); + final String sym = readString("GLHeader", tok, filename, lineNo); glHeaders.add(sym); } else if (cmd.equalsIgnoreCase("BufferObjectKind")) { readBufferObjectKind(tok, filename, lineNo); } else if (cmd.equalsIgnoreCase("BufferObjectOnly")) { - String sym = readString("BufferObjectOnly", tok, filename, lineNo); + final String sym = readString("BufferObjectOnly", tok, filename, lineNo); bufferObjectOnly.add(sym); } else if (cmd.equalsIgnoreCase("DropUniqVendorExtensions")) { - String sym = readString("DropUniqVendorExtensions", tok, filename, lineNo); + final String sym = readString("DropUniqVendorExtensions", tok, filename, lineNo); dropUniqVendorExtensions.add(sym); } else { super.dispatch(cmd, tok, file, filename, lineNo); } } - protected void readBufferObjectKind(StringTokenizer tok, String filename, int lineNo) { + protected void readBufferObjectKind(final StringTokenizer tok, final String filename, final int lineNo) { try { - String kindString = tok.nextToken(); + final String kindString = tok.nextToken(); GLEmitter.BufferObjectKind kind = null; - String target = tok.nextToken(); + final String target = tok.nextToken(); if (kindString.equalsIgnoreCase("UnpackPixel")) { kind = GLEmitter.BufferObjectKind.UNPACK_PIXEL; } else if (kindString.equalsIgnoreCase("PackPixel")) { @@ -140,7 +140,7 @@ public class GLConfiguration extends ProcAddressConfiguration { } bufferObjectKinds.put(target, kind); - } catch (NoSuchElementException e) { + } catch (final NoSuchElementException e) { throw new RuntimeException("Error parsing \"BufferObjectKind\" command at line " + lineNo + " in file \"" + filename + "\"", e); } @@ -150,10 +150,10 @@ public class GLConfiguration extends ProcAddressConfiguration { automatically generates prologue code for functions associated with buffer objects. */ @Override - public List javaPrologueForMethod(MethodBinding binding, boolean forImplementingMethodCall, boolean eraseBufferAndArrayTypes) { + public List javaPrologueForMethod(final MethodBinding binding, final boolean forImplementingMethodCall, final boolean eraseBufferAndArrayTypes) { List res = super.javaPrologueForMethod(binding, forImplementingMethodCall, eraseBufferAndArrayTypes); - GLEmitter.BufferObjectKind kind = getBufferObjectKind(binding.getName()); + final GLEmitter.BufferObjectKind kind = getBufferObjectKind(binding.getName()); if (kind != null) { // Need to generate appropriate prologue based on both buffer // object kind and whether this variant of the MethodBinding @@ -161,7 +161,7 @@ public class GLConfiguration extends ProcAddressConfiguration { // // NOTE we MUST NOT mutate the array returned from the super // call! - ArrayList res2 = new ArrayList(); + final ArrayList res2 = new ArrayList(); if (res != null) { res2.addAll(res); } @@ -196,8 +196,8 @@ public class GLConfiguration extends ProcAddressConfiguration { // Must also filter out bogus rangeCheck directives for VBO/PBO // variants if (emitter.isBufferObjectMethodBinding(binding)) { - for (Iterator iter = res.iterator(); iter.hasNext();) { - String line = iter.next(); + for (final Iterator iter = res.iterator(); iter.hasNext();) { + final String line = iter.next(); if (line.indexOf("Buffers.rangeCheck") >= 0) { iter.remove(); } @@ -211,22 +211,22 @@ public class GLConfiguration extends ProcAddressConfiguration { @Override public void dumpIgnores() { System.err.println("GL Ignored extensions: "); - for (String str : ignoredExtensions) { + for (final String str : ignoredExtensions) { System.err.println("\t" + str); } System.err.println("GL Forced extensions: "); - for (String str : forcedExtensions) { + for (final String str : forcedExtensions) { System.err.println("\t" + str); } super.dumpIgnores(); } - protected boolean shouldIgnoreExtension(String symbol, boolean criteria) { + protected boolean shouldIgnoreExtension(final String symbol, final boolean criteria) { if (criteria && glInfo != null) { final Set extensionNames = glInfo.getExtension(symbol); if( null != extensionNames ) { boolean ignoredExtension = false; - for(Iterator i=extensionNames.iterator(); !ignoredExtension && i.hasNext(); ) { + for(final Iterator i=extensionNames.iterator(); !ignoredExtension && i.hasNext(); ) { final String extensionName = i.next(); if ( extensionName != null && ignoredExtensions.contains(extensionName) ) { if (DEBUG_IGNORES) { @@ -245,7 +245,7 @@ public class GLConfiguration extends ProcAddressConfiguration { if( ignoredExtension ) { final Set origSymbols = getRenamedJavaSymbols( symbol ); if(null != origSymbols) { - for(String origSymbol : origSymbols) { + for(final String origSymbol : origSymbols) { if( shouldForceExtension( origSymbol, true, symbol ) ) { ignoredExtension = false; break; @@ -258,11 +258,11 @@ public class GLConfiguration extends ProcAddressConfiguration { return true; } } - boolean isGLEnum = GLNameResolver.isGLEnumeration(symbol); - boolean isGLFunc = GLNameResolver.isGLFunction(symbol); + final boolean isGLEnum = GLNameResolver.isGLEnumeration(symbol); + final boolean isGLFunc = GLNameResolver.isGLFunction(symbol); if (isGLFunc || isGLEnum) { if (GLNameResolver.isExtensionVEN(symbol, isGLFunc)) { - String extSuffix = GLNameResolver.getExtensionSuffix(symbol, isGLFunc); + final String extSuffix = GLNameResolver.getExtensionSuffix(symbol, isGLFunc); if (getDropUniqVendorExtensions(extSuffix)) { if (DEBUG_IGNORES) { System.err.println("Ignore UniqVendorEXT: " + symbol + ", vendor " + extSuffix); @@ -279,7 +279,7 @@ public class GLConfiguration extends ProcAddressConfiguration { if (criteria && glInfo != null) { final Set extensionNames = glInfo.getExtension(symbol); if( null != extensionNames ) { - for(Iterator i=extensionNames.iterator(); i.hasNext(); ) { + for(final Iterator i=extensionNames.iterator(); i.hasNext(); ) { final String extensionName = i.next(); if ( extensionName != null && forcedExtensions.contains(extensionName) ) { if (DEBUG_IGNORES) { @@ -299,20 +299,20 @@ public class GLConfiguration extends ProcAddressConfiguration { } @Override - public boolean shouldIgnoreInInterface(String symbol) { + public boolean shouldIgnoreInInterface(final String symbol) { return shouldIgnoreInInterface(symbol, true); } - public boolean shouldIgnoreInInterface(String symbol, boolean checkEXT) { + public boolean shouldIgnoreInInterface(final String symbol, final boolean checkEXT) { return shouldIgnoreExtension(symbol, checkEXT) || super.shouldIgnoreInInterface(symbol); } @Override - public boolean shouldIgnoreInImpl(String symbol) { + public boolean shouldIgnoreInImpl(final String symbol) { return shouldIgnoreInImpl(symbol, true); } - public boolean shouldIgnoreInImpl(String symbol, boolean checkEXT) { + public boolean shouldIgnoreInImpl(final String symbol, final boolean checkEXT) { return shouldIgnoreExtension(symbol, checkEXT) || super.shouldIgnoreInImpl(symbol); } @@ -330,32 +330,32 @@ public class GLConfiguration extends ProcAddressConfiguration { } /** shall the non unified (uniq) vendor extensions be dropped ? */ - public boolean getDropUniqVendorExtensions(String extName) { + public boolean getDropUniqVendorExtensions(final String extName) { return dropUniqVendorExtensions.contains(extName); } /** Returns the kind of buffer object this function deals with, or null if none. */ - GLEmitter.BufferObjectKind getBufferObjectKind(String name) { + GLEmitter.BufferObjectKind getBufferObjectKind(final String name) { return bufferObjectKinds.get(name); } - public boolean isBufferObjectFunction(String name) { + public boolean isBufferObjectFunction(final String name) { return (getBufferObjectKind(name) != null); } - public boolean isBufferObjectOnly(String name) { + public boolean isBufferObjectOnly(final String name) { return bufferObjectOnly.contains(name); } /** Parses any GL headers specified in the configuration file for the purpose of being able to ignore an extension at a time. */ - public void parseGLHeaders(GlueEmitterControls controls) throws IOException { + public void parseGLHeaders(final GlueEmitterControls controls) throws IOException { if (!glHeaders.isEmpty()) { glInfo = new BuildStaticGLInfo(); glInfo.setDebug(GlueGen.debug()); - for (String file : glHeaders) { - String fullPath = controls.findHeaderFile(file); + for (final String file : glHeaders) { + final String fullPath = controls.findHeaderFile(file); if (fullPath == null) { throw new IOException("Unable to locate header file \"" + file + "\""); } diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java index 547382ed1..bc230c83a 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLEmitter.java @@ -72,12 +72,12 @@ public class GLEmitter extends ProcAddressEmitter { // Keeps track of which MethodBindings were created for handling // Buffer Object variants. Used as a Set rather than a Map. - private Map bufferObjectMethodBindings = new IdentityHashMap(); + private final Map bufferObjectMethodBindings = new IdentityHashMap(); enum BufferObjectKind { UNPACK_PIXEL, PACK_PIXEL, ARRAY, ELEMENT, INDIRECT} @Override - public void beginEmission(GlueEmitterControls controls) throws IOException { + public void beginEmission(final GlueEmitterControls controls) throws IOException { getGLConfig().parseGLHeaders(controls); renameExtensionsIntoCore(); if (getGLConfig().getAutoUnifyExtensions()) { @@ -93,30 +93,30 @@ public class GLEmitter extends ProcAddressEmitter { // already in the core namespace in desktop OpenGL. It builds upon // renaming mechanisms that are built elsewhere. - GLConfiguration config = getGLConfig(); - Set extensionsRenamedIntoCore = config.getExtensionsRenamedIntoCore(); - BuildStaticGLInfo glInfo = config.getGLInfo(); + final GLConfiguration config = getGLConfig(); + final Set extensionsRenamedIntoCore = config.getExtensionsRenamedIntoCore(); + final BuildStaticGLInfo glInfo = config.getGLInfo(); if (null == glInfo) { if (extensionsRenamedIntoCore.size() > 0) { throw new RuntimeException("ExtensionRenamedIntoCore (num: " + extensionsRenamedIntoCore.size() + "), but no GLHeader"); } return; } - for (String extension : extensionsRenamedIntoCore) { + for (final String extension : extensionsRenamedIntoCore) { if(JavaConfiguration.DEBUG_RENAMES) { System.err.println(" declarations = glInfo.getDeclarations(extension); + final Set declarations = glInfo.getDeclarations(extension); if (declarations != null) { - for (Iterator iterator = declarations.iterator(); iterator.hasNext();) { - String decl = iterator.next(); - boolean isGLFunction = GLNameResolver.isGLFunction(decl); + for (final Iterator iterator = declarations.iterator(); iterator.hasNext();) { + final String decl = iterator.next(); + final boolean isGLFunction = GLNameResolver.isGLFunction(decl); boolean isGLEnumeration = false; if (!isGLFunction) { isGLEnumeration = GLNameResolver.isGLEnumeration(decl); } if (isGLFunction || isGLEnumeration) { - String renamed = GLNameResolver.normalize(decl, isGLFunction); + final String renamed = GLNameResolver.normalize(decl, isGLFunction); if (!renamed.equals(decl)) { config.addJavaSymbolRename(decl, renamed); } @@ -135,8 +135,8 @@ public class GLEmitter extends ProcAddressEmitter { private List functions; @Override - public void filterSymbols(List constants, - List functions) { + public void filterSymbols(final List constants, + final List functions) { this.constants = constants; this.functions = functions; doWork(); @@ -153,17 +153,17 @@ public class GLEmitter extends ProcAddressEmitter { } private void doWork() { - BuildStaticGLInfo glInfo = getGLConfig().getGLInfo(); + final BuildStaticGLInfo glInfo = getGLConfig().getGLInfo(); if (glInfo == null) { return; } // Try to retain a "good" ordering for these symbols - Map constantMap = new LinkedHashMap(); - for (ConstantDefinition def : constants) { + final Map constantMap = new LinkedHashMap(); + for (final ConstantDefinition def : constants) { constantMap.put(def.getName(), def); } - Map functionMap = new LinkedHashMap(); - for (FunctionSymbol sym : functions) { + final Map functionMap = new LinkedHashMap(); + for (final FunctionSymbol sym : functions) { functionMap.put(sym.getName(), sym); } @@ -175,15 +175,15 @@ public class GLEmitter extends ProcAddressEmitter { // that doesn't support the core version of these APIs, the runtime // will take care of looking up the extension version of these entry // points. - Set extensionNames = glInfo.getExtensions(); + final Set extensionNames = glInfo.getExtensions(); - for (String extension : extensionNames) { - Set declarations = glInfo.getDeclarations(extension); + for (final String extension : extensionNames) { + final Set declarations = glInfo.getDeclarations(extension); boolean isExtension = true; boolean shouldUnify = true; String cause = null; - for (String decl : declarations) { - boolean isFunc = !decl.startsWith("GL_"); + for (final String decl : declarations) { + final boolean isFunc = !decl.startsWith("GL_"); if (!GLNameResolver.isExtension(decl, isFunc)) { isExtension = false; break; @@ -202,7 +202,7 @@ public class GLEmitter extends ProcAddressEmitter { } } cause = decl; - String unifiedName = GLNameResolver.normalize(decl, isFunc); + final String unifiedName = GLNameResolver.normalize(decl, isFunc); // NOTE that we look up the unified name in the // BuildStaticGLInfo's notion of the APIs -- since // we might not be emitting glue code for the @@ -225,8 +225,8 @@ public class GLEmitter extends ProcAddressEmitter { } if (isExtension) { if (shouldUnify) { - for (String decl : declarations) { - boolean isFunc = !decl.startsWith("GL_"); + for (final String decl : declarations) { + final boolean isFunc = !decl.startsWith("GL_"); if (isFunc) { functionMap.remove(decl); } else { @@ -244,7 +244,7 @@ public class GLEmitter extends ProcAddressEmitter { } } - private void unifyExtensions(GlueEmitterControls controls) { + private void unifyExtensions(final GlueEmitterControls controls) { controls.runSymbolFilter(new ExtensionUnifier()); } @@ -264,7 +264,7 @@ public class GLEmitter extends ProcAddressEmitter { inform the CMethodBindingEmitter that it is overloaded in this case (though we default to true currently). */ @Override - protected List expandMethodBinding(MethodBinding binding) { + protected List expandMethodBinding(final MethodBinding binding) { final GLConfiguration glConfig = getGLConfig(); final List bindings = super.expandMethodBinding(binding); @@ -322,7 +322,7 @@ public class GLEmitter extends ProcAddressEmitter { } @Override - protected boolean needsModifiedEmitters(FunctionSymbol sym) { + protected boolean needsModifiedEmitters(final FunctionSymbol sym) { if ((!needsProcAddressWrapper(sym) && !needsBufferObjectVariant(sym)) || getConfig().isUnimplemented(sym.getName())) { return false; @@ -331,22 +331,22 @@ public class GLEmitter extends ProcAddressEmitter { return true; } - public boolean isBufferObjectMethodBinding(MethodBinding binding) { + public boolean isBufferObjectMethodBinding(final MethodBinding binding) { return bufferObjectMethodBindings.containsKey(binding); } @Override - public void emitDefine(ConstantDefinition def, String optionalComment) throws Exception { - BuildStaticGLInfo glInfo = getGLConfig().getGLInfo(); + public void emitDefine(final ConstantDefinition def, final String optionalComment) throws Exception { + final BuildStaticGLInfo glInfo = getGLConfig().getGLInfo(); if (null == glInfo) { throw new Exception("No GLInfo for: " + def); } - String symbolRenamed = def.getName(); - StringBuilder newComment = new StringBuilder(); + final String symbolRenamed = def.getName(); + final StringBuilder newComment = new StringBuilder(); newComment.append("Part of "); if (0 == addExtensionsOfSymbols2Buffer(newComment, ", ", "; ", symbolRenamed, def.getAliasedNames())) { if (def.isEnum()) { - String enumName = def.getEnumName(); + final String enumName = def.getEnumName(); if (null != enumName) { newComment.append(enumName); } else { @@ -362,7 +362,7 @@ public class GLEmitter extends ProcAddressEmitter { // ... // #endif if (JavaConfiguration.DEBUG_IGNORES) { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); JavaEmitter.addStrings2Buffer(sb, ", ", symbolRenamed, def.getAliasedNames()); System.err.println("Dropping marker: " + sb.toString()); } @@ -379,12 +379,12 @@ public class GLEmitter extends ProcAddressEmitter { super.emitDefine(def, newComment.toString()); } - private int addExtensionListOfSymbol2Buffer(BuildStaticGLInfo glInfo, StringBuilder buf, String sep1, String name) { + private int addExtensionListOfSymbol2Buffer(final BuildStaticGLInfo glInfo, final StringBuilder buf, final String sep1, final String name) { int num = 0; - Set extensionNames = glInfo.getExtension(name); + final Set extensionNames = glInfo.getExtension(name); if(null!=extensionNames) { - for(Iterator i=extensionNames.iterator(); i.hasNext(); ) { - String extensionName = i.next(); + for(final Iterator i=extensionNames.iterator(); i.hasNext(); ) { + final String extensionName = i.next(); if (null != extensionName) { buf.append(""); buf.append(extensionName); @@ -398,19 +398,19 @@ public class GLEmitter extends ProcAddressEmitter { } return num; } - private int addExtensionListOfAliasedSymbols2Buffer(BuildStaticGLInfo glInfo, StringBuilder buf, String sep1, String sep2, String name, Collection exclude) { + private int addExtensionListOfAliasedSymbols2Buffer(final BuildStaticGLInfo glInfo, final StringBuilder buf, final String sep1, final String sep2, final String name, final Collection exclude) { int num = 0; if(null != name) { num += addExtensionListOfSymbol2Buffer(glInfo, buf, sep1, name); // extensions of given name boolean needsSep2 = 0 origNames = cfg.getRenamedJavaSymbols(name); + final Set origNames = cfg.getRenamedJavaSymbols(name); if(null != origNames) { - for(String origName : origNames) { + for(final String origName : origNames) { if(!exclude.contains(origName)) { if (needsSep2) { buf.append(sep2); // diff-name seperator } - int num2 = addExtensionListOfSymbol2Buffer(glInfo, buf, sep1, origName); // extensions of orig-name + final int num2 = addExtensionListOfSymbol2Buffer(glInfo, buf, sep1, origName); // extensions of orig-name needsSep2 = num col) { - BuildStaticGLInfo glInfo = getGLConfig().getGLInfo(); + public int addExtensionsOfSymbols2Buffer(StringBuilder buf, final String sep1, final String sep2, final String first, final Collection col) { + final BuildStaticGLInfo glInfo = getGLConfig().getGLInfo(); if (null == glInfo) { throw new RuntimeException("No GLInfo for: " + first); } @@ -432,11 +432,11 @@ public class GLEmitter extends ProcAddressEmitter { num += addExtensionListOfAliasedSymbols2Buffer(glInfo, buf, sep1, sep2, first, col); boolean needsSep2 = 0 iter = col.iterator(); iter.hasNext(); ) { + for(final Iterator iter = col.iterator(); iter.hasNext(); ) { if(needsSep2) { buf.append(sep2); // diff-name seperator } - int num2 = addExtensionListOfAliasedSymbols2Buffer(glInfo, buf, sep1, sep2, iter.next(), col); + final int num2 = addExtensionListOfAliasedSymbols2Buffer(glInfo, buf, sep1, sep2, iter.next(), col); needsSep2 = num emitters) { - List superEmitters = new ArrayList(); + protected void generateModifiedEmitters(final JavaMethodBindingEmitter baseJavaEmitter, final List emitters) { + final List superEmitters = new ArrayList(); super.generateModifiedEmitters(baseJavaEmitter, superEmitters); // See whether this is one of the Buffer Object variants - boolean bufferObjectVariant = bufferObjectMethodBindings.containsKey(baseJavaEmitter.getBinding()); + final boolean bufferObjectVariant = bufferObjectMethodBindings.containsKey(baseJavaEmitter.getBinding()); for (FunctionEmitter emitter : superEmitters) { if (emitter instanceof ProcAddressJavaMethodBindingEmitter) { @@ -462,7 +462,7 @@ public class GLEmitter extends ProcAddressEmitter { } } - protected boolean needsBufferObjectVariant(FunctionSymbol sym) { + protected boolean needsBufferObjectVariant(final FunctionSymbol sym) { return getGLConfig().isBufferObjectFunction(sym.getName()); } @@ -475,7 +475,7 @@ public class GLEmitter extends ProcAddressEmitter { */ @Override protected void endProcAddressTable() throws Exception { - PrintWriter w = tableWriter; + final PrintWriter w = tableWriter; w.println(" @Override"); w.println(" protected boolean isFunctionAvailableImpl(String functionNameUsr) throws IllegalArgumentException {"); diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java index 389d35f99..d491a3712 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/GLJavaMethodBindingEmitter.java @@ -58,8 +58,8 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit protected GLEmitter glEmitter; protected CommentEmitter glCommentEmitter = new GLCommentEmitter(); - public GLJavaMethodBindingEmitter(JavaMethodBindingEmitter methodToWrap, boolean callThroughProcAddress, - String getProcAddressTableExpr, boolean changeNameAndArguments, boolean bufferObjectVariant, GLEmitter emitter) { + public GLJavaMethodBindingEmitter(final JavaMethodBindingEmitter methodToWrap, final boolean callThroughProcAddress, + final String getProcAddressTableExpr, final boolean changeNameAndArguments, final boolean bufferObjectVariant, final GLEmitter emitter) { super(methodToWrap, callThroughProcAddress, getProcAddressTableExpr, changeNameAndArguments, emitter); this.bufferObjectVariant = bufferObjectVariant; @@ -67,20 +67,20 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit setCommentEmitter(glCommentEmitter); } - public GLJavaMethodBindingEmitter(ProcAddressJavaMethodBindingEmitter methodToWrap, GLEmitter emitter, boolean bufferObjectVariant) { + public GLJavaMethodBindingEmitter(final ProcAddressJavaMethodBindingEmitter methodToWrap, final GLEmitter emitter, final boolean bufferObjectVariant) { super(methodToWrap); this.bufferObjectVariant = bufferObjectVariant; this.glEmitter = emitter; setCommentEmitter(glCommentEmitter); } - public GLJavaMethodBindingEmitter(GLJavaMethodBindingEmitter methodToWrap) { + public GLJavaMethodBindingEmitter(final GLJavaMethodBindingEmitter methodToWrap) { this(methodToWrap, methodToWrap.glEmitter, methodToWrap.bufferObjectVariant); } @Override - protected String getArgumentName(int i) { - String name = super.getArgumentName(i); + protected String getArgumentName(final int i) { + final String name = super.getArgumentName(i); if (!bufferObjectVariant) { return name; @@ -89,8 +89,8 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit // Emitters for VBO/PBO-related routines change the outgoing // argument name for the buffer if (binding.getJavaArgumentType(i).isLong()) { - Type cType = binding.getCArgumentType(i); - Type targetType = cType.asPointer().getTargetType(); + final Type cType = binding.getCArgumentType(i); + final Type targetType = cType.asPointer().getTargetType(); if (cType.isPointer() && (targetType.isVoid() || targetType.isPrimitive())) { return name + "_buffer_offset"; } @@ -102,10 +102,10 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit protected class GLCommentEmitter extends JavaMethodBindingEmitter.DefaultCommentEmitter { @Override - protected void emitBindingCSignature(MethodBinding binding, PrintWriter writer) { + protected void emitBindingCSignature(final MethodBinding binding, final PrintWriter writer) { - String symbolRenamed = binding.getName(); - StringBuilder newComment = new StringBuilder(); + final String symbolRenamed = binding.getName(); + final StringBuilder newComment = new StringBuilder(); final FunctionSymbol funcSym = binding.getCSymbol(); writer.print(" "); @@ -117,9 +117,9 @@ public class GLJavaMethodBindingEmitter extends ProcAddressJavaMethodBindingEmit if (glEmitter.getGLConfig().getAllowNonGLExtensions()) { newComment.append("CORE FUNC"); } else { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); JavaEmitter.addStrings2Buffer(sb, ", ", symbolRenamed, binding.getAliasedNames()); - RuntimeException ex = new RuntimeException("Couldn't find extension to: " + binding + " ; " + sb.toString()); + final RuntimeException ex = new RuntimeException("Couldn't find extension to: " + binding + " ; " + sb.toString()); glEmitter.getGLConfig().getGLInfo().dump(); // glEmitter.getGLConfig().dumpRenames(); throw ex; diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/ant/StaticGLGenTask.java b/src/jogl/classes/com/jogamp/gluegen/opengl/ant/StaticGLGenTask.java index 21946ea89..66819a83e 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/ant/StaticGLGenTask.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/ant/StaticGLGenTask.java @@ -78,7 +78,7 @@ public class StaticGLGenTask extends Task *

The {@link org.apache.tools.ant.types.CommandlineJava} that is used * to execute {@link com.jogamp.gluegen.opengl.BuildStaticGLInfo}.

*/ - private CommandlineJava glgenCommandline; + private final CommandlineJava glgenCommandline; // ========================================================================= /** @@ -94,7 +94,7 @@ public class StaticGLGenTask extends Task /** *

The {@link org.apache.tools.ant.types.FileSet} of GL headers.

*/ - private FileSet headerSet = new FileSet(); + private final FileSet headerSet = new FileSet(); // ========================================================================= /** @@ -117,7 +117,7 @@ public class StaticGLGenTask extends Task * * @param packageName the name of the package for the generated files */ - public void setPackage(String packageName) + public void setPackage(final String packageName) { log( ("Setting package name to: " + packageName), Project.MSG_VERBOSE); this.packageName = packageName; @@ -128,7 +128,7 @@ public class StaticGLGenTask extends Task * * @param directory the output directory */ - public void setOutputDir(String directory) + public void setOutputDir(final String directory) { log( ("Setting output directory to: " + directory), Project.MSG_VERBOSE); @@ -163,7 +163,7 @@ public class StaticGLGenTask extends Task * * @param headers the string containing the header patterns */ - public void setHeaders(String headers) + public void setHeaders(final String headers) { headerSet.setIncludes(headers); } @@ -236,7 +236,7 @@ public class StaticGLGenTask extends Task * @return true if the string is valid. false * otherwise. */ - private boolean isValid(String string) + private boolean isValid(final String string) { // check for null if(string == null) @@ -265,8 +265,8 @@ public class StaticGLGenTask extends Task // add the header -files- from the FileSet headerSet.setDir(getProject().getBaseDir()); - DirectoryScanner directoryScanner = headerSet.getDirectoryScanner(getProject()); - String[] directoryFiles = directoryScanner.getIncludedFiles(); + final DirectoryScanner directoryScanner = headerSet.getDirectoryScanner(getProject()); + final String[] directoryFiles = directoryScanner.getIncludedFiles(); for(int i=0; i generateMethodBindingEmitters(Set methodBindingSet, FunctionSymbol sym) throws Exception { + protected List generateMethodBindingEmitters(final Set methodBindingSet, final FunctionSymbol sym) throws Exception { // Allow superclass to do most of the work for us - List res = super.generateMethodBindingEmitters(methodBindingSet, sym); + final List res = super.generateMethodBindingEmitters(methodBindingSet, sym); // Filter out all non-JavaMethodBindingEmitters - for (Iterator iter = res.iterator(); iter.hasNext();) { - FunctionEmitter emitter = iter.next(); + for (final Iterator iter = res.iterator(); iter.hasNext();) { + final FunctionEmitter emitter = iter.next(); if (!(emitter instanceof JavaMethodBindingEmitter)) { iter.remove(); } @@ -78,13 +78,13 @@ public class NativeSignatureEmitter extends GLEmitter { return res; } - PrintWriter writer = (getConfig().allStatic() ? javaWriter() : javaImplWriter()); + final PrintWriter writer = (getConfig().allStatic() ? javaWriter() : javaImplWriter()); - List processed = new ArrayList(); + final List processed = new ArrayList(); // First, filter out all emitters going to the "other" (public) writer - for (Iterator iter = res.iterator(); iter.hasNext();) { - FunctionEmitter emitter = iter.next(); + for (final Iterator iter = res.iterator(); iter.hasNext();) { + final FunctionEmitter emitter = iter.next(); if (emitter.getDefaultOutput() != writer) { processed.add(emitter); iter.remove(); @@ -93,12 +93,12 @@ public class NativeSignatureEmitter extends GLEmitter { // Now process all of the remaining emitters sorted by MethodBinding while (!res.isEmpty()) { - List emittersForBinding = new ArrayList(); - JavaMethodBindingEmitter emitter = (JavaMethodBindingEmitter) res.remove(0); + final List emittersForBinding = new ArrayList(); + final JavaMethodBindingEmitter emitter = (JavaMethodBindingEmitter) res.remove(0); emittersForBinding.add(emitter); - MethodBinding binding = emitter.getBinding(); - for (Iterator iter = res.iterator(); iter.hasNext();) { - JavaMethodBindingEmitter emitter2 = (JavaMethodBindingEmitter) iter.next(); + final MethodBinding binding = emitter.getBinding(); + for (final Iterator iter = res.iterator(); iter.hasNext();) { + final JavaMethodBindingEmitter emitter2 = (JavaMethodBindingEmitter) iter.next(); if (emitter2.getBinding() == binding) { emittersForBinding.add(emitter2); iter.remove(); @@ -111,17 +111,17 @@ public class NativeSignatureEmitter extends GLEmitter { return processed; } - protected void generateNativeSignatureEmitters(MethodBinding binding, List allEmitters) { + protected void generateNativeSignatureEmitters(final MethodBinding binding, final List allEmitters) { if (allEmitters.isEmpty()) { return; } - PrintWriter writer = (getConfig().allStatic() ? javaWriter() : javaImplWriter()); + final PrintWriter writer = (getConfig().allStatic() ? javaWriter() : javaImplWriter()); // Give ourselves the chance to interpose on the generation of all code to keep things simple - List newEmitters = new ArrayList(); - for (JavaMethodBindingEmitter javaEmitter : allEmitters) { + final List newEmitters = new ArrayList(); + for (final JavaMethodBindingEmitter javaEmitter : allEmitters) { NativeSignatureJavaMethodBindingEmitter newEmitter = null; if (javaEmitter instanceof GLJavaMethodBindingEmitter) { newEmitter = new NativeSignatureJavaMethodBindingEmitter((GLJavaMethodBindingEmitter) javaEmitter); @@ -138,11 +138,11 @@ public class NativeSignatureEmitter extends GLEmitter { // been called with signatureOnly both true and false. if (signatureContainsStrings(binding) && !haveEmitterWithBody(allEmitters)) { // This basically handles glGetString but also any similar methods - NativeSignatureJavaMethodBindingEmitter javaEmitter = findEmitterWithWriter(allEmitters, writer); + final NativeSignatureJavaMethodBindingEmitter javaEmitter = findEmitterWithWriter(allEmitters, writer); // First, we need to clone this emitter to produce the native // entry point - NativeSignatureJavaMethodBindingEmitter emitter = new NativeSignatureJavaMethodBindingEmitter(javaEmitter); + final NativeSignatureJavaMethodBindingEmitter emitter = new NativeSignatureJavaMethodBindingEmitter(javaEmitter); emitter.removeModifier(JavaMethodBindingEmitter.PUBLIC); emitter.addModifier(JavaMethodBindingEmitter.PRIVATE); emitter.setForImplementingMethodCall(true); @@ -158,22 +158,22 @@ public class NativeSignatureEmitter extends GLEmitter { } } - protected boolean signatureContainsStrings(MethodBinding binding) { + protected boolean signatureContainsStrings(final MethodBinding binding) { for (int i = 0; i < binding.getNumArguments(); i++) { - JavaType type = binding.getJavaArgumentType(i); + final JavaType type = binding.getJavaArgumentType(i); if (type.isString() || type.isStringArray()) { return true; } } - JavaType retType = binding.getJavaReturnType(); + final JavaType retType = binding.getJavaReturnType(); if (retType.isString() || retType.isStringArray()) { return true; } return false; } - protected boolean haveEmitterWithBody(List allEmitters) { - for (JavaMethodBindingEmitter emitter : allEmitters) { + protected boolean haveEmitterWithBody(final List allEmitters) { + for (final JavaMethodBindingEmitter emitter : allEmitters) { if (!emitter.signatureOnly()) { return true; } @@ -181,9 +181,9 @@ public class NativeSignatureEmitter extends GLEmitter { return false; } - protected NativeSignatureJavaMethodBindingEmitter findEmitterWithWriter(List allEmitters, PrintWriter writer) { - for (JavaMethodBindingEmitter jemitter : allEmitters) { - NativeSignatureJavaMethodBindingEmitter emitter = (NativeSignatureJavaMethodBindingEmitter)jemitter; + protected NativeSignatureJavaMethodBindingEmitter findEmitterWithWriter(final List allEmitters, final PrintWriter writer) { + for (final JavaMethodBindingEmitter jemitter : allEmitters) { + final NativeSignatureJavaMethodBindingEmitter emitter = (NativeSignatureJavaMethodBindingEmitter)jemitter; if (emitter.getDefaultOutput() == writer) { return emitter; } diff --git a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java index 6d9d6f2bb..86080d84f 100644 --- a/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java +++ b/src/jogl/classes/com/jogamp/gluegen/opengl/nativesig/NativeSignatureJavaMethodBindingEmitter.java @@ -53,31 +53,31 @@ import java.io.PrintWriter; /** Review: This Package/Class is not used and subject to be deleted. */ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBindingEmitter { - public NativeSignatureJavaMethodBindingEmitter(GLJavaMethodBindingEmitter methodToWrap) { + public NativeSignatureJavaMethodBindingEmitter(final GLJavaMethodBindingEmitter methodToWrap) { super(methodToWrap); } - public NativeSignatureJavaMethodBindingEmitter(ProcAddressJavaMethodBindingEmitter methodToWrap, GLEmitter emitter, boolean bufferObjectVariant) { + public NativeSignatureJavaMethodBindingEmitter(final ProcAddressJavaMethodBindingEmitter methodToWrap, final GLEmitter emitter, final boolean bufferObjectVariant) { super(methodToWrap, emitter, bufferObjectVariant); } - public NativeSignatureJavaMethodBindingEmitter(JavaMethodBindingEmitter methodToWrap, NativeSignatureEmitter emitter) { + public NativeSignatureJavaMethodBindingEmitter(final JavaMethodBindingEmitter methodToWrap, final NativeSignatureEmitter emitter) { super(methodToWrap, false, null, false, false, emitter); } @Override - protected void emitSignature(PrintWriter writer) { + protected void emitSignature(final PrintWriter writer) { writer.print(getBaseIndentString()); emitNativeSignatureAnnotation(writer); super.emitSignature(writer); } - protected void emitNativeSignatureAnnotation(PrintWriter writer) { + protected void emitNativeSignatureAnnotation(final PrintWriter writer) { if (hasModifier(JavaMethodBindingEmitter.NATIVE)) { // Emit everything as a leaf for now // FIXME: make this configurable writer.print("@NativeSignature(\"l"); - MethodBinding binding = getBinding(); + final MethodBinding binding = getBinding(); if (callThroughProcAddress) { writer.print("p"); } @@ -94,7 +94,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } } - protected void emitNativeSignatureElement(PrintWriter writer, JavaType type, Type cType, int index) { + protected void emitNativeSignatureElement(final PrintWriter writer, final JavaType type, final Type cType, final int index) { if (type.isVoid()) { if (index > 0) { throw new InternalError("Error parsing arguments -- void should not be seen aside from argument 0"); @@ -107,7 +107,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } else if (type.isPrimitiveArray()) { writer.print("MO"); } else if (type.isPrimitive()) { - Class clazz = type.getJavaClass(); + final Class clazz = type.getJavaClass(); if (clazz == Byte.TYPE) { writer.print("B"); } else if (clazz == Character.TYPE) { writer.print("C"); } else if (clazz == Double.TYPE) { writer.print("D"); } @@ -132,9 +132,9 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } @Override - protected String getReturnTypeString(boolean skipArray) { + protected String getReturnTypeString(final boolean skipArray) { if (isForImplementingMethodCall()) { - JavaType returnType = getBinding().getJavaReturnType(); + final JavaType returnType = getBinding().getJavaReturnType(); if (returnType.isString() || returnType.isNIOByteBuffer()) { // Treat these as addresses return "long"; @@ -144,10 +144,10 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } @Override - protected void emitPreCallSetup(MethodBinding binding, PrintWriter writer) { + protected void emitPreCallSetup(final MethodBinding binding, final PrintWriter writer) { super.emitPreCallSetup(binding, writer); for (int i = 0; i < binding.getNumArguments(); i++) { - JavaType type = binding.getJavaArgumentType(i); + final JavaType type = binding.getJavaArgumentType(i); if (type.isNIOBuffer() && !useNIODirectOnly ) { // Emit declarations for variables holding primitive arrays as type Object // We don't know 100% sure we're going to use these at this point in the code, though @@ -160,12 +160,12 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } } - protected String getNIOBufferArrayName(int argNumber) { + protected String getNIOBufferArrayName(final int argNumber) { return "__buffer_array_" + argNumber; } @Override - protected int emitArguments(PrintWriter writer) + protected int emitArguments(final PrintWriter writer) { boolean needComma = false; int numEmitted = 0; @@ -191,7 +191,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } for (int i = 0; i < binding.getNumArguments(); i++) { - JavaType type = binding.getJavaArgumentType(i); + final JavaType type = binding.getJavaArgumentType(i); if (type.isVoid()) { // Make sure this is the only param to the method; if it isn't, // there's something wrong with our parsing of the headers. @@ -246,9 +246,9 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } @Override - protected void emitReturnVariableSetupAndCall(MethodBinding binding, PrintWriter writer) { + protected void emitReturnVariableSetupAndCall(final MethodBinding binding, final PrintWriter writer) { writer.print(" "); - JavaType returnType = binding.getJavaReturnType(); + final JavaType returnType = binding.getJavaReturnType(); boolean needsResultAssignment = false; if (!returnType.isVoid()) { @@ -344,7 +344,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } } - protected int emitCallArguments(MethodBinding binding, PrintWriter writer, boolean direct) { + protected int emitCallArguments(final MethodBinding binding, final PrintWriter writer, final boolean direct) { // Note that we override this completely because we both need to // move the potential location of the outgoing proc address as // well as change the way we pass out Buffers, arrays, Strings, etc. @@ -368,7 +368,7 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding ++numArgsEmitted; } for (int i = 0; i < binding.getNumArguments(); i++) { - JavaType type = binding.getJavaArgumentType(i); + final JavaType type = binding.getJavaArgumentType(i); if (type.isJNIEnv() || binding.isArgumentThisPointer(i)) { // Don't need to expose these at the Java level continue; @@ -460,9 +460,9 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding } @Override - protected void emitCallResultReturn(MethodBinding binding, PrintWriter writer) { + protected void emitCallResultReturn(final MethodBinding binding, final PrintWriter writer) { for (int i = 0; i < binding.getNumArguments(); i++) { - JavaType type = binding.getJavaArgumentType(i); + final JavaType type = binding.getJavaArgumentType(i); if (type.isString()) { writer.println(";"); writer.println(" BuffersInternal.freeCString(" + binding.getArgumentName(i) + "_c_str);"); @@ -475,14 +475,14 @@ public class NativeSignatureJavaMethodBindingEmitter extends GLJavaMethodBinding @Override public String getName() { - String res = super.getName(); + final String res = super.getName(); if (forImplementingMethodCall && bufferObjectVariant) { return res + "BufObj"; } return res; } - protected String getImplMethodName(boolean direct) { + protected String getImplMethodName(final boolean direct) { String name = null; if (direct) { name = binding.getName() + "$0"; diff --git a/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLNameResolver.java b/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLNameResolver.java index 9b57a2f2d..34ab3df9e 100644 --- a/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLNameResolver.java +++ b/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLNameResolver.java @@ -72,19 +72,19 @@ public class GLNameResolver { }; - public static final boolean isGLFunction(String str) { + public static final boolean isGLFunction(final String str) { return str.startsWith("gl") || /* str.startsWith("glu") || str.startsWith("glX") || */ str.startsWith("egl") || str.startsWith("wgl") || str.startsWith("agl") || str.startsWith("cgl") ; } - public static final boolean isGLEnumeration(String str) { + public static final boolean isGLEnumeration(final String str) { return str.startsWith("GL_") || str.startsWith("GLU_") || str.startsWith("GLX_") || str.startsWith("EGL_") || str.startsWith("WGL_") || str.startsWith("AGL_") || str.startsWith("CGL_") ; } - public static final int getExtensionIdx(String[] extensions, String str, boolean isGLFunc) { + public static final int getExtensionIdx(final String[] extensions, final String str, final boolean isGLFunc) { if(isGLFunc) { for(int i = extensions.length - 1 ; i>=0 ; i--) { if( str.endsWith(extensions[i]) ) { @@ -101,11 +101,11 @@ public class GLNameResolver { return -1; } - public static final boolean isExtension(String[] extensions, String str, boolean isGLFunc) { + public static final boolean isExtension(final String[] extensions, final String str, final boolean isGLFunc) { return getExtensionIdx(extensions, str, isGLFunc)>=0; } - public static final String getExtensionSuffix(String str, boolean isGLFunc) { + public static final String getExtensionSuffix(final String str, final boolean isGLFunc) { int idx = getExtensionIdx(extensionsARB, str, isGLFunc); if(idx>=0) { return extensionsARB[idx]; @@ -117,7 +117,7 @@ public class GLNameResolver { return null; } - public static final String normalize(String[] extensions, String str, boolean isGLFunc) { + public static final String normalize(final String[] extensions, String str, final boolean isGLFunc) { boolean touched = false; for(int i = extensions.length - 1 ; !touched && i>=0 ; i--) { if(isGLFunc) { @@ -136,19 +136,19 @@ public class GLNameResolver { } return str; } - public static final String normalizeARB(String str, boolean isGLFunc) { + public static final String normalizeARB(final String str, final boolean isGLFunc) { return normalize(extensionsARB, str, isGLFunc); } - public static final boolean isExtensionARB(String str, boolean isGLFunc) { + public static final boolean isExtensionARB(final String str, final boolean isGLFunc) { return isExtension(extensionsARB, str, isGLFunc); } - public static final String normalizeVEN(String str, boolean isGLFunc) { + public static final String normalizeVEN(final String str, final boolean isGLFunc) { return normalize(extensionsVEN, str, isGLFunc); } - public static final boolean isExtensionVEN(String str, boolean isGLFunc) { + public static final boolean isExtensionVEN(final String str, final boolean isGLFunc) { return isExtension(extensionsVEN, str, isGLFunc); } - public static final String normalize(String str, boolean isGLFunc) { + public static final String normalize(final String str, final boolean isGLFunc) { if (isExtensionARB(str, isGLFunc)) { return normalizeARB(str, isGLFunc); } @@ -157,12 +157,12 @@ public class GLNameResolver { } return str; } - public static final boolean isExtension(String str, boolean isGLFunc) { + public static final boolean isExtension(final String str, final boolean isGLFunc) { return isExtension(extensionsARB, str, isGLFunc) || isExtension(extensionsVEN, str, isGLFunc); } - public static final int getFuncNamePermutationNumber(String name) { + public static final int getFuncNamePermutationNumber(final String name) { if(isExtensionARB(name, true) || isExtensionVEN(name, true)) { // no name permutation, if it's already a known extension return 1; @@ -170,7 +170,7 @@ public class GLNameResolver { return 1 + extensionsARB.length + extensionsVEN.length; } - public static final String getFuncNamePermutation(String name, int i) { + public static final String getFuncNamePermutation(final String name, int i) { // identity if(i==0) { return name; diff --git a/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java b/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java index 3fb315c99..23d4fc3cf 100644 --- a/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java +++ b/src/jogl/classes/com/jogamp/gluegen/runtime/opengl/GLProcAddressResolver.java @@ -43,16 +43,16 @@ public class GLProcAddressResolver implements FunctionAddressResolver { public static final boolean DEBUG = false; @Override - public long resolve(String name, DynamicLookupHelper lookup) { + public long resolve(final String name, final DynamicLookupHelper lookup) { long newProcAddress = 0; - int permutations = GLNameResolver.getFuncNamePermutationNumber(name); + final int permutations = GLNameResolver.getFuncNamePermutationNumber(name); for (int i = 0; 0 == newProcAddress && i < permutations; i++) { - String funcName = GLNameResolver.getFuncNamePermutation(name, i); + final String funcName = GLNameResolver.getFuncNamePermutation(name, i); try { newProcAddress = lookup.dynamicLookupFunction(funcName); - } catch (Exception e) { + } catch (final Exception e) { if (DEBUG) { e.printStackTrace(); } diff --git a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java index d4977669e..939035c69 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java +++ b/src/jogl/classes/com/jogamp/graph/curve/OutlineShape.java @@ -106,7 +106,7 @@ public class OutlineShape implements Comparable { public final int state; - VerticesState(int state){ + VerticesState(final int state){ this.state = state; } } @@ -149,7 +149,7 @@ public class OutlineShape implements Comparable { /** Create a new Outline based Shape */ - public OutlineShape(Vertex.Factory factory) { + public OutlineShape(final Vertex.Factory factory) { this.vertexFactory = factory; this.outlines = new ArrayList(3); this.outlines.add(new Outline()); @@ -235,7 +235,7 @@ public class OutlineShape implements Comparable { * @param outline Outline object to be added * @throws NullPointerException if the {@link Outline} element is null */ - public final void addOutline(Outline outline) throws NullPointerException { + public final void addOutline(final Outline outline) throws NullPointerException { addOutline(outlines.size(), outline); } @@ -251,7 +251,7 @@ public class OutlineShape implements Comparable { * @throws NullPointerException if the {@link Outline} element is null * @throws IndexOutOfBoundsException if position is out of range (position < 0 || position > getOutlineNumber()) */ - public final void addOutline(int position, Outline outline) throws NullPointerException, IndexOutOfBoundsException { + public final void addOutline(final int position, final Outline outline) throws NullPointerException, IndexOutOfBoundsException { if (null == outline) { throw new NullPointerException("outline is null"); } @@ -285,7 +285,7 @@ public class OutlineShape implements Comparable { * @throws NullPointerException if the {@link OutlineShape} is null * @throws IndexOutOfBoundsException if position is out of range (position < 0 || position > getOutlineNumber()) */ - public final void addOutlineShape(OutlineShape outlineShape) throws NullPointerException { + public final void addOutlineShape(final OutlineShape outlineShape) throws NullPointerException { if (null == outlineShape) { throw new NullPointerException("OutlineShape is null"); } @@ -304,7 +304,7 @@ public class OutlineShape implements Comparable { * @throws NullPointerException if the {@link Outline} element is null * @throws IndexOutOfBoundsException if position is out of range (position < 0 || position >= getOutlineNumber()) */ - public final void setOutline(int position, Outline outline) throws NullPointerException, IndexOutOfBoundsException { + public final void setOutline(final int position, final Outline outline) throws NullPointerException, IndexOutOfBoundsException { if (null == outline) { throw new NullPointerException("outline is null"); } @@ -319,7 +319,7 @@ public class OutlineShape implements Comparable { * @param position of the to be removed Outline * @throws IndexOutOfBoundsException if position is out of range (position < 0 || position >= getOutlineNumber()) */ - public final Outline removeOutline(int position) throws IndexOutOfBoundsException { + public final Outline removeOutline(final int position) throws IndexOutOfBoundsException { dirtyBits |= DIRTY_BOUNDS | DIRTY_TRIANGLES | DIRTY_VERTICES; return outlines.remove(position); } @@ -337,7 +337,7 @@ public class OutlineShape implements Comparable { * Returns the {@code Outline} at {@code position} * @throws IndexOutOfBoundsException if position is out of range (position < 0 || position >= getOutlineNumber()) */ - public final Outline getOutline(int position) throws IndexOutOfBoundsException { + public final Outline getOutline(final int position) throws IndexOutOfBoundsException { return outlines.get(position); } @@ -345,7 +345,7 @@ public class OutlineShape implements Comparable { * Adds a vertex to the last open outline to the shape's tail. * @param v the vertex to be added to the OutlineShape */ - public final void addVertex(Vertex v) { + public final void addVertex(final Vertex v) { final Outline lo = getLastOutline(); lo.addVertex(v); if( 0 == ( dirtyBits & DIRTY_BOUNDS ) ) { @@ -360,7 +360,7 @@ public class OutlineShape implements Comparable { * @param position indx at which the vertex will be added * @param v the vertex to be added to the OutlineShape */ - public final void addVertex(int position, Vertex v) { + public final void addVertex(final int position, final Vertex v) { final Outline lo = getLastOutline(); lo.addVertex(position, v); if( 0 == ( dirtyBits & DIRTY_BOUNDS ) ) { @@ -378,7 +378,7 @@ public class OutlineShape implements Comparable { * @param onCurve flag if this vertex is on the final curve or defines a curved region * of the shape around this vertex. */ - public final void addVertex(float x, float y, boolean onCurve) { + public final void addVertex(final float x, final float y, final boolean onCurve) { addVertex(vertexFactory.create(x, y, 0f, onCurve)); } @@ -391,7 +391,7 @@ public class OutlineShape implements Comparable { * @param onCurve flag if this vertex is on the final curve or defines a curved region * of the shape around this vertex. */ - public final void addVertex(float x, float y, float z, boolean onCurve) { + public final void addVertex(final float x, final float y, final float z, final boolean onCurve) { addVertex(vertexFactory.create(x, y, z, onCurve)); } @@ -407,7 +407,7 @@ public class OutlineShape implements Comparable { * @param onCurve flag if this vertex is on the final curve or defines a curved region * of the shape around this vertex. */ - public final void addVertex(float[] coordsBuffer, int offset, int length, boolean onCurve) { + public final void addVertex(final float[] coordsBuffer, final int offset, final int length, final boolean onCurve) { addVertex(vertexFactory.create(coordsBuffer, offset, length, onCurve)); } @@ -421,7 +421,7 @@ public class OutlineShape implements Comparable { * @param closeTail if true, a clone of the first vertex will be appended, * otherwise a clone of the last vertex will be prepended. */ - public final void closeLastOutline(boolean closeTail) { + public final void closeLastOutline(final boolean closeTail) { if( getLastOutline().setClosed(true) ) { dirtyBits |= DIRTY_TRIANGLES | DIRTY_VERTICES; } @@ -443,7 +443,7 @@ public class OutlineShape implements Comparable { // checkPossibleOverlaps = false; } - private void subdivideTriangle(final Outline outline, Vertex a, Vertex b, Vertex c, int index){ + private void subdivideTriangle(final Outline outline, final Vertex a, final Vertex b, final Vertex c, final int index){ VectorUtil.midVec3(tmpV1, a.getCoord(), b.getCoord()); VectorUtil.midVec3(tmpV3, b.getCoord(), c.getCoord()); VectorUtil.midVec3(tmpV2, tmpV1, tmpV3); @@ -516,7 +516,7 @@ public class OutlineShape implements Comparable { final int count = getOutlineNumber(); for (int cc = 0; cc < count; cc++) { final Outline outline = getOutline(cc); - int vertexCount = outline.getVertexCount(); + final int vertexCount = outline.getVertexCount(); for(int i=0; i < vertexCount; i++) { final Vertex current = outline.getVertex(i); if(current.isOnCurve() || current == a || current == b || current == c) { @@ -549,7 +549,7 @@ public class OutlineShape implements Comparable { final int count = getOutlineNumber(); for (int cc = 0; cc < count; cc++) { final Outline outline = getOutline(cc); - int vertexCount = outline.getVertexCount(); + final int vertexCount = outline.getVertexCount(); for(int i=0; i < vertexCount; i++) { final Vertex current = outline.getVertex(i); if(current.isOnCurve() || current == a || current == b || current == c) { @@ -679,7 +679,7 @@ public class OutlineShape implements Comparable { * @return an arraylist of triangles representing the filled region * which is produced by the combination of the outlines */ - public ArrayList getTriangles(VerticesState destinationType) { + public ArrayList getTriangles(final VerticesState destinationType) { final boolean updated; if(destinationType != VerticesState.QUADRATIC_NURBS) { throw new IllegalStateException("destinationType "+destinationType.name()+" not supported (currently "+outlineState.name()+")"); @@ -724,7 +724,7 @@ public class OutlineShape implements Comparable { private static Comparator reversSizeComparator = new Comparator() { @Override - public int compare(Outline o1, Outline o2) { + public int compare(final Outline o1, final Outline o2) { return o2.compareTo(o1); // reverse ! } }; @@ -767,7 +767,7 @@ public class OutlineShape implements Comparable { * same outlineState, equal bounds and equal outlines in the same order */ @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if( obj == this) { return true; } diff --git a/src/jogl/classes/com/jogamp/graph/curve/Region.java b/src/jogl/classes/com/jogamp/graph/curve/Region.java index e101be33f..350e3ef41 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/Region.java +++ b/src/jogl/classes/com/jogamp/graph/curve/Region.java @@ -115,15 +115,15 @@ public abstract class Region { protected final AABBox box = new AABBox(); protected Frustum frustum = null; - public static boolean isVBAA(int renderModes) { + public static boolean isVBAA(final int renderModes) { return 0 != (renderModes & Region.VBAA_RENDERING_BIT); } - public static boolean isMSAA(int renderModes) { + public static boolean isMSAA(final int renderModes) { return 0 != (renderModes & Region.MSAA_RENDERING_BIT); } - public static boolean isTwoPass(int renderModes) { + public static boolean isTwoPass(final int renderModes) { return 0 != ( renderModes & ( Region.VBAA_RENDERING_BIT | Region.MSAA_RENDERING_BIT) ); } @@ -132,7 +132,7 @@ public abstract class Region { * i.e. the bit {@link #VARWEIGHT_RENDERING_BIT} is set, * otherwise false. */ - public static boolean hasVariableWeight(int renderModes) { + public static boolean hasVariableWeight(final int renderModes) { return 0 != (renderModes & Region.VARWEIGHT_RENDERING_BIT); } @@ -141,7 +141,7 @@ public abstract class Region { * i.e. the bit {@link #COLORCHANNEL_RENDERING_BIT} is set, * otherwise false. */ - public static boolean hasColorChannel(int renderModes) { + public static boolean hasColorChannel(final int renderModes) { return 0 != (renderModes & Region.COLORCHANNEL_RENDERING_BIT); } @@ -150,11 +150,11 @@ public abstract class Region { * i.e. the bit {@link #COLORTEXTURE_RENDERING_BIT} is set, * otherwise false. */ - public static boolean hasColorTexture(int renderModes) { + public static boolean hasColorTexture(final int renderModes) { return 0 != (renderModes & Region.COLORTEXTURE_RENDERING_BIT); } - public static String getRenderModeString(int renderModes) { + public static String getRenderModeString(final int renderModes) { final String curveS = hasVariableWeight(renderModes) ? "-curve" : ""; final String cChanS = hasColorChannel(renderModes) ? "-cols" : ""; final String cTexS = hasColorTexture(renderModes) ? "-ctex" : ""; @@ -167,7 +167,7 @@ public abstract class Region { } } - protected Region(int regionRenderModes) { + protected Region(final int regionRenderModes) { this.renderModes = regionRenderModes; this.quality = MAX_QUALITY; } @@ -187,7 +187,7 @@ public abstract class Region { public final int getQuality() { return quality; } /** See {@link #MAX_QUALITY} */ - public final void setQuality(int q) { quality=q; } + public final void setQuality(final int q) { quality=q; } protected void clearImpl() { dirty = DIRTY_SHAPE | DIRTY_STATE; @@ -241,13 +241,13 @@ public abstract class Region { /** * Set {@link Frustum} culling for {@link #addOutlineShape(OutlineShape, AffineTransform, float[])}. */ - public final void setFrustum(Frustum frustum) { + public final void setFrustum(final Frustum frustum) { this.frustum = frustum; } final float[] coordsEx = new float[3]; - private void pushNewVertexImpl(final Vertex vertIn, final AffineTransform transform, float[] rgba) { + private void pushNewVertexImpl(final Vertex vertIn, final AffineTransform transform, final float[] rgba) { if( null != transform ) { final float[] coordsIn = vertIn.getCoord(); transform.transform(coordsIn, coordsEx); @@ -261,7 +261,7 @@ public abstract class Region { numVertices++; } - private void pushNewVertexIdxImpl(final Vertex vertIn, final AffineTransform transform, float[] rgba) { + private void pushNewVertexIdxImpl(final Vertex vertIn, final AffineTransform transform, final float[] rgba) { pushIndex(numVertices); pushNewVertexImpl(vertIn, transform, rgba); } @@ -308,7 +308,7 @@ public abstract class Region { final int idxOffset = numVertices; int vertsVNewIdxCount = 0, vertsTMovIdxCount = 0, vertsTNewIdxCount = 0, tris = 0; - int vertsDupCountV = 0, vertsDupCountT = 0, vertsKnownMovedT = 0; + final int vertsDupCountV = 0, vertsDupCountT = 0, vertsKnownMovedT = 0; if( vertsIn.size() >= 3 ) { if(DEBUG_INSTANCE) { System.err.println("Region.addOutlineShape(): Processing Vertices"); @@ -399,7 +399,7 @@ public abstract class Region { /** * See {@link #markShapeDirty()} and {@link #markStateDirty()}. */ - protected final void clearDirtyBits(int v) { + protected final void clearDirtyBits(final int v) { dirty &= ~v; } protected final int getDirtyBits() { return dirty; } diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java index 568b8ddac..8f3a10d9d 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/GLRegion.java @@ -75,7 +75,7 @@ public abstract class GLRegion extends Region { protected final TextureSequence colorTexSeq; - protected GLRegion(int renderModes, TextureSequence colorTexSeq) { + protected GLRegion(final int renderModes, final TextureSequence colorTexSeq) { super(renderModes); this.colorTexSeq = colorTexSeq; } @@ -103,7 +103,7 @@ public abstract class GLRegion extends Region { /** * Delete and clear the associated OGL objects. */ - public final void destroy(GL2ES2 gl) { + public final void destroy(final GL2ES2 gl) { clear(gl); destroyImpl(gl); } diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java index 754eb56e8..9a175c030 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RegionRenderer.java @@ -207,7 +207,7 @@ public class RegionRenderer { initialized = true; } - public final void destroy(GL2ES2 gl) { + public final void destroy(final GL2ES2 gl) { if(!initialized){ if(DEBUG_INSTANCE) { System.err.println("TextRenderer: Not initialized!"); @@ -234,7 +234,7 @@ public class RegionRenderer { *

* @see #create(RenderState, GLCallback, GLCallback) */ - public final void enable(GL2ES2 gl, boolean enable) { + public final void enable(final GL2ES2 gl, final boolean enable) { if( enable ) { if( null != enableCallback ) { enableCallback.run(gl, this); @@ -253,12 +253,12 @@ public class RegionRenderer { } /** No PMVMatrix operation is performed here. PMVMatrix is marked dirty. */ - public final void reshapeNotify(int width, int height) { + public final void reshapeNotify(final int width, final int height) { this.vp_width = width; this.vp_height = height; } - public final void reshapePerspective(float angle, int width, int height, float near, float far) { + public final void reshapePerspective(final float angle, final int width, final int height, final float near, final float far) { this.vp_width = width; this.vp_height = height; final float ratio = (float)width/(float)height; @@ -268,7 +268,7 @@ public class RegionRenderer { p.gluPerspective(angle, ratio, near, far); } - public final void reshapeOrtho(int width, int height, float near, float far) { + public final void reshapeOrtho(final int width, final int height, final float near, final float far) { this.vp_width = width; this.vp_height = height; final PMVMatrix p = rs.getMatrix(); @@ -298,7 +298,7 @@ public class RegionRenderer { // FIXME: Really required to have sampler2D def. precision ? If not, we can drop getFragmentShaderPrecision(..) and use default ShaderCode .. private static final String es2_precision_fp = "\nprecision mediump float;\nprecision mediump int;\nprecision mediump sampler2D;\n"; - private final String getFragmentShaderPrecision(GL2ES2 gl) { + private final String getFragmentShaderPrecision(final GL2ES2 gl) { if( gl.isGLES() ) { return es2_precision_fp; } @@ -489,7 +489,7 @@ public class RegionRenderer { try { posFp = rsFp.insertShaderSource(0, posFp, AttributeNames.class, "uniforms.glsl"); posFp = rsFp.insertShaderSource(0, posFp, AttributeNames.class, "varyings.glsl"); - } catch (IOException ioe) { + } catch (final IOException ioe) { throw new RuntimeException("Failed to read: includes", ioe); } if( 0 > posFp ) { @@ -514,7 +514,7 @@ public class RegionRenderer { } try { posFp = rsFp.insertShaderSource(0, posFp, AttributeNames.class, shaderSegment); - } catch (IOException ioe) { + } catch (final IOException ioe) { throw new RuntimeException("Failed to read: "+shaderSegment, ioe); } if( 0 > posFp ) { diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java index f991855c0..6ff9bf9cd 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/RenderState.java @@ -34,6 +34,7 @@ import javax.media.opengl.GL2ES2; import javax.media.opengl.GLException; import javax.media.opengl.GLUniformData; +import jogamp.common.os.PlatformPropsImpl; import jogamp.graph.curve.opengl.shader.UniformNames; import com.jogamp.common.os.Platform; @@ -64,7 +65,7 @@ public class RenderState { *

*/ public static final int BITHINT_BLENDING_ENABLED = 1 << 0 ; - + /** * Bitfield hint, {@link #isHintMaskSet(int) if set} * stating globally enabled {@link GL#GL_DEPTH_TEST}, otherwise disabled. @@ -81,15 +82,15 @@ public class RenderState { */ public static final int BITHINT_GLOBAL_DEPTH_TEST_ENABLED = 1 << 1 ; - public static RenderState createRenderState(Vertex.Factory pointFactory) { + public static RenderState createRenderState(final Vertex.Factory pointFactory) { return new RenderState(pointFactory, null); } - public static RenderState createRenderState(Vertex.Factory pointFactory, PMVMatrix pmvMatrix) { + public static RenderState createRenderState(final Vertex.Factory pointFactory, final PMVMatrix pmvMatrix) { return new RenderState(pointFactory, pmvMatrix); } - public static final RenderState getRenderState(GL2ES2 gl) { + public static final RenderState getRenderState(final GL2ES2 gl) { return (RenderState) gl.getContext().getAttachedObject(thisKey); } @@ -167,13 +168,13 @@ public class RenderState { return res; } - public StringBuilder toString(StringBuilder sb, boolean alsoUnlocated) { + public StringBuilder toString(StringBuilder sb, final boolean alsoUnlocated) { if(null==sb) { sb = new StringBuilder(); } - sb.append("ProgramLocal[rsID ").append(rsId).append(Platform.NEWLINE); + sb.append("ProgramLocal[rsID ").append(rsId).append(PlatformPropsImpl.NEWLINE); // pmvMatrix.toString(sb, "%.2f"); - sb.append(gcu_PMVMatrix01).append(", ").append(Platform.NEWLINE); + sb.append(gcu_PMVMatrix01).append(", ").append(PlatformPropsImpl.NEWLINE); sb.append(gcu_ColorStatic).append(", "); sb.append(gcu_Weight).append("]"); return sb; @@ -185,7 +186,7 @@ public class RenderState { } } - protected RenderState(Vertex.Factory vertexFactory, PMVMatrix pmvMatrix) { + protected RenderState(final Vertex.Factory vertexFactory, final PMVMatrix pmvMatrix) { this.id = getNextID(); this.sp = null; this.vertexFactory = vertexFactory; @@ -226,11 +227,11 @@ public class RenderState { public final PMVMatrix getMatrix() { return pmvMatrix; } - public static boolean isWeightValid(float v) { + public static boolean isWeightValid(final float v) { return 0.0f <= v && v <= 1.9f ; } public final float getWeight() { return weight[0]; } - public final void setWeight(float v) { + public final void setWeight(final float v) { if( !isWeightValid(v) ) { throw new IllegalArgumentException("Weight out of range"); } @@ -238,11 +239,11 @@ public class RenderState { } - public final float[] getColorStatic(float[] rgbaColor) { + public final float[] getColorStatic(final float[] rgbaColor) { System.arraycopy(colorStatic, 0, rgbaColor, 0, 4); return rgbaColor; } - public final void setColorStatic(float r, float g, float b, float a){ + public final void setColorStatic(final float r, final float g, final float b, final float a){ colorStatic[0] = r; colorStatic[1] = g; colorStatic[2] = b; @@ -301,7 +302,7 @@ public class RenderState { * @param throwOnError TODO * @return true if no error occured, i.e. all locations found, otherwise false. */ - public final boolean updateAttributeLoc(final GL2ES2 gl, final boolean updateLocation, final GLArrayDataServer data, boolean throwOnError) { + public final boolean updateAttributeLoc(final GL2ES2 gl, final boolean updateLocation, final GLArrayDataServer data, final boolean throwOnError) { if( updateLocation || 0 > data.getLocation() ) { final boolean ok = 0 <= data.setLocation(gl, sp.program()); if( throwOnError && !ok ) { @@ -314,29 +315,29 @@ public class RenderState { } - public final boolean isHintMaskSet(int mask) { + public final boolean isHintMaskSet(final int mask) { return mask == ( hintBitfield & mask ); } - public final void setHintMask(int mask) { + public final void setHintMask(final int mask) { hintBitfield |= mask; } - public final void clearHintMask(int mask) { + public final void clearHintMask(final int mask) { hintBitfield &= ~mask; } - public void destroy(GL2ES2 gl) { + public void destroy(final GL2ES2 gl) { if( null != sp ) { sp.destroy(gl); sp = null; } } - public final RenderState attachTo(GL2ES2 gl) { + public final RenderState attachTo(final GL2ES2 gl) { return (RenderState) gl.getContext().attachObject(thisKey, this); } - public final boolean detachFrom(GL2ES2 gl) { - RenderState _rs = (RenderState) gl.getContext().getAttachedObject(thisKey); + public final boolean detachFrom(final GL2ES2 gl) { + final RenderState _rs = (RenderState) gl.getContext().getAttachedObject(thisKey); if(_rs == this) { gl.getContext().detachObject(thisKey); return true; diff --git a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java index aadbecc91..0fa1f49f1 100644 --- a/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java +++ b/src/jogl/classes/com/jogamp/graph/curve/opengl/TextRegionUtil.java @@ -88,7 +88,7 @@ public class TextRegionUtil { */ public static void processString(final ShapeVisitor visitor, final AffineTransform transform, final Font font, final float pixelSize, final CharSequence str, - final AffineTransform temp1, AffineTransform temp2) { + final AffineTransform temp1, final AffineTransform temp2) { final int charCount = str.length(); // region.setFlipped(true); @@ -248,7 +248,7 @@ public class TextRegionUtil { /** * Clear all cached {@link GLRegions}. */ - public void clear(GL2ES2 gl) { + public void clear(final GL2ES2 gl) { // fluchCache(gl) already called final Iterator iterator = stringCacheMap.values().iterator(); while(iterator.hasNext()){ @@ -269,7 +269,7 @@ public class TextRegionUtil { * * @see #DEFAULT_CACHE_LIMIT */ - public final void setCacheLimit(int newLimit ) { stringCacheLimit = newLimit; } + public final void setCacheLimit(final int newLimit ) { stringCacheLimit = newLimit; } /** * Sets the cache limit, see {@link #setCacheLimit(int)} and validates the cache. @@ -279,7 +279,7 @@ public class TextRegionUtil { * @param gl current GL used to remove cached objects if required * @param newLimit new cache size */ - public final void setCacheLimit(GL2ES2 gl, int newLimit ) { stringCacheLimit = newLimit; validateCache(gl, 0); } + public final void setCacheLimit(final GL2ES2 gl, final int newLimit ) { stringCacheLimit = newLimit; validateCache(gl, 0); } /** * @return the current cache limit @@ -291,7 +291,7 @@ public class TextRegionUtil { */ public final int getCacheSize() { return stringCacheArray.size(); } - protected final void validateCache(GL2ES2 gl, int space) { + protected final void validateCache(final GL2ES2 gl, final int space) { if ( getCacheLimit() > 0 ) { while ( getCacheSize() + space > getCacheLimit() ) { removeCachedRegion(gl, 0); @@ -299,11 +299,11 @@ public class TextRegionUtil { } } - protected final GLRegion getCachedRegion(Font font, CharSequence str, float pixelSize, int special) { + protected final GLRegion getCachedRegion(final Font font, final CharSequence str, final float pixelSize, final int special) { return stringCacheMap.get(getKey(font, str, pixelSize, special)); } - protected final void addCachedRegion(GL2ES2 gl, Font font, CharSequence str, float pixelSize, int special, GLRegion glyphString) { + protected final void addCachedRegion(final GL2ES2 gl, final Font font, final CharSequence str, final float pixelSize, final int special, final GLRegion glyphString) { if ( 0 != getCacheLimit() ) { final String key = getKey(font, str, pixelSize, special); final GLRegion oldRegion = stringCacheMap.put(key, glyphString); @@ -315,7 +315,7 @@ public class TextRegionUtil { } } - protected final void removeCachedRegion(GL2ES2 gl, Font font, CharSequence str, int pixelSize, int special) { + protected final void removeCachedRegion(final GL2ES2 gl, final Font font, final CharSequence str, final int pixelSize, final int special) { final String key = getKey(font, str, pixelSize, special); final GLRegion region = stringCacheMap.remove(key); if(null != region) { @@ -324,7 +324,7 @@ public class TextRegionUtil { stringCacheArray.remove(key); } - protected final void removeCachedRegion(GL2ES2 gl, int idx) { + protected final void removeCachedRegion(final GL2ES2 gl, final int idx) { final String key = stringCacheArray.remove(idx); if( null != key ) { final GLRegion region = stringCacheMap.remove(key); @@ -334,7 +334,7 @@ public class TextRegionUtil { } } - protected final String getKey(Font font, CharSequence str, float pixelSize, int special) { + protected final String getKey(final Font font, final CharSequence str, final float pixelSize, final int special) { final StringBuilder sb = new StringBuilder(); return font.getName(sb, Font.NAME_UNIQUNAME) .append(".").append(str.hashCode()).append(".").append(Float.floatToIntBits(pixelSize)).append(special).toString(); diff --git a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java index 948600a4a..db775e8dc 100644 --- a/src/jogl/classes/com/jogamp/graph/font/FontFactory.java +++ b/src/jogl/classes/com/jogamp/graph/font/FontFactory.java @@ -78,7 +78,7 @@ public class FontFactory { return get(UBUNTU); } - public static final FontSet get(int font) { + public static final FontSet get(final int font) { switch (font) { case JAVA: return JavaFontLoader.get(); @@ -87,7 +87,7 @@ public class FontFactory { } } - public static final Font get(File file) throws IOException { + public static final Font get(final File file) throws IOException { return fontConstr.create(file); } @@ -101,7 +101,7 @@ public class FontFactory { try { final URI uri = TempJarCache.getResource(fname); conn = null != uri ? uri.toURL().openConnection() : null; - } catch (Exception e) { + } catch (final Exception e) { throw new IOException(e); } } else { @@ -113,7 +113,7 @@ public class FontFactory { return null; } - public static boolean isPrintableChar( char c ) { + public static boolean isPrintableChar( final char c ) { if( Character.isWhitespace(c) ) { return true; } diff --git a/src/jogl/classes/com/jogamp/graph/geom/Outline.java b/src/jogl/classes/com/jogamp/graph/geom/Outline.java index 15a45b056..ea2059165 100644 --- a/src/jogl/classes/com/jogamp/graph/geom/Outline.java +++ b/src/jogl/classes/com/jogamp/graph/geom/Outline.java @@ -87,7 +87,7 @@ public class Outline implements Comparable { * @param vertex Vertex to be added * @throws NullPointerException if the {@link Vertex} element is null */ - public final void addVertex(Vertex vertex) throws NullPointerException { + public final void addVertex(final Vertex vertex) throws NullPointerException { addVertex(vertices.size(), vertex); } @@ -98,7 +98,7 @@ public class Outline implements Comparable { * @throws NullPointerException if the {@link Vertex} element is null * @throws IndexOutOfBoundsException if position is out of range (position < 0 || position > getVertexNumber()) */ - public final void addVertex(int position, Vertex vertex) throws NullPointerException, IndexOutOfBoundsException { + public final void addVertex(final int position, final Vertex vertex) throws NullPointerException, IndexOutOfBoundsException { if (null == vertex) { throw new NullPointerException("vertex is null"); } @@ -116,7 +116,7 @@ public class Outline implements Comparable { * @throws NullPointerException if the {@link Outline} element is null * @throws IndexOutOfBoundsException if position is out of range (position < 0 || position >= getVertexNumber()) */ - public final void setVertex(int position, Vertex vertex) throws NullPointerException, IndexOutOfBoundsException { + public final void setVertex(final int position, final Vertex vertex) throws NullPointerException, IndexOutOfBoundsException { if (null == vertex) { throw new NullPointerException("vertex is null"); } @@ -124,11 +124,11 @@ public class Outline implements Comparable { dirtyBBox = true; } - public final Vertex getVertex(int index){ + public final Vertex getVertex(final int index){ return vertices.get(index); } - public int getVertexIndex(Vertex vertex){ + public int getVertexIndex(final Vertex vertex){ return vertices.indexOf(vertex); } @@ -138,7 +138,7 @@ public class Outline implements Comparable { * @param position of the to be removed Vertex * @throws IndexOutOfBoundsException if position is out of range (position < 0 || position >= getVertexNumber()) */ - public final Vertex removeVertex(int position) throws IndexOutOfBoundsException { + public final Vertex removeVertex(final int position) throws IndexOutOfBoundsException { dirtyBBox = true; return vertices.remove(position); } @@ -164,7 +164,7 @@ public class Outline implements Comparable { * * @param vertices the new outline loop/strip */ - public final void setVertices(ArrayList vertices) { + public final void setVertices(final ArrayList vertices) { this.vertices = vertices; validateBoundingBox(); } @@ -184,7 +184,7 @@ public class Outline implements Comparable { * otherwise a clone of the last vertex will be prepended. * @return true if closing performed, otherwise false for NOP */ - public final boolean setClosed(boolean closeTail) { + public final boolean setClosed(final boolean closeTail) { this.closed = true; if( !isEmpty() ) { final Vertex first = vertices.get(0); @@ -253,7 +253,7 @@ public class Outline implements Comparable { * @return true if {@code obj} is an Outline, not null, equals bounds and equal vertices in the same order */ @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if( obj == this) { return true; } diff --git a/src/jogl/classes/com/jogamp/graph/geom/SVertex.java b/src/jogl/classes/com/jogamp/graph/geom/SVertex.java index 579f92455..8df8fbb31 100644 --- a/src/jogl/classes/com/jogamp/graph/geom/SVertex.java +++ b/src/jogl/classes/com/jogamp/graph/geom/SVertex.java @@ -65,7 +65,7 @@ public class SVertex implements Vertex { } @Override - public SVertex create(float[] coordsBuffer, int offset, int length, boolean onCurve) { + public SVertex create(final float[] coordsBuffer, final int offset, final int length, final boolean onCurve) { return new SVertex(coordsBuffer, offset, length, onCurve); } } @@ -100,14 +100,14 @@ public class SVertex implements Vertex { } @Override - public final void setCoord(float x, float y, float z) { + public final void setCoord(final float x, final float y, final float z) { coord[0] = x; coord[1] = y; coord[2] = z; } @Override - public final void setCoord(float[] coordsBuffer, int offset, int length) { + public final void setCoord(final float[] coordsBuffer, final int offset, final int length) { System.arraycopy(coordsBuffer, offset, coord, 0, length); } @@ -122,17 +122,17 @@ public class SVertex implements Vertex { } @Override - public final void setX(float x) { + public final void setX(final float x) { this.coord[0] = x; } @Override - public final void setY(float y) { + public final void setY(final float y) { this.coord[1] = y; } @Override - public final void setZ(float z) { + public final void setZ(final float z) { this.coord[2] = z; } @@ -157,7 +157,7 @@ public class SVertex implements Vertex { } @Override - public final void setOnCurve(boolean onCurve) { + public final void setOnCurve(final boolean onCurve) { this.onCurve = onCurve; } @@ -167,12 +167,12 @@ public class SVertex implements Vertex { } @Override - public final void setId(int id){ + public final void setId(final int id){ this.id = id; } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if( obj == this) { return true; } @@ -192,14 +192,14 @@ public class SVertex implements Vertex { } @Override - public final void setTexCoord(float s, float t, float p) { + public final void setTexCoord(final float s, final float t, final float p) { texCoord[0] = s; texCoord[1] = t; texCoord[2] = p; } @Override - public final void setTexCoord(float[] texCoordsBuffer, int offset, int length) { + public final void setTexCoord(final float[] texCoordsBuffer, final int offset, final int length) { System.arraycopy(texCoordsBuffer, offset, texCoord, 0, length); } diff --git a/src/jogl/classes/com/jogamp/graph/geom/Triangle.java b/src/jogl/classes/com/jogamp/graph/geom/Triangle.java index 33e53f3ed..fc345f2a7 100644 --- a/src/jogl/classes/com/jogamp/graph/geom/Triangle.java +++ b/src/jogl/classes/com/jogamp/graph/geom/Triangle.java @@ -93,7 +93,7 @@ public class Triangle { return id; } - public void setId(int id) { + public void setId(final int id) { this.id = id; } @@ -118,7 +118,7 @@ public class Triangle { return boundaryVertices; } - public void setVerticesBoundary(boolean[] boundaryVertices) { + public void setVerticesBoundary(final boolean[] boundaryVertices) { this.boundaryVertices = boundaryVertices; } diff --git a/src/jogl/classes/com/jogamp/opengl/FBObject.java b/src/jogl/classes/com/jogamp/opengl/FBObject.java index a9b54097f..e765d2d52 100644 --- a/src/jogl/classes/com/jogamp/opengl/FBObject.java +++ b/src/jogl/classes/com/jogamp/opengl/FBObject.java @@ -101,7 +101,7 @@ public class FBObject { * Returns {@link #COLOR}, {@link #DEPTH}, {@link #STENCIL} or {@link #DEPTH_STENCIL} * @throws IllegalArgumentException if format cannot be handled. */ - public static Type determine(int format) throws IllegalArgumentException { + public static Type determine(final int format) throws IllegalArgumentException { switch(format) { case GL.GL_RGBA4: case GL.GL_RGB5_A1: @@ -135,7 +135,7 @@ public class FBObject { private int name; - protected Attachment(Type type, int iFormat, int width, int height, int name) { + protected Attachment(final Type type, final int iFormat, final int width, final int height, final int name) { this.type = type; this.format = iFormat; this.width = width; @@ -148,7 +148,7 @@ public class FBObject { * @param caps the destination for format bits * @param rgba8Avail whether rgba8 is available */ - public final void formatToGLCapabilities(GLCapabilities caps, boolean rgba8Avail) { + public final void formatToGLCapabilities(final GLCapabilities caps, final boolean rgba8Avail) { final int _format; switch(format) { case GL.GL_RGBA: @@ -224,11 +224,11 @@ public class FBObject { public final int getWidth() { return width; } /** height of attachment */ public final int getHeight() { return height; } - /* pp */ final void setSize(int w, int h) { width = w; height = h; } + /* pp */ final void setSize(final int w, final int h) { width = w; height = h; } /** buffer name [1..max], maybe a texture or renderbuffer name, depending on type. */ public final int getName() { return name; } - /* pp */ final void setName(int n) { name = n; } + /* pp */ final void setName(final int n) { name = n; } /** * Initializes the attachment and set it's parameter, if uninitialized, i.e. name is zero. @@ -263,7 +263,7 @@ public class FBObject { * {@inheritDoc} */ @Override - public boolean equals(Object o) { + public boolean equals(final Object o) { if( this == o ) return true; if( ! ( o instanceof Attachment ) ) return false; final Attachment a = (Attachment)o; @@ -299,7 +299,7 @@ public class FBObject { "; name "+toHexString(name)+", obj "+toHexString(objectHashCode())+"]"; } - public static Type getType(int attachmentPoint, int maxColorAttachments) { + public static Type getType(final int attachmentPoint, final int maxColorAttachments) { if( GL.GL_COLOR_ATTACHMENT0 <= attachmentPoint && attachmentPoint < GL.GL_COLOR_ATTACHMENT0+maxColorAttachments ) { return Type.COLOR; } @@ -326,16 +326,16 @@ public class FBObject { * @param height * @param name */ - public RenderAttachment(Type type, int iFormat, int samples, int width, int height, int name) { + public RenderAttachment(final Type type, final int iFormat, final int samples, final int width, final int height, final int name) { super(validateType(type), iFormat, width, height, name); this.samples = samples; } /** number of samples, or zero for no multisampling */ public final int getSamples() { return samples; } - /* pp */ final void setSamples(int s) { samples = s; } + /* pp */ final void setSamples(final int s) { samples = s; } - private static Type validateType(Type type) { + private static Type validateType(final Type type) { switch(type) { case DEPTH_STENCIL: case DEPTH: @@ -354,7 +354,7 @@ public class FBObject { * {@inheritDoc} */ @Override - public boolean equals(Object o) { + public boolean equals(final Object o) { if( this == o ) return true; if( ! ( o instanceof RenderAttachment ) ) return false; return super.equals(o) && @@ -376,7 +376,7 @@ public class FBObject { } @Override - public boolean initialize(GL gl) throws GLException { + public boolean initialize(final GL gl) throws GLException { final boolean init = 0 == getName(); if( init ) { checkPreGLError(gl); @@ -405,7 +405,7 @@ public class FBObject { } @Override - public void free(GL gl) { + public void free(final GL gl) { final int[] name = new int[] { getName() }; if( 0 != name[0] ) { if(DEBUG) { @@ -425,7 +425,7 @@ public class FBObject { /** Color render buffer attachment */ public static class ColorAttachment extends RenderAttachment implements Colorbuffer { - public ColorAttachment(int iFormat, int samples, int width, int height, int name) { + public ColorAttachment(final int iFormat, final int samples, final int width, final int height, final int name) { super(Type.COLOR, iFormat, samples, width, height, name); } } @@ -448,8 +448,8 @@ public class FBObject { * @param wrapT * @param name */ - public TextureAttachment(Type type, int iFormat, int width, int height, int dataFormat, int dataType, - int magFilter, int minFilter, int wrapS, int wrapT, int name) { + public TextureAttachment(final Type type, final int iFormat, final int width, final int height, final int dataFormat, final int dataType, + final int magFilter, final int minFilter, final int wrapS, final int wrapT, final int name) { super(validateType(type), iFormat, width, height, name); this.dataFormat = dataFormat; this.dataType = dataType; @@ -459,7 +459,7 @@ public class FBObject { this.wrapT = wrapT; } - private static Type validateType(Type type) { + private static Type validateType(final Type type) { switch(type) { case COLOR_TEXTURE: case DEPTH_TEXTURE: @@ -475,7 +475,7 @@ public class FBObject { * @throws GLException if texture generation and setup fails. The just created texture name will be deleted in this case. */ @Override - public boolean initialize(GL gl) throws GLException { + public boolean initialize(final GL gl) throws GLException { final boolean init = 0 == getName(); if( init ) { checkPreGLError(gl); @@ -520,7 +520,7 @@ public class FBObject { } @Override - public void free(GL gl) { + public void free(final GL gl) { final int[] name = new int[] { getName() }; if( 0 != name[0] ) { if(DEBUG) { @@ -540,7 +540,7 @@ public class FBObject { "; name "+toHexString(getName())+", obj "+toHexString(objectHashCode())+"]"; } } - static String toHexString(int v) { + static String toHexString(final int v) { return "0x"+Integer.toHexString(v); } @@ -556,7 +556,7 @@ public class FBObject { * @param height texture height * @return the created and uninitialized color {@link TextureAttachment} */ - public static final TextureAttachment createColorTextureAttachment(GL gl, boolean alpha, int width, int height) { + public static final TextureAttachment createColorTextureAttachment(final GL gl, final boolean alpha, final int width, final int height) { return createColorTextureAttachment(gl, alpha, width, height, GL.GL_NEAREST, GL.GL_NEAREST, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE); } @@ -605,8 +605,8 @@ public class FBObject { * @param wrapT if > 0 value for {@link GL#GL_TEXTURE_WRAP_T} * @return the created and uninitialized color {@link TextureAttachment} */ - public static final TextureAttachment createColorTextureAttachment(GL gl, boolean alpha, int width, int height, - int magFilter, int minFilter, int wrapS, int wrapT) { + public static final TextureAttachment createColorTextureAttachment(final GL gl, final boolean alpha, final int width, final int height, + final int magFilter, final int minFilter, final int wrapS, final int wrapT) { final int textureInternalFormat, textureDataFormat, textureDataType; if(gl.isGLES3()) { textureInternalFormat = alpha ? GL.GL_RGBA8 : GL.GL_RGB8; @@ -640,13 +640,13 @@ public class FBObject { * @param wrapT if > 0 value for {@link GL#GL_TEXTURE_WRAP_T} * @return the created and uninitialized color {@link TextureAttachment} */ - public static final TextureAttachment createColorTextureAttachment(int internalFormat, int width, int height, int dataFormat, int dataType, - int magFilter, int minFilter, int wrapS, int wrapT) { + public static final TextureAttachment createColorTextureAttachment(final int internalFormat, final int width, final int height, final int dataFormat, final int dataType, + final int magFilter, final int minFilter, final int wrapS, final int wrapT) { return new TextureAttachment(Type.COLOR_TEXTURE, internalFormat, width, height, dataFormat, dataType, magFilter, minFilter, wrapS, wrapT, 0 /* name */); } - private static boolean hasAlpha(int format) { + private static boolean hasAlpha(final int format) { switch(format) { case GL.GL_RGBA8: case GL.GL_RGBA4: @@ -689,7 +689,7 @@ public class FBObject { // ColorAttachment helper .. // - private final void validateColorAttachmentPointRange(int point) { + private final void validateColorAttachmentPointRange(final int point) { if(!initialized) { throw new GLException("FBO not initialized"); } @@ -701,14 +701,14 @@ public class FBObject { } } - private final void validateAddColorAttachment(int point, Colorbuffer ca) { + private final void validateAddColorAttachment(final int point, final Colorbuffer ca) { validateColorAttachmentPointRange(point); if( null != colorAttachmentPoints[point] ) { throw new IllegalArgumentException("Cannot attach "+ca+", attachment point already in use by "+colorAttachmentPoints[point]+", "+this); } } - private final void addColorAttachment(int point, Colorbuffer ca) { + private final void addColorAttachment(final int point, final Colorbuffer ca) { validateColorAttachmentPointRange(point); final Colorbuffer c = colorAttachmentPoints[point]; if( null != c && c != ca ) { @@ -718,7 +718,7 @@ public class FBObject { colorAttachmentCount++; } - private final void removeColorAttachment(int point, Colorbuffer ca) { + private final void removeColorAttachment(final int point, final Colorbuffer ca) { validateColorAttachmentPointRange(point); final Colorbuffer c = colorAttachmentPoints[point]; if( null != c && c != ca ) { @@ -736,7 +736,7 @@ public class FBObject { * @see #attachTexture2D(GL, int, boolean, int, int, int, int) * @see #attachTexture2D(GL, int, int, int, int, int, int, int, int) */ - public final Colorbuffer getColorbuffer(int attachmentPoint) { + public final Colorbuffer getColorbuffer(final int attachmentPoint) { validateColorAttachmentPointRange(attachmentPoint); return colorAttachmentPoints[attachmentPoint]; } @@ -750,7 +750,7 @@ public class FBObject { * @param ca the {@link Colorbuffer} to look for. * @return -1 if the {@link Colorbuffer} could not be found, otherwise [0..{@link #getMaxColorAttachments()}-1] */ - public final int getColorbufferAttachmentPoint(Colorbuffer ca) { + public final int getColorbufferAttachmentPoint(final Colorbuffer ca) { for(int i=0; i=0 ? getColorbuffer(p) : null; } @@ -840,7 +840,7 @@ public class FBObject { this.samplingSinkDirty = true; } - private void init(GL gl, int width, int height, int samples) throws GLException { + private void init(final GL gl, int width, int height, final int samples) throws GLException { if(initialized) { throw new GLException("FBO already initialized"); } @@ -863,7 +863,7 @@ public class FBObject { final boolean NV_fbo_color_attachments = gl.isExtensionAvailable(GLExtensions.NV_fbo_color_attachments); - int val[] = new int[1]; + final int val[] = new int[1]; checkPreGLError(gl); @@ -874,7 +874,7 @@ public class FBObject { val[0] = 0; gl.glGetIntegerv(GL2ES2.GL_MAX_COLOR_ATTACHMENTS, val, 0); realMaxColorAttachments = 1 <= val[0] ? val[0] : 1; // cap minimum to 1 - } catch (GLException gle) { gle.printStackTrace(); } + } catch (final GLException gle) { gle.printStackTrace(); } } maxColorAttachments = realMaxColorAttachments <= 8 ? realMaxColorAttachments : 8; // cap to limit array size @@ -967,7 +967,7 @@ public class FBObject { * @param newHeight * @throws GLException in case of an error */ - public final void reset(GL gl, int newWidth, int newHeight) { + public final void reset(final GL gl, final int newWidth, final int newHeight) { reset(gl, newWidth, newHeight, 0, false); } @@ -996,7 +996,7 @@ public class FBObject { * * @throws GLException in case of an error, i.e. size too big, etc .. */ - public final void reset(GL gl, int newWidth, int newHeight, int newSamples, boolean resetSamplingSink) { + public final void reset(final GL gl, int newWidth, int newHeight, int newSamples, final boolean resetSamplingSink) { if( !initialized ) { init(gl, newWidth, newHeight, newSamples); return; @@ -1048,7 +1048,7 @@ public class FBObject { * Writes the internal format of the attachments to the given GLCapabilities object. * @param caps the destination for format bits */ - public final void formatToGLCapabilities(GLCapabilities caps) { + public final void formatToGLCapabilities(final GLCapabilities caps) { caps.setSampleBuffers(samples > 0); caps.setNumSamples(samples); caps.setDepthBits(0); @@ -1080,7 +1080,7 @@ public class FBObject { return getStatusString(vStatus); } - public static final String getStatusString(int fbStatus) { + public static final String getStatusString(final int fbStatus) { switch(fbStatus) { case -1: return "NOT A FBO"; @@ -1132,7 +1132,7 @@ public class FBObject { case GL.GL_FRAMEBUFFER_INCOMPLETE_FORMATS: case GL2GL3.GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER: case GL2GL3.GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER: - case GL2GL3.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: + case GL2ES3.GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: case GL3.GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS: if(0 == colorAttachmentCount || null == depth) { // we are in transition @@ -1152,8 +1152,8 @@ public class FBObject { } } - private static int checkPreGLError(GL gl) { - int glerr = gl.glGetError(); + private static int checkPreGLError(final GL gl) { + final int glerr = gl.glGetError(); if(DEBUG && GL.GL_NO_ERROR != glerr) { System.err.println("Pre-existing GL error: "+toHexString(glerr)); Thread.dumpStack(); @@ -1161,7 +1161,7 @@ public class FBObject { return glerr; } - private final boolean checkNoError(GL gl, int err, String exceptionMessage) throws GLException { + private final boolean checkNoError(final GL gl, final int err, final String exceptionMessage) throws GLException { if(GL.GL_NO_ERROR != err) { if(null != gl) { destroy(gl); @@ -1195,7 +1195,7 @@ public class FBObject { * @throws GLException in case the texture colorbuffer couldn't be allocated or MSAA has been chosen * @see #createColorTextureAttachment(GLProfile, boolean, int, int) */ - public final TextureAttachment attachTexture2D(GL gl, int attachmentPoint, boolean alpha) throws GLException { + public final TextureAttachment attachTexture2D(final GL gl, final int attachmentPoint, final boolean alpha) throws GLException { return (TextureAttachment)attachColorbuffer(gl, attachmentPoint, createColorTextureAttachment(gl, alpha, width, height)); } @@ -1217,7 +1217,7 @@ public class FBObject { * @throws GLException in case the texture colorbuffer couldn't be allocated or MSAA has been chosen * @see #createColorTextureAttachment(GLProfile, boolean, int, int, int, int, int, int) */ - public final TextureAttachment attachTexture2D(GL gl, int attachmentPoint, boolean alpha, int magFilter, int minFilter, int wrapS, int wrapT) throws GLException { + public final TextureAttachment attachTexture2D(final GL gl, final int attachmentPoint, final boolean alpha, final int magFilter, final int minFilter, final int wrapS, final int wrapT) throws GLException { return (TextureAttachment)attachColorbuffer(gl, attachmentPoint, createColorTextureAttachment(gl, alpha, width, height, magFilter, minFilter, wrapS, wrapT)); } @@ -1240,9 +1240,9 @@ public class FBObject { * @throws GLException in case the texture colorbuffer couldn't be allocated or MSAA has been chosen * @see #createColorTextureAttachment(int, int, int, int, int, int, int, int, int) */ - public final TextureAttachment attachTexture2D(GL gl, int attachmentPoint, - int internalFormat, int dataFormat, int dataType, - int magFilter, int minFilter, int wrapS, int wrapT) throws GLException { + public final TextureAttachment attachTexture2D(final GL gl, final int attachmentPoint, + final int internalFormat, final int dataFormat, final int dataType, + final int magFilter, final int minFilter, final int wrapS, final int wrapT) throws GLException { return (TextureAttachment)attachColorbuffer(gl, attachmentPoint, createColorTextureAttachment(internalFormat, width, height, dataFormat, dataType, magFilter, minFilter, wrapS, wrapT)); } @@ -1258,7 +1258,7 @@ public class FBObject { * @param alpha set to true if you request alpha channel, otherwise false; * @return uninitialized ColorAttachment instance describing the new attached colorbuffer */ - public final ColorAttachment createColorAttachment(boolean alpha) { + public final ColorAttachment createColorAttachment(final boolean alpha) { final int internalFormat; if( rgba8Avail ) { @@ -1282,7 +1282,7 @@ public class FBObject { * @throws GLException in case the colorbuffer couldn't be allocated * @see #createColorAttachment(boolean) */ - public final ColorAttachment attachColorbuffer(GL gl, int attachmentPoint, boolean alpha) throws GLException { + public final ColorAttachment attachColorbuffer(final GL gl, final int attachmentPoint, final boolean alpha) throws GLException { return (ColorAttachment) attachColorbuffer(gl, attachmentPoint, createColorAttachment(alpha)); } @@ -1298,7 +1298,7 @@ public class FBObject { * @throws GLException in case the colorbuffer couldn't be allocated * @throws IllegalArgumentException if internalFormat doesn't reflect a colorbuffer */ - public final ColorAttachment attachColorbuffer(GL gl, int attachmentPoint, int internalFormat) throws GLException, IllegalArgumentException { + public final ColorAttachment attachColorbuffer(final GL gl, final int attachmentPoint, final int internalFormat) throws GLException, IllegalArgumentException { final Attachment.Type atype = Attachment.Type.determine(internalFormat); if( Attachment.Type.COLOR != atype ) { throw new IllegalArgumentException("colorformat invalid: "+toHexString(internalFormat)+", "+this); @@ -1326,12 +1326,12 @@ public class FBObject { * @return newly attached {@link Colorbuffer} instance if bound and configured successfully, otherwise GLException is thrown * @throws GLException in case the colorbuffer couldn't be allocated or MSAA has been chosen in case of a {@link TextureAttachment} */ - public final Colorbuffer attachColorbuffer(GL gl, int attachmentPoint, Colorbuffer colbuf) throws GLException { + public final Colorbuffer attachColorbuffer(final GL gl, final int attachmentPoint, final Colorbuffer colbuf) throws GLException { bind(gl); return attachColorbufferImpl(gl, attachmentPoint, colbuf); } - private final Colorbuffer attachColorbufferImpl(GL gl, int attachmentPoint, Colorbuffer colbuf) throws GLException { + private final Colorbuffer attachColorbufferImpl(final GL gl, final int attachmentPoint, final Colorbuffer colbuf) throws GLException { validateAddColorAttachment(attachmentPoint, colbuf); final boolean initializedColorbuf = colbuf.initialize(gl); @@ -1407,7 +1407,7 @@ public class FBObject { * @see #getDepthAttachment() * @see #getStencilAttachment() */ - public final void attachRenderbuffer(GL gl, Attachment.Type atype, int reqBits) throws GLException, IllegalArgumentException { + public final void attachRenderbuffer(final GL gl, final Attachment.Type atype, int reqBits) throws GLException, IllegalArgumentException { if( 0 > reqBits ) { reqBits = 24; } @@ -1493,7 +1493,7 @@ public class FBObject { * @see #getDepthAttachment() * @see #getStencilAttachment() */ - public final void attachRenderbuffer(GL gl, int internalFormat) throws GLException, IllegalArgumentException { + public final void attachRenderbuffer(final GL gl, final int internalFormat) throws GLException, IllegalArgumentException { final Attachment.Type atype = Attachment.Type.determine(internalFormat); if( Attachment.Type.DEPTH != atype && Attachment.Type.STENCIL != atype && Attachment.Type.DEPTH_STENCIL != atype ) { throw new IllegalArgumentException("renderformat invalid: "+toHexString(internalFormat)+", "+this); @@ -1501,7 +1501,7 @@ public class FBObject { attachRenderbufferImpl(gl, atype, internalFormat); } - protected final void attachRenderbufferImpl(GL gl, Attachment.Type atype, int internalFormat) throws GLException { + protected final void attachRenderbufferImpl(final GL gl, final Attachment.Type atype, final int internalFormat) throws GLException { if( null != depth && ( Attachment.Type.DEPTH == atype || Attachment.Type.DEPTH_STENCIL == atype ) ) { throw new GLException("FBO depth buffer already attached (rb "+depth+"), type is "+atype+", "+toHexString(internalFormat)+", "+this); } @@ -1513,7 +1513,7 @@ public class FBObject { attachRenderbufferImpl2(gl, atype, internalFormat); } - private final void attachRenderbufferImpl2(GL gl, Attachment.Type atype, int internalFormat) throws GLException { + private final void attachRenderbufferImpl2(final GL gl, final Attachment.Type atype, final int internalFormat) throws GLException { if( Attachment.Type.DEPTH == atype ) { if(null == depth) { depth = new RenderAttachment(Type.DEPTH, internalFormat, samples, width, height, 0); @@ -1578,7 +1578,7 @@ public class FBObject { * @return the detached Colorbuffer * @throws IllegalArgumentException */ - public final Colorbuffer detachColorbuffer(GL gl, int attachmentPoint, boolean dispose) throws IllegalArgumentException { + public final Colorbuffer detachColorbuffer(final GL gl, final int attachmentPoint, final boolean dispose) throws IllegalArgumentException { bind(gl); final Colorbuffer res = detachColorbufferImpl(gl, attachmentPoint, dispose ? DetachAction.DISPOSE : DetachAction.NONE); @@ -1591,7 +1591,7 @@ public class FBObject { return res; } - private final Colorbuffer detachColorbufferImpl(GL gl, int attachmentPoint, DetachAction detachAction) { + private final Colorbuffer detachColorbufferImpl(final GL gl, final int attachmentPoint, final DetachAction detachAction) { Colorbuffer colbuf = colorAttachmentPoints[attachmentPoint]; // shortcut, don't validate here if(null == colbuf) { @@ -1661,7 +1661,7 @@ public class FBObject { return colbuf; } - private final void freeAllColorbufferImpl(GL gl) { + private final void freeAllColorbufferImpl(final GL gl) { for(int i=0; i * @param gl the current GL context */ - public final void detachAll(GL gl) { + public final void detachAll(final GL gl) { if(null != samplingSink) { samplingSink.detachAll(gl); } @@ -1869,7 +1869,7 @@ public class FBObject { *

* @param gl the current GL context */ - public final void detachAllColorbuffer(GL gl) { + public final void detachAllColorbuffer(final GL gl) { if(null != samplingSink) { samplingSink.detachAllColorbuffer(gl); } @@ -1884,7 +1884,7 @@ public class FBObject { *

* @param gl the current GL context */ - public final void detachAllTexturebuffer(GL gl) { + public final void detachAllTexturebuffer(final GL gl) { if( !isInitialized() ) { return; } @@ -1902,7 +1902,7 @@ public class FBObject { } } - public final void detachAllRenderbuffer(GL gl) { + public final void detachAllRenderbuffer(final GL gl) { if( !isInitialized() ) { return; } @@ -1913,7 +1913,7 @@ public class FBObject { detachRenderbufferImpl(gl, Attachment.Type.DEPTH_STENCIL, DetachAction.DISPOSE); } - private final void detachAllImpl(GL gl, boolean detachNonColorbuffer, boolean recreate) { + private final void detachAllImpl(final GL gl, final boolean detachNonColorbuffer, final boolean recreate) { if( !isInitialized() ) { return; } @@ -1957,7 +1957,7 @@ public class FBObject { /** * @param gl the current GL context */ - public final void destroy(GL gl) { + public final void destroy(final GL gl) { if(!initialized) { return; } @@ -1976,7 +1976,7 @@ public class FBObject { final int fb_cache = fbName; fbName = 0; - int name[] = new int[1]; + final int name[] = new int[1]; if(0!=fb_cache) { name[0] = fb_cache; gl.glDeleteFramebuffers(1, name, 0); @@ -2036,7 +2036,7 @@ public class FBObject { * @param gl the current GL context * @throws GLException in case of an error, i.e. size too big, etc .. */ - public final void resetSamplingSink(GL gl) throws GLException { + public final void resetSamplingSink(final GL gl) throws GLException { if(0 == samples) { // MSAA off if(null != samplingSink && samplingSink.initialized) { @@ -2088,7 +2088,7 @@ public class FBObject { } if(null == samplingSinkTexture) { - boolean hasAlpha = hasAttachmentUsingAlpha(); + final boolean hasAlpha = hasAttachmentUsingAlpha(); samplingSinkTexture = samplingSink.attachTexture2D(gl, 0, hasAlpha); } else if( 0 == samplingSinkTexture.getName() ) { samplingSinkTexture.setSize(width, height); @@ -2123,7 +2123,7 @@ public class FBObject { * @return the previous sampling sink or null if none was attached * @throws GLException if this FBO doesn't use MSAA or the given sink uses MSAA itself */ - public FBObject setSamplingSink(FBObject newSamplingSink) throws GLException { + public FBObject setSamplingSink(final FBObject newSamplingSink) throws GLException { final FBObject prev = samplingSink; if( null == newSamplingSink) { samplingSink = null; @@ -2154,7 +2154,7 @@ public class FBObject { * @param gl the current GL context * @throws GLException */ - public final void bind(GL gl) throws GLException { + public final void bind(final GL gl) throws GLException { if(!bound || fbName != gl.getBoundFramebuffer(GL.GL_FRAMEBUFFER)) { checkInitialized(); if(samples > 0 && fullFBOSupport) { @@ -2180,7 +2180,7 @@ public class FBObject { * @param gl the current GL context * @throws GLException */ - public final void unbind(GL gl) throws GLException { + public final void unbind(final GL gl) throws GLException { if(bound) { if(fullFBOSupport) { // default read/draw buffers, may utilize GLContext/GLDrawable override of @@ -2212,7 +2212,7 @@ public class FBObject { *

* @param gl the current GL context */ - public final boolean isBound(GL gl) { + public final boolean isBound(final GL gl) { bound = bound && fbName != gl.getBoundFramebuffer(GL.GL_FRAMEBUFFER) ; return bound; } @@ -2244,7 +2244,7 @@ public class FBObject { * @param ta {@link TextureAttachment} to use, prev. attached w/ {@link #attachTexture2D(GL, int, boolean, int, int, int, int) attachTexture2D(..)} * @throws IllegalArgumentException */ - public final void syncSamplingSink(GL gl) { + public final void syncSamplingSink(final GL gl) { markUnbound(); if(samples>0 && samplingSinkDirty) { samplingSinkDirty = false; @@ -2279,7 +2279,7 @@ public class FBObject { * @param ta {@link TextureAttachment} to use, prev. attached w/ {@link #attachTexture2D(GL, int, boolean, int, int, int, int) attachTexture2D(..)} * @throws IllegalArgumentException */ - public final void use(GL gl, TextureAttachment ta) throws IllegalArgumentException { + public final void use(final GL gl, final TextureAttachment ta) throws IllegalArgumentException { if(null == ta) { throw new IllegalArgumentException("Null TextureAttachment, this: "+toString()); } syncSamplingSink(gl); gl.glBindTexture(GL.GL_TEXTURE_2D, ta.getName()); // use it .. @@ -2290,7 +2290,7 @@ public class FBObject { * *

Leaves the FBO unbound.

*/ - public final void unuse(GL gl) { + public final void unuse(final GL gl) { unbind(gl); gl.glBindTexture(GL.GL_TEXTURE_2D, 0); // don't use it } @@ -2309,7 +2309,7 @@ public class FBObject { * @param bits 16, 24 or 32 bits * @throws GLException if {@link #init(GL)} hasn't been called. */ - public final boolean supportsDepth(int bits) throws GLException { + public final boolean supportsDepth(final int bits) throws GLException { checkInitialized(); switch(bits) { case 16: return true; @@ -2324,7 +2324,7 @@ public class FBObject { * @param bits 1, 4, 8 or 16 bits * @throws GLException if {@link #init(GL)} hasn't been called. */ - public final boolean supportsStencil(int bits) throws GLException { + public final boolean supportsStencil(final int bits) throws GLException { checkInitialized(); switch(bits) { case 1: return stencil01Avail; @@ -2400,7 +2400,7 @@ public class FBObject { ", dirty "+samplingSinkDirty+"], state "+getStatusString()+", obj "+toHexString(objectHashCode())+"]"; } - private final void updateStatus(GL gl) { + private final void updateStatus(final GL gl) { if( 0 == fbName ) { vStatus = -1; } else { diff --git a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java index e9fe80a91..f9a7ab029 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java +++ b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java @@ -84,7 +84,7 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto * and no further lifecycle handling is applied. * @param lock optional custom {@link RecursiveLock}. */ - public GLAutoDrawableDelegate(GLDrawable drawable, GLContext context, Object upstreamWidget, boolean ownDevice, RecursiveLock lock) { + public GLAutoDrawableDelegate(final GLDrawable drawable, final GLContext context, final Object upstreamWidget, final boolean ownDevice, final RecursiveLock lock) { super((GLDrawableImpl)drawable, (GLContextImpl)context, ownDevice); if(null == drawable) { throw new IllegalArgumentException("null drawable"); @@ -118,7 +118,7 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto * @param newWidth new width in pixel units * @param newWidth new height in pixel units */ - public final void windowResizedOp(int newWidth, int newHeight) { + public final void windowResizedOp(final int newWidth, final int newHeight) { super.defaultWindowResizedOp(newWidth, newHeight); } @@ -154,7 +154,7 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto * Set the upstream UI toolkit object. * @see #getUpstreamWidget() */ - public final void setUpstreamWidget(Object newUpstreamWidget) { + public final void setUpstreamWidget(final Object newUpstreamWidget) { upstreamWidget = newUpstreamWidget; } diff --git a/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java b/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java index 299e51532..aa56a8442 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java +++ b/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java @@ -70,9 +70,9 @@ import com.jogamp.nativewindow.MutableGraphicsConfiguration; public class GLEventListenerState { private static final boolean DEBUG = Debug.debug("GLDrawable") || Debug.debug("GLEventListenerState"); - private GLEventListenerState(AbstractGraphicsDevice upstreamDevice, boolean proxyOwnsUpstreamDevice, AbstractGraphicsDevice device, - GLCapabilitiesImmutable caps, - GLContext context, int count, GLAnimatorControl anim, boolean animStarted) { + private GLEventListenerState(final AbstractGraphicsDevice upstreamDevice, final boolean proxyOwnsUpstreamDevice, final AbstractGraphicsDevice device, + final GLCapabilitiesImmutable caps, + final GLContext context, final int count, final GLAnimatorControl anim, final boolean animStarted) { this.upstreamDevice = upstreamDevice; this.proxyOwnsUpstreamDevice = proxyOwnsUpstreamDevice; this.device = device; @@ -124,7 +124,7 @@ public class GLEventListenerState { } } - private static AbstractGraphicsDevice cloneDevice(AbstractGraphicsDevice aDevice) { + private static AbstractGraphicsDevice cloneDevice(final AbstractGraphicsDevice aDevice) { return (AbstractGraphicsDevice) aDevice.clone(); } @@ -148,7 +148,7 @@ public class GLEventListenerState { * * @see #moveTo(GLAutoDrawable) */ - public static GLEventListenerState moveFrom(GLAutoDrawable a) { + public static GLEventListenerState moveFrom(final GLAutoDrawable a) { final GLAnimatorControl aAnim = a.getAnimator(); final boolean aAnimStarted; if( null != aAnim ) { @@ -251,7 +251,7 @@ public class GLEventListenerState { * @see #moveFrom(GLAutoDrawable) * @see #isOwner() */ - public final void moveTo(GLAutoDrawable a) { + public final void moveTo(final GLAutoDrawable a) { final GLAnimatorControl aAnim = a.getAnimator(); final boolean hasAnimator = null != aAnim; final boolean aPaused; @@ -407,7 +407,7 @@ public class GLEventListenerState { public static GLRunnable setViewport = new GLRunnable() { @Override - public boolean run(GLAutoDrawable drawable) { + public boolean run(final GLAutoDrawable drawable) { drawable.getGL().glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); return true; } @@ -415,19 +415,19 @@ public class GLEventListenerState { public static GLRunnable glFinish = new GLRunnable() { @Override - public boolean run(GLAutoDrawable drawable) { + public boolean run(final GLAutoDrawable drawable) { drawable.getGL().glFinish(); return true; } }; public static class ReshapeGLEventListener implements GLRunnable { - private GLEventListener listener; - public ReshapeGLEventListener(GLEventListener listener) { + private final GLEventListener listener; + public ReshapeGLEventListener(final GLEventListener listener) { this.listener = listener; } @Override - public boolean run(GLAutoDrawable drawable) { + public boolean run(final GLAutoDrawable drawable) { listener.reshape(drawable, 0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); return true; } diff --git a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java index 9c9f4e3d6..078b48ec2 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java +++ b/src/jogl/classes/com/jogamp/opengl/GLRendererQuirks.java @@ -336,7 +336,7 @@ public class GLRendererQuirks { *

* @see #areSameStickyDevice(AbstractGraphicsDevice, AbstractGraphicsDevice) */ - public static GLRendererQuirks getStickyDeviceQuirks(AbstractGraphicsDevice device) { + public static GLRendererQuirks getStickyDeviceQuirks(final AbstractGraphicsDevice device) { final String key = device.getUniqueID(); final GLRendererQuirks has = stickyDeviceQuirks.get(key); final GLRendererQuirks res; @@ -353,7 +353,7 @@ public class GLRendererQuirks { * Returns true if both devices have the same {@link AbstractGraphicsDevice#getUniqueID()}, * otherwise false. */ - public static boolean areSameStickyDevice(AbstractGraphicsDevice device1, AbstractGraphicsDevice device2) { + public static boolean areSameStickyDevice(final AbstractGraphicsDevice device1, final AbstractGraphicsDevice device2) { return device1.getUniqueID() == device2.getUniqueID(); } @@ -364,7 +364,7 @@ public class GLRendererQuirks { *

* @see #getStickyDeviceQuirks(AbstractGraphicsDevice) */ - public static void addStickyDeviceQuirks(AbstractGraphicsDevice device, int[] quirks, int offset, int len) throws IllegalArgumentException { + public static void addStickyDeviceQuirks(final AbstractGraphicsDevice device, final int[] quirks, final int offset, final int len) throws IllegalArgumentException { final GLRendererQuirks sq = getStickyDeviceQuirks(device); sq.addQuirks(quirks, offset, len); } @@ -375,7 +375,7 @@ public class GLRendererQuirks { *

* @see #getStickyDeviceQuirks(AbstractGraphicsDevice) */ - public static void addStickyDeviceQuirks(AbstractGraphicsDevice device, GLRendererQuirks quirks) throws IllegalArgumentException { + public static void addStickyDeviceQuirks(final AbstractGraphicsDevice device, final GLRendererQuirks quirks) throws IllegalArgumentException { final GLRendererQuirks sq = getStickyDeviceQuirks(device); sq.addQuirks(quirks); } @@ -386,7 +386,7 @@ public class GLRendererQuirks { *

* @see #getStickyDeviceQuirks(AbstractGraphicsDevice) */ - public static boolean existStickyDeviceQuirk(AbstractGraphicsDevice device, int quirk) { + public static boolean existStickyDeviceQuirk(final AbstractGraphicsDevice device, final int quirk) { return getStickyDeviceQuirks(device).exist(quirk); } /** @@ -397,7 +397,7 @@ public class GLRendererQuirks { *

* @see #getStickyDeviceQuirks(AbstractGraphicsDevice) */ - public static void pushStickyDeviceQuirks(AbstractGraphicsDevice device, GLRendererQuirks dest) { + public static void pushStickyDeviceQuirks(final AbstractGraphicsDevice device, final GLRendererQuirks dest) { dest.addQuirks(getStickyDeviceQuirks(device)); } @@ -413,7 +413,7 @@ public class GLRendererQuirks { * @param len number of quirks to read from offset within quirks array * @throws IllegalArgumentException if one of the quirks is out of range */ - public GLRendererQuirks(int[] quirks, int offset, int len) throws IllegalArgumentException { + public GLRendererQuirks(final int[] quirks, final int offset, final int len) throws IllegalArgumentException { this(); addQuirks(quirks, offset, len); } @@ -424,7 +424,7 @@ public class GLRendererQuirks { * @param len number of quirks to read from offset within quirks array * @throws IllegalArgumentException if one of the quirks is out of range */ - public final void addQuirks(int[] quirks, int offset, int len) throws IllegalArgumentException { + public final void addQuirks(final int[] quirks, final int offset, final int len) throws IllegalArgumentException { int bitmask = 0; if( !( 0 <= offset + len && offset + len <= quirks.length ) ) { throw new IllegalArgumentException("offset and len out of bounds: offset "+offset+", len "+len+", array-len "+quirks.length); @@ -440,7 +440,7 @@ public class GLRendererQuirks { /** * @param quirks valid GLRendererQuirks to be added */ - public final void addQuirks(GLRendererQuirks quirks) { + public final void addQuirks(final GLRendererQuirks quirks) { _bitmask |= quirks._bitmask; } @@ -449,7 +449,7 @@ public class GLRendererQuirks { * @return true if quirk exist, otherwise false * @throws IllegalArgumentException if quirk is out of range */ - public final boolean exist(int quirk) throws IllegalArgumentException { + public final boolean exist(final int quirk) throws IllegalArgumentException { validateQuirk(quirk); return 0 != ( ( 1 << quirk ) & _bitmask ); } @@ -481,7 +481,7 @@ public class GLRendererQuirks { * @param quirk the quirk to be validated, i.e. whether it is out of range * @throws IllegalArgumentException if quirk is out of range */ - public static void validateQuirk(int quirk) throws IllegalArgumentException { + public static void validateQuirk(final int quirk) throws IllegalArgumentException { if( !( 0 <= quirk && quirk < COUNT ) ) { throw new IllegalArgumentException("Quirks must be in range [0.."+COUNT+"[, but quirk: "+quirk); } @@ -492,7 +492,7 @@ public class GLRendererQuirks { * @return the String equivalent of this quirk * @throws IllegalArgumentException if quirk is out of range */ - public static final String toString(int quirk) throws IllegalArgumentException { + public static final String toString(final int quirk) throws IllegalArgumentException { validateQuirk(quirk); return _names[quirk]; } diff --git a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java index 40f0d180f..8d6765036 100644 --- a/src/jogl/classes/com/jogamp/opengl/JoglVersion.java +++ b/src/jogl/classes/com/jogamp/opengl/JoglVersion.java @@ -43,7 +43,7 @@ public class JoglVersion extends JogampVersion { protected static volatile JoglVersion jogampCommonVersionInfo; - protected JoglVersion(String packageName, Manifest mf) { + protected JoglVersion(final String packageName, final Manifest mf) { super(packageName, mf); } @@ -60,17 +60,17 @@ public class JoglVersion extends JogampVersion { return jogampCommonVersionInfo; } - public StringBuilder toString(GL gl, StringBuilder sb) { + public StringBuilder toString(final GL gl, StringBuilder sb) { sb = super.toString(sb).append(Platform.getNewline()); getGLInfo(gl, sb); return sb; } - public String toString(GL gl) { + public String toString(final GL gl) { return toString(gl, null).toString(); } - public static StringBuilder getAvailableCapabilitiesInfo(GLDrawableFactory factory, AbstractGraphicsDevice device, StringBuilder sb) { + public static StringBuilder getAvailableCapabilitiesInfo(final GLDrawableFactory factory, final AbstractGraphicsDevice device, StringBuilder sb) { if(null==sb) { sb = new StringBuilder(); } @@ -84,7 +84,7 @@ public class JoglVersion extends JogampVersion { } done = true; } - } catch (GLException gle) { /* n/a */ } + } catch (final GLException gle) { /* n/a */ } } if(!done) { sb.append("\tnone").append(Platform.getNewline()); @@ -108,7 +108,7 @@ public class JoglVersion extends JogampVersion { return sb; } - public static StringBuilder getDefaultOpenGLInfo(AbstractGraphicsDevice device, StringBuilder sb, boolean withCapabilitiesInfo) { + public static StringBuilder getDefaultOpenGLInfo(AbstractGraphicsDevice device, StringBuilder sb, final boolean withCapabilitiesInfo) { if(null==sb) { sb = new StringBuilder(); } @@ -127,11 +127,11 @@ public class JoglVersion extends JogampVersion { return sb; } - public static StringBuilder getGLInfo(GL gl, StringBuilder sb) { + public static StringBuilder getGLInfo(final GL gl, final StringBuilder sb) { return getGLInfo(gl, sb, false); } - public static StringBuilder getGLInfo(GL gl, StringBuilder sb, boolean withCapabilitiesAndExtensionInfo) { - AbstractGraphicsDevice device = gl.getContext().getGLDrawable().getNativeSurface() + public static StringBuilder getGLInfo(final GL gl, StringBuilder sb, final boolean withCapabilitiesAndExtensionInfo) { + final AbstractGraphicsDevice device = gl.getContext().getGLDrawable().getNativeSurface() .getGraphicsConfiguration().getScreen().getDevice(); if(null==sb) { sb = new StringBuilder(); @@ -151,11 +151,11 @@ public class JoglVersion extends JogampVersion { return sb; } - public static StringBuilder getGLStrings(GL gl, StringBuilder sb) { + public static StringBuilder getGLStrings(final GL gl, final StringBuilder sb) { return getGLStrings(gl, sb, true); } - public static StringBuilder getGLStrings(GL gl, StringBuilder sb, boolean withExtensions) { + public static StringBuilder getGLStrings(final GL gl, StringBuilder sb, final boolean withExtensions) { if(null==sb) { sb = new StringBuilder(); } @@ -200,7 +200,7 @@ public class JoglVersion extends JogampVersion { return sb; } - public StringBuilder getBriefOSGLBuildInfo(GL gl, StringBuilder sb) { + public StringBuilder getBriefOSGLBuildInfo(final GL gl, StringBuilder sb) { if(null==sb) { sb = new StringBuilder(); } @@ -217,7 +217,7 @@ public class JoglVersion extends JogampVersion { return sb; } - public static void main(String args[]) { + public static void main(final String args[]) { System.err.println(VersionUtil.getPlatformInfo()); System.err.println(GlueGenVersion.getInstance()); // System.err.println(NativeWindowVersion.getInstance()); diff --git a/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java b/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java index 4270607f2..d3dae9d63 100644 --- a/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/com/jogamp/opengl/cg/CgDynamicLibraryBundleInfo.java @@ -89,12 +89,12 @@ public final class CgDynamicLibraryBundleInfo implements DynamicLibraryBundleInf /** Tool has none **/ @Override - public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) { + public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { return 0; } @Override - public final boolean useToolGetProcAdressFirst(String funcName) { + public final boolean useToolGetProcAdressFirst(final String funcName) { return false; } diff --git a/src/jogl/classes/com/jogamp/opengl/cg/CgException.java b/src/jogl/classes/com/jogamp/opengl/cg/CgException.java index 3e42f4d70..0a3535ba6 100644 --- a/src/jogl/classes/com/jogamp/opengl/cg/CgException.java +++ b/src/jogl/classes/com/jogamp/opengl/cg/CgException.java @@ -50,18 +50,18 @@ public class CgException extends RuntimeException { } /** Constructs a CgException object with the specified detail message. */ - public CgException(String message) { + public CgException(final String message) { super(message); } /** Constructs a CgException object with the specified detail message and root cause. */ - public CgException(String message, Throwable cause) { + public CgException(final String message, final Throwable cause) { super(message, cause); } /** Constructs a CgException object with the specified root cause. */ - public CgException(Throwable cause) { + public CgException(final Throwable cause) { super(cause); } } diff --git a/src/jogl/classes/com/jogamp/opengl/math/Binary16.java b/src/jogl/classes/com/jogamp/opengl/math/Binary16.java index 33add46c2..8e4aa9176 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/Binary16.java +++ b/src/jogl/classes/com/jogamp/opengl/math/Binary16.java @@ -151,7 +151,7 @@ public final class Binary16 * the interval of double precision values is far larger than that of the * binary16 type. *

- * + * * @see #unpackDouble(char) */ @@ -224,7 +224,7 @@ public final class Binary16 * the interval of single precision values is far larger than that of the * binary16 type. *

- * + * * @see #unpackFloat(char) */ @@ -280,7 +280,7 @@ public final class Binary16 * range [-15, 16] - values outside of this range will be * truncated. *

- * + * * @see #unpackGetExponentUnbiased(char) */ @@ -298,7 +298,7 @@ public final class Binary16 * Encode the significand s. Values should be in the range * [0, 1023]. Values outside of this range will be truncated. *

- * + * * @see #unpackGetSignificand(char) */ @@ -315,7 +315,7 @@ public final class Binary16 * [0, 1], with 0 ironically denoting a positive * value. Values outside of this range will be truncated. *

- * + * * @see #unpackGetSign(char) */ @@ -369,7 +369,7 @@ public final class Binary16 * k, and the decoded significand s of * k. * - * + * * @see #packDouble(double) */ @@ -405,7 +405,7 @@ public final class Binary16 /** * 1. Bias the exponent. - * + * * 2. Shift the result left to the position at which it will appear in the * resulting value. */ @@ -443,7 +443,7 @@ public final class Binary16 * k, and the decoded significand s of * k. * - * + * * @see #packFloat(float) */ @@ -479,7 +479,7 @@ public final class Binary16 /** * 1. Bias the exponent. - * + * * 2. Shift the result left to the position at which it will appear in the * resulting value. */ @@ -522,7 +522,7 @@ public final class Binary16 * 16 iff the input is {@link #POSITIVE_INFINITY}, * {@link #NEGATIVE_INFINITY}, or NaN. * - * + * * @see #packSetExponentUnbiasedUnchecked(int) */ @@ -537,7 +537,7 @@ public final class Binary16 /** * Retrieve the sign bit of the given packed binary16 value, as * an integer in the range [0, 1]. - * + * * @see Binary16#packSetSignUnchecked(int) */ @@ -552,7 +552,7 @@ public final class Binary16 * Return the significand of the given packed binary16 value as * an integer in the range [0, 1023]. *

- * + * * @see Binary16#packSetSignificandUnchecked(int) */ diff --git a/src/jogl/classes/com/jogamp/opengl/math/Binary32.java b/src/jogl/classes/com/jogamp/opengl/math/Binary32.java index d98815d9f..599b1ff68 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/Binary32.java +++ b/src/jogl/classes/com/jogamp/opengl/math/Binary32.java @@ -75,7 +75,7 @@ public final class Binary32 * {@link #POSITIVE_INFINITY}, {@link #NEGATIVE_INFINITY}, or * NaN. * - * + * * @see #packSetExponentUnbiasedUnchecked(int) */ diff --git a/src/jogl/classes/com/jogamp/opengl/math/Binary64.java b/src/jogl/classes/com/jogamp/opengl/math/Binary64.java index 5efad433a..d4ec636a5 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/Binary64.java +++ b/src/jogl/classes/com/jogamp/opengl/math/Binary64.java @@ -75,7 +75,7 @@ public final class Binary64 * {@link #POSITIVE_INFINITY}, {@link #NEGATIVE_INFINITY}, or * NaN. * - * + * * @see #packSetExponentUnbiasedUnchecked(int) */ @@ -93,7 +93,7 @@ public final class Binary64 * Return the significand of the given double value. *

*/ - + public static long unpackGetSignificand( final double d) { @@ -106,7 +106,7 @@ public final class Binary64 * Return the sign of the given double value. *

*/ - + public static long unpackGetSign( final double d) { diff --git a/src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java b/src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java index b7dbf183f..31408b079 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java +++ b/src/jogl/classes/com/jogamp/opengl/math/FixedPoint.java @@ -46,15 +46,15 @@ public class FixedPoint { return (int)(value * 65536.0f); } - public static final float toFloat(int value) { - return (float)value/65536.0f; + public static final float toFloat(final int value) { + return value/65536.0f; } - public static final int mult(int x1, int x2) { + public static final int mult(final int x1, final int x2) { return (int) ( ((long)x1*(long)x2)/65536 ); } - public static final int div(int x1, int x2) { + public static final int div(final int x1, final int x2) { return (int) ( (((long)x1)<<16)/x2 ); } } diff --git a/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java b/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java index 243ab2a33..5e0784022 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java +++ b/src/jogl/classes/com/jogamp/opengl/math/Quaternion.java @@ -438,7 +438,7 @@ public class Quaternion { * @see #rotateByAngleX(float) * @see #setFromEuler(float, float, float) */ - public final Quaternion rotateByEuler(final float bankX, final float headingY, float attitudeZ) { + public final Quaternion rotateByEuler(final float bankX, final float headingY, final float attitudeZ) { if ( VectorUtil.isZero(bankX, headingY, attitudeZ, FloatUtil.EPSILON) ) { return this; } else { @@ -859,7 +859,7 @@ public class Quaternion { * @see euclideanspace.com-eulerToQuaternion * @see #toEuler(float[]) */ - public final Quaternion setFromEuler(final float bankX, final float headingY, float attitudeZ) { + public final Quaternion setFromEuler(final float bankX, final float headingY, final float attitudeZ) { if ( VectorUtil.isZero(bankX, headingY, attitudeZ, FloatUtil.EPSILON) ) { return setIdentity(); } else { @@ -1154,7 +1154,7 @@ public class Quaternion { * @param m 3x3 column matrix * @return true if representing a rotational matrix, false otherwise */ - public final boolean isRotationMatrix3f(float[] m) { + public final boolean isRotationMatrix3f(final float[] m) { final float epsilon = 0.01f; // margin to allow for rounding errors if (FloatUtil.abs(m[0] * m[3] + m[3] * m[4] + m[6] * m[7]) > epsilon) return false; @@ -1171,7 +1171,7 @@ public class Quaternion { return (FloatUtil.abs(determinant3f(m) - 1) < epsilon); } - private final float determinant3f(float[] m) { + private final float determinant3f(final float[] m) { return m[0] * m[4] * m[8] + m[3] * m[7] * m[2] + m[6] * m[1] * m[5] - m[0] * m[7] * m[5] - m[3] * m[1] * m[8] - m[6] * m[4] * m[2]; } diff --git a/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java b/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java index d87bbb6f9..e454c036a 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java +++ b/src/jogl/classes/com/jogamp/opengl/math/geom/AABBox.java @@ -68,7 +68,7 @@ public class AABBox { * Create an AABBox copying all values from the given one * @param src the box value to be used for the new instance */ - public AABBox(AABBox src) { + public AABBox(final AABBox src) { copy(src); } @@ -147,7 +147,7 @@ public class AABBox { * @param src source AABBox * @return this AABBox for chaining */ - public final AABBox copy(AABBox src) { + public final AABBox copy(final AABBox src) { System.arraycopy(src.low, 0, low, 0, 3); System.arraycopy(src.high, 0, high, 0, 3); System.arraycopy(src.center, 0, center, 0, 3); @@ -196,8 +196,8 @@ public class AABBox { * @return this AABBox for chaining */ public final AABBox resize(final AABBox newBox) { - float[] newLow = newBox.getLow(); - float[] newHigh = newBox.getHigh(); + final float[] newLow = newBox.getLow(); + final float[] newHigh = newBox.getHigh(); /** test low */ if (newLow[0] < low[0]) @@ -662,7 +662,7 @@ public class AABBox { } @Override - public final boolean equals(Object obj) { + public final boolean equals(final Object obj) { if( obj == this ) { return true; } diff --git a/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java b/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java index 87d31becb..f6d3c0dfa 100644 --- a/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java +++ b/src/jogl/classes/com/jogamp/opengl/math/geom/Frustum.java @@ -27,6 +27,8 @@ */ package com.jogamp.opengl.math.geom; +import jogamp.common.os.PlatformPropsImpl; + import com.jogamp.common.os.Platform; /** @@ -113,12 +115,12 @@ public class Frustum { * Negative halfspace is the other side of the plane, i.e. *-1 *

**/ - public final float distanceTo(float x, float y, float z) { + public final float distanceTo(final float x, final float y, final float z) { return n[0] * x + n[1] * y + n[2] * z + d; } /** Return distance of plane to given point, see {@link #distanceTo(float, float, float)}. */ - public final float distanceTo(float[] p) { + public final float distanceTo(final float[] p) { return n[0] * p[0] + n[1] * p[1] + n[2] * p[2] + d; } @@ -164,7 +166,7 @@ public class Frustum { * Copy the given src planes into this this instance's planes. * @param src the 6 source planes */ - public final void updateByPlanes(Plane[] src) { + public final void updateByPlanes(final Plane[] src) { for (int i = 0; i < 6; ++i) { final Plane p0 = planes[i]; final float[] p0_n = p0.n; @@ -185,7 +187,7 @@ public class Frustum { * as required by this class. *

*/ - public void updateByPMV(float[] pmv, int pmv_off) { + public void updateByPMV(final float[] pmv, final int pmv_off) { // Left: a = m41 + m11, b = m42 + m12, c = m43 + m13, d = m44 + m14 - [1..4] column-major // Left: a = m30 + m00, b = m31 + m01, c = m32 + m02, d = m33 + m03 - [0..3] column-major { @@ -265,7 +267,7 @@ public class Frustum { } } - private static final boolean isOutsideImpl(Plane p, AABBox box) { + private static final boolean isOutsideImpl(final Plane p, final AABBox box) { final float[] low = box.getLow(); final float[] high = box.getHigh(); @@ -288,7 +290,7 @@ public class Frustum { * Note: If method returns false, the box may only be partially inside. *

*/ - public final boolean isAABBoxOutside(AABBox box) { + public final boolean isAABBoxOutside(final AABBox box) { for (int i = 0; i < 6; ++i) { if ( isOutsideImpl(planes[i], box) ) { // fully outside @@ -308,7 +310,7 @@ public class Frustum { * @param p the point * @return {@link Location} of point related to frustum planes */ - public final Location classifyPoint(float[] p) { + public final Location classifyPoint(final float[] p) { Location res = Location.INSIDE; for (int i = 0; i < 6; ++i) { @@ -328,7 +330,7 @@ public class Frustum { * @param p the point * @return true if outside of the frustum, otherwise inside or on a plane */ - public final boolean isPointOutside(float[] p) { + public final boolean isPointOutside(final float[] p) { return Location.OUTSIDE == classifyPoint(p); } @@ -339,7 +341,7 @@ public class Frustum { * @param radius radius of the sphere * @return {@link Location} of point related to frustum planes */ - public final Location classifySphere(float[] p, float radius) { + public final Location classifySphere(final float[] p, final float radius) { Location res = Location.INSIDE; // fully inside for (int i = 0; i < 6; ++i) { @@ -362,7 +364,7 @@ public class Frustum { * @param radius radius of the sphere * @return true if outside of the frustum, otherwise inside or intersecting */ - public final boolean isSphereOutside(float[] p, float radius) { + public final boolean isSphereOutside(final float[] p, final float radius) { return Location.OUTSIDE == classifySphere(p, radius); } @@ -370,13 +372,13 @@ public class Frustum { if( null == sb ) { sb = new StringBuilder(); } - sb.append("Frustum[ Planes[ ").append(Platform.NEWLINE) - .append(" L: ").append(planes[0]).append(", ").append(Platform.NEWLINE) - .append(" R: ").append(planes[1]).append(", ").append(Platform.NEWLINE) - .append(" B: ").append(planes[2]).append(", ").append(Platform.NEWLINE) - .append(" T: ").append(planes[3]).append(", ").append(Platform.NEWLINE) - .append(" N: ").append(planes[4]).append(", ").append(Platform.NEWLINE) - .append(" F: ").append(planes[5]).append("], ").append(Platform.NEWLINE) + sb.append("Frustum[ Planes[ ").append(PlatformPropsImpl.NEWLINE) + .append(" L: ").append(planes[0]).append(", ").append(PlatformPropsImpl.NEWLINE) + .append(" R: ").append(planes[1]).append(", ").append(PlatformPropsImpl.NEWLINE) + .append(" B: ").append(planes[2]).append(", ").append(PlatformPropsImpl.NEWLINE) + .append(" T: ").append(planes[3]).append(", ").append(PlatformPropsImpl.NEWLINE) + .append(" N: ").append(planes[4]).append(", ").append(PlatformPropsImpl.NEWLINE) + .append(" F: ").append(planes[5]).append("], ").append(PlatformPropsImpl.NEWLINE) .append("]"); return sb; } diff --git a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java index fbe5fedc4..c94d21369 100644 --- a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java +++ b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java @@ -125,8 +125,8 @@ public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextS private volatile boolean sendReshape; // volatile: maybe written by WindowManager thread w/o locking private static String getThreadName() { return Thread.currentThread().getName(); } - private static String toHexString(int v) { return "0x"+Integer.toHexString(v); } - private static String toHexString(long v) { return "0x"+Long.toHexString(v); } + private static String toHexString(final int v) { return "0x"+Integer.toHexString(v); } + private static String toHexString(final long v) { return "0x"+Long.toHexString(v); } /* * Invokes init(...) on all GLEventListeners. Assumes context is current when run. @@ -215,7 +215,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextS } else { context.destroy(); } - } catch (GLException gle) { + } catch (final GLException gle) { gle.printStackTrace(); } } @@ -247,7 +247,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextS private class DisposeGLEventListenerAction implements Runnable { private GLEventListener listener; private final boolean remove; - private DisposeGLEventListenerAction(GLEventListener listener, boolean remove) { + private DisposeGLEventListenerAction(final GLEventListener listener, final boolean remove) { this.listener = listener; this.remove = remove; } @@ -346,7 +346,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextS * Optional GLCapabilitiesChooser to customize the selection of the used GLCapabilities based on the * requested GLCapabilities, and the available capabilities of the graphics device. */ - public GLCanvas(final Composite parent, final int style, GLCapabilitiesImmutable capsReqUser, + public GLCanvas(final Composite parent, final int style, final GLCapabilitiesImmutable capsReqUser, final GLCapabilitiesChooser capsChooser) { this(parent, style, capsReqUser, capsChooser, null); } @@ -418,7 +418,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextS final Listener listener = new Listener () { @Override - public void handleEvent (Event event) { + public void handleEvent (final Event event) { switch (event.type) { case SWT.Paint: displayIfNoAnimatorNoCheck(); @@ -438,29 +438,29 @@ public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextS } @Override - public final void setSharedContext(GLContext sharedContext) throws IllegalStateException { + public final void setSharedContext(final GLContext sharedContext) throws IllegalStateException { helper.setSharedContext(this.context, sharedContext); } @Override - public final void setSharedAutoDrawable(GLAutoDrawable sharedAutoDrawable) throws IllegalStateException { + public final void setSharedAutoDrawable(final GLAutoDrawable sharedAutoDrawable) throws IllegalStateException { helper.setSharedAutoDrawable(this, sharedAutoDrawable); } private final UpstreamSurfaceHook swtCanvasUpStreamHook = new UpstreamSurfaceHook() { @Override - public final void create(ProxySurface s) { /* nop */ } + public final void create(final ProxySurface s) { /* nop */ } @Override - public final void destroy(ProxySurface s) { /* nop */ } + public final void destroy(final ProxySurface s) { /* nop */ } @Override - public final int getSurfaceWidth(ProxySurface s) { + public final int getSurfaceWidth(final ProxySurface s) { return clientArea.width; } @Override - public final int getSurfaceHeight(ProxySurface s) { + public final int getSurfaceHeight(final ProxySurface s) { return clientArea.height; } @@ -619,7 +619,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextS final GLDrawableFactory glFactory = GLDrawableFactory.getFactory(capsRequested.getGLProfile()); // Create a NativeWindow proxy for the SWT canvas - ProxySurface proxySurface = glFactory.createProxySurface(device, screen.getIndex(), nativeWindowHandle, + final ProxySurface proxySurface = glFactory.createProxySurface(device, screen.getIndex(), nativeWindowHandle, capsRequested, capsChooser, swtCanvasUpStreamHook); // Associate a GL surface with the proxy final GLDrawableImpl _drawable = (GLDrawableImpl) glFactory.createGLDrawable(proxySurface); @@ -731,7 +731,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextS } @Override - public GLEventListener getGLEventListener(int index) throws IndexOutOfBoundsException { + public GLEventListener getGLEventListener(final int index) throws IndexOutOfBoundsException { return helper.getGLEventListener(index); } @@ -741,17 +741,17 @@ public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextS } @Override - public boolean getGLEventListenerInitState(GLEventListener listener) { + public boolean getGLEventListenerInitState(final GLEventListener listener) { return helper.getGLEventListenerInitState(listener); } @Override - public void setGLEventListenerInitState(GLEventListener listener, boolean initialized) { + public void setGLEventListenerInitState(final GLEventListener listener, final boolean initialized) { helper.setGLEventListenerInitState(listener, initialized); } @Override - public GLEventListener disposeGLEventListener(GLEventListener listener, boolean remove) { + public GLEventListener disposeGLEventListener(final GLEventListener listener, final boolean remove) { final DisposeGLEventListenerAction r = new DisposeGLEventListenerAction(listener, remove); runInGLThread(r); return r.listener; @@ -781,7 +781,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextS } @Override - public final Thread setExclusiveContextThread(Thread t) throws GLException { + public final Thread setExclusiveContextThread(final Thread t) throws GLException { return helper.setExclusiveContextThread(t, context); } @@ -837,7 +837,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextS } @Override - public GLContext setContext(GLContext newCtx, boolean destroyPrevCtx) { + public GLContext setContext(final GLContext newCtx, final boolean destroyPrevCtx) { final RecursiveLock _lock = lock; _lock.lock(); try { @@ -981,7 +981,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextS action.run(); } - private void runOnEDTIfAvail(boolean wait, final Runnable action) { + private void runOnEDTIfAvail(final boolean wait, final Runnable action) { final Display d = isDisposed() ? null : getDisplay(); if( null == d || d.isDisposed() || d.getThread() == Thread.currentThread() ) { action.run(); @@ -1025,7 +1025,7 @@ public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextS canvas.addGLEventListener(new GLEventListener() { @Override public void init(final GLAutoDrawable drawable) { - GL gl = drawable.getGL(); + final GL gl = drawable.getGL(); System.err.println(JoglVersion.getGLInfo(gl, null)); } @Override diff --git a/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java b/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java index d0de3b3a0..496fb88c0 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java +++ b/src/jogl/classes/com/jogamp/opengl/util/AWTAnimatorImpl.java @@ -54,16 +54,16 @@ import javax.media.opengl.GLAutoDrawable; class AWTAnimatorImpl implements AnimatorBase.AnimatorImpl { // For efficient rendering of Swing components, in particular when // they overlap one another - private List lightweights = new ArrayList(); - private Map repaintManagers = new IdentityHashMap(); - private Map dirtyRegions = new IdentityHashMap(); + private final List lightweights = new ArrayList(); + private final Map repaintManagers = new IdentityHashMap(); + private final Map dirtyRegions = new IdentityHashMap(); @Override - public void display(ArrayList drawables, - boolean ignoreExceptions, - boolean printExceptions) { + public void display(final ArrayList drawables, + final boolean ignoreExceptions, + final boolean printExceptions) { for (int i=0; i 0) { try { SwingUtilities.invokeAndWait(drawWithRepaintManagerRunnable); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } lightweights.clear(); @@ -97,10 +97,10 @@ class AWTAnimatorImpl implements AnimatorBase.AnimatorImpl { // Uses RepaintManager APIs to implement more efficient redrawing of // the Swing widgets we're animating - private Runnable drawWithRepaintManagerRunnable = new Runnable() { + private final Runnable drawWithRepaintManagerRunnable = new Runnable() { @Override public void run() { - for (Iterator iter = lightweights.iterator(); iter.hasNext(); ) { + for (final Iterator iter = lightweights.iterator(); iter.hasNext(); ) { JComponent comp = iter.next(); RepaintManager rm = RepaintManager.currentManager(comp); rm.markCompletelyDirty(comp); @@ -117,13 +117,13 @@ class AWTAnimatorImpl implements AnimatorBase.AnimatorImpl { // Walk up the hierarchy trying to find a non-optimizable // ancestor - Rectangle visible = comp.getVisibleRect(); + final Rectangle visible = comp.getVisibleRect(); int x = visible.x; int y = visible.y; while (comp != null) { x += comp.getX(); y += comp.getY(); - Component c = comp.getParent(); + final Component c = comp.getParent(); if ((c == null) || (!(c instanceof JComponent))) { comp = null; } else { @@ -132,7 +132,7 @@ class AWTAnimatorImpl implements AnimatorBase.AnimatorImpl { rm = RepaintManager.currentManager(comp); repaintManagers.put(rm, rm); // Need to dirty this region - Rectangle dirty = (Rectangle) dirtyRegions.get(comp); + Rectangle dirty = dirtyRegions.get(comp); if (dirty == null) { dirty = new Rectangle(x, y, visible.width, visible.height); dirtyRegions.put(comp, dirty); @@ -150,15 +150,15 @@ class AWTAnimatorImpl implements AnimatorBase.AnimatorImpl { } // Dirty any needed regions on non-optimizable components - for (Iterator iter = dirtyRegions.keySet().iterator(); iter.hasNext(); ) { - JComponent comp = iter.next(); - Rectangle rect = dirtyRegions.get(comp); - RepaintManager rm = RepaintManager.currentManager(comp); + for (final Iterator iter = dirtyRegions.keySet().iterator(); iter.hasNext(); ) { + final JComponent comp = iter.next(); + final Rectangle rect = dirtyRegions.get(comp); + final RepaintManager rm = RepaintManager.currentManager(comp); rm.addDirtyRegion(comp, rect.x, rect.y, rect.width, rect.height); } // Draw all dirty regions - for (Iterator iter = repaintManagers.keySet().iterator(); iter.hasNext(); ) { + for (final Iterator iter = repaintManagers.keySet().iterator(); iter.hasNext(); ) { iter.next().paintDirtyRegions(); } dirtyRegions.clear(); @@ -167,7 +167,7 @@ class AWTAnimatorImpl implements AnimatorBase.AnimatorImpl { }; @Override - public boolean blockUntilDone(Thread thread) { + public boolean blockUntilDone(final Thread thread) { return Thread.currentThread() != thread && !EventQueue.isDispatchThread(); } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/Animator.java b/src/jogl/classes/com/jogamp/opengl/util/Animator.java index 31938612a..ae09d81a4 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/Animator.java +++ b/src/jogl/classes/com/jogamp/opengl/util/Animator.java @@ -78,7 +78,7 @@ public class Animator extends AnimatorBase { /** * Creates a new Animator w/ an associated ThreadGroup. */ - public Animator(ThreadGroup tg) { + public Animator(final ThreadGroup tg) { super(); setThreadGroup(tg); if(DEBUG) { @@ -89,7 +89,7 @@ public class Animator extends AnimatorBase { /** * Creates a new Animator for a particular drawable. */ - public Animator(GLAutoDrawable drawable) { + public Animator(final GLAutoDrawable drawable) { super(); add(drawable); if(DEBUG) { @@ -100,7 +100,7 @@ public class Animator extends AnimatorBase { /** * Creates a new Animator w/ an associated ThreadGroup for a particular drawable. */ - public Animator(ThreadGroup tg, GLAutoDrawable drawable) { + public Animator(final ThreadGroup tg, final GLAutoDrawable drawable) { super(); setThreadGroup(tg); add(drawable); @@ -110,7 +110,7 @@ public class Animator extends AnimatorBase { } @Override - protected final String getBaseName(String prefix) { + protected final String getBaseName(final String prefix) { return prefix + "Animator" ; } @@ -120,7 +120,7 @@ public class Animator extends AnimatorBase { * animation loop which prevents the CPU from getting swamped. * This method may not have an effect on subclasses. */ - public final synchronized void setRunAsFastAsPossible(boolean runFast) { + public final synchronized void setRunAsFastAsPossible(final boolean runFast) { runAsFastAsPossible = runFast; } @@ -151,7 +151,7 @@ public class Animator extends AnimatorBase { if( drawablesEmpty ) { pauseIssued = true; } - boolean wasPaused = pauseIssued; + final boolean wasPaused = pauseIssued; if (DEBUG) { System.err.println("Animator pause on " + animThread.getName() + ": " + toString()); } @@ -164,7 +164,7 @@ public class Animator extends AnimatorBase { Animator.this.notifyAll(); try { Animator.this.wait(); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { } if (wasPaused) { // resume from pause -> reset counter @@ -192,7 +192,7 @@ public class Animator extends AnimatorBase { Thread.yield(); } } - } catch( ThreadDeath td) { + } catch( final ThreadDeath td) { if(DEBUG) { System.err.println("Animator caught: "+td.getClass().getName()+": "+td.getMessage()); td.printStackTrace(); @@ -232,7 +232,7 @@ public class Animator extends AnimatorBase { * @param tg the {@link ThreadGroup} * @throws GLException if the animator has already been started */ - public final synchronized void setThreadGroup(ThreadGroup tg) throws GLException { + public final synchronized void setThreadGroup(final ThreadGroup tg) throws GLException { if ( isStarted() ) { throw new GLException("Animator already started."); } @@ -248,7 +248,7 @@ public class Animator extends AnimatorBase { runnable = new MainLoop(); } fpsCounter.resetFPSCounter(); - String threadName = getThreadName()+"-"+baseName; + final String threadName = getThreadName()+"-"+baseName; Thread thread; if(null==threadGroup) { thread = new Thread(runnable, threadName); diff --git a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java index 39643744a..68a48381e 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java +++ b/src/jogl/classes/com/jogamp/opengl/util/AnimatorBase.java @@ -92,7 +92,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { Class clazz; try { clazz = Class.forName("com.jogamp.opengl.util.AWTAnimatorImpl"); - } catch (Exception e) { + } catch (final Exception e) { clazz = null; } awtAnimatorImplClazz = clazz; @@ -112,7 +112,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { drawablesEmpty = true; } - private static final boolean useAWTAnimatorImpl(int modeBits) { + private static final boolean useAWTAnimatorImpl(final int modeBits) { return 0 != ( MODE_EXPECT_AWT_RENDERING_THREAD & modeBits ) && null != awtAnimatorImplClazz; } @@ -126,13 +126,13 @@ public abstract class AnimatorBase implements GLAnimatorControl { * * @throws GLException if Animator is {@link #isStarted()} */ - protected final synchronized void initImpl(boolean force) { + protected final synchronized void initImpl(final boolean force) { if( force || null == impl ) { if( useAWTAnimatorImpl( modeBits ) ) { try { impl = (AnimatorImpl) awtAnimatorImplClazz.newInstance(); baseName = getBaseName("AWT"); - } catch (Exception e) { e.printStackTrace(); } + } catch (final Exception e) { e.printStackTrace(); } } if( null == impl ) { impl = new DefaultAnimatorImpl(); @@ -154,7 +154,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { * @throws GLException if Animator is {@link #isStarted()} and {@link #MODE_EXPECT_AWT_RENDERING_THREAD} about to change * @see AnimatorBase#MODE_EXPECT_AWT_RENDERING_THREAD */ - public final synchronized void setModeBits(boolean enable, int bitValues) throws GLException { + public final synchronized void setModeBits(final boolean enable, final int bitValues) throws GLException { final int _oldModeBits = modeBits; if(enable) { modeBits |= bitValues; @@ -225,7 +225,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { } } - boolean paused = pause(); + final boolean paused = pause(); drawables.remove(drawable); drawablesEmpty = drawables.size() == 0; drawable.setAnimator(null); @@ -267,7 +267,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { * @see #isExclusiveContextEnabled() */ // @Override - public final synchronized Thread setExclusiveContext(Thread t) { + public final synchronized Thread setExclusiveContext(final Thread t) { final boolean enable = null != t; final Thread old = userExclusiveContextThread; if( enable && t != animThread ) { // disable: will be cleared at end after propagation && filter out own animThread usae @@ -299,7 +299,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { * @see #isExclusiveContextEnabled() */ // @Override - public final boolean setExclusiveContext(boolean enable) { + public final boolean setExclusiveContext(final boolean enable) { final boolean propagateState; final boolean oldExclusiveContext; final Thread _exclusiveContextThread; @@ -324,7 +324,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { while( 0 */ - protected final synchronized void setDrawablesExclCtxState(boolean enable) { + protected final synchronized void setDrawablesExclCtxState(final boolean enable) { if(DEBUG) { System.err.println("AnimatorBase.setExclusiveContextImpl exlusive "+exclusiveContext+": Enable "+enable+" for "+this+" - "+Thread.currentThread()); // Thread.dumpStack(); @@ -388,12 +388,12 @@ public abstract class AnimatorBase implements GLAnimatorControl { for (int i=0; i0
, method will wait for the given pollPeriod in milliseconds. * @return true if {@link Condition#eval() waitCondition.eval()} returned false, otherwise false. */ - protected final synchronized boolean finishLifecycleAction(Condition waitCondition, long pollPeriod) { + protected final synchronized boolean finishLifecycleAction(final Condition waitCondition, long pollPeriod) { /** * It's hard to tell whether the thread which changes the lifecycle has * dependencies on the Animator's internal thread. Currently we @@ -519,7 +519,7 @@ public abstract class AnimatorBase implements GLAnimatorControl { notifyAll(); try { wait(pollPeriod); - } catch (InterruptedException ie) { } + } catch (final InterruptedException ie) { } remaining -= System.currentTimeMillis() - t1 ; nok = waitCondition.eval(); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java b/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java index a9c6e6456..7fa4011f8 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java +++ b/src/jogl/classes/com/jogamp/opengl/util/DefaultAnimatorImpl.java @@ -42,14 +42,14 @@ import javax.media.opengl.GLAutoDrawable; class DefaultAnimatorImpl implements AnimatorBase.AnimatorImpl { @Override - public void display(ArrayList drawables, - boolean ignoreExceptions, - boolean printExceptions) { + public void display(final ArrayList drawables, + final boolean ignoreExceptions, + final boolean printExceptions) { for (int i=0; iFPSAnimator(null, fps)
. */ - public FPSAnimator(int fps) { + public FPSAnimator(final int fps) { this(null, fps); } @@ -79,21 +79,21 @@ public class FPSAnimator extends AnimatorBase { value and a flag indicating whether to use fixed-rate scheduling. Equivalent to FPSAnimator(null, fps, scheduleAtFixedRate). */ - public FPSAnimator(int fps, boolean scheduleAtFixedRate) { + public FPSAnimator(final int fps, final boolean scheduleAtFixedRate) { this(null, fps, scheduleAtFixedRate); } /** Creates an FPSAnimator with a given target frames-per-second value and an initial drawable to animate. Equivalent to FPSAnimator(null, fps, false). */ - public FPSAnimator(GLAutoDrawable drawable, int fps) { + public FPSAnimator(final GLAutoDrawable drawable, final int fps) { this(drawable, fps, false); } /** Creates an FPSAnimator with a given target frames-per-second value, an initial drawable to animate, and a flag indicating whether to use fixed-rate scheduling. */ - public FPSAnimator(GLAutoDrawable drawable, int fps, boolean scheduleAtFixedRate) { + public FPSAnimator(final GLAutoDrawable drawable, final int fps, final boolean scheduleAtFixedRate) { super(); this.fps = fps; if (drawable != null) { @@ -106,7 +106,7 @@ public class FPSAnimator extends AnimatorBase { * @param fps * @throws GLException if the animator has already been started */ - public final synchronized void setFPS(int fps) throws GLException { + public final synchronized void setFPS(final int fps) throws GLException { if ( isStarted() ) { throw new GLException("Animator already started."); } @@ -122,7 +122,7 @@ public class FPSAnimator extends AnimatorBase { public MainTask() { } - public void start(Timer timer) { + public void start(final Timer timer) { fpsCounter.resetFPSCounter(); shouldRun = true; shouldStop = false; diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java index a58eb82cd..1a9ec2782 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataClient.java @@ -69,11 +69,11 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData * * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int) */ - public static GLArrayDataClient createFixed(int index, int comps, int dataType, boolean normalized, int initialElementCount) + public static GLArrayDataClient createFixed(final int index, final int comps, final int dataType, final boolean normalized, final int initialElementCount) throws GLException { - GLArrayDataClient adc = new GLArrayDataClient(); - GLArrayHandler glArrayHandler = new GLFixedArrayHandler(adc); + final GLArrayDataClient adc = new GLArrayDataClient(); + final GLArrayHandler glArrayHandler = new GLFixedArrayHandler(adc); adc.init(null, index, comps, dataType, normalized, 0, null, initialElementCount, 0 /* mappedElementCount */, false, glArrayHandler, 0, 0, 0, 0, false); return adc; } @@ -99,12 +99,12 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData * * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int) */ - public static GLArrayDataClient createFixed(int index, int comps, int dataType, boolean normalized, int stride, - Buffer buffer) + public static GLArrayDataClient createFixed(final int index, final int comps, final int dataType, final boolean normalized, final int stride, + final Buffer buffer) throws GLException { - GLArrayDataClient adc = new GLArrayDataClient(); - GLArrayHandler glArrayHandler = new GLFixedArrayHandler(adc); + final GLArrayDataClient adc = new GLArrayDataClient(); + final GLArrayHandler glArrayHandler = new GLFixedArrayHandler(adc); adc.init(null, index, comps, dataType, normalized, stride, buffer, comps*comps, 0 /* mappedElementCount */, false, glArrayHandler, 0, 0, 0, 0, false); return adc; } @@ -118,12 +118,12 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData * @param normalized Whether the data shall be normalized * @param initialElementCount */ - public static GLArrayDataClient createGLSL(String name, int comps, - int dataType, boolean normalized, int initialElementCount) + public static GLArrayDataClient createGLSL(final String name, final int comps, + final int dataType, final boolean normalized, final int initialElementCount) throws GLException { - GLArrayDataClient adc = new GLArrayDataClient(); - GLArrayHandler glArrayHandler = new GLSLArrayHandler(adc); + final GLArrayDataClient adc = new GLArrayDataClient(); + final GLArrayHandler glArrayHandler = new GLSLArrayHandler(adc); adc.init(name, -1, comps, dataType, normalized, 0, null, initialElementCount, 0 /* mappedElementCount */, true, glArrayHandler, 0, 0, 0, 0, true); return adc; } @@ -138,18 +138,18 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData * @param stride * @param buffer the user define data */ - public static GLArrayDataClient createGLSL(String name, int comps, - int dataType, boolean normalized, int stride, Buffer buffer) + public static GLArrayDataClient createGLSL(final String name, final int comps, + final int dataType, final boolean normalized, final int stride, final Buffer buffer) throws GLException { - GLArrayDataClient adc = new GLArrayDataClient(); - GLArrayHandler glArrayHandler = new GLSLArrayHandler(adc); + final GLArrayDataClient adc = new GLArrayDataClient(); + final GLArrayHandler glArrayHandler = new GLSLArrayHandler(adc); adc.init(name, -1, comps, dataType, normalized, stride, buffer, comps*comps, 0 /* mappedElementCount */, true, glArrayHandler, 0, 0, 0, 0, true); return adc; } @Override - public void associate(Object obj, boolean enable) { + public void associate(final Object obj, final boolean enable) { if(obj instanceof ShaderState) { if(enable) { shaderState = (ShaderState)obj; @@ -177,30 +177,30 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData // @Override - public final void setVBOWritten(boolean written) { + public final void setVBOWritten(final boolean written) { bufferWritten = ( 0 == mappedElementCount ) ? written : true; } @Override - public void destroy(GL gl) { + public void destroy(final GL gl) { reset(gl); super.destroy(gl); } @Override - public void reset(GL gl) { + public void reset(final GL gl) { enableBuffer(gl, false); reset(); } @Override - public void seal(GL gl, boolean seal) { + public void seal(final GL gl, final boolean seal) { seal(seal); enableBuffer(gl, seal); } @Override - public void enableBuffer(GL gl, boolean enable) { + public void enableBuffer(final GL gl, final boolean enable) { if( enableBufferAlways || bufferEnabled != enable ) { if(enable) { checkSeal(true); @@ -213,7 +213,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData } @Override - public boolean bindBuffer(GL gl, boolean bind) { + public boolean bindBuffer(final GL gl, final boolean bind) { if(bind) { checkSeal(true); // init/generate VBO name if not done yet @@ -223,7 +223,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData } @Override - public void setEnableAlways(boolean always) { + public void setEnableAlways(final boolean always) { enableBufferAlways = always; } @@ -242,7 +242,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData } @Override - public void seal(boolean seal) + public void seal(final boolean seal) { if( sealed == seal ) return; sealed = seal; @@ -281,7 +281,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData * The arguments remaining elements must be a multiple of this arrays element stride. */ @Override - public void put(Buffer v) { + public void put(final Buffer v) { if ( sealed ) return; /** FIXME: isn't true for interleaved arrays ! if(0!=(v.remaining() % strideL)) { @@ -292,33 +292,33 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData } @Override - public void putb(byte v) { + public void putb(final byte v) { if ( sealed ) return; growBufferIfNecessary(1); Buffers.putb(buffer, v); } @Override - public void puts(short v) { + public void puts(final short v) { if ( sealed ) return; growBufferIfNecessary(1); Buffers.puts(buffer, v); } @Override - public void puti(int v) { + public void puti(final int v) { if ( sealed ) return; growBufferIfNecessary(1); Buffers.puti(buffer, v); } @Override - public void putx(int v) { + public void putx(final int v) { puti(v); } @Override - public void putf(float v) { + public void putf(final float v) { if ( sealed ) return; growBufferIfNecessary(1); Buffers.putf(buffer, v); @@ -349,7 +349,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData // non public matters - protected final boolean growBufferIfNecessary(int spareComponents) { + protected final boolean growBufferIfNecessary(final int spareComponents) { if( buffer==null || buffer.remaining() */ - public GLArrayDataClient(GLArrayDataClient src) { + public GLArrayDataClient(final GLArrayDataClient src) { super(src); this.isValidated = src.isValidated; this.sealed = src.sealed; @@ -481,7 +481,7 @@ public class GLArrayDataClient extends GLArrayDataWrapper implements GLArrayData try { final Constructor ctor = clazz.getConstructor(GLArrayDataEditable.class); this.glArrayHandler = ctor.newInstance(this); - } catch (Exception e) { + } catch (final Exception e) { throw new RuntimeException("Could not ctor "+clazz.getName()+"("+this.getClass().getName()+")", e); } } else { diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java index 833f1ccda..51c55e326 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataServer.java @@ -81,12 +81,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int) */ - public static GLArrayDataServer createFixed(int index, int compsPerElement, int dataType, boolean normalized, int stride, - Buffer buffer, int vboUsage) + public static GLArrayDataServer createFixed(final int index, final int compsPerElement, final int dataType, final boolean normalized, final int stride, + final Buffer buffer, final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLFixedArrayHandler(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLFixedArrayHandler(ads); ads.init(null, index, compsPerElement, dataType, normalized, stride, buffer, buffer.limit(), 0 /* mappedElementCount */, false, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, false); return ads; @@ -113,12 +113,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * * @see javax.media.opengl.GLContext#getPredefinedArrayIndexName(int) */ - public static GLArrayDataServer createFixed(int index, int compsPerElement, int dataType, boolean normalized, int initialElementCount, - int vboUsage) + public static GLArrayDataServer createFixed(final int index, final int compsPerElement, final int dataType, final boolean normalized, final int initialElementCount, + final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLFixedArrayHandler(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLFixedArrayHandler(ads); ads.init(null, index, compsPerElement, dataType, normalized, 0, null, initialElementCount, 0 /* mappedElementCount */, false, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, false); return ads; @@ -134,12 +134,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param initialElementCount * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public static GLArrayDataServer createGLSL(String name, int compsPerElement, - int dataType, boolean normalized, int initialElementCount, int vboUsage) + public static GLArrayDataServer createGLSL(final String name, final int compsPerElement, + final int dataType, final boolean normalized, final int initialElementCount, final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLSLArrayHandler(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLSLArrayHandler(ads); ads.init(name, -1, compsPerElement, dataType, normalized, 0, null, initialElementCount, 0 /* mappedElementCount */, true, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true); return ads; @@ -155,12 +155,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param mappedElementCount * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public static GLArrayDataServer createGLSLMapped(String name, int compsPerElement, - int dataType, boolean normalized, int mappedElementCount, int vboUsage) + public static GLArrayDataServer createGLSLMapped(final String name, final int compsPerElement, + final int dataType, final boolean normalized, final int mappedElementCount, final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLSLArrayHandler(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLSLArrayHandler(ads); ads.init(name, -1, compsPerElement, dataType, normalized, 0, null, 0 /* initialElementCount */, mappedElementCount, true, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true); ads.seal(true); @@ -178,13 +178,13 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param buffer the user define data * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public static GLArrayDataServer createGLSL(String name, int compsPerElement, - int dataType, boolean normalized, int stride, Buffer buffer, - int vboUsage) + public static GLArrayDataServer createGLSL(final String name, final int compsPerElement, + final int dataType, final boolean normalized, final int stride, final Buffer buffer, + final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLSLArrayHandler(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLSLArrayHandler(ads); ads.init(name, -1, compsPerElement, dataType, normalized, stride, buffer, buffer.limit(), 0 /* mappedElementCount */, true, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true); return ads; @@ -203,12 +203,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param vboTarget {@link GL#GL_ELEMENT_ARRAY_BUFFER}, .. * {@link GL#glGenBuffers(int, int[], int) */ - public static GLArrayDataServer createData(int compsPerElement, int dataType, int stride, - Buffer buffer, int vboUsage, int vboTarget) + public static GLArrayDataServer createData(final int compsPerElement, final int dataType, final int stride, + final Buffer buffer, final int vboUsage, final int vboTarget) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLDataArrayHandler(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLDataArrayHandler(ads); ads.init(null, -1, compsPerElement, dataType, false, stride, buffer, buffer.limit(), 0 /* mappedElementCount */, false, glArrayHandler, 0, 0, vboUsage, vboTarget, false); return ads; @@ -225,12 +225,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} * @param vboTarget {@link GL#GL_ELEMENT_ARRAY_BUFFER}, .. */ - public static GLArrayDataServer createData(int compsPerElement, int dataType, int initialElementCount, - int vboUsage, int vboTarget) + public static GLArrayDataServer createData(final int compsPerElement, final int dataType, final int initialElementCount, + final int vboUsage, final int vboTarget) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLDataArrayHandler(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLDataArrayHandler(ads); ads.init(null, -1, compsPerElement, dataType, false, 0, null, initialElementCount, 0 /* mappedElementCount */, false, glArrayHandler, 0, 0, vboUsage, vboTarget, false); return ads; @@ -249,12 +249,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} * @param vboTarget {@link GL#GL_ELEMENT_ARRAY_BUFFER}, .. */ - public static GLArrayDataServer createDataMapped(int compsPerElement, int dataType, int mappedElementCount, - int vboUsage, int vboTarget) + public static GLArrayDataServer createDataMapped(final int compsPerElement, final int dataType, final int mappedElementCount, + final int vboUsage, final int vboTarget) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLDataArrayHandler(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLDataArrayHandler(ads); ads.init(null, -1, compsPerElement, dataType, false, 0, null, 0 /* initialElementCount */, mappedElementCount, false, glArrayHandler, 0, 0, vboUsage, vboTarget, false); return ads; @@ -271,12 +271,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param initialElementCount The initial number of all interleaved elements * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public static GLArrayDataServer createFixedInterleaved(int compsPerElement, int dataType, boolean normalized, int initialElementCount, - int vboUsage) + public static GLArrayDataServer createFixedInterleaved(final int compsPerElement, final int dataType, final boolean normalized, final int initialElementCount, + final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLArrayHandlerInterleaved(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLArrayHandlerInterleaved(ads); ads.init(GLPointerFuncUtil.mgl_InterleaveArray, -1, compsPerElement, dataType, false, 0, null, initialElementCount, 0 /* mappedElementCount */, false, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, false); return ads; @@ -293,12 +293,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param mappedElementCount The total number of all interleaved elements * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public static GLArrayDataServer createFixedInterleavedMapped(int compsPerElement, int dataType, boolean normalized, int mappedElementCount, - int vboUsage) + public static GLArrayDataServer createFixedInterleavedMapped(final int compsPerElement, final int dataType, final boolean normalized, final int mappedElementCount, + final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLArrayHandlerInterleaved(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLArrayHandlerInterleaved(ads); ads.init(GLPointerFuncUtil.mgl_InterleaveArray, -1, compsPerElement, dataType, false, 0, null, 0 /* initialElementCount */, mappedElementCount, false, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, false); ads.seal(true); @@ -317,12 +317,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param buffer The user define data of all interleaved elements * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public static GLArrayDataServer createFixedInterleaved(int compsPerElement, int dataType, boolean normalized, int stride, Buffer buffer, - int vboUsage) + public static GLArrayDataServer createFixedInterleaved(final int compsPerElement, final int dataType, final boolean normalized, final int stride, final Buffer buffer, + final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLArrayHandlerInterleaved(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLArrayHandlerInterleaved(ads); ads.init(GLPointerFuncUtil.mgl_InterleaveArray, -1, compsPerElement, dataType, normalized, stride, buffer, buffer.limit(), 0 /* mappedElementCount */, false, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, false); return ads; @@ -342,7 +342,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param comps This interleaved array segment's component count per element * @param vboTarget {@link GL#GL_ARRAY_BUFFER} or {@link GL#GL_ELEMENT_ARRAY_BUFFER} */ - public GLArrayData addFixedSubArray(int index, int comps, int vboTarget) { + public GLArrayData addFixedSubArray(final int index, final int comps, final int vboTarget) { if(interleavedOffset >= getComponentCount() * getComponentSizeInBytes()) { final int iOffC = interleavedOffset / getComponentSizeInBytes(); throw new GLException("Interleaved offset > total components ("+iOffC+" > "+getComponentCount()+")"); @@ -382,12 +382,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param initialElementCount The initial number of all interleaved elements * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public static GLArrayDataServer createGLSLInterleaved(int compsPerElement, int dataType, boolean normalized, int initialElementCount, - int vboUsage) + public static GLArrayDataServer createGLSLInterleaved(final int compsPerElement, final int dataType, final boolean normalized, final int initialElementCount, + final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLSLArrayHandlerInterleaved(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLSLArrayHandlerInterleaved(ads); ads.init(GLPointerFuncUtil.mgl_InterleaveArray, -1, compsPerElement, dataType, normalized, 0, null, initialElementCount, 0 /* mappedElementCount */, false, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true); return ads; @@ -404,11 +404,11 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param mappedElementCount The total number of all interleaved elements * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public static GLArrayDataServer createGLSLInterleavedMapped(int compsPerElement, int dataType, boolean normalized, int mappedElementCount, int vboUsage) + public static GLArrayDataServer createGLSLInterleavedMapped(final int compsPerElement, final int dataType, final boolean normalized, final int mappedElementCount, final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLSLArrayHandlerInterleaved(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLSLArrayHandlerInterleaved(ads); ads.init(GLPointerFuncUtil.mgl_InterleaveArray, -1, compsPerElement, dataType, normalized, 0, null, 0 /* initialElementCount */, mappedElementCount, false, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true); ads.seal(true); @@ -427,12 +427,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param buffer The user define data of all interleaved elements * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public static GLArrayDataServer createGLSLInterleaved(int compsPerElement, int dataType, boolean normalized, int stride, Buffer buffer, - int vboUsage) + public static GLArrayDataServer createGLSLInterleaved(final int compsPerElement, final int dataType, final boolean normalized, final int stride, final Buffer buffer, + final int vboUsage) throws GLException { - GLArrayDataServer ads = new GLArrayDataServer(); - GLArrayHandler glArrayHandler = new GLSLArrayHandlerInterleaved(ads); + final GLArrayDataServer ads = new GLArrayDataServer(); + final GLArrayHandler glArrayHandler = new GLSLArrayHandlerInterleaved(ads); ads.init(GLPointerFuncUtil.mgl_InterleaveArray, -1, compsPerElement, dataType, normalized, stride, buffer, buffer.limit(), 0 /* mappedElementCount */, false, glArrayHandler, 0, 0, vboUsage, GL.GL_ARRAY_BUFFER, true); return ads; @@ -451,7 +451,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * @param comps This interleaved array segment's component count per element * @param vboTarget {@link GL#GL_ARRAY_BUFFER} or {@link GL#GL_ELEMENT_ARRAY_BUFFER} */ - public GLArrayData addGLSLSubArray(String name, int comps, int vboTarget) { + public GLArrayData addGLSLSubArray(final String name, final int comps, final int vboTarget) { if(interleavedOffset >= getComponentCount() * getComponentSizeInBytes()) { final int iOffC = interleavedOffset / getComponentSizeInBytes(); throw new GLException("Interleaved offset > total components ("+iOffC+" > "+getComponentCount()+")"); @@ -480,7 +480,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE return ad; } - public final void setInterleavedOffset(int interleavedOffset) { + public final void setInterleavedOffset(final int interleavedOffset) { this.interleavedOffset = interleavedOffset; } @@ -497,11 +497,11 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE // @Override - public void destroy(GL gl) { + public void destroy(final GL gl) { // super.destroy(gl): // - GLArrayDataClient.destroy(gl): disables & clears client-side buffer // - GLArrayDataWrapper.destroy(gl) (clears all values 'vboName' ..) - int _vboName = vboName; + final int _vboName = vboName; super.destroy(gl); if(_vboName!=0) { final int[] tmp = new int[] { _vboName } ; @@ -520,12 +520,12 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * Only possible if buffer is defined. */ @Override - public void setVBOEnabled(boolean vboUsage) { + public void setVBOEnabled(final boolean vboUsage) { checkSeal(false); super.setVBOEnabled(vboUsage); } - public GLBufferStorage mapStorage(GL gl, int access) { + public GLBufferStorage mapStorage(final GL gl, final int access) { if( null != this.getBuffer() ) { throw new IllegalStateException("user buffer not null"); } @@ -542,7 +542,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE rewind(); return storage; } - public GLBufferStorage mapStorage(GL gl, long offset, long length, int access) { + public GLBufferStorage mapStorage(final GL gl, final long offset, final long length, final int access) { if( null != this.getBuffer() ) { throw new IllegalStateException("user buffer not null"); } @@ -559,7 +559,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE rewind(); return storage; } - private final void setMappedBuffer(GLBufferStorage storage) { + private final void setMappedBuffer(final GLBufferStorage storage) { mappedStorage = storage; final ByteBuffer bb = storage.getMappedBuffer(); if(componentClazz==ByteBuffer.class) { @@ -575,7 +575,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE } } - public void unmapStorage(GL gl) { + public void unmapStorage(final GL gl) { if( null == mappedStorage ) { throw new IllegalStateException("not mapped"); } @@ -621,10 +621,10 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE // @Override - protected void init(String name, int index, int comps, int dataType, boolean normalized, - int stride, Buffer data, int initialElementCount, int mappedElementCount, - boolean isVertexAttribute, - GLArrayHandler glArrayHandler, int vboName, long vboOffset, int vboUsage, int vboTarget, boolean usesGLSL) + protected void init(final String name, final int index, final int comps, final int dataType, final boolean normalized, + final int stride, final Buffer data, final int initialElementCount, final int mappedElementCount, + final boolean isVertexAttribute, + final GLArrayHandler glArrayHandler, final int vboName, final long vboOffset, final int vboUsage, final int vboTarget, final boolean usesGLSL) throws GLException { super.init(name, index, comps, dataType, normalized, stride, data, initialElementCount, mappedElementCount, isVertexAttribute, @@ -634,10 +634,10 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE } @Override - protected void init_vbo(GL gl) { + protected void init_vbo(final GL gl) { super.init_vbo(gl); if(vboEnabled && vboName==0) { - int[] tmp = new int[1]; + final int[] tmp = new int[1]; gl.glGenBuffers(1, tmp, 0); vboName = tmp[0]; if(0 < interleavedOffset) { @@ -657,7 +657,7 @@ public class GLArrayDataServer extends GLArrayDataClient implements GLArrayDataE * All other values are simply copied. *

*/ - public GLArrayDataServer(GLArrayDataServer src) { + public GLArrayDataServer(final GLArrayDataServer src) { super(src); this.interleavedOffset = src.interleavedOffset; this.mappedStorage = src.mappedStorage; diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java index f617fed73..867bc00ac 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLArrayDataWrapper.java @@ -66,11 +66,11 @@ public class GLArrayDataWrapper implements GLArrayData { * * @throws GLException */ - public static GLArrayDataWrapper createFixed(int index, int comps, int dataType, boolean normalized, int stride, - Buffer buffer, int vboName, long vboOffset, int vboUsage, int vboTarget) + public static GLArrayDataWrapper createFixed(final int index, final int comps, final int dataType, final boolean normalized, final int stride, + final Buffer buffer, final int vboName, final long vboOffset, final int vboUsage, final int vboTarget) throws GLException { - GLArrayDataWrapper adc = new GLArrayDataWrapper(); + final GLArrayDataWrapper adc = new GLArrayDataWrapper(); adc.init(null, index, comps, dataType, normalized, stride, buffer, 0 /* mappedElementCount */, false, vboName, vboOffset, vboUsage, vboTarget); return adc; @@ -93,11 +93,11 @@ public class GLArrayDataWrapper implements GLArrayData { * * @throws GLException */ - public static GLArrayDataWrapper createFixed(int index, int comps, int dataType, boolean normalized, int stride, - int mappedElementCount, int vboName, long vboOffset, int vboUsage, int vboTarget) + public static GLArrayDataWrapper createFixed(final int index, final int comps, final int dataType, final boolean normalized, final int stride, + final int mappedElementCount, final int vboName, final long vboOffset, final int vboUsage, final int vboTarget) throws GLException { - GLArrayDataWrapper adc = new GLArrayDataWrapper(); + final GLArrayDataWrapper adc = new GLArrayDataWrapper(); adc.init(null, index, comps, dataType, normalized, stride, null, mappedElementCount, false, vboName, vboOffset, vboUsage, vboTarget); return adc; @@ -119,11 +119,11 @@ public class GLArrayDataWrapper implements GLArrayData { * @return the new create instance * @throws GLException */ - public static GLArrayDataWrapper createGLSL(String name, int comps, int dataType, boolean normalized, int stride, - Buffer buffer, int vboName, long vboOffset, int vboUsage, int vboTarget) + public static GLArrayDataWrapper createGLSL(final String name, final int comps, final int dataType, final boolean normalized, final int stride, + final Buffer buffer, final int vboName, final long vboOffset, final int vboUsage, final int vboTarget) throws GLException { - GLArrayDataWrapper adc = new GLArrayDataWrapper(); + final GLArrayDataWrapper adc = new GLArrayDataWrapper(); adc.init(name, -1, comps, dataType, normalized, stride, buffer, 0 /* mappedElementCount */, true, vboName, vboOffset, vboUsage, vboTarget); return adc; @@ -145,11 +145,11 @@ public class GLArrayDataWrapper implements GLArrayData { * @return the new create instance * @throws GLException */ - public static GLArrayDataWrapper createGLSL(String name, int comps, int dataType, boolean normalized, int stride, - int mappedElementCount, int vboName, long vboOffset, int vboUsage, int vboTarget) + public static GLArrayDataWrapper createGLSL(final String name, final int comps, final int dataType, final boolean normalized, final int stride, + final int mappedElementCount, final int vboName, final long vboOffset, final int vboUsage, final int vboTarget) throws GLException { - GLArrayDataWrapper adc = new GLArrayDataWrapper(); + final GLArrayDataWrapper adc = new GLArrayDataWrapper(); adc.init(name, -1, comps, dataType, normalized, stride, null, mappedElementCount, true, vboName, vboOffset, vboUsage, vboTarget); return adc; @@ -163,7 +163,7 @@ public class GLArrayDataWrapper implements GLArrayData { * @param throwException whether to throw an exception if this instance has invalid parameter or not * @return true if this instance has invalid parameter, otherwise false */ - public final boolean validate(GLProfile glp, boolean throwException) { + public final boolean validate(final GLProfile glp, final boolean throwException) { if(!alive) { if(throwException) { throw new GLException("Instance !alive "+this); @@ -180,7 +180,7 @@ public class GLArrayDataWrapper implements GLArrayData { } @Override - public void associate(Object obj, boolean enable) { + public void associate(final Object obj, final boolean enable) { // nop } @@ -198,16 +198,16 @@ public class GLArrayDataWrapper implements GLArrayData { public final int getLocation() { return location; } @Override - public final int setLocation(int v) { location = v; return location; } + public final int setLocation(final int v) { location = v; return location; } @Override - public final int setLocation(GL2ES2 gl, int program) { + public final int setLocation(final GL2ES2 gl, final int program) { location = gl.glGetAttribLocation(program, name); return location; } @Override - public final int setLocation(GL2ES2 gl, int program, int location) { + public final int setLocation(final GL2ES2 gl, final int program, final int location) { this.location = location; gl.glBindAttribLocation(program, location, name); return location; @@ -275,7 +275,7 @@ public class GLArrayDataWrapper implements GLArrayData { public final Class getBufferClass() { return componentClazz; } @Override - public void destroy(GL gl) { + public void destroy(final GL gl) { buffer = null; vboName=0; vboEnabled=false; @@ -305,7 +305,7 @@ public class GLArrayDataWrapper implements GLArrayData { "]"; } - public static final Class getBufferClass(int dataType) { + public static final Class getBufferClass(final int dataType) { switch(dataType) { case GL.GL_BYTE: case GL.GL_UNSIGNED_BYTE: @@ -314,7 +314,7 @@ public class GLArrayDataWrapper implements GLArrayData { case GL.GL_UNSIGNED_SHORT: return ShortBuffer.class; case GL.GL_UNSIGNED_INT: - case GL2ES1.GL_FIXED: + case GL.GL_FIXED: case GL2ES2.GL_INT: return IntBuffer.class; case GL.GL_FLOAT: @@ -325,7 +325,7 @@ public class GLArrayDataWrapper implements GLArrayData { } @Override - public void setName(String newName) { + public void setName(final String newName) { location = -1; name = newName; } @@ -335,7 +335,7 @@ public class GLArrayDataWrapper implements GLArrayData { * Only possible if a VBO buffer name is defined. * @see #setVBOName(int) */ - public void setVBOEnabled(boolean vboEnabled) { + public void setVBOEnabled(final boolean vboEnabled) { this.vboEnabled=vboEnabled; } @@ -345,7 +345,7 @@ public class GLArrayDataWrapper implements GLArrayData { * * @see #setVBOEnabled(boolean) */ - public void setVBOName(int vboName) { + public void setVBOName(final int vboName) { this.vboName=vboName; setVBOEnabled(0!=vboName); } @@ -353,20 +353,20 @@ public class GLArrayDataWrapper implements GLArrayData { /** * @param vboUsage {@link GL2ES2#GL_STREAM_DRAW}, {@link GL#GL_STATIC_DRAW} or {@link GL#GL_DYNAMIC_DRAW} */ - public void setVBOUsage(int vboUsage) { + public void setVBOUsage(final int vboUsage) { this.vboUsage = vboUsage; } /** * @param vboTarget either {@link GL#GL_ARRAY_BUFFER} or {@link GL#GL_ELEMENT_ARRAY_BUFFER} */ - public void setVBOTarget(int vboTarget) { + public void setVBOTarget(final int vboTarget) { this.vboTarget = vboTarget; } - protected void init(String name, int index, int componentsPerElement, int componentType, - boolean normalized, int stride, Buffer data, int mappedElementCount, - boolean isVertexAttribute, int vboName, long vboOffset, int vboUsage, int vboTarget) + protected void init(final String name, final int index, final int componentsPerElement, final int componentType, + final boolean normalized, final int stride, final Buffer data, final int mappedElementCount, + final boolean isVertexAttribute, final int vboName, final long vboOffset, final int vboUsage, final int vboTarget) throws GLException { if( 0 */ - public GLArrayDataWrapper(GLArrayDataWrapper src) { + public GLArrayDataWrapper(final GLArrayDataWrapper src) { this.alive = src.alive; this.index = src.index; this.location = src.location; diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java index b9903ac6d..67dc08450 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLBuffers.java @@ -44,6 +44,7 @@ import java.nio.ByteBuffer; import javax.media.opengl.GL; import javax.media.opengl.GL2; import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2ES3; import javax.media.opengl.GL2GL3; import javax.media.opengl.GLES2; import javax.media.opengl.GLException; @@ -65,7 +66,7 @@ public class GLBuffers extends Buffers { * GL_UNSIGNED_INT,
* GL_HILO16_NV
*/ - public static final boolean isSignedGLType(int glType) { + public static final boolean isSignedGLType(final int glType) { switch (glType) { // 29 case GL.GL_UNSIGNED_BYTE: case GL.GL_UNSIGNED_SHORT: @@ -85,7 +86,7 @@ public class GLBuffers extends Buffers { * GL_HALF_FLOAT_OES,
* GL_DOUBLE
*/ - public static final boolean isGLTypeFixedPoint(int glType) { + public static final boolean isGLTypeFixedPoint(final int glType) { switch(glType) { case GL.GL_FLOAT: case GL.GL_HALF_FLOAT: @@ -123,7 +124,7 @@ public class GLBuffers extends Buffers { * * @return -1 if glType is unhandled, otherwise the actual value > 0 */ - public static final int sizeOfGLType(int glType) { + public static final int sizeOfGLType(final int glType) { switch (glType) { // 29 // case GL2.GL_BITMAP: case GL.GL_BYTE: @@ -136,9 +137,9 @@ public class GLBuffers extends Buffers { case GL.GL_UNSIGNED_SHORT: case GL.GL_UNSIGNED_SHORT_5_6_5: case GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV: - case GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4: + case GL.GL_UNSIGNED_SHORT_4_4_4_4: case GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1: + case GL.GL_UNSIGNED_SHORT_5_5_5_1: case GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV: case GL2.GL_UNSIGNED_SHORT_8_8_APPLE: case GL2.GL_UNSIGNED_SHORT_8_8_REV_APPLE: @@ -151,16 +152,16 @@ public class GLBuffers extends Buffers { case GL.GL_UNSIGNED_INT: case GL2GL3.GL_UNSIGNED_INT_8_8_8_8: case GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV: - case GL2GL3.GL_UNSIGNED_INT_10_10_10_2: - case GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV: - case GL2GL3.GL_UNSIGNED_INT_24_8: - case GL2GL3.GL_UNSIGNED_INT_10F_11F_11F_REV: - case GL2GL3.GL_UNSIGNED_INT_5_9_9_9_REV: + case GL2ES2.GL_UNSIGNED_INT_10_10_10_2: + case GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV: + case GL.GL_UNSIGNED_INT_24_8: + case GL.GL_UNSIGNED_INT_10F_11F_11F_REV: + case GL2ES3.GL_UNSIGNED_INT_5_9_9_9_REV: case GL2.GL_HILO16_NV: case GL2.GL_SIGNED_HILO16_NV: return SIZEOF_INT; - case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV: + case GL2ES3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV: return SIZEOF_LONG; case GL.GL_FLOAT: @@ -197,7 +198,7 @@ public class GLBuffers extends Buffers { * * @return null if glType is unhandled, otherwise the new Buffer object */ - public static final Buffer newDirectGLBuffer(int glType, int numElements) { + public static final Buffer newDirectGLBuffer(final int glType, final int numElements) { switch (glType) { // 29 case GL.GL_BYTE: case GL.GL_UNSIGNED_BYTE: @@ -209,9 +210,9 @@ public class GLBuffers extends Buffers { case GL.GL_UNSIGNED_SHORT: case GL.GL_UNSIGNED_SHORT_5_6_5: case GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV: - case GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4: + case GL.GL_UNSIGNED_SHORT_4_4_4_4: case GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1: + case GL.GL_UNSIGNED_SHORT_5_5_5_1: case GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV: case GL2.GL_UNSIGNED_SHORT_8_8_APPLE: case GL2.GL_UNSIGNED_SHORT_8_8_REV_APPLE: @@ -224,22 +225,22 @@ public class GLBuffers extends Buffers { case GL.GL_UNSIGNED_INT: case GL2GL3.GL_UNSIGNED_INT_8_8_8_8: case GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV: - case GL2GL3.GL_UNSIGNED_INT_10_10_10_2: - case GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV: - case GL2GL3.GL_UNSIGNED_INT_24_8: - case GL2GL3.GL_UNSIGNED_INT_10F_11F_11F_REV: - case GL2GL3.GL_UNSIGNED_INT_5_9_9_9_REV: + case GL2ES2.GL_UNSIGNED_INT_10_10_10_2: + case GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV: + case GL.GL_UNSIGNED_INT_24_8: + case GL.GL_UNSIGNED_INT_10F_11F_11F_REV: + case GL2ES3.GL_UNSIGNED_INT_5_9_9_9_REV: case GL2.GL_HILO16_NV: case GL2.GL_SIGNED_HILO16_NV: return newDirectIntBuffer(numElements); - case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV: + case GL2ES3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV: return newDirectLongBuffer(numElements); case GL.GL_FLOAT: return newDirectFloatBuffer(numElements); - case GL2.GL_DOUBLE: + case GL2GL3.GL_DOUBLE: return newDirectDoubleBuffer(numElements); } return null; @@ -269,7 +270,7 @@ public class GLBuffers extends Buffers { * GL_FLOAT, GL_DOUBLE
* @return null if glType is unhandled or parent is null or bufLen is 0, otherwise the new Buffer object */ - public static final Buffer sliceGLBuffer(ByteBuffer parent, int bytePos, int byteLen, int glType) { + public static final Buffer sliceGLBuffer(final ByteBuffer parent, final int bytePos, final int byteLen, final int glType) { if (parent == null || byteLen == 0) { return null; } @@ -292,9 +293,9 @@ public class GLBuffers extends Buffers { case GL.GL_UNSIGNED_SHORT: case GL.GL_UNSIGNED_SHORT_5_6_5: case GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV: - case GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4: + case GL.GL_UNSIGNED_SHORT_4_4_4_4: case GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1: + case GL.GL_UNSIGNED_SHORT_5_5_5_1: case GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV: case GL2.GL_UNSIGNED_SHORT_8_8_APPLE: case GL2.GL_UNSIGNED_SHORT_8_8_REV_APPLE: @@ -304,21 +305,21 @@ public class GLBuffers extends Buffers { break; case GL.GL_FIXED: - case GL2GL3.GL_INT: - case GL2ES2.GL_UNSIGNED_INT: + case GL2ES2.GL_INT: + case GL.GL_UNSIGNED_INT: case GL2GL3.GL_UNSIGNED_INT_8_8_8_8: case GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV: - case GL2GL3.GL_UNSIGNED_INT_10_10_10_2: - case GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV: - case GL2GL3.GL_UNSIGNED_INT_24_8: - case GL2GL3.GL_UNSIGNED_INT_10F_11F_11F_REV: - case GL2GL3.GL_UNSIGNED_INT_5_9_9_9_REV: + case GL2ES2.GL_UNSIGNED_INT_10_10_10_2: + case GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV: + case GL.GL_UNSIGNED_INT_24_8: + case GL.GL_UNSIGNED_INT_10F_11F_11F_REV: + case GL2ES3.GL_UNSIGNED_INT_5_9_9_9_REV: case GL2.GL_HILO16_NV: case GL2.GL_SIGNED_HILO16_NV: res = parent.slice().order(parent.order()).asIntBuffer(); // slice and duplicate may change byte order break; - case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV: + case GL2ES3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV: res = parent.slice().order(parent.order()).asLongBuffer(); // slice and duplicate may change byte order break; @@ -326,7 +327,7 @@ public class GLBuffers extends Buffers { res = parent.slice().order(parent.order()).asFloatBuffer(); // slice and duplicate may change byte order break; - case GL2.GL_DOUBLE: + case GL2GL3.GL_DOUBLE: res = parent.slice().order(parent.order()).asDoubleBuffer(); // slice and duplicate may change byte order break; } @@ -334,7 +335,7 @@ public class GLBuffers extends Buffers { return res; } - private static final int glGetInteger(GL gl, int pname, int[] tmp) { + private static final int glGetInteger(final GL gl, final int pname, final int[] tmp) { gl.glGetIntegerv(pname, tmp, 0); return tmp[0]; } @@ -359,9 +360,9 @@ public class GLBuffers extends Buffers { * @return required minimum size of the buffer in bytes * @throws GLException if alignment is invalid. Please contact the maintainer if this is our bug. */ - public static final int sizeof(GL gl, int tmp[], - int bytesPerPixel, int width, int height, int depth, - boolean pack) { + public static final int sizeof(final GL gl, final int tmp[], + final int bytesPerPixel, int width, int height, int depth, + final boolean pack) { int rowLength = 0; int skipRows = 0; int skipPixels = 0; @@ -372,9 +373,9 @@ public class GLBuffers extends Buffers { if (pack) { alignment = glGetInteger(gl, GL.GL_PACK_ALIGNMENT, tmp); if(gl.isGL2GL3()) { - rowLength = glGetInteger(gl, GL2GL3.GL_PACK_ROW_LENGTH, tmp); - skipRows = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_ROWS, tmp); - skipPixels = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_PIXELS, tmp); + rowLength = glGetInteger(gl, GL2ES3.GL_PACK_ROW_LENGTH, tmp); + skipRows = glGetInteger(gl, GL2ES3.GL_PACK_SKIP_ROWS, tmp); + skipPixels = glGetInteger(gl, GL2ES3.GL_PACK_SKIP_PIXELS, tmp); if (depth > 1) { imageHeight = glGetInteger(gl, GL2GL3.GL_PACK_IMAGE_HEIGHT, tmp); skipImages = glGetInteger(gl, GL2GL3.GL_PACK_SKIP_IMAGES, tmp); @@ -383,12 +384,12 @@ public class GLBuffers extends Buffers { } else { alignment = glGetInteger(gl, GL.GL_UNPACK_ALIGNMENT, tmp); if(gl.isGL2GL3 ()) { - rowLength = glGetInteger(gl, GL2GL3.GL_UNPACK_ROW_LENGTH, tmp); - skipRows = glGetInteger(gl, GL2GL3.GL_UNPACK_SKIP_ROWS, tmp); - skipPixels = glGetInteger(gl, GL2GL3.GL_UNPACK_SKIP_PIXELS, tmp); + rowLength = glGetInteger(gl, GL2ES2.GL_UNPACK_ROW_LENGTH, tmp); + skipRows = glGetInteger(gl, GL2ES2.GL_UNPACK_SKIP_ROWS, tmp); + skipPixels = glGetInteger(gl, GL2ES2.GL_UNPACK_SKIP_PIXELS, tmp); if (depth > 1) { - imageHeight = glGetInteger(gl, GL2GL3.GL_UNPACK_IMAGE_HEIGHT, tmp); - skipImages = glGetInteger(gl, GL2GL3.GL_UNPACK_SKIP_IMAGES, tmp); + imageHeight = glGetInteger(gl, GL2ES3.GL_UNPACK_IMAGE_HEIGHT, tmp); + skipImages = glGetInteger(gl, GL2ES3.GL_UNPACK_SKIP_IMAGES, tmp); } } } @@ -511,9 +512,9 @@ public class GLBuffers extends Buffers { * @return required minimum size of the buffer in bytes * @throws GLException if format, type or alignment is not handled. Please contact the maintainer if this is our bug. */ - public static final int sizeof(GL gl, int tmp[], - int format, int type, int width, int height, int depth, - boolean pack) throws GLException { + public static final int sizeof(final GL gl, final int tmp[], + final int format, final int type, final int width, final int height, final int depth, + final boolean pack) throws GLException { if (width < 0) return 0; if (height < 0) return 0; if (depth < 0) return 0; @@ -578,14 +579,14 @@ public class GLBuffers extends Buffers { * @return required size of one pixel in bytes * @throws GLException if format or type alignment is not handled. Please contact the maintainer if this is our bug. */ - public static final int bytesPerPixel(int format, int type) throws GLException { + public static final int bytesPerPixel(final int format, final int type) throws GLException { int compSize = 0; int compCount = componentCount(format); switch (type) /* 30 */ { case GL2.GL_BITMAP: - if (GL2.GL_COLOR_INDEX == format || GL2GL3.GL_STENCIL_INDEX == format) { + if (GL2.GL_COLOR_INDEX == format || GL2ES2.GL_STENCIL_INDEX == format) { compSize = 1; } case GL.GL_BYTE: @@ -615,9 +616,9 @@ public class GLBuffers extends Buffers { break; case GL.GL_UNSIGNED_SHORT_5_6_5: case GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV: - case GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4: + case GL.GL_UNSIGNED_SHORT_4_4_4_4: case GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1: + case GL.GL_UNSIGNED_SHORT_5_5_5_1: case GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV: case GL2.GL_UNSIGNED_SHORT_8_8_APPLE: case GL2.GL_UNSIGNED_SHORT_8_8_REV_APPLE: @@ -631,15 +632,15 @@ public class GLBuffers extends Buffers { break; case GL2GL3.GL_UNSIGNED_INT_8_8_8_8: case GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV: - case GL2GL3.GL_UNSIGNED_INT_10_10_10_2: - case GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV: - case GL2GL3.GL_UNSIGNED_INT_24_8: - case GL2GL3.GL_UNSIGNED_INT_10F_11F_11F_REV: - case GL2GL3.GL_UNSIGNED_INT_5_9_9_9_REV: + case GL2ES2.GL_UNSIGNED_INT_10_10_10_2: + case GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV: + case GL.GL_UNSIGNED_INT_24_8: + case GL.GL_UNSIGNED_INT_10F_11F_11F_REV: + case GL2ES3.GL_UNSIGNED_INT_5_9_9_9_REV: compSize = 4; compCount = 1; break; - case GL2GL3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV: + case GL2ES3.GL_FLOAT_32_UNSIGNED_INT_24_8_REV: compSize = 8; compCount = 1; break; @@ -681,33 +682,33 @@ public class GLBuffers extends Buffers { * @return number of components required for the given OpenGL format * @throws GLException if format is not handled. Please contact the maintainer if this is our bug. */ - public static final int componentCount(int format) throws GLException { + public static final int componentCount(final int format) throws GLException { final int compCount; switch (format) /* 26 */ { case GL2.GL_COLOR_INDEX: - case GL2GL3.GL_STENCIL_INDEX: - case GL2GL3.GL_DEPTH_COMPONENT: - case GL2GL3.GL_DEPTH_STENCIL: - case GL2GL3.GL_RED: - case GL2GL3.GL_RED_INTEGER: - case GL2GL3.GL_GREEN: + case GL2ES2.GL_STENCIL_INDEX: + case GL2ES2.GL_DEPTH_COMPONENT: + case GL.GL_DEPTH_STENCIL: + case GL2ES2.GL_RED: + case GL2ES3.GL_RED_INTEGER: + case GL2ES3.GL_GREEN: case GL2GL3.GL_GREEN_INTEGER: - case GL2GL3.GL_BLUE: + case GL2ES3.GL_BLUE: case GL2GL3.GL_BLUE_INTEGER: case GL.GL_ALPHA: case GL.GL_LUMINANCE: compCount = 1; break; case GL.GL_LUMINANCE_ALPHA: - case GL2GL3.GL_RG: - case GL2GL3.GL_RG_INTEGER: + case GL2ES2.GL_RG: + case GL2ES3.GL_RG_INTEGER: case GL2.GL_HILO_NV: case GL2.GL_SIGNED_HILO_NV: compCount = 2; break; case GL.GL_RGB: - case GL2GL3.GL_RGB_INTEGER: + case GL2ES3.GL_RGB_INTEGER: case GL2GL3.GL_BGR: case GL2GL3.GL_BGR_INTEGER: compCount = 3; @@ -716,7 +717,7 @@ public class GLBuffers extends Buffers { compCount = 3; break; case GL.GL_RGBA: - case GL2GL3.GL_RGBA_INTEGER: + case GL2ES3.GL_RGBA_INTEGER: case GL.GL_BGRA: case GL2GL3.GL_BGRA_INTEGER: case GL2.GL_ABGR_EXT: @@ -748,9 +749,9 @@ public class GLBuffers extends Buffers { //---------------------------------------------------------------------- // Conversion routines // - public final static float[] getFloatArray(double[] source) { + public final static float[] getFloatArray(final double[] source) { int i = source.length; - float[] dest = new float[i--]; + final float[] dest = new float[i--]; while (i >= 0) { dest[i] = (float) source[i]; i--; diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java index cf88e7bf6..c74284299 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLDrawableUtil.java @@ -47,19 +47,19 @@ import jogamp.opengl.Debug; public class GLDrawableUtil { protected static final boolean DEBUG = Debug.debug("GLDrawable"); - public static final boolean isAnimatorStartedOnOtherThread(GLAnimatorControl animatorCtrl) { + public static final boolean isAnimatorStartedOnOtherThread(final GLAnimatorControl animatorCtrl) { return ( null != animatorCtrl ) ? animatorCtrl.isStarted() && animatorCtrl.getThread() != Thread.currentThread() : false ; } - public static final boolean isAnimatorStarted(GLAnimatorControl animatorCtrl) { + public static final boolean isAnimatorStarted(final GLAnimatorControl animatorCtrl) { return ( null != animatorCtrl ) ? animatorCtrl.isStarted() : false ; } - public static final boolean isAnimatorAnimatingOnOtherThread(GLAnimatorControl animatorCtrl) { + public static final boolean isAnimatorAnimatingOnOtherThread(final GLAnimatorControl animatorCtrl) { return ( null != animatorCtrl ) ? animatorCtrl.isAnimating() && animatorCtrl.getThread() != Thread.currentThread() : false ; } - public static final boolean isAnimatorAnimating(GLAnimatorControl animatorCtrl) { + public static final boolean isAnimatorAnimating(final GLAnimatorControl animatorCtrl) { return ( null != animatorCtrl ) ? animatorCtrl.isAnimating() : false ; } @@ -79,7 +79,7 @@ public class GLDrawableUtil { * @param listener * @param preserveInitState */ - public static final void moveGLEventListener(GLAutoDrawable src, GLAutoDrawable dest, GLEventListener listener, boolean preserveInitState) { + public static final void moveGLEventListener(final GLAutoDrawable src, final GLAutoDrawable dest, final GLEventListener listener, final boolean preserveInitState) { final boolean initialized = src.getGLEventListenerInitState(listener); src.removeGLEventListener(listener); dest.addGLEventListener(listener); @@ -105,7 +105,7 @@ public class GLDrawableUtil { * @param listener * @param preserveInitState */ - public static final void moveAllGLEventListener(GLAutoDrawable src, GLAutoDrawable dest, boolean preserveInitState) { + public static final void moveAllGLEventListener(final GLAutoDrawable src, final GLAutoDrawable dest, final boolean preserveInitState) { for(int count = src.getGLEventListenerCount(); 0true, allow row-stride, otherwise not. * See {@link #getAllowRowStride()} and {@link GLPixelBuffer#requiresNewBuffer(GL, int, int, int)}. */ - public DefaultGLPixelBufferProvider(boolean allowRowStride) { + public DefaultGLPixelBufferProvider(final boolean allowRowStride) { this.allowRowStride = allowRowStride; } @@ -111,7 +111,7 @@ public class GLPixelBuffer { public boolean getAllowRowStride() { return allowRowStride; } @Override - public GLPixelAttributes getAttributes(GL gl, int componentCount) { + public GLPixelAttributes getAttributes(final GL gl, final int componentCount) { final GLContext ctx = gl.getContext(); final int dFormat, dType; @@ -121,14 +121,14 @@ public class GLPixelBuffer { dFormat = GL2ES2.GL_RED; } else { // ALPHA is supported on ES2 and GL2, i.e. <= GL3 [core] or compatibility - dFormat = GL2ES2.GL_ALPHA; + dFormat = GL.GL_ALPHA; } dType = GL.GL_UNSIGNED_BYTE; } else if( 3 == componentCount ) { dFormat = GL.GL_RGB; dType = GL.GL_UNSIGNED_BYTE; } else if( 4 == componentCount ) { - int _dFormat = ctx.getDefaultPixelDataFormat(); + final int _dFormat = ctx.getDefaultPixelDataFormat(); final int dComps = GLBuffers.componentCount(_dFormat); if( dComps == componentCount ) { dFormat = _dFormat; @@ -150,11 +150,11 @@ public class GLPixelBuffer { *

*/ @Override - public GLPixelBuffer allocate(GL gl, GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize) { + public GLPixelBuffer allocate(final GL gl, final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final int minByteSize) { if( minByteSize > 0 ) { return new GLPixelBuffer(pixelAttributes, width, height, depth, pack, Buffers.newDirectByteBuffer(minByteSize), getAllowRowStride()); } else { - int[] tmp = { 0 }; + final int[] tmp = { 0 }; final int byteSize = GLBuffers.sizeof(gl, tmp, pixelAttributes.bytesPerPixel, width, height, depth, pack); return new GLPixelBuffer(pixelAttributes, width, height, depth, pack, Buffers.newDirectByteBuffer(byteSize), getAllowRowStride()); } @@ -194,7 +194,7 @@ public class GLPixelBuffer { * @param dataFormat GL data format * @param dataType GL data type */ - public GLPixelAttributes(int dataFormat, int dataType) { + public GLPixelAttributes(final int dataFormat, final int dataType) { this(0 < dataFormat ? GLBuffers.componentCount(dataFormat) : 0, dataFormat, dataType); } /** @@ -203,7 +203,7 @@ public class GLPixelBuffer { * @param dataFormat GL data format * @param dataType GL data type */ - public GLPixelAttributes(int componentCount, int dataFormat, int dataType) { + public GLPixelAttributes(final int componentCount, final int dataFormat, final int dataType) { this(componentCount, dataFormat, dataType, true); } @@ -211,7 +211,7 @@ public class GLPixelBuffer { * Returns the matching {@link GLPixelAttributes} for the given {@link PixelFormat} and {@link GLProfile} if exists, * otherwise returns null. */ - public static final GLPixelAttributes convert(PixelFormat pixFmt, GLProfile glp) { + public static final GLPixelAttributes convert(final PixelFormat pixFmt, final GLProfile glp) { int df = 0; // format int dt = GL.GL_UNSIGNED_BYTE; // data type switch(pixFmt) { @@ -221,7 +221,7 @@ public class GLPixelBuffer { df = GL2ES2.GL_RED; } else { // ALPHA/LUMINANCE is supported on ES2 and GL2, i.e. <= GL3 [core] or compatibility - df = GL2ES2.GL_LUMINANCE; + df = GL.GL_LUMINANCE; } break; case BGR888: @@ -256,7 +256,7 @@ public class GLPixelBuffer { } return null; } - private GLPixelAttributes(int componentCount, int dataFormat, int dataType, boolean checkArgs) { + private GLPixelAttributes(final int componentCount, final int dataFormat, final int dataType, final boolean checkArgs) { this.componentCount = componentCount; this.format = dataFormat; this.type = dataType; @@ -290,7 +290,7 @@ public class GLPixelBuffer { case GL.GL_RGBA: pixFmt = PixelFormat.RGBA8888; break; - case GL2.GL_BGR: + case GL2GL3.GL_BGR: pixFmt = PixelFormat.BGR888; break; case GL.GL_BGRA: @@ -383,7 +383,7 @@ public class GLPixelBuffer { * @param buffer the backing array * @param allowRowStride If true, allow row-stride, otherwise not. See {@link #requiresNewBuffer(GL, int, int, int)}. */ - public GLPixelBuffer(GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, Buffer buffer, boolean allowRowStride) { + public GLPixelBuffer(final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final Buffer buffer, final boolean allowRowStride) { this.pixelAttributes = pixelAttributes; this.width = width; this.height = height; @@ -414,7 +414,7 @@ public class GLPixelBuffer { } /** Sets the byte position of the {@link #buffer}. */ - public Buffer position(int bytePos) { + public Buffer position(final int bytePos) { return buffer.position( bytePos / bufferElemSize ); } @@ -465,7 +465,7 @@ public class GLPixelBuffer { * @param newByteSize if > 0, the pre-calculated minimum byte-size for the resulting buffer, otherwise ignore. * @see GLPixelBufferProvider#allocate(GL, GLPixelAttributes, int, int, int, boolean, int) */ - public boolean requiresNewBuffer(GL gl, int newWidth, int newHeight, int newByteSize) { + public boolean requiresNewBuffer(final GL gl, final int newWidth, final int newHeight, int newByteSize) { if( !isValid() ) { return true; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java b/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java index 34b493586..52612d224 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLPixelStorageModes.java @@ -171,7 +171,7 @@ public class GLPixelStorageModes { */ public final void resetPack(final GL gl) { // Compared w/ ES2, ES3 and GL3-core spec - gl.glPixelStorei(GL2ES2.GL_PACK_ALIGNMENT, 4); // es2, es3, gl3 + gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 4); // es2, es3, gl3 if( gl.isGL2ES3() ) { gl.glPixelStorei(GL2ES3.GL_PACK_ROW_LENGTH, 0); // es3, gl3 gl.glPixelStorei(GL2ES3.GL_PACK_SKIP_ROWS, 0); // es3, gl3 @@ -202,7 +202,7 @@ public class GLPixelStorageModes { gl.getGL2().glPushClientAttrib(GL2.GL_CLIENT_PIXEL_STORE_BIT); } else { // ES1 or ES2 deals with pack/unpack alignment only - gl.glGetIntegerv(GL2ES2.GL_PACK_ALIGNMENT, cachePack, 0); + gl.glGetIntegerv(GL.GL_PACK_ALIGNMENT, cachePack, 0); if( gl.isGL2ES3() ) { gl.glGetIntegerv(GL2ES3.GL_PACK_ROW_LENGTH, cachePack, 1); gl.glGetIntegerv(GL2ES3.GL_PACK_SKIP_ROWS, cachePack, 2); @@ -222,7 +222,7 @@ public class GLPixelStorageModes { if( gl.isGL2() ) { gl.getGL2().glPopClientAttrib(); } else { - gl.glPixelStorei(GL2ES2.GL_PACK_ALIGNMENT, cachePack[0]); + gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, cachePack[0]); if( gl.isGL2ES3() ) { gl.glPixelStorei(GL2ES3.GL_PACK_ROW_LENGTH, cachePack[1]); gl.glPixelStorei(GL2ES3.GL_PACK_SKIP_ROWS, cachePack[2]); @@ -242,7 +242,7 @@ public class GLPixelStorageModes { */ public final void resetUnpack(final GL gl) { // Compared w/ ES2, ES3 and GL3-core spec - gl.glPixelStorei(GL2ES2.GL_UNPACK_ALIGNMENT, 4); // es2, es3, gl3 + gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 4); // es2, es3, gl3 if( gl.isGL2ES3() ) { gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, 0); // es3, gl3 gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_ROWS, 0); // es3, gl3 @@ -273,7 +273,7 @@ public class GLPixelStorageModes { gl.getGL2().glPushClientAttrib(GL2.GL_CLIENT_PIXEL_STORE_BIT); } else { // ES1 or ES2 deals with pack/unpack alignment only - gl.glGetIntegerv(GL2ES2.GL_UNPACK_ALIGNMENT, cacheUnpack, 0); + gl.glGetIntegerv(GL.GL_UNPACK_ALIGNMENT, cacheUnpack, 0); if( gl.isGL2ES3() ) { gl.glGetIntegerv(GL2ES2.GL_UNPACK_ROW_LENGTH, cacheUnpack, 1); gl.glGetIntegerv(GL2ES2.GL_UNPACK_SKIP_ROWS, cacheUnpack, 2); @@ -293,7 +293,7 @@ public class GLPixelStorageModes { if( gl.isGL2() ) { gl.getGL2().glPopClientAttrib(); } else { - gl.glPixelStorei(GL2ES2.GL_UNPACK_ALIGNMENT, cacheUnpack[0]); + gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, cacheUnpack[0]); if( gl.isGL2ES3() ) { gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, cacheUnpack[1]); gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_ROWS, cacheUnpack[2]); diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java index 680984cdb..abdb7c5f9 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java @@ -62,11 +62,11 @@ public class GLReadBufferUtil { * @param alpha true for RGBA readPixels, otherwise RGB readPixels. Disclaimer: Alpha maybe forced on ES platforms! * @param write2Texture true if readPixel's TextureData shall be written to a 2d Texture */ - public GLReadBufferUtil(boolean alpha, boolean write2Texture) { + public GLReadBufferUtil(final boolean alpha, final boolean write2Texture) { this(GLPixelBuffer.defaultProviderNoRowStride, alpha, write2Texture); } - public GLReadBufferUtil(GLPixelBufferProvider pixelBufferProvider, boolean alpha, boolean write2Texture) { + public GLReadBufferUtil(final GLPixelBufferProvider pixelBufferProvider, final boolean alpha, final boolean write2Texture) { this.pixelBufferProvider = pixelBufferProvider; this.componentCount = alpha ? 4 : 3 ; this.alignment = alpha ? 4 : 1 ; @@ -110,11 +110,11 @@ public class GLReadBufferUtil { /** * Write the TextureData filled by {@link #readPixels(GLAutoDrawable, boolean)} to file */ - public void write(File dest) { + public void write(final File dest) { try { TextureIO.write(readTextureData, dest); rewindPixelBuffer(); - } catch (IOException ex) { + } catch (final IOException ex) { throw new RuntimeException("can not write to file: " + dest.getAbsolutePath(), ex); } } @@ -131,7 +131,7 @@ public class GLReadBufferUtil { * * @see #GLReadBufferUtil(boolean, boolean) */ - public boolean readPixels(GL gl, boolean mustFlipVertically) { + public boolean readPixels(final GL gl, final boolean mustFlipVertically) { return readPixels(gl, 0, 0, 0, 0, mustFlipVertically); } @@ -150,7 +150,7 @@ public class GLReadBufferUtil { * and handled in a efficient manner there (TextureCoordinates and TextureIO writer). * @see #GLReadBufferUtil(boolean, boolean) */ - public boolean readPixels(GL gl, int inX, int inY, int inWidth, int inHeight, boolean mustFlipVertically) { + public boolean readPixels(final GL gl, final int inX, final int inY, final int inWidth, final int inHeight, final boolean mustFlipVertically) { final GLDrawable drawable = gl.getContext().getGLReadDrawable(); final int width, height; if( 0 >= inWidth || drawable.getSurfaceWidth() < inWidth ) { @@ -207,7 +207,7 @@ public class GLReadBufferUtil { readPixelBuffer.buffer, null /* Flusher */); newData = true; - } catch (Exception e) { + } catch (final Exception e) { readTextureData = null; readPixelBuffer = null; throw new RuntimeException("can not fetch offscreen texture", e); @@ -229,7 +229,7 @@ public class GLReadBufferUtil { readPixelBuffer.clear(); try { gl.glReadPixels(inX, inY, width, height, pixelAttribs.format, pixelAttribs.type, readPixelBuffer.buffer); - } catch(GLException gle) { res = false; gle.printStackTrace(); } + } catch(final GLException gle) { res = false; gle.printStackTrace(); } readPixelBuffer.position( readPixelSize ); readPixelBuffer.flip(); final int glerr1 = gl.glGetError(); @@ -256,7 +256,7 @@ public class GLReadBufferUtil { return res; } - public void dispose(GL gl) { + public void dispose(final GL gl) { if(null != readTexture) { readTexture.destroy(gl); readTextureData = null; diff --git a/src/jogl/classes/com/jogamp/opengl/util/Gamma.java b/src/jogl/classes/com/jogamp/opengl/util/Gamma.java index 966781906..4e44c997a 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/Gamma.java +++ b/src/jogl/classes/com/jogamp/opengl/util/Gamma.java @@ -87,7 +87,7 @@ public class Gamma { * @throws IllegalArgumentException if any of the parameters were * out-of-bounds */ - public static boolean setDisplayGamma(GL gl, float gamma, float brightness, float contrast) throws IllegalArgumentException { + public static boolean setDisplayGamma(final GL gl, final float gamma, final float brightness, final float contrast) throws IllegalArgumentException { return GLDrawableFactoryImpl.getFactoryImpl(gl.getContext().getGLDrawable().getGLProfile()).setDisplayGamma(gamma, brightness, contrast); } @@ -101,7 +101,7 @@ public class Gamma { * exiting, calling it is recommended because of the inevitable * unspecified behavior during JVM teardown. */ - public static void resetDisplayGamma(GL gl) { + public static void resetDisplayGamma(final GL gl) { GLDrawableFactoryImpl.getFactoryImpl(gl.getContext().getGLDrawable().getGLProfile()).resetDisplayGamma(); } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java index 986f6d8d3..150e92c2e 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java +++ b/src/jogl/classes/com/jogamp/opengl/util/ImmModeSink.java @@ -18,6 +18,7 @@ import jogamp.opengl.Debug; import com.jogamp.common.nio.Buffers; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.opengl.util.glsl.ShaderState; /** @@ -54,9 +55,9 @@ public class ImmModeSink { static { Debug.initSingleton(); - DEBUG_BEGIN_END = Debug.isPropertyDefined("jogl.debug.ImmModeSink.BeginEnd", true); - DEBUG_DRAW = Debug.isPropertyDefined("jogl.debug.ImmModeSink.Draw", true); - DEBUG_BUFFER = Debug.isPropertyDefined("jogl.debug.ImmModeSink.Buffer", true); + DEBUG_BEGIN_END = PropertyAccess.isPropertyDefined("jogl.debug.ImmModeSink.BeginEnd", true); + DEBUG_DRAW = PropertyAccess.isPropertyDefined("jogl.debug.ImmModeSink.Draw", true); + DEBUG_BUFFER = PropertyAccess.isPropertyDefined("jogl.debug.ImmModeSink.Buffer", true); } public static final int GL_QUADS = 0x0007; // Needs data manipulation on ES1/ES2 @@ -81,12 +82,12 @@ public class ImmModeSink { * @param glBufferUsage VBO usage parameter for {@link GL#glBufferData(int, long, Buffer, int)}, e.g. {@link GL#GL_STATIC_DRAW}, * set to 0 for no VBO usage */ - public static ImmModeSink createFixed(int initialElementCount, - int vComps, int vDataType, - int cComps, int cDataType, - int nComps, int nDataType, - int tComps, int tDataType, - int glBufferUsage) { + public static ImmModeSink createFixed(final int initialElementCount, + final int vComps, final int vDataType, + final int cComps, final int cDataType, + final int nComps, final int nDataType, + final int tComps, final int tDataType, + final int glBufferUsage) { return new ImmModeSink(initialElementCount, vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType, false, glBufferUsage, null, 0); @@ -114,12 +115,12 @@ public class ImmModeSink { * @see com.jogamp.opengl.util.glsl.ShaderState#useProgram(GL2ES2, boolean) * @see com.jogamp.opengl.util.glsl.ShaderState#getCurrentShaderState() */ - public static ImmModeSink createGLSL(int initialElementCount, - int vComps, int vDataType, - int cComps, int cDataType, - int nComps, int nDataType, - int tComps, int tDataType, - int glBufferUsage, ShaderState st) { + public static ImmModeSink createGLSL(final int initialElementCount, + final int vComps, final int vDataType, + final int cComps, final int cDataType, + final int nComps, final int nDataType, + final int tComps, final int tDataType, + final int glBufferUsage, final ShaderState st) { return new ImmModeSink(initialElementCount, vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType, true, glBufferUsage, st, 0); @@ -147,18 +148,18 @@ public class ImmModeSink { * @see com.jogamp.opengl.util.glsl.ShaderState#useProgram(GL2ES2, boolean) * @see com.jogamp.opengl.util.glsl.ShaderState#getCurrentShaderState() */ - public static ImmModeSink createGLSL(int initialElementCount, - int vComps, int vDataType, - int cComps, int cDataType, - int nComps, int nDataType, - int tComps, int tDataType, - int glBufferUsage, int shaderProgram) { + public static ImmModeSink createGLSL(final int initialElementCount, + final int vComps, final int vDataType, + final int cComps, final int cDataType, + final int nComps, final int nDataType, + final int tComps, final int tDataType, + final int glBufferUsage, final int shaderProgram) { return new ImmModeSink(initialElementCount, vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType, true, glBufferUsage, null, shaderProgram); } - public void destroy(GL gl) { + public void destroy(final GL gl) { destroyList(gl); vboSet.destroy(gl); @@ -168,16 +169,16 @@ public class ImmModeSink { reset(null); } - public void reset(GL gl) { + public void reset(final GL gl) { destroyList(gl); vboSet.reset(gl); } @Override public String toString() { - StringBuilder sb = new StringBuilder("ImmModeSink["); + final StringBuilder sb = new StringBuilder("ImmModeSink["); sb.append(",\n\tVBO list: "+vboSetList.size()+" ["); - for(Iterator i=vboSetList.iterator(); i.hasNext() ; ) { + for(final Iterator i=vboSetList.iterator(); i.hasNext() ; ) { sb.append("\n\t"); sb.append( i.next() ); } @@ -191,7 +192,7 @@ public class ImmModeSink { return sb.toString(); } - public void draw(GL gl, boolean disableBufferAfterDraw) { + public void draw(final GL gl, final boolean disableBufferAfterDraw) { if(DEBUG_DRAW) { System.err.println("ImmModeSink.draw(disableBufferAfterDraw: "+disableBufferAfterDraw+"):\n\t"+this); } @@ -201,7 +202,7 @@ public class ImmModeSink { } } - public void draw(GL gl, Buffer indices, boolean disableBufferAfterDraw) { + public void draw(final GL gl, final Buffer indices, final boolean disableBufferAfterDraw) { if(DEBUG_DRAW) { System.err.println("ImmModeSink.draw(disableBufferAfterDraw: "+disableBufferAfterDraw+"):\n\t"+this); } @@ -228,19 +229,19 @@ public class ImmModeSink { vboSet.checkSeal(false); } - public final void glEnd(GL gl) { + public final void glEnd(final GL gl) { glEnd(gl, null, true); } - public void glEnd(GL gl, boolean immediateDraw) { + public void glEnd(final GL gl, final boolean immediateDraw) { glEnd(gl, null, immediateDraw); } - public final void glEnd(GL gl, Buffer indices) { + public final void glEnd(final GL gl, final Buffer indices) { glEnd(gl, indices, true); } - private void glEnd(GL gl, Buffer indices, boolean immediateDraw) { + private void glEnd(final GL gl, final Buffer indices, final boolean immediateDraw) { if(DEBUG_BEGIN_END) { System.err.println("ImmModeSink START glEnd(immediate: "+immediateDraw+")"); } @@ -259,117 +260,117 @@ public class ImmModeSink { } } - public void glVertexv(Buffer v) { + public void glVertexv(final Buffer v) { vboSet.glVertexv(v); } - public void glNormalv(Buffer v) { + public void glNormalv(final Buffer v) { vboSet.glNormalv(v); } - public void glColorv(Buffer v) { + public void glColorv(final Buffer v) { vboSet.glColorv(v); } - public void glTexCoordv(Buffer v) { + public void glTexCoordv(final Buffer v) { vboSet.glTexCoordv(v); } - public final void glVertex2f(float x, float y) { + public final void glVertex2f(final float x, final float y) { vboSet.glVertex2f(x,y); } - public final void glVertex3f(float x, float y, float z) { + public final void glVertex3f(final float x, final float y, final float z) { vboSet.glVertex3f(x,y,z); } - public final void glNormal3f(float x, float y, float z) { + public final void glNormal3f(final float x, final float y, final float z) { vboSet.glNormal3f(x,y,z); } - public final void glColor3f(float x, float y, float z) { + public final void glColor3f(final float x, final float y, final float z) { vboSet.glColor3f(x,y,z); } - public final void glColor4f(float x, float y, float z, float a) { + public final void glColor4f(final float x, final float y, final float z, final float a) { vboSet.glColor4f(x,y,z, a); } - public final void glTexCoord2f(float x, float y) { + public final void glTexCoord2f(final float x, final float y) { vboSet.glTexCoord2f(x,y); } - public final void glTexCoord3f(float x, float y, float z) { + public final void glTexCoord3f(final float x, final float y, final float z) { vboSet.glTexCoord3f(x,y,z); } - public final void glVertex2s(short x, short y) { + public final void glVertex2s(final short x, final short y) { vboSet.glVertex2s(x,y); } - public final void glVertex3s(short x, short y, short z) { + public final void glVertex3s(final short x, final short y, final short z) { vboSet.glVertex3s(x,y,z); } - public final void glNormal3s(short x, short y, short z) { + public final void glNormal3s(final short x, final short y, final short z) { vboSet.glNormal3s(x,y,z); } - public final void glColor3s(short x, short y, short z) { + public final void glColor3s(final short x, final short y, final short z) { vboSet.glColor3s(x,y,z); } - public final void glColor4s(short x, short y, short z, short a) { + public final void glColor4s(final short x, final short y, final short z, final short a) { vboSet.glColor4s(x,y,z,a); } - public final void glTexCoord2s(short x, short y) { + public final void glTexCoord2s(final short x, final short y) { vboSet.glTexCoord2s(x,y); } - public final void glTexCoord3s(short x, short y, short z) { + public final void glTexCoord3s(final short x, final short y, final short z) { vboSet.glTexCoord3s(x,y,z); } - public final void glVertex2b(byte x, byte y) { + public final void glVertex2b(final byte x, final byte y) { vboSet.glVertex2b(x,y); } - public final void glVertex3b(byte x, byte y, byte z) { + public final void glVertex3b(final byte x, final byte y, final byte z) { vboSet.glVertex3b(x,y,z); } - public final void glNormal3b(byte x, byte y, byte z) { + public final void glNormal3b(final byte x, final byte y, final byte z) { vboSet.glNormal3b(x,y,z); } - public final void glColor3b(byte x, byte y, byte z) { + public final void glColor3b(final byte x, final byte y, final byte z) { vboSet.glColor3b(x,y,z); } - public final void glColor3ub(byte x, byte y, byte z) { + public final void glColor3ub(final byte x, final byte y, final byte z) { vboSet.glColor3ub(x,y,z); } - public final void glColor4b(byte x, byte y, byte z, byte a) { + public final void glColor4b(final byte x, final byte y, final byte z, final byte a) { vboSet.glColor4b(x,y,z,a); } - public final void glColor4ub(byte x, byte y, byte z, byte a) { + public final void glColor4ub(final byte x, final byte y, final byte z, final byte a) { vboSet.glColor4ub(x,y,z,a); } - public final void glTexCoord2b(byte x, byte y) { + public final void glTexCoord2b(final byte x, final byte y) { vboSet.glTexCoord2b(x,y); } - public final void glTexCoord3b(byte x, byte y, byte z) { + public final void glTexCoord3b(final byte x, final byte y, final byte z) { vboSet.glTexCoord3b(x,y,z); } - protected ImmModeSink(int initialElementCount, - int vComps, int vDataType, - int cComps, int cDataType, - int nComps, int nDataType, - int tComps, int tDataType, - boolean useGLSL, int glBufferUsage, ShaderState st, int shaderProgram) { + protected ImmModeSink(final int initialElementCount, + final int vComps, final int vDataType, + final int cComps, final int cDataType, + final int nComps, final int nDataType, + final int tComps, final int tDataType, + final boolean useGLSL, final int glBufferUsage, final ShaderState st, final int shaderProgram) { vboSet = new VBOSet(initialElementCount, vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType, useGLSL, glBufferUsage, st, shaderProgram); @@ -390,9 +391,9 @@ public class ImmModeSink { * @see #createFixed(int, int, int, int, int, int, int, int, int, int) * @see #createGLSL(int, int, int, int, int, int, int, int, int, int, ShaderState) */ - public void setResizeElementCount(int v) { vboSet.setResizeElementCount(v); } + public void setResizeElementCount(final int v) { vboSet.setResizeElementCount(v); } - private void destroyList(GL gl) { + private void destroyList(final GL gl) { for(int i=0; i vboSetList; protected static class VBOSet { - protected VBOSet (int initialElementCount, - int vComps, int vDataType, - int cComps, int cDataType, - int nComps, int nDataType, - int tComps, int tDataType, - boolean useGLSL, int glBufferUsage, ShaderState st, int shaderProgram) { + protected VBOSet (final int initialElementCount, + final int vComps, final int vDataType, + final int cComps, final int cDataType, + final int nComps, final int nDataType, + final int tComps, final int tDataType, + final boolean useGLSL, final int glBufferUsage, final ShaderState st, final int shaderProgram) { // final .. this.glBufferUsage=glBufferUsage; this.initialElementCount=initialElementCount; @@ -465,17 +466,17 @@ public class ImmModeSink { } protected int getResizeElementCount() { return resizeElementCount; } - protected void setResizeElementCount(int v) { resizeElementCount=v; } + protected void setResizeElementCount(final int v) { resizeElementCount=v; } protected boolean getUseVBO() { return useVBO; } - protected final VBOSet regenerate(GL gl) { + protected final VBOSet regenerate(final GL gl) { return new VBOSet(initialElementCount, vComps, vDataType, cComps, cDataType, nComps, nDataType, tComps, tDataType, useGLSL, glBufferUsage, shaderState, shaderProgram); } - protected void checkSeal(boolean test) throws GLException { + protected void checkSeal(final boolean test) throws GLException { if(0==mode) { throw new GLException("No mode set yet, call glBegin(mode) first:\n\t"+this); } @@ -490,7 +491,7 @@ public class ImmModeSink { private boolean usingShaderProgram = false; - protected void useShaderProgram(GL2ES2 gl, boolean force) { + protected void useShaderProgram(final GL2ES2 gl, final boolean force) { if( force || !usingShaderProgram ) { if(null != shaderState) { shaderState.useProgram(gl, true); @@ -501,7 +502,7 @@ public class ImmModeSink { } } - protected void draw(GL gl, Buffer indices, boolean disableBufferAfterDraw, int i) + protected void draw(final GL gl, final Buffer indices, final boolean disableBufferAfterDraw, final int i) { enableBuffer(gl, true); @@ -544,17 +545,17 @@ public class ImmModeSink { if( GL.GL_UNSIGNED_BYTE == type ) { final ByteBuffer b = (ByteBuffer) indices; for (int j = 0; j < idxLen; j++) { - gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x000000ff & b.get(idx0+j)), 4); + gl.glDrawArrays(GL.GL_TRIANGLE_FAN, 0x000000ff & b.get(idx0+j), 4); } } else if( GL.GL_UNSIGNED_SHORT == type ){ final ShortBuffer b = (ShortBuffer) indices; for (int j = 0; j < idxLen; j++) { - gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x0000ffff & b.get(idx0+j)), 4); + gl.glDrawArrays(GL.GL_TRIANGLE_FAN, 0x0000ffff & b.get(idx0+j), 4); } } else { final IntBuffer b = (IntBuffer) indices; for (int j = 0; j < idxLen; j++) { - gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0xffffffff & b.get(idx0+j)), 4); + gl.glDrawArrays(GL.GL_TRIANGLE_FAN, 0xffffffff & b.get(idx0+j), 4); } } } else { @@ -573,24 +574,24 @@ public class ImmModeSink { } } - public void glVertexv(Buffer v) { + public void glVertexv(final Buffer v) { checkSeal(false); Buffers.put(vertexArray, v); } - public void glNormalv(Buffer v) { + public void glNormalv(final Buffer v) { checkSeal(false); Buffers.put(normalArray, v); } - public void glColorv(Buffer v) { + public void glColorv(final Buffer v) { checkSeal(false); Buffers.put(colorArray, v); } - public void glTexCoordv(Buffer v) { + public void glTexCoordv(final Buffer v) { checkSeal(false); Buffers.put(textCoordArray, v); } - public void glVertex2b(byte x, byte y) { + public void glVertex2b(final byte x, final byte y) { checkSeal(false); growBuffer(VERTEX); if(vComps>0) @@ -599,7 +600,7 @@ public class ImmModeSink { Buffers.putNb(vertexArray, vDataTypeSigned, y, true); countAndPadding(VERTEX, vComps-2); } - public void glVertex3b(byte x, byte y, byte z) { + public void glVertex3b(final byte x, final byte y, final byte z) { checkSeal(false); growBuffer(VERTEX); if(vComps>0) @@ -610,7 +611,7 @@ public class ImmModeSink { Buffers.putNb(vertexArray, vDataTypeSigned, z, true); countAndPadding(VERTEX, vComps-3); } - public void glVertex2s(short x, short y) { + public void glVertex2s(final short x, final short y) { checkSeal(false); growBuffer(VERTEX); if(vComps>0) @@ -619,7 +620,7 @@ public class ImmModeSink { Buffers.putNs(vertexArray, vDataTypeSigned, y, true); countAndPadding(VERTEX, vComps-2); } - public void glVertex3s(short x, short y, short z) { + public void glVertex3s(final short x, final short y, final short z) { checkSeal(false); growBuffer(VERTEX); if(vComps>0) @@ -630,7 +631,7 @@ public class ImmModeSink { Buffers.putNs(vertexArray, vDataTypeSigned, z, true); countAndPadding(VERTEX, vComps-3); } - public void glVertex2f(float x, float y) { + public void glVertex2f(final float x, final float y) { checkSeal(false); growBuffer(VERTEX); if(vComps>0) @@ -639,7 +640,7 @@ public class ImmModeSink { Buffers.putNf(vertexArray, vDataTypeSigned, y); countAndPadding(VERTEX, vComps-2); } - public void glVertex3f(float x, float y, float z) { + public void glVertex3f(final float x, final float y, final float z) { checkSeal(false); growBuffer(VERTEX); if(vComps>0) @@ -651,7 +652,7 @@ public class ImmModeSink { countAndPadding(VERTEX, vComps-3); } - public void glNormal3b(byte x, byte y, byte z) { + public void glNormal3b(final byte x, final byte y, final byte z) { checkSeal(false); growBuffer(NORMAL); if(nComps>0) @@ -662,7 +663,7 @@ public class ImmModeSink { Buffers.putNb(normalArray, nDataTypeSigned, z, true); countAndPadding(NORMAL, nComps-3); } - public void glNormal3s(short x, short y, short z) { + public void glNormal3s(final short x, final short y, final short z) { checkSeal(false); growBuffer(NORMAL); if(nComps>0) @@ -673,7 +674,7 @@ public class ImmModeSink { Buffers.putNs(normalArray, nDataTypeSigned, z, true); countAndPadding(NORMAL, nComps-3); } - public void glNormal3f(float x, float y, float z) { + public void glNormal3f(final float x, final float y, final float z) { checkSeal(false); growBuffer(NORMAL); if(nComps>0) @@ -685,7 +686,7 @@ public class ImmModeSink { countAndPadding(NORMAL, nComps-3); } - public void glColor3b(byte r, byte g, byte b) { + public void glColor3b(final byte r, final byte g, final byte b) { checkSeal(false); growBuffer(COLOR); if(cComps>0) @@ -696,7 +697,7 @@ public class ImmModeSink { Buffers.putNb(colorArray, cDataTypeSigned, b, true); countAndPadding(COLOR, cComps-3); } - public void glColor3ub(byte r, byte g, byte b) { + public void glColor3ub(final byte r, final byte g, final byte b) { checkSeal(false); growBuffer(COLOR); if(cComps>0) @@ -707,7 +708,7 @@ public class ImmModeSink { Buffers.putNb(colorArray, cDataTypeSigned, b, false); countAndPadding(COLOR, cComps-3); } - public void glColor4b(byte r, byte g, byte b, byte a) { + public void glColor4b(final byte r, final byte g, final byte b, final byte a) { checkSeal(false); growBuffer(COLOR); if(cComps>0) @@ -720,7 +721,7 @@ public class ImmModeSink { Buffers.putNb(colorArray, cDataTypeSigned, a, true); countAndPadding(COLOR, cComps-4); } - public void glColor4ub(byte r, byte g, byte b, byte a) { + public void glColor4ub(final byte r, final byte g, final byte b, final byte a) { checkSeal(false); growBuffer(COLOR); if(cComps>0) @@ -733,7 +734,7 @@ public class ImmModeSink { Buffers.putNb(colorArray, cDataTypeSigned, a, false); countAndPadding(COLOR, cComps-4); } - public void glColor3s(short r, short g, short b) { + public void glColor3s(final short r, final short g, final short b) { checkSeal(false); growBuffer(COLOR); if(cComps>0) @@ -744,7 +745,7 @@ public class ImmModeSink { Buffers.putNs(colorArray, cDataTypeSigned, b, true); countAndPadding(COLOR, cComps-3); } - public void glColor4s(short r, short g, short b, short a) { + public void glColor4s(final short r, final short g, final short b, final short a) { checkSeal(false); growBuffer(COLOR); if(cComps>0) @@ -757,7 +758,7 @@ public class ImmModeSink { Buffers.putNs(colorArray, cDataTypeSigned, a, true); countAndPadding(COLOR, cComps-4); } - public void glColor3f(float r, float g, float b) { + public void glColor3f(final float r, final float g, final float b) { checkSeal(false); growBuffer(COLOR); if(cComps>0) @@ -768,7 +769,7 @@ public class ImmModeSink { Buffers.putNf(colorArray, cDataTypeSigned, b); countAndPadding(COLOR, cComps-3); } - public void glColor4f(float r, float g, float b, float a) { + public void glColor4f(final float r, final float g, final float b, final float a) { checkSeal(false); growBuffer(COLOR); if(cComps>0) @@ -782,7 +783,7 @@ public class ImmModeSink { countAndPadding(COLOR, cComps-4); } - public void glTexCoord2b(byte x, byte y) { + public void glTexCoord2b(final byte x, final byte y) { checkSeal(false); growBuffer(TEXTCOORD); if(tComps>0) @@ -791,7 +792,7 @@ public class ImmModeSink { Buffers.putNb(textCoordArray, tDataTypeSigned, y, true); countAndPadding(TEXTCOORD, tComps-2); } - public void glTexCoord3b(byte x, byte y, byte z) { + public void glTexCoord3b(final byte x, final byte y, final byte z) { checkSeal(false); growBuffer(TEXTCOORD); if(tComps>0) @@ -802,7 +803,7 @@ public class ImmModeSink { Buffers.putNb(textCoordArray, tDataTypeSigned, z, true); countAndPadding(TEXTCOORD, tComps-3); } - public void glTexCoord2s(short x, short y) { + public void glTexCoord2s(final short x, final short y) { checkSeal(false); growBuffer(TEXTCOORD); if(tComps>0) @@ -811,7 +812,7 @@ public class ImmModeSink { Buffers.putNs(textCoordArray, tDataTypeSigned, y, true); countAndPadding(TEXTCOORD, tComps-2); } - public void glTexCoord3s(short x, short y, short z) { + public void glTexCoord3s(final short x, final short y, final short z) { checkSeal(false); growBuffer(TEXTCOORD); if(tComps>0) @@ -822,7 +823,7 @@ public class ImmModeSink { Buffers.putNs(textCoordArray, tDataTypeSigned, z, true); countAndPadding(TEXTCOORD, tComps-3); } - public void glTexCoord2f(float x, float y) { + public void glTexCoord2f(final float x, final float y) { checkSeal(false); growBuffer(TEXTCOORD); if(tComps>0) @@ -831,7 +832,7 @@ public class ImmModeSink { Buffers.putNf(textCoordArray, tDataTypeSigned, y); countAndPadding(TEXTCOORD, tComps-2); } - public void glTexCoord3f(float x, float y, float z) { + public void glTexCoord3f(final float x, final float y, final float z) { checkSeal(false); growBuffer(TEXTCOORD); if(tComps>0) @@ -858,7 +859,7 @@ public class ImmModeSink { } } - public void setShaderProgram(int program) { + public void setShaderProgram(final int program) { if(null == shaderState && 0 == program) { throw new IllegalArgumentException("Not allowed to zero shader program if no ShaderState is set"); } @@ -871,7 +872,7 @@ public class ImmModeSink { * @return true if all locations for all used arrays are found (min 1 array), otherwise false. * Also sets 'glslLocationSet' to the return value! */ - private boolean resetGLSLArrayLocation(GL2ES2 gl) { + private boolean resetGLSLArrayLocation(final GL2ES2 gl) { int iA = 0; int iL = 0; @@ -903,7 +904,7 @@ public class ImmModeSink { return glslLocationSet; } - public void destroy(GL gl) { + public void destroy(final GL gl) { reset(gl); vCount=0; cCount=0; nCount=0; tCount=0; @@ -912,7 +913,7 @@ public class ImmModeSink { buffer=null; } - public void reset(GL gl) { + public void reset(final GL gl) { enableBuffer(gl, false); reset(); } @@ -935,16 +936,16 @@ public class ImmModeSink { this.tElems=0; } - public void seal(GL glObj, boolean seal) + public void seal(final GL glObj, final boolean seal) { seal(seal); if(sealedGL==seal) return; sealedGL = seal; - GL gl = glObj.getGL(); + final GL gl = glObj.getGL(); if(seal) { if(useVBO) { if(0 == vboName) { - int[] tmp = new int[1]; + final int[] tmp = new int[1]; gl.glGenBuffers(1, tmp, 0); vboName = tmp[0]; } @@ -967,7 +968,7 @@ public class ImmModeSink { } } - public void seal(boolean seal) + public void seal(final boolean seal) { if(sealed==seal) return; sealed = seal; @@ -977,7 +978,7 @@ public class ImmModeSink { } } - public void enableBuffer(GL gl, boolean enable) { + public void enableBuffer(final GL gl, final boolean enable) { if( bufferEnabled != enable && vElems>0 ) { if(enable) { checkSeal(true); @@ -996,7 +997,7 @@ public class ImmModeSink { } } - private final void writeBuffer(GL gl) { + private final void writeBuffer(final GL gl) { final int vBytes = vElems * vCompsBytes; final int cBytes = cElems * cCompsBytes; final int nBytes = nElems * nCompsBytes; @@ -1021,8 +1022,8 @@ public class ImmModeSink { } } - private void enableBufferFixed(GL gl, boolean enable) { - GL2ES1 glf = gl.getGL2ES1(); + private void enableBufferFixed(final GL gl, final boolean enable) { + final GL2ES1 glf = gl.getGL2ES1(); final boolean useV = vComps>0 && vElems>0 ; final boolean useC = cComps>0 && cElems>0 ; @@ -1089,8 +1090,8 @@ public class ImmModeSink { } } - private void enableBufferGLSLShaderState(GL gl, boolean enable) { - GL2ES2 glsl = gl.getGL2ES2(); + private void enableBufferGLSLShaderState(final GL gl, final boolean enable) { + final GL2ES2 glsl = gl.getGL2ES2(); final boolean useV = vComps>0 && vElems>0 ; final boolean useC = cComps>0 && cElems>0 ; @@ -1157,8 +1158,8 @@ public class ImmModeSink { } } - private void enableBufferGLSLSimple(GL gl, boolean enable) { - GL2ES2 glsl = gl.getGL2ES2(); + private void enableBufferGLSLSimple(final GL gl, final boolean enable) { + final GL2ES2 glsl = gl.getGL2ES2(); final boolean useV = vComps>0 && vElems>0 ; final boolean useC = cComps>0 && cElems>0 ; @@ -1267,7 +1268,7 @@ public class ImmModeSink { return "[v "+vElems+"/"+vCount+", c "+cElems+"/"+cCount+", n "+nElems+"/"+nCount+", t "+tElems+"/"+tCount+"]"; } - protected boolean fitElementInBuffer(int type) { + protected boolean fitElementInBuffer(final int type) { final int addElems = 1; switch (type) { case VERTEX: @@ -1283,7 +1284,7 @@ public class ImmModeSink { } } - protected boolean reallocateBuffer(int addElems) { + protected boolean reallocateBuffer(final int addElems) { final int vAdd = addElems - ( vCount - vElems ); final int cAdd = addElems - ( cCount - cElems ); final int nAdd = addElems - ( nCount - nElems ); @@ -1381,7 +1382,7 @@ public class ImmModeSink { } /** grow buffer by initialElementCount if there is no space for one more element in the designated buffer */ - protected final boolean growBuffer(int type) { + protected final boolean growBuffer(final int type) { if( null !=buffer && !sealed ) { if( !fitElementInBuffer(type) ) { // save olde values .. @@ -1422,7 +1423,7 @@ public class ImmModeSink { * @param type * @param fill */ - private void countAndPadding(int type, int fill) { + private void countAndPadding(final int type, int fill) { if ( sealed ) return; final Buffer dest; diff --git a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java index 71d880a44..39608b116 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java +++ b/src/jogl/classes/com/jogamp/opengl/util/PMVMatrix.java @@ -41,8 +41,9 @@ import javax.media.opengl.GL; import javax.media.opengl.GLException; import javax.media.opengl.fixedfunc.GLMatrixFunc; +import jogamp.common.os.PlatformPropsImpl; + import com.jogamp.common.nio.Buffers; -import com.jogamp.common.os.Platform; import com.jogamp.common.util.FloatStack; import com.jogamp.opengl.math.FloatUtil; import com.jogamp.opengl.math.Quaternion; @@ -852,19 +853,19 @@ public final class PMVMatrix implements GLMatrixFunc { final boolean modT = 0 != ( MODIFIED_TEXTURE & modifiedBits ); sb.append("PMVMatrix[modified[P ").append(modP).append(", Mv ").append(modMv).append(", T ").append(modT); - sb.append("], dirty/req[Mvi ").append(mviDirty).append("/").append(mviReq).append(", Mvit ").append(mvitDirty).append("/").append(mvitReq).append(", Frustum ").append(frustumDirty).append("/").append(frustumReq).append("]").append(Platform.NEWLINE); - sb.append(", Projection").append(Platform.NEWLINE); + sb.append("], dirty/req[Mvi ").append(mviDirty).append("/").append(mviReq).append(", Mvit ").append(mvitDirty).append("/").append(mvitReq).append(", Frustum ").append(frustumDirty).append("/").append(frustumReq).append("]").append(PlatformPropsImpl.NEWLINE); + sb.append(", Projection").append(PlatformPropsImpl.NEWLINE); matrixToString(sb, f, matrixP); - sb.append(", Modelview").append(Platform.NEWLINE); + sb.append(", Modelview").append(PlatformPropsImpl.NEWLINE); matrixToString(sb, f, matrixMv); - sb.append(", Texture").append(Platform.NEWLINE); + sb.append(", Texture").append(PlatformPropsImpl.NEWLINE); matrixToString(sb, f, matrixTex); if( 0 != ( requestMask & DIRTY_INVERSE_MODELVIEW ) ) { - sb.append(", Inverse Modelview").append(Platform.NEWLINE); + sb.append(", Inverse Modelview").append(PlatformPropsImpl.NEWLINE); matrixToString(sb, f, matrixMvi); } if( 0 != ( requestMask & DIRTY_INVERSE_TRANSPOSED_MODELVIEW ) ) { - sb.append(", Inverse Transposed Modelview").append(Platform.NEWLINE); + sb.append(", Inverse Transposed Modelview").append(PlatformPropsImpl.NEWLINE); matrixToString(sb, f, matrixMvit); } sb.append("]"); diff --git a/src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java b/src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java index fd8f54152..64da547c2 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java +++ b/src/jogl/classes/com/jogamp/opengl/util/PNGPixelRect.java @@ -192,7 +192,7 @@ public class PNGPixelRect extends PixelRectangle.GenericPixelRect { return new PNGPixelRect(destFmt, new Dimension(width, height), destStrideInBytes, destIsGLOriented, destPixels, dpiX, dpiY); } - private static final int getPixelLUMToAny(PixelFormat dest_fmt, ByteBuffer d, int dOff, byte lum, byte alpha) { + private static final int getPixelLUMToAny(final PixelFormat dest_fmt, final ByteBuffer d, int dOff, final byte lum, final byte alpha) { switch(dest_fmt) { case LUMINANCE: d.put(dOff++, lum); diff --git a/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java index 0a3a9d513..3b65b0824 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/RandomTileRenderer.java @@ -51,7 +51,7 @@ public class RandomTileRenderer extends TileRendererBase { } @Override - public final int getParam(int pname) { + public final int getParam(final int pname) { switch (pname) { case TR_IMAGE_WIDTH: return imageSize.getWidth(); @@ -75,7 +75,7 @@ public class RandomTileRenderer extends TileRendererBase { * * @throws IllegalArgumentException is tile x/y are < 0 or tile size is <= 0x0 */ - public void setTileRect(int tX, int tY, int tWidth, int tHeight) throws IllegalStateException, IllegalArgumentException { + public void setTileRect(final int tX, final int tY, final int tWidth, final int tHeight) throws IllegalStateException, IllegalArgumentException { if( 0 > tX || 0 > tY ) { throw new IllegalArgumentException("Tile pos must be >= 0/0"); } @@ -120,7 +120,7 @@ public class RandomTileRenderer extends TileRendererBase { * {@link #setTileRect(int, int, int, int) tile-rect} has not been set. */ @Override - public final void beginTile(GL gl) throws IllegalStateException, GLException { + public final void beginTile(final GL gl) throws IllegalStateException, GLException { if( 0 >= imageSize.getWidth() || 0 >= imageSize.getHeight() ) { throw new IllegalStateException("Image size has not been set"); } @@ -143,7 +143,7 @@ public class RandomTileRenderer extends TileRendererBase { } @Override - public void endTile( GL gl ) throws IllegalStateException, GLException { + public void endTile( final GL gl ) throws IllegalStateException, GLException { if( !beginCalled ) { throw new IllegalStateException("beginTile(..) has not been called"); } @@ -229,7 +229,7 @@ public class RandomTileRenderer extends TileRendererBase { * @throws IllegalStateException if no {@link GLAutoDrawable} is {@link #attachAutoDrawable(GLAutoDrawable) attached} * or imageSize is not set */ - public void display(int tX, int tY, int tWidth, int tHeight) throws IllegalStateException { + public void display(final int tX, final int tY, final int tWidth, final int tHeight) throws IllegalStateException { setTileRect(tX, tY, tWidth, tHeight); display(); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java b/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java index 47d56bcb1..6e31c78a0 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java +++ b/src/jogl/classes/com/jogamp/opengl/util/TGAWriter.java @@ -70,18 +70,18 @@ public class TGAWriter { * @throws IOException if an I/O error occurred while writing the * file */ - public void open(File file, - int width, - int height, - boolean alpha) throws IOException { - RandomAccessFile out = new RandomAccessFile(file, "rw"); + public void open(final File file, + final int width, + final int height, + final boolean alpha) throws IOException { + final RandomAccessFile out = new RandomAccessFile(file, "rw"); ch = out.getChannel(); - int pixelSize = (alpha ? 32 : 24); - int numChannels = (alpha ? 4 : 3); + final int pixelSize = (alpha ? 32 : 24); + final int numChannels = (alpha ? 4 : 3); - int fileLength = TARGA_HEADER_SIZE + width * height * numChannels; + final int fileLength = TARGA_HEADER_SIZE + width * height * numChannels; out.setLength(fileLength); - MappedByteBuffer image = ch.map(FileChannel.MapMode.READ_WRITE, 0, fileLength); + final MappedByteBuffer image = ch.map(FileChannel.MapMode.READ_WRITE, 0, fileLength); // write the TARGA header image.put(0, (byte) 0).put(1, (byte) 0); diff --git a/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java index 887312a64..d8410a102 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/TileRenderer.java @@ -145,7 +145,7 @@ public class TileRenderer extends TileRendererBase { private int offsetY; @Override - protected StringBuilder tileDetails(StringBuilder sb) { + protected StringBuilder tileDetails(final StringBuilder sb) { sb.append("# "+currentTile+": ["+currentColumn+"]["+currentRow+"] / "+columns+"x"+rows+", ") .append("rowOrder "+rowOrder+", offset/size "+offsetX+"/"+offsetY+" "+tileSize.getWidth()+"x"+tileSize.getHeight()+" brd "+tileBorder+", "); return super.tileDetails(sb); @@ -165,7 +165,7 @@ public class TileRenderer extends TileRendererBase { *

*/ @Override - public final void setImageSize(int width, int height) { + public final void setImageSize(final int width, final int height) { super.setImageSize(width, height); reset(); } @@ -184,7 +184,7 @@ public class TileRenderer extends TileRendererBase { * @param height The image-clipping.height * @see #getClippedImageSize() */ - public final void clipImageSize(int width, int height) { + public final void clipImageSize(final int width, final int height) { if( null == imageClippingDim ) { imageClippingDim = new Dimension(width, height); } else { @@ -236,7 +236,7 @@ public class TileRenderer extends TileRendererBase { * to avoid artifacts when rendering lines or points with * thickness > 1. */ - public final void setTileSize(int width, int height, int border) { + public final void setTileSize(final int width, final int height, final int border) { if( 0 > border ) { throw new IllegalArgumentException("Tile border must be >= 0"); } @@ -255,7 +255,7 @@ public class TileRenderer extends TileRendererBase { * @see #TR_TILE_X_OFFSET * @see #TR_TILE_Y_OFFSET **/ - public void setTileOffset(int xoff, int yoff) { + public void setTileOffset(final int xoff, final int yoff) { offsetX = xoff; offsetY = yoff; } @@ -299,7 +299,7 @@ public class TileRenderer extends TileRendererBase { /* pp */ final int getCurrentTile() { return currentTile; } @Override - public final int getParam(int pname) { + public final int getParam(final int pname) { switch (pname) { case TR_IMAGE_WIDTH: return imageSize.getWidth(); @@ -349,7 +349,7 @@ public class TileRenderer extends TileRendererBase { * * @param order The row traversal order, must be either {@link #TR_TOP_TO_BOTTOM} or {@link #TR_BOTTOM_TO_TOP}. */ - public final void setRowOrder(int order) { + public final void setRowOrder(final int order) { if (order == TR_TOP_TO_BOTTOM || order == TR_BOTTOM_TO_TOP) { rowOrder = order; } else { @@ -388,7 +388,7 @@ public class TileRenderer extends TileRendererBase { * {@link #eot() end-of-tiling} has been reached. */ @Override - public final void beginTile( GL gl ) throws IllegalStateException, GLException { + public final void beginTile( final GL gl ) throws IllegalStateException, GLException { if( !isSetup() ) { throw new IllegalStateException("Image size has not been set: "+this); } @@ -408,7 +408,7 @@ public class TileRenderer extends TileRendererBase { assert ( currentRow < rows ); assert ( currentColumn < columns ); - int border = tileBorder; + final int border = tileBorder; final DimensionImmutable clippedImageSize = getClippedImageSize(); int tH, tW; @@ -446,7 +446,7 @@ public class TileRenderer extends TileRendererBase { } @Override - public void endTile( GL gl ) throws IllegalStateException, GLException { + public void endTile( final GL gl ) throws IllegalStateException, GLException { if( !beginCalled ) { throw new IllegalStateException("beginTile(..) has not been called"); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/TimeFrameI.java b/src/jogl/classes/com/jogamp/opengl/util/TimeFrameI.java index b29846d91..99def6f5c 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/TimeFrameI.java +++ b/src/jogl/classes/com/jogamp/opengl/util/TimeFrameI.java @@ -60,7 +60,7 @@ public class TimeFrameI { pts = INVALID_PTS; duration = 0; } - public TimeFrameI(int pts, int duration) { + public TimeFrameI(final int pts, final int duration) { this.pts = pts; this.duration = duration; } @@ -68,11 +68,11 @@ public class TimeFrameI { /** Get this frame's presentation timestamp (PTS) in milliseconds. */ public final int getPTS() { return pts; } /** Set this frame's presentation timestamp (PTS) in milliseconds. */ - public final void setPTS(int pts) { this.pts = pts; } + public final void setPTS(final int pts) { this.pts = pts; } /** Get this frame's duration in milliseconds. */ public final int getDuration() { return duration; } /** Set this frame's duration in milliseconds. */ - public final void setDuration(int duration) { this.duration = duration; } + public final void setDuration(final int duration) { this.duration = duration; } @Override public String toString() { diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java index 1d835dd33..6d875fcf5 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java +++ b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSink.java @@ -61,7 +61,7 @@ public interface AudioSink { * @param planar true for planar data package (each channel in own data buffer), false for packed data channels interleaved in one buffer. * @param littleEndian true for little-endian, false for big endian */ - public AudioFormat(int sampleRate, int sampleSize, int channelCount, boolean signed, boolean fixedP, boolean planar, boolean littleEndian) { + public AudioFormat(final int sampleRate, final int sampleSize, final int channelCount, final boolean signed, final boolean fixedP, final boolean planar, final boolean littleEndian) { this.sampleRate = sampleRate; this.sampleSize = sampleSize; this.channelCount = channelCount; @@ -104,7 +104,7 @@ public interface AudioSink { * Time -> Byte Count *

*/ - public final int getDurationsByteSize(int millisecs) { + public final int getDurationsByteSize(final int millisecs) { final int bytesPerSample = sampleSize >>> 3; // /8 return millisecs * ( channelCount * bytesPerSample * ( sampleRate / 1000 ) ); } @@ -116,7 +116,7 @@ public interface AudioSink { * Byte Count -> Time *

*/ - public final int getBytesDuration(int byteCount) { + public final int getBytesDuration(final int byteCount) { final int bytesPerSample = sampleSize >>> 3; // /8 return byteCount / ( channelCount * bytesPerSample * ( sampleRate / 1000 ) ); } @@ -132,7 +132,7 @@ public interface AudioSink { *

* @param sampleCount sample count per frame and channel */ - public final float getSamplesDuration(int sampleCount) { + public final float getSamplesDuration(final int sampleCount) { return ( 1000f * sampleCount ) / sampleRate; } @@ -151,7 +151,7 @@ public interface AudioSink { * @param millisecs time in milliseconds * @param frameDuration duration per frame in milliseconds. */ - public final int getFrameCount(int millisecs, float frameDuration) { + public final int getFrameCount(final int millisecs, final float frameDuration) { return Math.max(1, (int) ( millisecs / frameDuration + 0.5f )); } @@ -170,7 +170,7 @@ public interface AudioSink { *

* @param sampleCount sample count */ - public final int getSamplesByteCount(int sampleCount) { + public final int getSamplesByteCount(final int sampleCount) { return sampleCount * ( sampleSize >>> 3 ); } @@ -189,7 +189,7 @@ public interface AudioSink { *

* @param byteCount number of bytes */ - public final int getBytesSampleCount(int byteCount) { + public final int getBytesSampleCount(final int byteCount) { return ( byteCount << 3 ) / sampleSize; } @@ -208,7 +208,7 @@ public interface AudioSink { public AudioFrame() { this.byteSize = 0; } - public AudioFrame(int pts, int duration, int byteCount) { + public AudioFrame(final int pts, final int duration, final int byteCount) { super(pts, duration); this.byteSize=byteCount; } @@ -216,7 +216,7 @@ public interface AudioSink { /** Get this frame's size in bytes. */ public final int getByteSize() { return byteSize; } /** Set this frame's size in bytes. */ - public final void setByteSize(int size) { this.byteSize=size; } + public final void setByteSize(final int size) { this.byteSize=size; } @Override public String toString() { @@ -226,7 +226,7 @@ public interface AudioSink { public static class AudioDataFrame extends AudioFrame { protected final ByteBuffer data; - public AudioDataFrame(int pts, int duration, ByteBuffer bytes, int byteCount) { + public AudioDataFrame(final int pts, final int duration, final ByteBuffer bytes, final int byteCount) { super(pts, duration, byteCount); if( byteCount > bytes.remaining() ) { throw new IllegalArgumentException("Give size "+byteCount+" exceeds remaining bytes in ls "+bytes+". "+this); diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSinkFactory.java b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSinkFactory.java index 386b1e085..a2b29b4eb 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/av/AudioSinkFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/util/av/AudioSinkFactory.java @@ -50,7 +50,7 @@ public class AudioSinkFactory { return new NullAudioSink(); } - public static AudioSink create(final ClassLoader cl, String implName) { + public static AudioSink create(final ClassLoader cl, final String implName) { final AudioSink audioSink; if(ReflectionUtil.isClassAvailable(implName, cl)){ try { @@ -58,7 +58,7 @@ public class AudioSinkFactory { if( audioSink.isInitialized() ) { return audioSink; } - } catch (Throwable t) { + } catch (final Throwable t) { if(AudioSink.DEBUG) { System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); } } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java index 215275951..4fffd9fab 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayer.java @@ -246,10 +246,10 @@ public interface GLMediaPlayer extends TextureSequence { */ @SuppressWarnings("serial") public static class StreamException extends Exception { - public StreamException(Throwable cause) { + public StreamException(final Throwable cause) { super(cause); } - public StreamException(String message, Throwable cause) { + public StreamException(final String message, final Throwable cause) { super(message, cause); } } @@ -318,7 +318,7 @@ public interface GLMediaPlayer extends TextureSequence { public final int id; - State(int id){ + State(final int id){ this.id = id; } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java index 558d59630..9378cec91 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java +++ b/src/jogl/classes/com/jogamp/opengl/util/av/GLMediaPlayerFactory.java @@ -55,12 +55,12 @@ public class GLMediaPlayerFactory { return new NullGLMediaPlayer(); } - public static GLMediaPlayer create(final ClassLoader cl, String implName) { + public static GLMediaPlayer create(final ClassLoader cl, final String implName) { try { if(((Boolean)ReflectionUtil.callStaticMethod(implName, isAvailableMethodName, null, null, cl)).booleanValue()) { return (GLMediaPlayer) ReflectionUtil.createInstance(implName, cl); } - } catch (Throwable t) { if(GLMediaPlayer.DEBUG) { System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); } } + } catch (final Throwable t) { if(GLMediaPlayer.DEBUG) { System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); } } return null; } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java index a33356067..04bc0a15d 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLPixelBuffer.java @@ -31,6 +31,7 @@ import java.awt.image.BufferedImage; import java.awt.image.ColorModel; import java.awt.image.DataBuffer; import java.awt.image.DataBufferInt; +import java.awt.image.Raster; import java.awt.image.SinglePixelPackedSampleModel; import java.awt.image.WritableRaster; import java.nio.Buffer; @@ -78,8 +79,8 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { * @param allowRowStride If true, allow row-stride, otherwise not. See {@link #requiresNewBuffer(GL, int, int, int)}. * If true, user shall decide whether to use a {@link #getAlignedImage(int, int) width-aligned image}. */ - public AWTGLPixelBuffer(GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, BufferedImage image, - Buffer buffer, boolean allowRowStride) { + public AWTGLPixelBuffer(final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final BufferedImage image, + final Buffer buffer, final boolean allowRowStride) { super(pixelAttributes, width, height, depth, pack, buffer, allowRowStride); this.image = image; } @@ -97,7 +98,7 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { * @return * @throws IllegalArgumentException if requested size exceeds image size */ - public BufferedImage getAlignedImage(int width, int height) throws IllegalArgumentException { + public BufferedImage getAlignedImage(final int width, final int height) throws IllegalArgumentException { if( width * height > image.getWidth() * image.getHeight() ) { throw new IllegalArgumentException("Requested size exceeds image size: "+width+"x"+height+" > "+image.getWidth()+"x"+image.getHeight()); } @@ -110,12 +111,12 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { final SinglePixelPackedSampleModel sppsm0 = (SinglePixelPackedSampleModel) raster0.getSampleModel(); final SinglePixelPackedSampleModel sppsm1 = new SinglePixelPackedSampleModel(dataBuffer.getDataType(), width, height, width /* scanLineStride */, sppsm0.getBitMasks()); - final WritableRaster raster1 = WritableRaster.createWritableRaster(sppsm1, dataBuffer, null); + final WritableRaster raster1 = Raster.createWritableRaster(sppsm1, dataBuffer, null); return new BufferedImage (cm, raster1, cm.isAlphaPremultiplied(), null); } } - public final boolean isDataBufferSource(BufferedImage imageU) { + public final boolean isDataBufferSource(final BufferedImage imageU) { final DataBuffer dataBuffer0 = image.getRaster().getDataBuffer(); final DataBuffer dataBufferU = imageU.getRaster().getDataBuffer(); return dataBufferU == dataBuffer0; @@ -143,14 +144,14 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { * See {@link #getAllowRowStride()} and {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int)}. * If true, user shall decide whether to use a {@link AWTGLPixelBuffer#getAlignedImage(int, int) width-aligned image}. */ - public AWTGLPixelBufferProvider(boolean allowRowStride) { + public AWTGLPixelBufferProvider(final boolean allowRowStride) { this.allowRowStride = allowRowStride; } @Override public boolean getAllowRowStride() { return allowRowStride; } @Override - public GLPixelAttributes getAttributes(GL gl, int componentCount) { + public GLPixelAttributes getAttributes(final GL gl, final int componentCount) { return 4 == componentCount ? awtPixelAttributesIntRGBA4 : awtPixelAttributesIntRGB3; } @@ -161,7 +162,7 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { *

*/ @Override - public AWTGLPixelBuffer allocate(GL gl, GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize) { + public AWTGLPixelBuffer allocate(final GL gl, final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final int minByteSize) { final BufferedImage image = new BufferedImage(width, height, 4 == pixelAttributes.componentCount ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB); final int[] readBackIntBuffer = ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); final Buffer ibuffer = IntBuffer.wrap( readBackIntBuffer ); @@ -186,7 +187,7 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { /** * @param allowRowStride If true, allow row-stride, otherwise not. See {@link AWTGLPixelBuffer#requiresNewBuffer(GL, int, int, int)}. */ - public SingleAWTGLPixelBufferProvider(boolean allowRowStride) { + public SingleAWTGLPixelBufferProvider(final boolean allowRowStride) { super(allowRowStride); } @@ -197,7 +198,7 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { *

*/ @Override - public AWTGLPixelBuffer allocate(GL gl, GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize) { + public AWTGLPixelBuffer allocate(final GL gl, final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final int minByteSize) { if( 4 == pixelAttributes.componentCount ) { if( null == singleRGBA4 || singleRGBA4.requiresNewBuffer(gl, width, height, minByteSize) ) { singleRGBA4 = allocateImpl(pixelAttributes, width, height, depth, pack, minByteSize); @@ -211,7 +212,7 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { } } - private AWTGLPixelBuffer allocateImpl(GLPixelAttributes pixelAttributes, int width, int height, int depth, boolean pack, int minByteSize) { + private AWTGLPixelBuffer allocateImpl(final GLPixelAttributes pixelAttributes, final int width, final int height, final int depth, final boolean pack, final int minByteSize) { final BufferedImage image = new BufferedImage(width, height, 4 == pixelAttributes.componentCount ? BufferedImage.TYPE_INT_ARGB : BufferedImage.TYPE_INT_RGB); final int[] readBackIntBuffer = ((DataBufferInt) image.getRaster().getDataBuffer()).getData(); final Buffer ibuffer = IntBuffer.wrap( readBackIntBuffer ); @@ -220,7 +221,7 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { /** Return the last {@link #allocate(GL, GLPixelAttributes, int, int, int, boolean, int) allocated} {@link AWTGLPixelBuffer} w/ {@link GLPixelAttributes#componentCount}. */ @Override - public AWTGLPixelBuffer getSingleBuffer(GLPixelAttributes pixelAttributes) { + public AWTGLPixelBuffer getSingleBuffer(final GLPixelAttributes pixelAttributes) { return 4 == pixelAttributes.componentCount ? singleRGBA4 : singleRGB3; } @@ -229,7 +230,7 @@ public class AWTGLPixelBuffer extends GLPixelBuffer { * @return the newly initialized single {@link AWTGLPixelBuffer}, or null if already allocated. */ @Override - public AWTGLPixelBuffer initSingleton(int componentCount, int width, int height, int depth, boolean pack) { + public AWTGLPixelBuffer initSingleton(final int componentCount, final int width, final int height, final int depth, final boolean pack) { if( 4 == componentCount ) { if( null != singleRGBA4 ) { return null; diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java index 3c5d6be2d..06e3ccda5 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java @@ -46,7 +46,7 @@ public class AWTGLReadBufferUtil extends GLReadBufferUtil { * * @param alpha */ - public AWTGLReadBufferUtil(GLProfile glp, boolean alpha) { + public AWTGLReadBufferUtil(final GLProfile glp, final boolean alpha) { super(new AWTGLPixelBuffer.AWTGLPixelBufferProvider( glp.isGL2ES3() /* allowRowStride */ ), alpha, false); } @@ -64,7 +64,7 @@ public class AWTGLReadBufferUtil extends GLReadBufferUtil { * and handled in a efficient manner there (TextureCoordinates and TextureIO writer). * @see #AWTGLReadBufferUtil(GLProfile, boolean) */ - public BufferedImage readPixelsToBufferedImage(GL gl, boolean awtOrientation) { + public BufferedImage readPixelsToBufferedImage(final GL gl, final boolean awtOrientation) { return readPixelsToBufferedImage(gl, 0, 0, 0, 0, awtOrientation); } @@ -84,7 +84,7 @@ public class AWTGLReadBufferUtil extends GLReadBufferUtil { * and handled in a efficient manner there (TextureCoordinates and TextureIO writer). * @see #AWTGLReadBufferUtil(GLProfile, boolean) */ - public BufferedImage readPixelsToBufferedImage(GL gl, int inX, int inY, int inWidth, int inHeight, boolean awtOrientation) { + public BufferedImage readPixelsToBufferedImage(final GL gl, final int inX, final int inY, final int inWidth, final int inHeight, final boolean awtOrientation) { final GLDrawable drawable = gl.getContext().getGLReadDrawable(); final int width, height; if( 0 >= inWidth || drawable.getSurfaceWidth() < inWidth ) { diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java b/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java index df3cc4a39..4023a06f0 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/ImageUtil.java @@ -50,8 +50,8 @@ public class ImageUtil { /** Flips the supplied BufferedImage vertically. This is often a necessary conversion step to display a Java2D image correctly with OpenGL and vice versa. */ - public static void flipImageVertically(BufferedImage image) { - WritableRaster raster = image.getRaster(); + public static void flipImageVertically(final BufferedImage image) { + final WritableRaster raster = image.getRaster(); Object scanline1 = null; Object scanline2 = null; @@ -73,8 +73,8 @@ public class ImageUtil { * * @return A instance of BufferedImage with a type compatible with the graphics card. */ - public static BufferedImage createCompatibleImage(int width, int height) { - GraphicsConfiguration configuration = + public static BufferedImage createCompatibleImage(final int width, final int height) { + final GraphicsConfiguration configuration = GraphicsEnvironment.getLocalGraphicsEnvironment(). getDefaultScreenDevice().getDefaultConfiguration(); return configuration.createCompatibleImage(width, height); @@ -92,7 +92,7 @@ public class ImageUtil { * * @return A thumbnail with the requested width or the original picture if thumbWidth = image.getWidth() */ - public static BufferedImage createThumbnail(BufferedImage image, int thumbWidth) { + public static BufferedImage createThumbnail(final BufferedImage image, final int thumbWidth) { // Thanks to Romain Guy for this utility if (thumbWidth > image.getWidth()) { throw new IllegalArgumentException("Thumbnail width must be greater than image width"); @@ -102,7 +102,7 @@ public class ImageUtil { return image; } - float ratio = (float) image.getWidth() / (float) image.getHeight(); + final float ratio = (float) image.getWidth() / (float) image.getHeight(); int width = image.getWidth(); BufferedImage thumb = image; @@ -112,8 +112,8 @@ public class ImageUtil { width = thumbWidth; } - BufferedImage temp = createCompatibleImage(width, (int) (width / ratio)); - Graphics2D g2 = temp.createGraphics(); + final BufferedImage temp = createCompatibleImage(width, (int) (width / ratio)); + final Graphics2D g2 = temp.createGraphics(); g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); g2.drawImage(thumb, 0, 0, temp.getWidth(), temp.getHeight(), null); diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java b/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java index 1ad7b9987..a78bc9bb3 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java @@ -49,13 +49,13 @@ import javax.media.opengl.*; efficiency. */ public class Overlay { - private GLDrawable drawable; + private final GLDrawable drawable; private TextureRenderer renderer; private boolean contentsLost; /** Creates a new Java 2D overlay on top of the specified GLDrawable. */ - public Overlay(GLDrawable drawable) { + public Overlay(final GLDrawable drawable) { this.drawable = drawable; } @@ -103,7 +103,7 @@ public class Overlay { @param height the height of the region to update @throws GLException If an OpenGL context is not current when this method is called */ - public void markDirty(int x, int y, int width, int height) { + public void markDirty(final int x, final int y, final int width, final int height) { renderer.markDirty(x, y, width, height); } @@ -159,7 +159,7 @@ public class Overlay { @throws GLException If an OpenGL context is not current when this method is called */ - public void draw(int x, int y, int width, int height) throws GLException { + public void draw(final int x, final int y, final int width, final int height) throws GLException { draw(x, y, x, y, width, height); } @@ -184,9 +184,9 @@ public class Overlay { @throws GLException If an OpenGL context is not current when this method is called */ - public void draw(int screenx, int screeny, - int overlayx, int overlayy, - int width, int height) throws GLException { + public void draw(final int screenx, final int screeny, + final int overlayx, final int overlayy, + final int width, final int height) throws GLException { renderer.drawOrthoRect(screenx, screeny, overlayx, overlayy, width, height); diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java b/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java index f686b672a..ac208044b 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/Screenshot.java @@ -88,9 +88,9 @@ public class Screenshot { * @throws IOException if an I/O error occurred while writing the * file */ - public static void writeToTargaFile(File file, - int width, - int height) throws GLException, IOException { + public static void writeToTargaFile(final File file, + final int width, + final int height) throws GLException, IOException { writeToTargaFile(file, width, height, false); } @@ -115,10 +115,10 @@ public class Screenshot { * @throws IOException if an I/O error occurred while writing the * file */ - public static void writeToTargaFile(File file, - int width, - int height, - boolean alpha) throws GLException, IOException { + public static void writeToTargaFile(final File file, + final int width, + final int height, + final boolean alpha) throws GLException, IOException { writeToTargaFile(file, 0, 0, width, height, alpha); } @@ -145,27 +145,27 @@ public class Screenshot { * @throws IOException if an I/O error occurred while writing the * file */ - public static void writeToTargaFile(File file, - int x, - int y, - int width, - int height, - boolean alpha) throws GLException, IOException { + public static void writeToTargaFile(final File file, + final int x, + final int y, + final int width, + final int height, + final boolean alpha) throws GLException, IOException { if (alpha) { checkExtABGR(); } - TGAWriter writer = new TGAWriter(); + final TGAWriter writer = new TGAWriter(); writer.open(file, width, height, alpha); - ByteBuffer bgr = writer.getImageData(); + final ByteBuffer bgr = writer.getImageData(); - GL gl = GLContext.getCurrentGL(); + final GL gl = GLContext.getCurrentGL(); // Set up pixel storage modes - GLPixelStorageModes psm = new GLPixelStorageModes(); + final GLPixelStorageModes psm = new GLPixelStorageModes(); psm.setPackAlignment(gl, 1); - int readbackType = (alpha ? GL2.GL_ABGR_EXT : GL2GL3.GL_BGR); + final int readbackType = (alpha ? GL2.GL_ABGR_EXT : GL2GL3.GL_BGR); // read the BGR values into the image buffer gl.glReadPixels(x, y, width, height, readbackType, @@ -198,8 +198,8 @@ public class Screenshot { * @throws GLException if an OpenGL context was not current or * another OpenGL-related error occurred */ - public static BufferedImage readToBufferedImage(int width, - int height) throws GLException { + public static BufferedImage readToBufferedImage(final int width, + final int height) throws GLException { return readToBufferedImage(width, height, false); } @@ -223,9 +223,9 @@ public class Screenshot { * @throws GLException if an OpenGL context was not current or * another OpenGL-related error occurred */ - public static BufferedImage readToBufferedImage(int width, - int height, - boolean alpha) throws GLException { + public static BufferedImage readToBufferedImage(final int width, + final int height, + final boolean alpha) throws GLException { return readToBufferedImage(0, 0, width, height, alpha); } @@ -251,26 +251,26 @@ public class Screenshot { * @throws GLException if an OpenGL context was not current or * another OpenGL-related error occurred */ - public static BufferedImage readToBufferedImage(int x, - int y, - int width, - int height, - boolean alpha) throws GLException { - int bufImgType = (alpha ? BufferedImage.TYPE_4BYTE_ABGR : BufferedImage.TYPE_3BYTE_BGR); - int readbackType = (alpha ? GL2.GL_ABGR_EXT : GL2GL3.GL_BGR); + public static BufferedImage readToBufferedImage(final int x, + final int y, + final int width, + final int height, + final boolean alpha) throws GLException { + final int bufImgType = (alpha ? BufferedImage.TYPE_4BYTE_ABGR : BufferedImage.TYPE_3BYTE_BGR); + final int readbackType = (alpha ? GL2.GL_ABGR_EXT : GL2GL3.GL_BGR); if (alpha) { checkExtABGR(); } // Allocate necessary storage - BufferedImage image = new BufferedImage(width, height, bufImgType); + final BufferedImage image = new BufferedImage(width, height, bufImgType); - GLContext glc = GLContext.getCurrent(); - GL gl = glc.getGL(); + final GLContext glc = GLContext.getCurrent(); + final GL gl = glc.getGL(); // Set up pixel storage modes - GLPixelStorageModes psm = new GLPixelStorageModes(); + final GLPixelStorageModes psm = new GLPixelStorageModes(); psm.setPackAlignment(gl, 1); // read the BGR values into the image @@ -313,9 +313,9 @@ public class Screenshot { * not be written to disk due to the requested file format being * unsupported by ImageIO */ - public static void writeToFile(File file, - int width, - int height) throws IOException, GLException { + public static void writeToFile(final File file, + final int width, + final int height) throws IOException, GLException { writeToFile(file, width, height, false); } @@ -348,10 +348,10 @@ public class Screenshot { * not be written to disk due to the requested file format being * unsupported by ImageIO */ - public static void writeToFile(File file, - int width, - int height, - boolean alpha) throws IOException, GLException { + public static void writeToFile(final File file, + final int width, + final int height, + final boolean alpha) throws IOException, GLException { writeToFile(file, 0, 0, width, height, alpha); } @@ -386,26 +386,26 @@ public class Screenshot { * not be written to disk due to the requested file format being * unsupported by ImageIO */ - public static void writeToFile(File file, - int x, - int y, - int width, - int height, + public static void writeToFile(final File file, + final int x, + final int y, + final int width, + final int height, boolean alpha) throws IOException, GLException { - String fileSuffix = IOUtil.getFileSuffix(file); + final String fileSuffix = IOUtil.getFileSuffix(file); if (alpha && (fileSuffix.equals("jpg") || fileSuffix.equals("jpeg"))) { // JPEGs can't deal properly with alpha channels alpha = false; } - BufferedImage image = readToBufferedImage(x, y, width, height, alpha); + final BufferedImage image = readToBufferedImage(x, y, width, height, alpha); if (!ImageIO.write(image, fileSuffix, file)) { throw new IOException("Unsupported file format " + fileSuffix); } } private static void checkExtABGR() { - GL gl = GLContext.getCurrentGL(); + final GL gl = GLContext.getCurrentGL(); if (!gl.isExtensionAvailable(GLExtensions.EXT_abgr)) { throw new IllegalArgumentException("Saving alpha channel requires GL_EXT_abgr"); diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java index a5c8f66af..660d3bc6a 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextRenderer.java @@ -40,7 +40,7 @@ package com.jogamp.opengl.util.awt; import com.jogamp.common.nio.Buffers; - +import com.jogamp.common.util.PropertyAccess; import com.jogamp.opengl.GLExtensions; import com.jogamp.opengl.util.*; import com.jogamp.opengl.util.packrect.*; @@ -60,14 +60,12 @@ import java.awt.RenderingHints; import java.awt.event.*; import java.awt.font.*; import java.awt.geom.*; - import java.nio.*; - import java.text.*; - import java.util.*; import javax.media.opengl.*; +import javax.media.opengl.fixedfunc.GLPointerFunc; import javax.media.opengl.glu.*; import javax.media.opengl.awt.*; @@ -132,7 +130,7 @@ public class TextRenderer { static { Debug.initSingleton(); - DEBUG = Debug.isPropertyDefined("jogl.debug.TextRenderer", true); + DEBUG = PropertyAccess.isPropertyDefined("jogl.debug.TextRenderer", true); } // These are occasionally useful for more in-depth debugging @@ -218,7 +216,7 @@ public class TextRenderer { @param font the font to render with */ - public TextRenderer(Font font) { + public TextRenderer(final Font font) { this(font, false, false, null, false); } @@ -232,7 +230,7 @@ public class TextRenderer { @param font the font to render with @param mipmap whether to attempt use of automatic mipmap generation */ - public TextRenderer(Font font, boolean mipmap) { + public TextRenderer(final Font font, final boolean mipmap) { this(font, false, false, null, mipmap); } @@ -249,8 +247,8 @@ public class TextRenderer { @param useFractionalMetrics whether to use fractional font metrics at the Java 2D level */ - public TextRenderer(Font font, boolean antialiased, - boolean useFractionalMetrics) { + public TextRenderer(final Font font, final boolean antialiased, + final boolean useFractionalMetrics) { this(font, antialiased, useFractionalMetrics, null, false); } @@ -268,8 +266,8 @@ public class TextRenderer { @param renderDelegate the render delegate to use to draw the text's bitmap, or null to use the default one */ - public TextRenderer(Font font, boolean antialiased, - boolean useFractionalMetrics, RenderDelegate renderDelegate) { + public TextRenderer(final Font font, final boolean antialiased, + final boolean useFractionalMetrics, final RenderDelegate renderDelegate) { this(font, antialiased, useFractionalMetrics, renderDelegate, false); } @@ -290,9 +288,9 @@ public class TextRenderer { text's bitmap, or null to use the default one @param mipmap whether to attempt use of automatic mipmap generation */ - public TextRenderer(Font font, boolean antialiased, - boolean useFractionalMetrics, RenderDelegate renderDelegate, - boolean mipmap) { + public TextRenderer(final Font font, final boolean antialiased, + final boolean useFractionalMetrics, RenderDelegate renderDelegate, + final boolean mipmap) { this.font = font; this.antialiased = antialiased; this.useFractionalMetrics = useFractionalMetrics; @@ -314,7 +312,7 @@ public class TextRenderer { /** Returns the bounding rectangle of the given String, assuming it was rendered at the origin. See {@link #getBounds(CharSequence) getBounds(CharSequence)}. */ - public Rectangle2D getBounds(String str) { + public Rectangle2D getBounds(final String str) { return getBounds((CharSequence) str); } @@ -333,12 +331,12 @@ public class TextRenderer { {@link java.awt.font.GlyphVector#getPixelBounds getPixelBounds}, etc.) the returned bounds correspond to, although every effort is made to ensure an accurate bound. */ - public Rectangle2D getBounds(CharSequence str) { + public Rectangle2D getBounds(final CharSequence str) { // FIXME: this should be more optimized and use the glyph cache - Rect r = stringLocations.get(str); + final Rect r = stringLocations.get(str); if (r != null) { - TextData data = (TextData) r.getUserData(); + final TextData data = (TextData) r.getUserData(); // Reconstitute the Java 2D results based on the cached values return new Rectangle2D.Double(-data.origin().x, -data.origin().y, @@ -385,7 +383,7 @@ public class TextRenderer { @param height the height of the current on-screen OpenGL drawable @throws javax.media.opengl.GLException If an OpenGL context is not current when this method is called */ - public void beginRendering(int width, int height) throws GLException { + public void beginRendering(final int width, final int height) throws GLException { beginRendering(width, height, true); } @@ -405,7 +403,7 @@ public class TextRenderer { @param disableDepthTest whether to disable the depth test @throws GLException If an OpenGL context is not current when this method is called */ - public void beginRendering(int width, int height, boolean disableDepthTest) + public void beginRendering(final int width, final int height, final boolean disableDepthTest) throws GLException { beginRendering(true, width, height, disableDepthTest); } @@ -432,8 +430,8 @@ public class TextRenderer { @param color the new color to use for rendering text @throws GLException If an OpenGL context is not current when this method is called */ - public void setColor(Color color) throws GLException { - boolean noNeedForFlush = (haveCachedColor && (cachedColor != null) && + public void setColor(final Color color) throws GLException { + final boolean noNeedForFlush = (haveCachedColor && (cachedColor != null) && color.equals(cachedColor)); if (!noNeedForFlush) { @@ -460,9 +458,9 @@ public class TextRenderer { transparent, 1.0f = completely opaque @throws GLException If an OpenGL context is not current when this method is called */ - public void setColor(float r, float g, float b, float a) + public void setColor(final float r, final float g, final float b, final float a) throws GLException { - boolean noNeedForFlush = (haveCachedColor && (cachedColor == null) && + final boolean noNeedForFlush = (haveCachedColor && (cachedColor == null) && (r == cachedR) && (g == cachedG) && (b == cachedB) && (a == cachedA)); @@ -490,14 +488,14 @@ public class TextRenderer { @param y the y coordinate at which to draw @throws GLException If an OpenGL context is not current when this method is called */ - public void draw(CharSequence str, int x, int y) throws GLException { + public void draw(final CharSequence str, final int x, final int y) throws GLException { draw3D(str, x, y, 0, 1); } /** Draws the supplied String at the desired location using the renderer's current color. See {@link #draw(CharSequence, int, int) draw(CharSequence, int, int)}. */ - public void draw(String str, int x, int y) throws GLException { + public void draw(final String str, final int x, final int y) throws GLException { draw3D(str, x, y, 0, 1); } @@ -513,8 +511,8 @@ public class TextRenderer { @param scaleFactor a uniform scale factor applied to the width and height of the drawn rectangle @throws GLException If an OpenGL context is not current when this method is called */ - public void draw3D(CharSequence str, float x, float y, float z, - float scaleFactor) { + public void draw3D(final CharSequence str, final float x, final float y, final float z, + final float scaleFactor) { internal_draw3D(str, x, y, z, scaleFactor); } @@ -522,12 +520,12 @@ public class TextRenderer { renderer's current color. See {@link #draw3D(CharSequence, float, float, float, float) draw3D(CharSequence, float, float, float, float)}. */ - public void draw3D(String str, float x, float y, float z, float scaleFactor) { + public void draw3D(final String str, final float x, final float y, final float z, final float scaleFactor) { internal_draw3D(str, x, y, z, scaleFactor); } /** Returns the pixel width of the given character. */ - public float getCharWidth(char inChar) { + public float getCharWidth(final char inChar) { return mGlyphProducer.getGlyphPixelWidth(inChar); } @@ -582,20 +580,20 @@ public class TextRenderer { // Internals only below this point // - private static Rectangle2D preNormalize(Rectangle2D src) { + private static Rectangle2D preNormalize(final Rectangle2D src) { // Need to round to integer coordinates // Also give ourselves a little slop around the reported // bounds of glyphs because it looks like neither the visual // nor the pixel bounds works perfectly well - int minX = (int) Math.floor(src.getMinX()) - 1; - int minY = (int) Math.floor(src.getMinY()) - 1; - int maxX = (int) Math.ceil(src.getMaxX()) + 1; - int maxY = (int) Math.ceil(src.getMaxY()) + 1; + final int minX = (int) Math.floor(src.getMinX()) - 1; + final int minY = (int) Math.floor(src.getMinY()) - 1; + final int maxX = (int) Math.ceil(src.getMaxX()) + 1; + final int maxY = (int) Math.ceil(src.getMaxY()) + 1; return new Rectangle2D.Double(minX, minY, maxX - minX, maxY - minY); } - private Rectangle2D normalize(Rectangle2D src) { + private Rectangle2D normalize(final Rectangle2D src) { // Give ourselves a boundary around each entity on the backing // store in order to prevent bleeding of nearby Strings due to // the fact that we use linear filtering @@ -603,7 +601,7 @@ public class TextRenderer { // NOTE that this boundary is quite heuristic and is related // to how far away in 3D we may view the text -- // heuristically, 1.5% of the font's height - int boundary = (int) Math.max(1, 0.015 * font.getSize()); + final int boundary = (int) Math.max(1, 0.015 * font.getSize()); return new Rectangle2D.Double((int) Math.floor(src.getMinX() - boundary), (int) Math.floor(src.getMinY() - boundary), @@ -612,7 +610,7 @@ public class TextRenderer { } private TextureRenderer getBackingStore() { - TextureRenderer renderer = (TextureRenderer) packer.getBackingStore(); + final TextureRenderer renderer = (TextureRenderer) packer.getBackingStore(); if (renderer != cachedBackingStore) { // Backing store changed since last time; discard any cached Graphics2D @@ -629,7 +627,7 @@ public class TextRenderer { } private Graphics2D getGraphics2D() { - TextureRenderer renderer = getBackingStore(); + final TextureRenderer renderer = getBackingStore(); if (cachedGraphics == null) { cachedGraphics = renderer.createGraphics(); @@ -650,9 +648,9 @@ public class TextRenderer { return cachedGraphics; } - private void beginRendering(boolean ortho, int width, int height, - boolean disableDepthTestForOrtho) { - GL2 gl = GLContext.getCurrentGL().getGL2(); + private void beginRendering(final boolean ortho, final int width, final int height, + final boolean disableDepthTestForOrtho) { + final GL2 gl = GLContext.getCurrentGL().getGL2(); if (DEBUG && !debugged) { debug(gl); @@ -677,8 +675,8 @@ public class TextRenderer { if (!haveMaxSize) { // Query OpenGL for the maximum texture size and set it in the // RectanglePacker to keep it from expanding too large - int[] sz = new int[1]; - gl.glGetIntegerv(GL2.GL_MAX_TEXTURE_SIZE, sz, 0); + final int[] sz = new int[1]; + gl.glGetIntegerv(GL.GL_MAX_TEXTURE_SIZE, sz, 0); packer.setMaxSize(sz[0], sz[0]); haveMaxSize = true; } @@ -711,12 +709,12 @@ public class TextRenderer { * @param ortho * @throws GLException */ - private void endRendering(boolean ortho) throws GLException { + private void endRendering(final boolean ortho) throws GLException { flushGlyphPipeline(); inBeginEndPair = false; - GL2 gl = GLContext.getCurrentGL().getGL2(); + final GL2 gl = GLContext.getCurrentGL().getGL2(); // Pop client attrib bits used by the pipelined quad renderer gl.glPopClientAttrib(); @@ -726,8 +724,8 @@ public class TextRenderer { // binding if (getUseVertexArrays() && is15Available(gl)) { try { - gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0); - } catch (Exception e) { + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); + } catch (final Exception e) { isExtensionAvailable_GL_VERSION_1_5 = false; } } @@ -756,8 +754,8 @@ public class TextRenderer { // text strings that haven't been used recently packer.visit(new RectVisitor() { @Override - public void visit(Rect rect) { - TextData data = (TextData) rect.getUserData(); + public void visit(final Rect rect) { + final TextData data = (TextData) rect.getUserData(); if (data.used()) { data.clearUsed(); @@ -767,11 +765,11 @@ public class TextRenderer { } }); - for (Rect r : deadRects) { + for (final Rect r : deadRects) { packer.remove(r); stringLocations.remove(((TextData) r.getUserData()).string()); - int unicodeToClearFromCache = ((TextData) r.getUserData()).unicodeID; + final int unicodeToClearFromCache = ((TextData) r.getUserData()).unicodeID; if (unicodeToClearFromCache > 0) { mGlyphProducer.clearCacheEntry(unicodeToClearFromCache); @@ -786,7 +784,7 @@ public class TextRenderer { } // If we removed dead rectangles this cycle, try to do a compaction - float frag = packer.verticalFragmentationRatio(); + final float frag = packer.verticalFragmentationRatio(); if (!deadRects.isEmpty() && (frag > MAX_VERTICAL_FRAGMENTATION)) { if (DEBUG) { @@ -804,10 +802,10 @@ public class TextRenderer { } } - private void internal_draw3D(CharSequence str, float x, float y, float z, - float scaleFactor) { - for (Glyph glyph : mGlyphProducer.getGlyphs(str)) { - float advance = glyph.draw3D(x, y, z, scaleFactor); + private void internal_draw3D(final CharSequence str, float x, final float y, final float z, + final float scaleFactor) { + for (final Glyph glyph : mGlyphProducer.getGlyphs(str)) { + final float advance = glyph.draw3D(x, y, z, scaleFactor); x += advance * scaleFactor; } } @@ -818,8 +816,8 @@ public class TextRenderer { } } - private void draw3D_ROBUST(CharSequence str, float x, float y, float z, - float scaleFactor) { + private void draw3D_ROBUST(final CharSequence str, final float x, final float y, final float z, + final float scaleFactor) { String curStr; if (str instanceof String) { curStr = (String) str; @@ -833,9 +831,9 @@ public class TextRenderer { if (rect == null) { // Rasterize this string and place it on the backing store Graphics2D g = getGraphics2D(); - Rectangle2D origBBox = preNormalize(renderDelegate.getBounds(curStr, font, getFontRenderContext())); - Rectangle2D bbox = normalize(origBBox); - Point origin = new Point((int) -bbox.getMinX(), + final Rectangle2D origBBox = preNormalize(renderDelegate.getBounds(curStr, font, getFontRenderContext())); + final Rectangle2D bbox = normalize(origBBox); + final Point origin = new Point((int) -bbox.getMinX(), (int) -bbox.getMinY()); rect = new Rect(0, 0, (int) bbox.getWidth(), (int) bbox.getHeight(), @@ -850,8 +848,8 @@ public class TextRenderer { // OK, should now have an (x, y) for this rectangle; rasterize // the String - int strx = rect.x() + origin.x; - int stry = rect.y() + origin.y; + final int strx = rect.x() + origin.x; + final int stry = rect.y() + origin.y; // Clear out the area we're going to draw into g.setComposite(AlphaComposite.Clear); @@ -862,7 +860,7 @@ public class TextRenderer { renderDelegate.draw(g, curStr, strx, stry); if (DRAW_BBOXES) { - TextData data = (TextData) rect.getUserData(); + final TextData data = (TextData) rect.getUserData(); // Draw a bounding box on the backing store g.drawRect(strx - data.origOriginX(), stry - data.origOriginY(), @@ -880,15 +878,15 @@ public class TextRenderer { } // OK, now draw the portion of the backing store to the screen - TextureRenderer renderer = getBackingStore(); + final TextureRenderer renderer = getBackingStore(); // NOTE that the rectangles managed by the packer have their // origin at the upper-left but the TextureRenderer's origin is // at its lower left!!! - TextData data = (TextData) rect.getUserData(); + final TextData data = (TextData) rect.getUserData(); data.markUsed(); - Rectangle2D origRect = data.origRect(); + final Rectangle2D origRect = data.origRect(); // Align the leftmost point of the baseline to the (x, y, z) coordinate requested renderer.draw3DRect(x - (scaleFactor * data.origOriginX()), @@ -902,10 +900,10 @@ public class TextRenderer { //---------------------------------------------------------------------- // Debugging functionality // - private void debug(GL gl) { + private void debug(final GL gl) { dbgFrame = new Frame("TextRenderer Debug Output"); - GLCanvas dbgCanvas = new GLCanvas(new GLCapabilities(gl.getGLProfile())); + final GLCanvas dbgCanvas = new GLCanvas(new GLCapabilities(gl.getGLProfile())); dbgCanvas.setSharedContext(GLContext.getCurrent()); dbgCanvas.addGLEventListener(new DebugListener(gl, dbgFrame)); dbgFrame.add(dbgCanvas); @@ -913,7 +911,7 @@ public class TextRenderer { final FPSAnimator anim = new FPSAnimator(dbgCanvas, 10); dbgFrame.addWindowListener(new WindowAdapter() { @Override - public void windowClosing(WindowEvent e) { + public void windowClosing(final WindowEvent e) { // Run this on another thread than the AWT event queue to // make sure the call to Animator.stop() completes before // exiting @@ -999,11 +997,11 @@ public class TextRenderer { CharSequenceIterator() { } - CharSequenceIterator(CharSequence sequence) { + CharSequenceIterator(final CharSequence sequence) { initFromCharSequence(sequence); } - public void initFromCharSequence(CharSequence sequence) { + public void initFromCharSequence(final CharSequence sequence) { mSequence = sequence; mLength = mSequence.length(); mCurrentIndex = 0; @@ -1040,7 +1038,7 @@ public class TextRenderer { } @Override - public char setIndex(int position) { + public char setIndex(final int position) { mCurrentIndex = position; return current(); @@ -1063,7 +1061,7 @@ public class TextRenderer { @Override public Object clone() { - CharSequenceIterator iter = new CharSequenceIterator(mSequence); + final CharSequenceIterator iter = new CharSequenceIterator(mSequence); iter.mCurrentIndex = mCurrentIndex; return iter; @@ -1108,7 +1106,7 @@ public class TextRenderer { private boolean used; // Whether this text was used recently - TextData(String str, Point origin, Rectangle2D origRect, int unicodeID) { + TextData(final String str, final Point origin, final Rectangle2D origRect, final int unicodeID) { this.str = str; this.origin = origin; this.origRect = origRect; @@ -1154,7 +1152,7 @@ public class TextRenderer { private Graphics2D g; @Override - public Object allocateBackingStore(int w, int h) { + public Object allocateBackingStore(final int w, final int h) { // FIXME: should consider checking Font's attributes to see // whether we're likely to need to support a full RGBA backing // store (i.e., non-default Paint, foreground color, etc.), but @@ -1177,12 +1175,12 @@ public class TextRenderer { } @Override - public void deleteBackingStore(Object backingStore) { + public void deleteBackingStore(final Object backingStore) { ((TextureRenderer) backingStore).dispose(); } @Override - public boolean preExpand(Rect cause, int attemptNumber) { + public boolean preExpand(final Rect cause, final int attemptNumber) { // Only try this one time; clear out potentially obsolete entries // NOTE: this heuristic and the fact that it clears the used bit // of all entries seems to cause cycling of entries in some @@ -1218,7 +1216,7 @@ public class TextRenderer { } @Override - public boolean additionFailed(Rect cause, int attemptNumber) { + public boolean additionFailed(final Rect cause, final int attemptNumber) { // Heavy hammer -- might consider doing something different packer.clear(); stringLocations.clear(); @@ -1242,13 +1240,13 @@ public class TextRenderer { } @Override - public void beginMovement(Object oldBackingStore, Object newBackingStore) { + public void beginMovement(final Object oldBackingStore, final Object newBackingStore) { // Exit the begin / end pair if necessary if (inBeginEndPair) { // Draw any outstanding glyphs flush(); - GL2 gl = GLContext.getCurrentGL().getGL2(); + final GL2 gl = GLContext.getCurrentGL().getGL2(); // Pop client attrib bits used by the pipelined quad renderer gl.glPopClientAttrib(); @@ -1258,8 +1256,8 @@ public class TextRenderer { // binding if (getUseVertexArrays() && is15Available(gl)) { try { - gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, 0); - } catch (Exception e) { + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); + } catch (final Exception e) { isExtensionAvailable_GL_VERSION_1_5 = false; } } @@ -1271,15 +1269,15 @@ public class TextRenderer { } } - TextureRenderer newRenderer = (TextureRenderer) newBackingStore; + final TextureRenderer newRenderer = (TextureRenderer) newBackingStore; g = newRenderer.createGraphics(); } @Override - public void move(Object oldBackingStore, Rect oldLocation, - Object newBackingStore, Rect newLocation) { - TextureRenderer oldRenderer = (TextureRenderer) oldBackingStore; - TextureRenderer newRenderer = (TextureRenderer) newBackingStore; + public void move(final Object oldBackingStore, final Rect oldLocation, + final Object newBackingStore, final Rect newLocation) { + final TextureRenderer oldRenderer = (TextureRenderer) oldBackingStore; + final TextureRenderer newRenderer = (TextureRenderer) newBackingStore; if (oldRenderer == newRenderer) { // Movement on the same backing store -- easy case @@ -1288,7 +1286,7 @@ public class TextRenderer { newLocation.y() - oldLocation.y()); } else { // Need to draw from the old renderer's image into the new one - Image img = oldRenderer.getImage(); + final Image img = oldRenderer.getImage(); g.drawImage(img, newLocation.x(), newLocation.y(), newLocation.x() + newLocation.w(), newLocation.y() + newLocation.h(), oldLocation.x(), @@ -1298,11 +1296,11 @@ public class TextRenderer { } @Override - public void endMovement(Object oldBackingStore, Object newBackingStore) { + public void endMovement(final Object oldBackingStore, final Object newBackingStore) { g.dispose(); // Sync the whole surface - TextureRenderer newRenderer = (TextureRenderer) newBackingStore; + final TextureRenderer newRenderer = (TextureRenderer) newBackingStore; newRenderer.markDirty(0, 0, newRenderer.getWidth(), newRenderer.getHeight()); @@ -1316,7 +1314,7 @@ public class TextRenderer { } // Push client attrib bits used by the pipelined quad renderer - GL2 gl = GLContext.getCurrentGL().getGL2(); + final GL2 gl = GLContext.getCurrentGL().getGL2(); gl.glPushClientAttrib((int) GL2.GL_ALL_CLIENT_ATTRIB_BITS); if (haveCachedColor) { @@ -1340,32 +1338,32 @@ public class TextRenderer { } @Override - public Rectangle2D getBounds(CharSequence str, Font font, - FontRenderContext frc) { + public Rectangle2D getBounds(final CharSequence str, final Font font, + final FontRenderContext frc) { return getBounds(font.createGlyphVector(frc, new CharSequenceIterator(str)), frc); } @Override - public Rectangle2D getBounds(String str, Font font, - FontRenderContext frc) { + public Rectangle2D getBounds(final String str, final Font font, + final FontRenderContext frc) { return getBounds(font.createGlyphVector(frc, str), frc); } @Override - public Rectangle2D getBounds(GlyphVector gv, FontRenderContext frc) { + public Rectangle2D getBounds(final GlyphVector gv, final FontRenderContext frc) { return gv.getVisualBounds(); } @Override - public void drawGlyphVector(Graphics2D graphics, GlyphVector str, - int x, int y) { + public void drawGlyphVector(final Graphics2D graphics, final GlyphVector str, + final int x, final int y) { graphics.drawGlyphVector(str, x, y); } @Override - public void draw(Graphics2D graphics, String str, int x, int y) { + public void draw(final Graphics2D graphics, final String str, final int x, final int y) { graphics.drawString(str, x, y); } } @@ -1415,11 +1413,11 @@ public class TextRenderer { private boolean needAdvance; // Creates a Glyph representing an individual Unicode character - public Glyph(int unicodeID, - int glyphCode, - float advance, - GlyphVector singleUnicodeGlyphVector, - GlyphProducer producer) { + public Glyph(final int unicodeID, + final int glyphCode, + final float advance, + final GlyphVector singleUnicodeGlyphVector, + final GlyphProducer producer) { this.unicodeID = unicodeID; this.glyphCode = glyphCode; this.advance = advance; @@ -1430,7 +1428,7 @@ public class TextRenderer { // Creates a Glyph representing a sequence of characters, with // an indication of whether additional single glyphs are being // rendered after it - public Glyph(String str, boolean needAdvance) { + public Glyph(final String str, final boolean needAdvance) { this.str = str; this.needAdvance = needAdvance; } @@ -1451,14 +1449,14 @@ public class TextRenderer { } /** Draws this glyph and returns the (x) advance for this glyph */ - public float draw3D(float inX, float inY, float z, float scaleFactor) { + public float draw3D(final float inX, final float inY, final float z, final float scaleFactor) { if (str != null) { draw3D_ROBUST(str, inX, inY, z, scaleFactor); if (!needAdvance) { return 0; } // Compute and return the advance for this string - GlyphVector gv = font.createGlyphVector(getFontRenderContext(), str); + final GlyphVector gv = font.createGlyphVector(getFontRenderContext(), str); float totalAdvance = 0; for (int i = 0; i < gv.getNumGlyphs(); i++) { totalAdvance += gv.getGlyphMetrics(i).getAdvance(); @@ -1476,32 +1474,32 @@ public class TextRenderer { mPipelinedQuadRenderer = new Pipelined_QuadRenderer(); } - TextureRenderer renderer = getBackingStore(); + final TextureRenderer renderer = getBackingStore(); // Handles case where NPOT texture is used for backing store - TextureCoords wholeImageTexCoords = renderer.getTexture().getImageTexCoords(); - float xScale = wholeImageTexCoords.right(); - float yScale = wholeImageTexCoords.bottom(); + final TextureCoords wholeImageTexCoords = renderer.getTexture().getImageTexCoords(); + final float xScale = wholeImageTexCoords.right(); + final float yScale = wholeImageTexCoords.bottom(); - Rect rect = glyphRectForTextureMapping; - TextData data = (TextData) rect.getUserData(); + final Rect rect = glyphRectForTextureMapping; + final TextData data = (TextData) rect.getUserData(); data.markUsed(); - Rectangle2D origRect = data.origRect(); + final Rectangle2D origRect = data.origRect(); - float x = inX - (scaleFactor * data.origOriginX()); - float y = inY - (scaleFactor * ((float) origRect.getHeight() - data.origOriginY())); + final float x = inX - (scaleFactor * data.origOriginX()); + final float y = inY - (scaleFactor * ((float) origRect.getHeight() - data.origOriginY())); - int texturex = rect.x() + (data.origin().x - data.origOriginX()); - int texturey = renderer.getHeight() - rect.y() - (int) origRect.getHeight() - + final int texturex = rect.x() + (data.origin().x - data.origOriginX()); + final int texturey = renderer.getHeight() - rect.y() - (int) origRect.getHeight() - (data.origin().y - data.origOriginY()); - int width = (int) origRect.getWidth(); - int height = (int) origRect.getHeight(); + final int width = (int) origRect.getWidth(); + final int height = (int) origRect.getHeight(); - float tx1 = xScale * texturex / renderer.getWidth(); - float ty1 = yScale * (1.0f - + final float tx1 = xScale * texturex / renderer.getWidth(); + final float ty1 = yScale * (1.0f - ((float) texturey / (float) renderer.getHeight())); - float tx2 = xScale * (texturex + width) / renderer.getWidth(); - float ty2 = yScale * (1.0f - + final float tx2 = xScale * (texturex + width) / renderer.getWidth(); + final float ty2 = yScale * (1.0f - ((float) (texturey + height) / (float) renderer.getHeight())); mPipelinedQuadRenderer.glTexCoord2f(tx1, ty1); @@ -1515,7 +1513,7 @@ public class TextRenderer { mPipelinedQuadRenderer.glTexCoord2f(tx1, ty2); mPipelinedQuadRenderer.glVertex3f(x, y + (height * scaleFactor), z); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } return advance; @@ -1527,21 +1525,21 @@ public class TextRenderer { } private void upload() { - GlyphVector gv = getGlyphVector(); - Rectangle2D origBBox = preNormalize(renderDelegate.getBounds(gv, getFontRenderContext())); - Rectangle2D bbox = normalize(origBBox); - Point origin = new Point((int) -bbox.getMinX(), + final GlyphVector gv = getGlyphVector(); + final Rectangle2D origBBox = preNormalize(renderDelegate.getBounds(gv, getFontRenderContext())); + final Rectangle2D bbox = normalize(origBBox); + final Point origin = new Point((int) -bbox.getMinX(), (int) -bbox.getMinY()); - Rect rect = new Rect(0, 0, (int) bbox.getWidth(), + final Rect rect = new Rect(0, 0, (int) bbox.getWidth(), (int) bbox.getHeight(), new TextData(null, origin, origBBox, unicodeID)); packer.add(rect); glyphRectForTextureMapping = rect; - Graphics2D g = getGraphics2D(); + final Graphics2D g = getGraphics2D(); // OK, should now have an (x, y) for this rectangle; rasterize // the glyph - int strx = rect.x() + origin.x; - int stry = rect.y() + origin.y; + final int strx = rect.x() + origin.x; + final int stry = rect.y() + origin.y; // Clear out the area we're going to draw into g.setComposite(AlphaComposite.Clear); @@ -1552,7 +1550,7 @@ public class TextRenderer { renderDelegate.drawGlyphVector(g, gv, strx, stry); if (DRAW_BBOXES) { - TextData data = (TextData) rect.getUserData(); + final TextData data = (TextData) rect.getUserData(); // Draw a bounding box on the backing store g.drawRect(strx - data.origOriginX(), stry - data.origOriginY(), @@ -1572,7 +1570,7 @@ public class TextRenderer { } private GlyphVector getGlyphVector() { - GlyphVector gv = singleUnicodeGlyphVector; + final GlyphVector gv = singleUnicodeGlyphVector; if (gv != null) { singleUnicodeGlyphVector = null; // Don't need this anymore return gv; @@ -1595,13 +1593,13 @@ public class TextRenderer { // We re-use this for each incoming string CharSequenceIterator iter = new CharSequenceIterator(); - GlyphProducer(int fontLengthInGlyphs) { + GlyphProducer(final int fontLengthInGlyphs) { unicodes2Glyphs = new int[512]; glyphCache = new Glyph[fontLengthInGlyphs]; clearAllCacheEntries(); } - public List getGlyphs(CharSequence inString) { + public List getGlyphs(final CharSequence inString) { glyphsOutput.clear(); GlyphVector fullRunGlyphVector; fullRunGlyphVector = fullGlyphVectorCache.get(inString.toString()); @@ -1610,30 +1608,30 @@ public class TextRenderer { fullRunGlyphVector = font.createGlyphVector(getFontRenderContext(), iter); fullGlyphVectorCache.put(inString.toString(), fullRunGlyphVector); } - boolean complex = (fullRunGlyphVector.getLayoutFlags() != 0); + final boolean complex = (fullRunGlyphVector.getLayoutFlags() != 0); if (complex || DISABLE_GLYPH_CACHE) { // Punt to the robust version of the renderer glyphsOutput.add(new Glyph(inString.toString(), false)); return glyphsOutput; } - int lengthInGlyphs = fullRunGlyphVector.getNumGlyphs(); + final int lengthInGlyphs = fullRunGlyphVector.getNumGlyphs(); int i = 0; while (i < lengthInGlyphs) { - Character letter = CharacterCache.valueOf(inString.charAt(i)); + final Character letter = CharacterCache.valueOf(inString.charAt(i)); GlyphMetrics metrics = glyphMetricsCache.get(letter); if (metrics == null) { metrics = fullRunGlyphVector.getGlyphMetrics(i); glyphMetricsCache.put(letter, metrics); } - Glyph glyph = getGlyph(inString, metrics, i); + final Glyph glyph = getGlyph(inString, metrics, i); if (glyph != null) { glyphsOutput.add(glyph); i++; } else { // Assemble a run of characters that don't fit in // the cache - StringBuilder buf = new StringBuilder(); + final StringBuilder buf = new StringBuilder(); while (i < lengthInGlyphs && getGlyph(inString, fullRunGlyphVector.getGlyphMetrics(i), i) == null) { buf.append(inString.charAt(i++)); @@ -1646,10 +1644,10 @@ public class TextRenderer { return glyphsOutput; } - public void clearCacheEntry(int unicodeID) { - int glyphID = unicodes2Glyphs[unicodeID]; + public void clearCacheEntry(final int unicodeID) { + final int glyphID = unicodes2Glyphs[unicodeID]; if (glyphID != undefined) { - Glyph glyph = glyphCache[glyphID]; + final Glyph glyph = glyphCache[glyphID]; if (glyph != null) { glyph.clear(); } @@ -1664,20 +1662,20 @@ public class TextRenderer { } } - public void register(Glyph glyph) { + public void register(final Glyph glyph) { unicodes2Glyphs[glyph.getUnicodeID()] = glyph.getGlyphCode(); glyphCache[glyph.getGlyphCode()] = glyph; } - public float getGlyphPixelWidth(char unicodeID) { - Glyph glyph = getGlyph(unicodeID); + public float getGlyphPixelWidth(final char unicodeID) { + final Glyph glyph = getGlyph(unicodeID); if (glyph != null) { return glyph.getAdvance(); } // Have to do this the hard / uncached way singleUnicode[0] = unicodeID; - GlyphVector gv = font.createGlyphVector(fontRenderContext, + final GlyphVector gv = font.createGlyphVector(fontRenderContext, singleUnicode); return gv.getGlyphMetrics(0).getAdvance(); } @@ -1685,52 +1683,52 @@ public class TextRenderer { // Returns a glyph object for this single glyph. Returns null // if the unicode or glyph ID would be out of bounds of the // glyph cache. - private Glyph getGlyph(CharSequence inString, - GlyphMetrics glyphMetrics, - int index) { - char unicodeID = inString.charAt(index); + private Glyph getGlyph(final CharSequence inString, + final GlyphMetrics glyphMetrics, + final int index) { + final char unicodeID = inString.charAt(index); if (unicodeID >= unicodes2Glyphs.length) { return null; } - int glyphID = unicodes2Glyphs[unicodeID]; + final int glyphID = unicodes2Glyphs[unicodeID]; if (glyphID != undefined) { return glyphCache[glyphID]; } // Must fabricate the glyph singleUnicode[0] = unicodeID; - GlyphVector gv = font.createGlyphVector(getFontRenderContext(), singleUnicode); + final GlyphVector gv = font.createGlyphVector(getFontRenderContext(), singleUnicode); return getGlyph(unicodeID, gv, glyphMetrics); } // It's unclear whether this variant might produce less // optimal results than if we can see the entire GlyphVector // for the incoming string - private Glyph getGlyph(int unicodeID) { + private Glyph getGlyph(final int unicodeID) { if (unicodeID >= unicodes2Glyphs.length) { return null; } - int glyphID = unicodes2Glyphs[unicodeID]; + final int glyphID = unicodes2Glyphs[unicodeID]; if (glyphID != undefined) { return glyphCache[glyphID]; } singleUnicode[0] = (char) unicodeID; - GlyphVector gv = font.createGlyphVector(getFontRenderContext(), singleUnicode); + final GlyphVector gv = font.createGlyphVector(getFontRenderContext(), singleUnicode); return getGlyph(unicodeID, gv, gv.getGlyphMetrics(0)); } - private Glyph getGlyph(int unicodeID, - GlyphVector singleUnicodeGlyphVector, - GlyphMetrics metrics) { - int glyphCode = singleUnicodeGlyphVector.getGlyphCode(0); + private Glyph getGlyph(final int unicodeID, + final GlyphVector singleUnicodeGlyphVector, + final GlyphMetrics metrics) { + final int glyphCode = singleUnicodeGlyphVector.getGlyphCode(0); // Have seen huge glyph codes (65536) coming out of some fonts in some Unicode situations if (glyphCode >= glyphCache.length) { return null; } - Glyph glyph = new Glyph(unicodeID, + final Glyph glyph = new Glyph(unicodeID, glyphCode, metrics.getAdvance(), singleUnicodeGlyphVector, @@ -1752,7 +1750,7 @@ public class TextRenderer { } } - public static Character valueOf(char c) { + public static Character valueOf(final char c) { if (c <= 127) { // must cache return CharacterCache.cache[c]; } @@ -1769,7 +1767,7 @@ public class TextRenderer { int mVBO_For_ResuableTileTexCoords; Pipelined_QuadRenderer() { - GL2 gl = GLContext.getCurrentGL().getGL2(); + final GL2 gl = GLContext.getCurrentGL().getGL2(); mVertCoords = Buffers.newDirectFloatBuffer(kTotalBufferSizeCoordsVerts); mTexCoords = Buffers.newDirectFloatBuffer(kTotalBufferSizeCoordsTex); @@ -1777,34 +1775,34 @@ public class TextRenderer { if (usingVBOs) { try { - int[] vbos = new int[2]; + final int[] vbos = new int[2]; gl.glGenBuffers(2, IntBuffer.wrap(vbos)); mVBO_For_ResuableTileVertices = vbos[0]; mVBO_For_ResuableTileTexCoords = vbos[1]; - gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, mVBO_For_ResuableTileVertices); - gl.glBufferData(GL2.GL_ARRAY_BUFFER, kTotalBufferSizeBytesVerts, - null, GL2.GL_STREAM_DRAW); // stream draw because this is a single quad use pipeline + gl.glBufferData(GL.GL_ARRAY_BUFFER, kTotalBufferSizeBytesVerts, + null, GL2ES2.GL_STREAM_DRAW); // stream draw because this is a single quad use pipeline - gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, mVBO_For_ResuableTileTexCoords); - gl.glBufferData(GL2.GL_ARRAY_BUFFER, kTotalBufferSizeBytesTex, - null, GL2.GL_STREAM_DRAW); // stream draw because this is a single quad use pipeline - } catch (Exception e) { + gl.glBufferData(GL.GL_ARRAY_BUFFER, kTotalBufferSizeBytesTex, + null, GL2ES2.GL_STREAM_DRAW); // stream draw because this is a single quad use pipeline + } catch (final Exception e) { isExtensionAvailable_GL_VERSION_1_5 = false; usingVBOs = false; } } } - public void glTexCoord2f(float v, float v1) { + public void glTexCoord2f(final float v, final float v1) { mTexCoords.put(v); mTexCoords.put(v1); } - public void glVertex3f(float inX, float inY, float inZ) { + public void glVertex3f(final float inX, final float inY, final float inZ) { mVertCoords.put(inX); mVertCoords.put(inY); mVertCoords.put(inZ); @@ -1826,41 +1824,41 @@ public class TextRenderer { private void drawVertexArrays() { if (mOutstandingGlyphsVerticesPipeline > 0) { - GL2 gl = GLContext.getCurrentGL().getGL2(); + final GL2 gl = GLContext.getCurrentGL().getGL2(); - TextureRenderer renderer = getBackingStore(); + final TextureRenderer renderer = getBackingStore(); renderer.getTexture(); // triggers texture uploads. Maybe this should be more obvious? mVertCoords.rewind(); mTexCoords.rewind(); - gl.glEnableClientState(GL2.GL_VERTEX_ARRAY); + gl.glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY); if (usingVBOs) { - gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, mVBO_For_ResuableTileVertices); - gl.glBufferSubData(GL2.GL_ARRAY_BUFFER, 0, + gl.glBufferSubData(GL.GL_ARRAY_BUFFER, 0, mOutstandingGlyphsVerticesPipeline * kSizeInBytes_OneVertices_VertexData, mVertCoords); // upload only the new stuff - gl.glVertexPointer(3, GL2.GL_FLOAT, 0, 0); + gl.glVertexPointer(3, GL.GL_FLOAT, 0, 0); } else { - gl.glVertexPointer(3, GL2.GL_FLOAT, 0, mVertCoords); + gl.glVertexPointer(3, GL.GL_FLOAT, 0, mVertCoords); } - gl.glEnableClientState(GL2.GL_TEXTURE_COORD_ARRAY); + gl.glEnableClientState(GLPointerFunc.GL_TEXTURE_COORD_ARRAY); if (usingVBOs) { - gl.glBindBuffer(GL2.GL_ARRAY_BUFFER, + gl.glBindBuffer(GL.GL_ARRAY_BUFFER, mVBO_For_ResuableTileTexCoords); - gl.glBufferSubData(GL2.GL_ARRAY_BUFFER, 0, + gl.glBufferSubData(GL.GL_ARRAY_BUFFER, 0, mOutstandingGlyphsVerticesPipeline * kSizeInBytes_OneVertices_TexData, mTexCoords); // upload only the new stuff - gl.glTexCoordPointer(2, GL2.GL_FLOAT, 0, 0); + gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, 0); } else { - gl.glTexCoordPointer(2, GL2.GL_FLOAT, 0, mTexCoords); + gl.glTexCoordPointer(2, GL.GL_FLOAT, 0, mTexCoords); } - gl.glDrawArrays(GL2.GL_QUADS, 0, + gl.glDrawArrays(GL2GL3.GL_QUADS, 0, mOutstandingGlyphsVerticesPipeline); mVertCoords.rewind(); @@ -1871,14 +1869,14 @@ public class TextRenderer { private void drawIMMEDIATE() { if (mOutstandingGlyphsVerticesPipeline > 0) { - TextureRenderer renderer = getBackingStore(); + final TextureRenderer renderer = getBackingStore(); renderer.getTexture(); // triggers texture uploads. Maybe this should be more obvious? - GL2 gl = GLContext.getCurrentGL().getGL2(); - gl.glBegin(GL2.GL_QUADS); + final GL2 gl = GLContext.getCurrentGL().getGL2(); + gl.glBegin(GL2GL3.GL_QUADS); try { - int numberOfQuads = mOutstandingGlyphsVerticesPipeline / 4; + final int numberOfQuads = mOutstandingGlyphsVerticesPipeline / 4; mVertCoords.rewind(); mTexCoords.rewind(); @@ -1899,7 +1897,7 @@ public class TextRenderer { gl.glVertex3f(mVertCoords.get(), mVertCoords.get(), mVertCoords.get()); } - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } finally { gl.glEnd(); @@ -1915,21 +1913,21 @@ public class TextRenderer { private GLU glu; private Frame frame; - DebugListener(GL gl, Frame frame) { + DebugListener(final GL gl, final Frame frame) { this.glu = GLU.createGLU(gl); this.frame = frame; } @Override - public void display(GLAutoDrawable drawable) { - GL2 gl = GLContext.getCurrentGL().getGL2(); - gl.glClear(GL2.GL_DEPTH_BUFFER_BIT | GL2.GL_COLOR_BUFFER_BIT); + public void display(final GLAutoDrawable drawable) { + final GL2 gl = GLContext.getCurrentGL().getGL2(); + gl.glClear(GL.GL_DEPTH_BUFFER_BIT | GL.GL_COLOR_BUFFER_BIT); if (packer == null) { return; } - TextureRenderer rend = getBackingStore(); + final TextureRenderer rend = getBackingStore(); final int w = rend.getWidth(); final int h = rend.getHeight(); rend.beginOrthoRendering(w, h); @@ -1947,23 +1945,23 @@ public class TextRenderer { } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { glu=null; frame=null; } // Unused methods @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, - int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, + final int height) { } - public void displayChanged(GLAutoDrawable drawable, - boolean modeChanged, boolean deviceChanged) { + public void displayChanged(final GLAutoDrawable drawable, + final boolean modeChanged, final boolean deviceChanged) { } } @@ -1974,7 +1972,7 @@ public class TextRenderer { * certain graphics cards which have poor vertex array * performance. Defaults to true. */ - public void setUseVertexArrays(boolean useVertexArrays) { + public void setUseVertexArrays(final boolean useVertexArrays) { this.useVertexArrays = useVertexArrays; } @@ -1993,7 +1991,7 @@ public class TextRenderer { * graphics cards do not behave well when this is enabled, * resulting in fuzzy text. Defaults to true. */ - public void setSmoothing(boolean smoothing) { + public void setSmoothing(final boolean smoothing) { this.smoothing = smoothing; getBackingStore().setSmoothing(smoothing); } @@ -2008,7 +2006,7 @@ public class TextRenderer { return smoothing; } - private final boolean is15Available(GL gl) { + private final boolean is15Available(final GL gl) { if (!checkFor_isExtensionAvailable_GL_VERSION_1_5) { isExtensionAvailable_GL_VERSION_1_5 = gl.isExtensionAvailable(GLExtensions.VERSION_1_5); checkFor_isExtensionAvailable_GL_VERSION_1_5 = true; diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java b/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java index 26e1eb041..ef59f9fa0 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/TextureRenderer.java @@ -48,7 +48,10 @@ import java.awt.Rectangle; import java.awt.image.*; import javax.media.opengl.*; +import javax.media.opengl.fixedfunc.GLLightingFunc; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import javax.media.opengl.glu.gl2.*; + import com.jogamp.opengl.util.texture.*; import com.jogamp.opengl.util.texture.awt.*; @@ -70,10 +73,10 @@ public class TextureRenderer { // appropriate threads, which would be somewhat unfortunate. // Whether we have an alpha channel in the (RGB/A) backing store - private boolean alpha; + private final boolean alpha; // Whether we're using only a GL_INTENSITY backing store - private boolean intensity; + private final boolean intensity; // Whether we're attempting to use automatic mipmap generation support private boolean mipmap; @@ -91,7 +94,7 @@ public class TextureRenderer { private boolean mustReallocateTexture; private Rectangle dirtyRegion; - private GLUgl2 glu = new GLUgl2(); + private final GLUgl2 glu = new GLUgl2(); // Current color private float r = 1.0f; @@ -108,7 +111,7 @@ public class TextureRenderer { @param height the height of the texture to render into @param alpha whether to allocate an alpha channel for the texture */ - public TextureRenderer(int width, int height, boolean alpha) { + public TextureRenderer(final int width, final int height, final boolean alpha) { this(width, height, alpha, false); } @@ -123,13 +126,13 @@ public class TextureRenderer { @param alpha whether to allocate an alpha channel for the texture @param mipmap whether to attempt use of automatic mipmap generation */ - public TextureRenderer(int width, int height, boolean alpha, boolean mipmap) { + public TextureRenderer(final int width, final int height, final boolean alpha, final boolean mipmap) { this(width, height, alpha, false, mipmap); } // Internal constructor to avoid confusion since alpha only makes // sense when intensity is not set - private TextureRenderer(int width, int height, boolean alpha, boolean intensity, boolean mipmap) { + private TextureRenderer(final int width, final int height, final boolean alpha, final boolean intensity, final boolean mipmap) { this.alpha = alpha; this.intensity = intensity; this.mipmap = mipmap; @@ -140,7 +143,7 @@ public class TextureRenderer { which acts only as an alpha channel. No mipmap support is requested. Internally, this associates a GL_INTENSITY OpenGL texture with the backing store. */ - public static TextureRenderer createAlphaOnlyRenderer(int width, int height) { + public static TextureRenderer createAlphaOnlyRenderer(final int width, final int height) { return createAlphaOnlyRenderer(width, height, false); } @@ -150,7 +153,7 @@ public class TextureRenderer { better smoothing when rendering the TextureRenderer's contents at a distance. Internally, this associates a GL_INTENSITY OpenGL texture with the backing store. */ - public static TextureRenderer createAlphaOnlyRenderer(int width, int height, boolean mipmap) { + public static TextureRenderer createAlphaOnlyRenderer(final int width, final int height, final boolean mipmap) { return new TextureRenderer(width, height, false, true, mipmap); } @@ -205,7 +208,7 @@ public class TextureRenderer { @param height the new height of the backing store of this renderer @throws GLException If an OpenGL context is not current when this method is called */ - public void setSize(int width, int height) throws GLException { + public void setSize(final int width, final int height) throws GLException { init(width, height); } @@ -216,7 +219,7 @@ public class TextureRenderer { @param d the new size of the backing store of this renderer @throws GLException If an OpenGL context is not current when this method is called */ - public void setSize(Dimension d) throws GLException { + public void setSize(final Dimension d) throws GLException { setSize(d.width, d.height); } @@ -228,7 +231,7 @@ public class TextureRenderer { @param smoothing whether smoothing is enabled for the OpenGL texture */ - public void setSmoothing(boolean smoothing) { + public void setSmoothing(final boolean smoothing) { this.smoothing = smoothing; smoothingChanged = true; } @@ -275,8 +278,8 @@ public class TextureRenderer { @param width the width of the region to update @param height the height of the region to update */ - public void markDirty(int x, int y, int width, int height) { - Rectangle curRegion = new Rectangle(x, y, width, height); + public void markDirty(final int x, final int y, final int width, final int height) { + final Rectangle curRegion = new Rectangle(x, y, width, height); if (dirtyRegion == null) { dirtyRegion = curRegion; } else { @@ -333,7 +336,7 @@ public class TextureRenderer { @throws GLException If an OpenGL context is not current when this method is called */ - public void beginOrthoRendering(int width, int height) throws GLException { + public void beginOrthoRendering(final int width, final int height) throws GLException { beginOrthoRendering(width, height, true); } @@ -355,7 +358,7 @@ public class TextureRenderer { @throws GLException If an OpenGL context is not current when this method is called */ - public void beginOrthoRendering(int width, int height, boolean disableDepthTest) throws GLException { + public void beginOrthoRendering(final int width, final int height, final boolean disableDepthTest) throws GLException { beginRendering(true, width, height, disableDepthTest); } @@ -399,8 +402,8 @@ public class TextureRenderer { transparent, 1.0f = completely opaque @throws GLException If an OpenGL context is not current when this method is called */ - public void setColor(float r, float g, float b, float a) throws GLException { - GL2 gl = GLContext.getCurrentGL().getGL2(); + public void setColor(final float r, final float g, final float b, final float a) throws GLException { + final GL2 gl = GLContext.getCurrentGL().getGL2(); this.r = r * a; this.g = g * a; this.b = b * a; @@ -417,7 +420,7 @@ public class TextureRenderer { @param color the new color to use for rendering @throws GLException If an OpenGL context is not current when this method is called */ - public void setColor(Color color) throws GLException { + public void setColor(final Color color) throws GLException { // Get color's RGBA components as floats in the range [0,1]. if (compArray == null) { compArray = new float[4]; @@ -440,7 +443,7 @@ public class TextureRenderer { @throws GLException If an OpenGL context is not current when this method is called */ - public void drawOrthoRect(int screenx, int screeny) throws GLException { + public void drawOrthoRect(final int screenx, final int screeny) throws GLException { drawOrthoRect(screenx, screeny, 0, 0, getWidth(), getHeight()); } @@ -462,9 +465,9 @@ public class TextureRenderer { @throws GLException If an OpenGL context is not current when this method is called */ - public void drawOrthoRect(int screenx, int screeny, - int texturex, int texturey, - int width, int height) throws GLException { + public void drawOrthoRect(final int screenx, final int screeny, + final int texturex, final int texturey, + final int width, final int height) throws GLException { draw3DRect(screenx, screeny, 0, texturex, texturey, width, height, 1); } @@ -493,16 +496,16 @@ public class TextureRenderer { @throws GLException If an OpenGL context is not current when this method is called */ - public void draw3DRect(float x, float y, float z, - int texturex, int texturey, - int width, int height, - float scaleFactor) throws GLException { - GL2 gl = GLContext.getCurrentGL().getGL2(); - Texture texture = getTexture(); - TextureCoords coords = texture.getSubImageTexCoords(texturex, texturey, + public void draw3DRect(final float x, final float y, final float z, + final int texturex, final int texturey, + final int width, final int height, + final float scaleFactor) throws GLException { + final GL2 gl = GLContext.getCurrentGL().getGL2(); + final Texture texture = getTexture(); + final TextureCoords coords = texture.getSubImageTexCoords(texturex, texturey, texturex + width, texturey + height); - gl.glBegin(GL2.GL_QUADS); + gl.glBegin(GL2GL3.GL_QUADS); gl.glTexCoord2f(coords.left(), coords.bottom()); gl.glVertex3f(x, y, z); gl.glTexCoord2f(coords.right(), coords.bottom()); @@ -550,70 +553,70 @@ public class TextureRenderer { // Internals only below this point // - private void beginRendering(boolean ortho, int width, int height, boolean disableDepthTestForOrtho) { - GL2 gl = GLContext.getCurrentGL().getGL2(); - int attribBits = - GL2.GL_ENABLE_BIT | GL2.GL_TEXTURE_BIT | GL2.GL_COLOR_BUFFER_BIT | - (ortho ? (GL2.GL_DEPTH_BUFFER_BIT | GL2.GL_TRANSFORM_BIT) : 0); + private void beginRendering(final boolean ortho, final int width, final int height, final boolean disableDepthTestForOrtho) { + final GL2 gl = GLContext.getCurrentGL().getGL2(); + final int attribBits = + GL2.GL_ENABLE_BIT | GL2.GL_TEXTURE_BIT | GL.GL_COLOR_BUFFER_BIT | + (ortho ? (GL.GL_DEPTH_BUFFER_BIT | GL2.GL_TRANSFORM_BIT) : 0); gl.glPushAttrib(attribBits); - gl.glDisable(GL2.GL_LIGHTING); + gl.glDisable(GLLightingFunc.GL_LIGHTING); if (ortho) { if (disableDepthTestForOrtho) { - gl.glDisable(GL2.GL_DEPTH_TEST); + gl.glDisable(GL.GL_DEPTH_TEST); } - gl.glDisable(GL2.GL_CULL_FACE); - gl.glMatrixMode(GL2.GL_PROJECTION); + gl.glDisable(GL.GL_CULL_FACE); + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glPushMatrix(); gl.glLoadIdentity(); glu.gluOrtho2D(0, width, 0, height); - gl.glMatrixMode(GL2.GL_MODELVIEW); + gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glPushMatrix(); gl.glLoadIdentity(); - gl.glMatrixMode(GL2.GL_TEXTURE); + gl.glMatrixMode(GL.GL_TEXTURE); gl.glPushMatrix(); gl.glLoadIdentity(); } - gl.glEnable(GL2.GL_BLEND); - gl.glBlendFunc(GL2.GL_ONE, GL2.GL_ONE_MINUS_SRC_ALPHA); - Texture texture = getTexture(); + gl.glEnable(GL.GL_BLEND); + gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE_MINUS_SRC_ALPHA); + final Texture texture = getTexture(); texture.enable(gl); texture.bind(gl); - gl.glTexEnvi(GL2.GL_TEXTURE_ENV, GL2.GL_TEXTURE_ENV_MODE, GL2.GL_MODULATE); + gl.glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_TEXTURE_ENV_MODE, GL2ES1.GL_MODULATE); // Change polygon color to last saved gl.glColor4f(r, g, b, a); if (smoothingChanged) { smoothingChanged = false; if (smoothing) { - texture.setTexParameteri(gl, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_LINEAR); + texture.setTexParameteri(gl, GL.GL_TEXTURE_MAG_FILTER, GL.GL_LINEAR); if (mipmap) { - texture.setTexParameteri(gl, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR_MIPMAP_LINEAR); + texture.setTexParameteri(gl, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR_MIPMAP_LINEAR); } else { - texture.setTexParameteri(gl, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_LINEAR); + texture.setTexParameteri(gl, GL.GL_TEXTURE_MIN_FILTER, GL.GL_LINEAR); } } else { - texture.setTexParameteri(gl, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST); - texture.setTexParameteri(gl, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_NEAREST); + texture.setTexParameteri(gl, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); + texture.setTexParameteri(gl, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); } } } - private void endRendering(boolean ortho) { - GL2 gl = GLContext.getCurrentGL().getGL2(); - Texture texture = getTexture(); + private void endRendering(final boolean ortho) { + final GL2 gl = GLContext.getCurrentGL().getGL2(); + final Texture texture = getTexture(); texture.disable(gl); if (ortho) { - gl.glMatrixMode(GL2.GL_PROJECTION); + gl.glMatrixMode(GLMatrixFunc.GL_PROJECTION); gl.glPopMatrix(); - gl.glMatrixMode(GL2.GL_MODELVIEW); + gl.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); gl.glPopMatrix(); - gl.glMatrixMode(GL2.GL_TEXTURE); + gl.glMatrixMode(GL.GL_TEXTURE); gl.glPopMatrix(); } gl.glPopAttrib(); } - private void init(int width, int height) { - GL2 gl = GLContext.getCurrentGL().getGL2(); + private void init(final int width, final int height) { + final GL2 gl = GLContext.getCurrentGL().getGL2(); // Discard previous BufferedImage if any if (image != null) { image.flush(); @@ -621,8 +624,8 @@ public class TextureRenderer { } // Infer the internal format if not an intensity texture - int internalFormat = (intensity ? GL2.GL_INTENSITY : 0); - int imageType = + final int internalFormat = (intensity ? GL2.GL_INTENSITY : 0); + final int imageType = (intensity ? BufferedImage.TYPE_BYTE_GRAY : (alpha ? BufferedImage.TYPE_INT_ARGB_PRE : BufferedImage.TYPE_INT_RGB)); image = new BufferedImage(width, height, imageType); @@ -650,9 +653,9 @@ public class TextureRenderer { @throws GLException If an OpenGL context is not current when this method is called */ - private void sync(int x, int y, int width, int height) throws GLException { + private void sync(final int x, final int y, final int width, final int height) throws GLException { // Force allocation if necessary - boolean canSkipUpdate = ensureTexture(); + final boolean canSkipUpdate = ensureTexture(); if (!canSkipUpdate) { // Update specified region. @@ -667,7 +670,7 @@ public class TextureRenderer { // Returns true if the texture was newly allocated, false if not private boolean ensureTexture() { - GL gl = GLContext.getCurrentGL(); + final GL gl = GLContext.getCurrentGL(); if (mustReallocateTexture) { if (texture != null) { texture.destroy(gl); @@ -688,8 +691,8 @@ public class TextureRenderer { if (!smoothing) { // The TextureIO classes default to GL_LINEAR filtering - texture.setTexParameteri(gl, GL2.GL_TEXTURE_MIN_FILTER, GL2.GL_NEAREST); - texture.setTexParameteri(gl, GL2.GL_TEXTURE_MAG_FILTER, GL2.GL_NEAREST); + texture.setTexParameteri(gl, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); + texture.setTexParameteri(gl, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); } return true; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java index e8df6aaec..1f055211d 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapCharRec.java @@ -53,12 +53,12 @@ class BitmapCharRec { public float advance; public byte[] bitmap; - public BitmapCharRec(int width, - int height, - float xorig, - float yorig, - float advance, - byte[] bitmap) { + public BitmapCharRec(final int width, + final int height, + final float xorig, + final float yorig, + final float advance, + final byte[] bitmap) { this.width = width; this.height = height; this.xorig = xorig; diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java index d4ee12b32..7b8418704 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/BitmapFontRec.java @@ -51,10 +51,10 @@ class BitmapFontRec { public int first; public BitmapCharRec[] ch; - public BitmapFontRec(String name, - int num_chars, - int first, - BitmapCharRec[] ch) { + public BitmapFontRec(final String name, + final int num_chars, + final int first, + final BitmapCharRec[] ch) { this.name = name; this.num_chars = num_chars; this.first = first; diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java index 5e26e0d14..d79f16638 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/CoordRec.java @@ -49,7 +49,7 @@ class CoordRec { public float x; public float y; - public CoordRec(float x, float y) { + public CoordRec(final float x, final float y) { this.x = x; this.y = y; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java index 42529f3f1..92cbd66da 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUT.java @@ -40,6 +40,7 @@ package com.jogamp.opengl.util.gl2; import javax.media.opengl.*; +import javax.media.opengl.fixedfunc.GLLightingFunc; import javax.media.opengl.glu.*; import javax.media.opengl.glu.gl2.*; @@ -103,13 +104,13 @@ public class GLUT { public static final int BITMAP_HELVETICA_12 = 7; public static final int BITMAP_HELVETICA_18 = 8; - private GLUgl2 glu = new GLUgl2(); + private final GLUgl2 glu = new GLUgl2(); //---------------------------------------------------------------------- // Shapes // - public void glutWireSphere(double radius, int slices, int stacks) { + public void glutWireSphere(final double radius, final int slices, final int stacks) { quadObjInit(glu); glu.gluQuadricDrawStyle(quadObj, GLU.GLU_LINE); glu.gluQuadricNormals(quadObj, GLU.GLU_SMOOTH); @@ -119,7 +120,7 @@ public class GLUT { glu.gluSphere(quadObj, radius, slices, stacks); } - public void glutSolidSphere(double radius, int slices, int stacks) { + public void glutSolidSphere(final double radius, final int slices, final int stacks) { quadObjInit(glu); glu.gluQuadricDrawStyle(quadObj, GLU.GLU_FILL); glu.gluQuadricNormals(quadObj, GLU.GLU_SMOOTH); @@ -129,8 +130,8 @@ public class GLUT { glu.gluSphere(quadObj, radius, slices, stacks); } - public void glutWireCone(double base, double height, - int slices, int stacks) { + public void glutWireCone(final double base, final double height, + final int slices, final int stacks) { quadObjInit(glu); glu.gluQuadricDrawStyle(quadObj, GLU.GLU_LINE); glu.gluQuadricNormals(quadObj, GLU.GLU_SMOOTH); @@ -140,8 +141,8 @@ public class GLUT { glu.gluCylinder(quadObj, base, 0.0, height, slices, stacks); } - public void glutSolidCone(double base, double height, - int slices, int stacks) { + public void glutSolidCone(final double base, final double height, + final int slices, final int stacks) { quadObjInit(glu); glu.gluQuadricDrawStyle(quadObj, GLU.GLU_FILL); glu.gluQuadricNormals(quadObj, GLU.GLU_SMOOTH); @@ -151,7 +152,7 @@ public class GLUT { glu.gluCylinder(quadObj, base, 0.0, height, slices, stacks); } - public void glutWireCylinder(double radius, double height, int slices, int stacks) { + public void glutWireCylinder(final double radius, final double height, final int slices, final int stacks) { quadObjInit(glu); glu.gluQuadricDrawStyle(quadObj, GLU.GLU_LINE); glu.gluQuadricNormals(quadObj, GLU.GLU_SMOOTH); @@ -161,13 +162,13 @@ public class GLUT { glu.gluCylinder(quadObj, radius, radius, height, slices, stacks); } - public void glutSolidCylinder(double radius, double height, int slices, int stacks) { - GL2 gl = GLUgl2.getCurrentGL2(); + public void glutSolidCylinder(final double radius, final double height, final int slices, final int stacks) { + final GL2 gl = GLUgl2.getCurrentGL2(); // Prepare table of points for drawing end caps - double [] x = new double[slices]; - double [] y = new double[slices]; - double angleDelta = Math.PI * 2 / slices; + final double [] x = new double[slices]; + final double [] y = new double[slices]; + final double angleDelta = Math.PI * 2 / slices; double angle = 0; for (int i = 0 ; i < slices ; i ++) { angle = i * angleDelta; @@ -176,7 +177,7 @@ public class GLUT { } // Draw bottom cap - gl.glBegin(GL2.GL_TRIANGLE_FAN); + gl.glBegin(GL.GL_TRIANGLE_FAN); gl.glNormal3d(0,0,-1); gl.glVertex3d(0,0,0); for (int i = 0 ; i < slices ; i ++) { @@ -186,7 +187,7 @@ public class GLUT { gl.glEnd(); // Draw top cap - gl.glBegin(GL2.GL_TRIANGLE_FAN); + gl.glBegin(GL.GL_TRIANGLE_FAN); gl.glNormal3d(0,0,1); gl.glVertex3d(0,0,height); for (int i = 0 ; i < slices ; i ++) { @@ -205,58 +206,58 @@ public class GLUT { glu.gluCylinder(quadObj, radius, radius, height, slices, stacks); } - public void glutWireCube(float size) { - drawBox(GLUgl2.getCurrentGL2(), size, GL2.GL_LINE_LOOP); + public void glutWireCube(final float size) { + drawBox(GLUgl2.getCurrentGL2(), size, GL.GL_LINE_LOOP); } - public void glutSolidCube(float size) { - drawBox(GLUgl2.getCurrentGL2(), size, GL2.GL_QUADS); + public void glutSolidCube(final float size) { + drawBox(GLUgl2.getCurrentGL2(), size, GL2GL3.GL_QUADS); } - public void glutWireTorus(double innerRadius, double outerRadius, - int nsides, int rings) { - GL2 gl = GLUgl2.getCurrentGL2(); + public void glutWireTorus(final double innerRadius, final double outerRadius, + final int nsides, final int rings) { + final GL2 gl = GLUgl2.getCurrentGL2(); gl.glPushAttrib(GL2.GL_POLYGON_BIT); - gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_LINE); + gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL2GL3.GL_LINE); doughnut(gl, innerRadius, outerRadius, nsides, rings); gl.glPopAttrib(); } - public void glutSolidTorus(double innerRadius, double outerRadius, - int nsides, int rings) { + public void glutSolidTorus(final double innerRadius, final double outerRadius, + final int nsides, final int rings) { doughnut(GLUgl2.getCurrentGL2(), innerRadius, outerRadius, nsides, rings); } public void glutWireDodecahedron() { - dodecahedron(GLUgl2.getCurrentGL2(), GL2.GL_LINE_LOOP); + dodecahedron(GLUgl2.getCurrentGL2(), GL.GL_LINE_LOOP); } public void glutSolidDodecahedron() { - dodecahedron(GLUgl2.getCurrentGL2(), GL2.GL_TRIANGLE_FAN); + dodecahedron(GLUgl2.getCurrentGL2(), GL.GL_TRIANGLE_FAN); } public void glutWireOctahedron() { - octahedron(GLUgl2.getCurrentGL2(), GL2.GL_LINE_LOOP); + octahedron(GLUgl2.getCurrentGL2(), GL.GL_LINE_LOOP); } public void glutSolidOctahedron() { - octahedron(GLUgl2.getCurrentGL2(), GL2.GL_TRIANGLES); + octahedron(GLUgl2.getCurrentGL2(), GL.GL_TRIANGLES); } public void glutWireIcosahedron() { - icosahedron(GLUgl2.getCurrentGL2(), GL2.GL_LINE_LOOP); + icosahedron(GLUgl2.getCurrentGL2(), GL.GL_LINE_LOOP); } public void glutSolidIcosahedron() { - icosahedron(GLUgl2.getCurrentGL2(), GL2.GL_TRIANGLES); + icosahedron(GLUgl2.getCurrentGL2(), GL.GL_TRIANGLES); } public void glutWireTetrahedron() { - tetrahedron(GLUgl2.getCurrentGL2(), GL2.GL_LINE_LOOP); + tetrahedron(GLUgl2.getCurrentGL2(), GL.GL_LINE_LOOP); } public void glutSolidTetrahedron() { - tetrahedron(GLUgl2.getCurrentGL2(), GL2.GL_TRIANGLES); + tetrahedron(GLUgl2.getCurrentGL2(), GL.GL_TRIANGLES); } /** @@ -266,7 +267,7 @@ public class GLUT { * @param scale * the factor by which to scale the teapot */ - public void glutSolidTeapot(double scale) { + public void glutSolidTeapot(final double scale) { glutSolidTeapot(scale, true); } @@ -285,8 +286,8 @@ public class GLUT { * whether to create the teapot in exactly the same way as in the C * implementation of GLUT */ - public void glutSolidTeapot(double scale, boolean cStyle) { - teapot(GLUgl2.getCurrentGL2(), 14, scale, GL2.GL_FILL, cStyle); + public void glutSolidTeapot(final double scale, final boolean cStyle) { + teapot(GLUgl2.getCurrentGL2(), 14, scale, GL2GL3.GL_FILL, cStyle); } /** @@ -296,7 +297,7 @@ public class GLUT { * @param scale * the factor by which to scale the teapot */ - public void glutWireTeapot(double scale) { + public void glutWireTeapot(final double scale) { glutWireTeapot(scale, true); } @@ -315,22 +316,22 @@ public class GLUT { * whether to create the teapot in exactly the same way as in the C * implementation of GLUT */ - public void glutWireTeapot(double scale, boolean cStyle) { - teapot(GLUgl2.getCurrentGL2(), 10, scale, GL2.GL_LINE, cStyle); + public void glutWireTeapot(final double scale, final boolean cStyle) { + teapot(GLUgl2.getCurrentGL2(), 10, scale, GL2GL3.GL_LINE, cStyle); } //---------------------------------------------------------------------- // Fonts // - public void glutBitmapCharacter(int font, char character) { - GL2 gl = GLUgl2.getCurrentGL2(); - int[] swapbytes = new int[1]; - int[] lsbfirst = new int[1]; - int[] rowlength = new int[1]; - int[] skiprows = new int[1]; - int[] skippixels = new int[1]; - int[] alignment = new int[1]; + public void glutBitmapCharacter(final int font, final char character) { + final GL2 gl = GLUgl2.getCurrentGL2(); + final int[] swapbytes = new int[1]; + final int[] lsbfirst = new int[1]; + final int[] rowlength = new int[1]; + final int[] skiprows = new int[1]; + final int[] skippixels = new int[1]; + final int[] alignment = new int[1]; beginBitmap(gl, swapbytes, lsbfirst, @@ -348,14 +349,14 @@ public class GLUT { alignment); } - public void glutBitmapString (int font, String string) { - GL2 gl = GLUgl2.getCurrentGL2(); - int[] swapbytes = new int[1]; - int[] lsbfirst = new int[1]; - int[] rowlength = new int[1]; - int[] skiprows = new int[1]; - int[] skippixels = new int[1]; - int[] alignment = new int[1]; + public void glutBitmapString (final int font, final String string) { + final GL2 gl = GLUgl2.getCurrentGL2(); + final int[] swapbytes = new int[1]; + final int[] lsbfirst = new int[1]; + final int[] rowlength = new int[1]; + final int[] skiprows = new int[1]; + final int[] skippixels = new int[1]; + final int[] alignment = new int[1]; beginBitmap(gl, swapbytes, lsbfirst, @@ -363,7 +364,7 @@ public class GLUT { skiprows, skippixels, alignment); - int len = string.length(); + final int len = string.length(); for (int i = 0; i < len; i++) { bitmapCharacterImpl(gl, font, string.charAt(i)); } @@ -376,31 +377,31 @@ public class GLUT { alignment); } - public int glutBitmapWidth (int font, char character) { - BitmapFontRec fontinfo = getBitmapFont(font); - int c = character & 0xFFFF; + public int glutBitmapWidth (final int font, final char character) { + final BitmapFontRec fontinfo = getBitmapFont(font); + final int c = character & 0xFFFF; if (c < fontinfo.first || c >= fontinfo.first + fontinfo.num_chars) return 0; - BitmapCharRec ch = fontinfo.ch[c - fontinfo.first]; + final BitmapCharRec ch = fontinfo.ch[c - fontinfo.first]; if (ch != null) return (int) ch.advance; else return 0; } - public void glutStrokeCharacter(int font, char character) { - GL2 gl = GLUgl2.getCurrentGL2(); - StrokeFontRec fontinfo = getStrokeFont(font); - int c = character & 0xFFFF; + public void glutStrokeCharacter(final int font, final char character) { + final GL2 gl = GLUgl2.getCurrentGL2(); + final StrokeFontRec fontinfo = getStrokeFont(font); + final int c = character & 0xFFFF; if (c < 0 || c >= fontinfo.num_chars) return; - StrokeCharRec ch = fontinfo.ch[c]; + final StrokeCharRec ch = fontinfo.ch[c]; if (ch != null) { for (int i = 0; i < ch.num_strokes; i++) { - StrokeRec stroke = ch.stroke[i]; - gl.glBegin(GL2.GL_LINE_STRIP); + final StrokeRec stroke = ch.stroke[i]; + gl.glBegin(GL.GL_LINE_STRIP); for (int j = 0; j < stroke.num_coords; j++) { - CoordRec coord = stroke.coord[j]; + final CoordRec coord = stroke.coord[j]; gl.glVertex2f(coord.x, coord.y); } gl.glEnd(); @@ -409,21 +410,21 @@ public class GLUT { } } - public void glutStrokeString(int font, String string) { - GL2 gl = GLUgl2.getCurrentGL2(); - StrokeFontRec fontinfo = getStrokeFont(font); - int len = string.length(); + public void glutStrokeString(final int font, final String string) { + final GL2 gl = GLUgl2.getCurrentGL2(); + final StrokeFontRec fontinfo = getStrokeFont(font); + final int len = string.length(); for (int pos = 0; pos < len; pos++) { - int c = string.charAt(pos) & 0xFFFF; + final int c = string.charAt(pos) & 0xFFFF; if (c < 0 || c >= fontinfo.num_chars) continue; - StrokeCharRec ch = fontinfo.ch[c]; + final StrokeCharRec ch = fontinfo.ch[c]; if (ch != null) { for (int i = 0; i < ch.num_strokes; i++) { - StrokeRec stroke = ch.stroke[i]; - gl.glBegin(GL2.GL_LINE_STRIP); + final StrokeRec stroke = ch.stroke[i]; + gl.glBegin(GL.GL_LINE_STRIP); for (int j = 0; j < stroke.num_coords; j++) { - CoordRec coord = stroke.coord[j]; + final CoordRec coord = stroke.coord[j]; gl.glVertex2f(coord.x, coord.y); } gl.glEnd(); @@ -433,30 +434,30 @@ public class GLUT { } } - public int glutStrokeWidth (int font, char character) { + public int glutStrokeWidth (final int font, final char character) { return (int) glutStrokeWidthf(font, character); } - public float glutStrokeWidthf (int font, char character) { - StrokeFontRec fontinfo = getStrokeFont(font); - int c = character & 0xFFFF; + public float glutStrokeWidthf (final int font, final char character) { + final StrokeFontRec fontinfo = getStrokeFont(font); + final int c = character & 0xFFFF; if (c < 0 || c >= fontinfo.num_chars) return 0; - StrokeCharRec ch = fontinfo.ch[c]; + final StrokeCharRec ch = fontinfo.ch[c]; if (ch != null) return ch.right; else return 0; } - public int glutBitmapLength (int font, String string) { - BitmapFontRec fontinfo = getBitmapFont(font); + public int glutBitmapLength (final int font, final String string) { + final BitmapFontRec fontinfo = getBitmapFont(font); int length = 0; - int len = string.length(); + final int len = string.length(); for (int pos = 0; pos < len; pos++) { - int c = string.charAt(pos) & 0xFFFF; + final int c = string.charAt(pos) & 0xFFFF; if (c >= fontinfo.first && c < fontinfo.first + fontinfo.num_chars) { - BitmapCharRec ch = fontinfo.ch[c - fontinfo.first]; + final BitmapCharRec ch = fontinfo.ch[c - fontinfo.first]; if (ch != null) length += ch.advance; } @@ -464,18 +465,18 @@ public class GLUT { return length; } - public int glutStrokeLength (int font, String string) { + public int glutStrokeLength (final int font, final String string) { return (int) glutStrokeLengthf(font, string); } - public float glutStrokeLengthf (int font, String string) { - StrokeFontRec fontinfo = getStrokeFont(font); + public float glutStrokeLengthf (final int font, final String string) { + final StrokeFontRec fontinfo = getStrokeFont(font); float length = 0; - int len = string.length(); + final int len = string.length(); for (int i = 0; i < len; i++) { - char c = string.charAt(i); + final char c = string.charAt(i); if (c >= 0 && c < fontinfo.num_chars) { - StrokeCharRec ch = fontinfo.ch[c]; + final StrokeCharRec ch = fontinfo.ch[c]; if (ch != null) length += ch.right; } @@ -491,9 +492,9 @@ public class GLUT { The polyhedron is centered at the origin. */ public void glutWireRhombicDodecahedron() { - GL2 gl = GLUgl2.getCurrentGL2(); + final GL2 gl = GLUgl2.getCurrentGL2(); for( int i = 0; i < 12; i++ ) { - gl.glBegin( GL2.GL_LINE_LOOP ); + gl.glBegin( GL.GL_LINE_LOOP ); gl.glNormal3dv( rdod_n[ i ],0 ); gl.glVertex3dv( rdod_r[ rdod_v[ i ][ 0 ] ],0 ); gl.glVertex3dv( rdod_r[ rdod_v[ i ][ 1 ] ],0 ); @@ -511,8 +512,8 @@ public class GLUT { The polyhedron is centered at the origin. */ public void glutSolidRhombicDodecahedron() { - GL2 gl = GLUgl2.getCurrentGL2(); - gl.glBegin( GL2.GL_QUADS ); + final GL2 gl = GLUgl2.getCurrentGL2(); + gl.glBegin( GL2GL3.GL_QUADS ); for( int i = 0; i < 12; i++ ) { gl.glNormal3dv( rdod_n[ i ],0 ); gl.glVertex3dv( rdod_r[ rdod_v[ i ][ 0 ] ],0 ); @@ -532,7 +533,7 @@ public class GLUT { // private GLUquadric quadObj; - private void quadObjInit(GLUgl2 glu) { + private void quadObjInit(final GLUgl2 glu) { if (quadObj == null) { quadObj = glu.gluNewQuadric(); } @@ -541,7 +542,7 @@ public class GLUT { } } - private static void doughnut(GL2 gl, double r, double R, int nsides, int rings) { + private static void doughnut(final GL2 gl, final double r, final double R, final int nsides, final int rings) { int i, j; float theta, phi, theta1; float cosTheta, sinTheta; @@ -597,9 +598,9 @@ public class GLUT { {5, 6, 2, 1}, {7, 4, 0, 3} }; - private void drawBox(GL2 gl, float size, int type) { + private void drawBox(final GL2 gl, final float size, final int type) { if (boxVertices == null) { - float[][] v = new float[8][]; + final float[][] v = new float[8][]; for (int i = 0; i < 8; i++) { v[i] = new float[3]; } @@ -611,9 +612,9 @@ public class GLUT { v[1][2] = v[2][2] = v[5][2] = v[6][2] = 0.5f; boxVertices = v; } - float[][] v = boxVertices; - float[][] n = boxNormals; - int[][] faces = boxFaces; + final float[][] v = boxVertices; + final float[][] n = boxNormals; + final int[][] faces = boxFaces; for (int i = 5; i >= 0; i--) { gl.glBegin(type); gl.glNormal3fv(n[i], 0); @@ -664,14 +665,14 @@ public class GLUT { dodec[19][0] = 0; dodec[19][1] = -beta; dodec[19][2] = -alpha; } - private static void diff3(float[] a, float[] b, float[] c) { + private static void diff3(final float[] a, final float[] b, final float[] c) { c[0] = a[0] - b[0]; c[1] = a[1] - b[1]; c[2] = a[2] - b[2]; } - private static void crossprod(float[] v1, float[] v2, float[] prod) { - float[] p = new float[3]; /* in case prod == v1 or v2 */ + private static void crossprod(final float[] v1, final float[] v2, final float[] prod) { + final float[] p = new float[3]; /* in case prod == v1 or v2 */ p[0] = v1[1] * v2[2] - v2[1] * v1[2]; p[1] = v1[2] * v2[0] - v2[2] * v1[0]; @@ -681,7 +682,7 @@ public class GLUT { prod[2] = p[2]; } - private static void normalize(float[] v) { + private static void normalize(final float[] v) { float d; d = (float) Math.sqrt(v[0] * v[0] + v[1] * v[1] + v[2] * v[2]); @@ -694,10 +695,10 @@ public class GLUT { v[2] *= d; } - private void pentagon(GL2 gl, int a, int b, int c, int d, int e, int shadeType) { - float[] n0 = new float[3]; - float[] d1 = new float[3]; - float[] d2 = new float[3]; + private void pentagon(final GL2 gl, final int a, final int b, final int c, final int d, final int e, final int shadeType) { + final float[] n0 = new float[3]; + final float[] d1 = new float[3]; + final float[] d2 = new float[3]; diff3(dodec[a], dodec[b], d1); diff3(dodec[b], dodec[c], d2); @@ -714,7 +715,7 @@ public class GLUT { gl.glEnd(); } - private void dodecahedron(GL2 gl, int type) { + private void dodecahedron(final GL2 gl, final int type) { if (dodec == null) { initDodecahedron(); } @@ -732,9 +733,9 @@ public class GLUT { pentagon(gl, 4, 12, 5, 16, 17, type); } - private static void recorditem(GL2 gl, float[] n1, float[] n2, float[] n3, int shadeType) { - float[] q0 = new float[3]; - float[] q1 = new float[3]; + private static void recorditem(final GL2 gl, final float[] n1, final float[] n2, final float[] n3, final int shadeType) { + final float[] q0 = new float[3]; + final float[] q1 = new float[3]; diff3(n1, n2, q0); diff3(n2, n3, q1); @@ -749,11 +750,11 @@ public class GLUT { gl.glEnd(); } - private static void subdivide(GL2 gl, float[] v0, float[] v1, float[] v2, int shadeType) { + private static void subdivide(final GL2 gl, final float[] v0, final float[] v1, final float[] v2, final int shadeType) { int depth; - float[] w0 = new float[3]; - float[] w1 = new float[3]; - float[] w2 = new float[3]; + final float[] w0 = new float[3]; + final float[] w1 = new float[3]; + final float[] w2 = new float[3]; float l; int i, j, k, n; @@ -785,10 +786,10 @@ public class GLUT { } } - private static void drawtriangle(GL2 gl, int i, float[][] data, int[][] ndx, int shadeType) { - float[] x0 = data[ndx[i][0]]; - float[] x1 = data[ndx[i][1]]; - float[] x2 = data[ndx[i][2]]; + private static void drawtriangle(final GL2 gl, final int i, final float[][] data, final int[][] ndx, final int shadeType) { + final float[] x0 = data[ndx[i][0]]; + final float[] x1 = data[ndx[i][1]]; + final float[] x2 = data[ndx[i][2]]; subdivide(gl, x0, x1, x2, shadeType); } @@ -816,7 +817,7 @@ public class GLUT { {1, 3, 5} }; - private static void octahedron(GL2 gl, int shadeType) { + private static void octahedron(final GL2 gl, final int shadeType) { int i; for (i = 7; i >= 0; i--) { @@ -870,7 +871,7 @@ public class GLUT { {7, 2, 11}, }; - private static void icosahedron(GL2 gl, int shadeType) { + private static void icosahedron(final GL2 gl, final int shadeType) { int i; for (i = 19; i >= 0; i--) { @@ -950,7 +951,7 @@ public class GLUT { {1, 2, 3} }; - private static final void tetrahedron(GL2 gl, int shadeType) { + private static final void tetrahedron(final GL2 gl, final int shadeType) { for (int i = 3; i >= 0; i--) drawtriangle(gl, i, tdata, tndex, shadeType); } @@ -1112,28 +1113,28 @@ public class GLUT { 0, 0, 1, 0, 0, 1, 1, 1 }; - private static void teapot(GL2 gl, - int grid, - double scale, - int type, - boolean backCompatible) + private static void teapot(final GL2 gl, + final int grid, + final double scale, + final int type, + final boolean backCompatible) { // As mentioned above, GL2.glMap2f expects a packed array of floats - float[] p = new float[4*4*3]; - float[] q = new float[4*4*3]; - float[] r = new float[4*4*3]; - float[] s = new float[4*4*3]; + final float[] p = new float[4*4*3]; + final float[] q = new float[4*4*3]; + final float[] r = new float[4*4*3]; + final float[] s = new float[4*4*3]; int i, j, k, l; gl.glPushAttrib(GL2.GL_ENABLE_BIT | GL2.GL_EVAL_BIT | GL2.GL_POLYGON_BIT); gl.glEnable(GL2.GL_AUTO_NORMAL); - gl.glEnable(GL2.GL_NORMALIZE); + gl.glEnable(GLLightingFunc.GL_NORMALIZE); gl.glEnable(GL2.GL_MAP2_VERTEX_3); gl.glEnable(GL2.GL_MAP2_TEXTURE_COORD_2); gl.glPushMatrix(); if (!backCompatible) { // The time has come to have the teapot no longer be inside out - gl.glFrontFace(GL2.GL_CW); + gl.glFrontFace(GL.GL_CW); gl.glScaled(0.5*scale, 0.5*scale, 0.5*scale); } else { // We want the teapot in it's backward compatible position and @@ -1184,29 +1185,29 @@ public class GLUT { gl.glPopAttrib(); } - private static void evaluateTeapotMesh(GL2 gl, - int grid, - int type, - int partNum, - boolean repairSingularities) + private static void evaluateTeapotMesh(final GL2 gl, + final int grid, + final int type, + final int partNum, + final boolean repairSingularities) { if (repairSingularities && (partNum == 5 || partNum == 3)) { // Instead of using evaluators that give bad results at singularities, // evaluate by hand - gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, type); + gl.glPolygonMode(GL.GL_FRONT_AND_BACK, type); for (int nv = 0; nv < grid; nv++) { if (nv == 0) { // Draw a small triangle-fan to fill the hole gl.glDisable(GL2.GL_AUTO_NORMAL); gl.glNormal3f(0, 0, partNum == 3 ? 1 : -1); - gl.glBegin(GL2.GL_TRIANGLE_FAN); + gl.glBegin(GL.GL_TRIANGLE_FAN); { gl.glEvalCoord2f(0, 0); // Note that we draw in clock-wise order to match the evaluator // method for (int nu = 0; nu <= grid; nu++) { - gl.glEvalCoord2f(nu / (float)grid, (1f / grid) / (float)grid); + gl.glEvalCoord2f(nu / (float)grid, (1f / grid) / grid); } } gl.glEnd(); @@ -1219,7 +1220,7 @@ public class GLUT { for (int nu = grid; nu >= 0; nu--) { gl.glEvalCoord2f(nu / (float)grid, (nv + 1) / (float)grid); gl.glEvalCoord2f(nu / (float)grid, Math.max(nv, 1f / grid) - / (float)grid); + / grid); } } gl.glEnd(); @@ -1233,13 +1234,13 @@ public class GLUT { // Font implementation // - private static void bitmapCharacterImpl(GL2 gl, int font, char cin) { - BitmapFontRec fontinfo = getBitmapFont(font); - int c = cin & 0xFFFF; + private static void bitmapCharacterImpl(final GL2 gl, final int font, final char cin) { + final BitmapFontRec fontinfo = getBitmapFont(font); + final int c = cin & 0xFFFF; if (c < fontinfo.first || c >= fontinfo.first + fontinfo.num_chars) return; - BitmapCharRec ch = fontinfo.ch[c - fontinfo.first]; + final BitmapCharRec ch = fontinfo.ch[c - fontinfo.first]; if (ch != null) { gl.glBitmap(ch.width, ch.height, ch.xorig, ch.yorig, ch.advance, 0, ch.bitmap, 0); @@ -1249,7 +1250,7 @@ public class GLUT { private static final BitmapFontRec[] bitmapFonts = new BitmapFontRec[9]; private static final StrokeFontRec[] strokeFonts = new StrokeFontRec[9]; - private static BitmapFontRec getBitmapFont(int font) { + private static BitmapFontRec getBitmapFont(final int font) { BitmapFontRec rec = bitmapFonts[font]; if (rec == null) { switch (font) { @@ -1282,7 +1283,7 @@ public class GLUT { return rec; } - private static StrokeFontRec getStrokeFont(int font) { + private static StrokeFontRec getStrokeFont(final int font) { StrokeFontRec rec = strokeFonts[font]; if (rec == null) { switch (font) { @@ -1299,44 +1300,44 @@ public class GLUT { return rec; } - private static void beginBitmap(GL2 gl, - int[] swapbytes, - int[] lsbfirst, - int[] rowlength, - int[] skiprows, - int[] skippixels, - int[] alignment) { - gl.glGetIntegerv(GL2.GL_UNPACK_SWAP_BYTES, swapbytes, 0); - gl.glGetIntegerv(GL2.GL_UNPACK_LSB_FIRST, lsbfirst, 0); - gl.glGetIntegerv(GL2.GL_UNPACK_ROW_LENGTH, rowlength, 0); - gl.glGetIntegerv(GL2.GL_UNPACK_SKIP_ROWS, skiprows, 0); - gl.glGetIntegerv(GL2.GL_UNPACK_SKIP_PIXELS, skippixels, 0); - gl.glGetIntegerv(GL2.GL_UNPACK_ALIGNMENT, alignment, 0); + private static void beginBitmap(final GL2 gl, + final int[] swapbytes, + final int[] lsbfirst, + final int[] rowlength, + final int[] skiprows, + final int[] skippixels, + final int[] alignment) { + gl.glGetIntegerv(GL2GL3.GL_UNPACK_SWAP_BYTES, swapbytes, 0); + gl.glGetIntegerv(GL2GL3.GL_UNPACK_LSB_FIRST, lsbfirst, 0); + gl.glGetIntegerv(GL2ES2.GL_UNPACK_ROW_LENGTH, rowlength, 0); + gl.glGetIntegerv(GL2ES2.GL_UNPACK_SKIP_ROWS, skiprows, 0); + gl.glGetIntegerv(GL2ES2.GL_UNPACK_SKIP_PIXELS, skippixels, 0); + gl.glGetIntegerv(GL.GL_UNPACK_ALIGNMENT, alignment, 0); /* Little endian machines (DEC Alpha for example) could benefit from setting GL_UNPACK_LSB_FIRST to GL_TRUE instead of GL_FALSE, but this would require changing the generated bitmaps too. */ - gl.glPixelStorei(GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE); - gl.glPixelStorei(GL2.GL_UNPACK_LSB_FIRST, GL2.GL_FALSE); - gl.glPixelStorei(GL2.GL_UNPACK_ROW_LENGTH, 0); - gl.glPixelStorei(GL2.GL_UNPACK_SKIP_ROWS, 0); - gl.glPixelStorei(GL2.GL_UNPACK_SKIP_PIXELS, 0); - gl.glPixelStorei(GL2.GL_UNPACK_ALIGNMENT, 1); + gl.glPixelStorei(GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE); + gl.glPixelStorei(GL2GL3.GL_UNPACK_LSB_FIRST, GL.GL_FALSE); + gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, 0); + gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_ROWS, 0); + gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_PIXELS, 0); + gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1); } - private static void endBitmap(GL2 gl, - int[] swapbytes, - int[] lsbfirst, - int[] rowlength, - int[] skiprows, - int[] skippixels, - int[] alignment) { + private static void endBitmap(final GL2 gl, + final int[] swapbytes, + final int[] lsbfirst, + final int[] rowlength, + final int[] skiprows, + final int[] skippixels, + final int[] alignment) { /* Restore saved modes. */ - gl.glPixelStorei(GL2.GL_UNPACK_SWAP_BYTES, swapbytes[0]); - gl.glPixelStorei(GL2.GL_UNPACK_LSB_FIRST, lsbfirst[0]); - gl.glPixelStorei(GL2.GL_UNPACK_ROW_LENGTH, rowlength[0]); - gl.glPixelStorei(GL2.GL_UNPACK_SKIP_ROWS, skiprows[0]); - gl.glPixelStorei(GL2.GL_UNPACK_SKIP_PIXELS, skippixels[0]); - gl.glPixelStorei(GL2.GL_UNPACK_ALIGNMENT, alignment[0]); + gl.glPixelStorei(GL2GL3.GL_UNPACK_SWAP_BYTES, swapbytes[0]); + gl.glPixelStorei(GL2GL3.GL_UNPACK_LSB_FIRST, lsbfirst[0]); + gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, rowlength[0]); + gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_ROWS, skiprows[0]); + gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_PIXELS, skippixels[0]); + gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, alignment[0]); } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java index 3587ca992..a191efdb4 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeMonoRoman.java @@ -46,14 +46,14 @@ class GLUTStrokeMonoRoman { /* char: 33 '!' */ static final CoordRec char33_stroke0[] = { - new CoordRec((float) 52.381, (float) 100 ), + new CoordRec((float) 52.381, 100 ), new CoordRec((float) 52.381, (float) 33.3333 ), }; static final CoordRec char33_stroke1[] = { new CoordRec((float) 52.381, (float) 9.5238 ), new CoordRec((float) 47.6191, (float) 4.7619 ), - new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 52.381, 0 ), new CoordRec((float) 57.1429, (float) 4.7619 ), new CoordRec((float) 52.381, (float) 9.5238 ), }; @@ -66,12 +66,12 @@ static final StrokeRec char33[] = { /* char: 34 '"' */ static final CoordRec char34_stroke0[] = { - new CoordRec((float) 33.3334, (float) 100 ), + new CoordRec((float) 33.3334, 100 ), new CoordRec((float) 33.3334, (float) 66.6667 ), }; static final CoordRec char34_stroke1[] = { - new CoordRec((float) 71.4286, (float) 100 ), + new CoordRec((float) 71.4286, 100 ), new CoordRec((float) 71.4286, (float) 66.6667 ), }; @@ -89,7 +89,7 @@ static final CoordRec char35_stroke0[] = { static final CoordRec char35_stroke1[] = { new CoordRec((float) 83.3334, (float) 119.048 ), - new CoordRec((float) 50, (float) -33.3333 ), + new CoordRec(50, (float) -33.3333 ), }; static final CoordRec char35_stroke2[] = { @@ -124,8 +124,8 @@ static final CoordRec char36_stroke1[] = { static final CoordRec char36_stroke2[] = { new CoordRec((float) 85.7143, (float) 85.7143 ), new CoordRec((float) 76.1905, (float) 95.2381 ), - new CoordRec((float) 61.9047, (float) 100 ), - new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 61.9047, 100 ), + new CoordRec((float) 42.8571, 100 ), new CoordRec((float) 28.5714, (float) 95.2381 ), new CoordRec((float) 19.0476, (float) 85.7143 ), new CoordRec((float) 19.0476, (float) 76.1905 ), @@ -138,8 +138,8 @@ static final CoordRec char36_stroke2[] = { new CoordRec((float) 85.7143, (float) 28.5714 ), new CoordRec((float) 85.7143, (float) 14.2857 ), new CoordRec((float) 76.1905, (float) 4.7619 ), - new CoordRec((float) 61.9047, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 61.9047, 0 ), + new CoordRec((float) 42.8571, 0 ), new CoordRec((float) 28.5714, (float) 4.7619 ), new CoordRec((float) 19.0476, (float) 14.2857 ), }; @@ -153,12 +153,12 @@ static final StrokeRec char36[] = { /* char: 37 '%' */ static final CoordRec char37_stroke0[] = { - new CoordRec((float) 95.2381, (float) 100 ), - new CoordRec((float) 9.5238, (float) 0 ), + new CoordRec((float) 95.2381, 100 ), + new CoordRec((float) 9.5238, 0 ), }; static final CoordRec char37_stroke1[] = { - new CoordRec((float) 33.3333, (float) 100 ), + new CoordRec((float) 33.3333, 100 ), new CoordRec((float) 42.8571, (float) 90.4762 ), new CoordRec((float) 42.8571, (float) 80.9524 ), new CoordRec((float) 38.0952, (float) 71.4286 ), @@ -167,13 +167,13 @@ static final CoordRec char37_stroke1[] = { new CoordRec((float) 9.5238, (float) 76.1905 ), new CoordRec((float) 9.5238, (float) 85.7143 ), new CoordRec((float) 14.2857, (float) 95.2381 ), - new CoordRec((float) 23.8095, (float) 100 ), - new CoordRec((float) 33.3333, (float) 100 ), + new CoordRec((float) 23.8095, 100 ), + new CoordRec((float) 33.3333, 100 ), new CoordRec((float) 42.8571, (float) 95.2381 ), new CoordRec((float) 57.1428, (float) 90.4762 ), new CoordRec((float) 71.4286, (float) 90.4762 ), new CoordRec((float) 85.7143, (float) 95.2381 ), - new CoordRec((float) 95.2381, (float) 100 ), + new CoordRec((float) 95.2381, 100 ), }; static final CoordRec char37_stroke2[] = { @@ -181,8 +181,8 @@ static final CoordRec char37_stroke2[] = { new CoordRec((float) 66.6667, (float) 28.5714 ), new CoordRec((float) 61.9048, (float) 19.0476 ), new CoordRec((float) 61.9048, (float) 9.5238 ), - new CoordRec((float) 71.4286, (float) 0 ), - new CoordRec((float) 80.9524, (float) 0 ), + new CoordRec((float) 71.4286, 0 ), + new CoordRec((float) 80.9524, 0 ), new CoordRec((float) 90.4762, (float) 4.7619 ), new CoordRec((float) 95.2381, (float) 14.2857 ), new CoordRec((float) 95.2381, (float) 23.8095 ), @@ -199,8 +199,8 @@ static final StrokeRec char37[] = { /* char: 38 '&' */ static final CoordRec char38_stroke0[] = { - new CoordRec((float) 100, (float) 57.1429 ), - new CoordRec((float) 100, (float) 61.9048 ), + new CoordRec(100, (float) 57.1429 ), + new CoordRec(100, (float) 61.9048 ), new CoordRec((float) 95.2381, (float) 66.6667 ), new CoordRec((float) 90.4762, (float) 66.6667 ), new CoordRec((float) 85.7143, (float) 61.9048 ), @@ -208,8 +208,8 @@ static final CoordRec char38_stroke0[] = { new CoordRec((float) 71.4286, (float) 28.5714 ), new CoordRec((float) 61.9048, (float) 14.2857 ), new CoordRec((float) 52.3809, (float) 4.7619 ), - new CoordRec((float) 42.8571, (float) 0 ), - new CoordRec((float) 23.8095, (float) 0 ), + new CoordRec((float) 42.8571, 0 ), + new CoordRec((float) 23.8095, 0 ), new CoordRec((float) 14.2857, (float) 4.7619 ), new CoordRec((float) 9.5238, (float) 9.5238 ), new CoordRec((float) 4.7619, (float) 19.0476 ), @@ -221,7 +221,7 @@ static final CoordRec char38_stroke0[] = { new CoordRec((float) 57.1429, (float) 76.1905 ), new CoordRec((float) 57.1429, (float) 85.7143 ), new CoordRec((float) 52.3809, (float) 95.2381 ), - new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 42.8571, 100 ), new CoordRec((float) 33.3333, (float) 95.2381 ), new CoordRec((float) 28.5714, (float) 85.7143 ), new CoordRec((float) 28.5714, (float) 76.1905 ), @@ -229,10 +229,10 @@ static final CoordRec char38_stroke0[] = { new CoordRec((float) 42.8571, (float) 47.619 ), new CoordRec((float) 66.6667, (float) 14.2857 ), new CoordRec((float) 76.1905, (float) 4.7619 ), - new CoordRec((float) 85.7143, (float) 0 ), - new CoordRec((float) 95.2381, (float) 0 ), - new CoordRec((float) 100, (float) 4.7619 ), - new CoordRec((float) 100, (float) 9.5238 ), + new CoordRec((float) 85.7143, 0 ), + new CoordRec((float) 95.2381, 0 ), + new CoordRec(100, (float) 4.7619 ), + new CoordRec(100, (float) 9.5238 ), }; static final StrokeRec char38[] = { @@ -242,7 +242,7 @@ static final StrokeRec char38[] = { /* char: 39 ''' */ static final CoordRec char39_stroke0[] = { - new CoordRec((float) 52.381, (float) 100 ), + new CoordRec((float) 52.381, 100 ), new CoordRec((float) 52.381, (float) 66.6667 ), }; @@ -255,12 +255,12 @@ static final StrokeRec char39[] = { static final CoordRec char40_stroke0[] = { new CoordRec((float) 69.0476, (float) 119.048 ), new CoordRec((float) 59.5238, (float) 109.524 ), - new CoordRec((float) 50, (float) 95.2381 ), + new CoordRec(50, (float) 95.2381 ), new CoordRec((float) 40.4762, (float) 76.1905 ), new CoordRec((float) 35.7143, (float) 52.381 ), new CoordRec((float) 35.7143, (float) 33.3333 ), new CoordRec((float) 40.4762, (float) 9.5238 ), - new CoordRec((float) 50, (float) -9.5238 ), + new CoordRec(50, (float) -9.5238 ), new CoordRec((float) 59.5238, (float) -23.8095 ), new CoordRec((float) 69.0476, (float) -33.3333 ), }; @@ -315,7 +315,7 @@ static final StrokeRec char42[] = { static final CoordRec char43_stroke0[] = { new CoordRec((float) 52.3809, (float) 85.7143 ), - new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 52.3809, 0 ), }; static final CoordRec char43_stroke1[] = { @@ -332,7 +332,7 @@ static final StrokeRec char43[] = { static final CoordRec char44_stroke0[] = { new CoordRec((float) 57.1429, (float) 4.7619 ), - new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 52.381, 0 ), new CoordRec((float) 47.6191, (float) 4.7619 ), new CoordRec((float) 52.381, (float) 9.5238 ), new CoordRec((float) 57.1429, (float) 4.7619 ), @@ -361,7 +361,7 @@ static final StrokeRec char45[] = { static final CoordRec char46_stroke0[] = { new CoordRec((float) 52.381, (float) 9.5238 ), new CoordRec((float) 47.6191, (float) 4.7619 ), - new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 52.381, 0 ), new CoordRec((float) 57.1429, (float) 4.7619 ), new CoordRec((float) 52.381, (float) 9.5238 ), }; @@ -374,7 +374,7 @@ static final StrokeRec char46[] = { static final CoordRec char47_stroke0[] = { new CoordRec((float) 19.0476, (float) -14.2857 ), - new CoordRec((float) 85.7143, (float) 100 ), + new CoordRec((float) 85.7143, 100 ), }; static final StrokeRec char47[] = { @@ -384,23 +384,23 @@ static final StrokeRec char47[] = { /* char: 48 '0' */ static final CoordRec char48_stroke0[] = { - new CoordRec((float) 47.619, (float) 100 ), + new CoordRec((float) 47.619, 100 ), new CoordRec((float) 33.3333, (float) 95.2381 ), new CoordRec((float) 23.8095, (float) 80.9524 ), new CoordRec((float) 19.0476, (float) 57.1429 ), new CoordRec((float) 19.0476, (float) 42.8571 ), new CoordRec((float) 23.8095, (float) 19.0476 ), new CoordRec((float) 33.3333, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 57.1428, (float) 0 ), + new CoordRec((float) 47.619, 0 ), + new CoordRec((float) 57.1428, 0 ), new CoordRec((float) 71.4286, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 19.0476 ), new CoordRec((float) 85.7143, (float) 42.8571 ), new CoordRec((float) 85.7143, (float) 57.1429 ), new CoordRec((float) 80.9524, (float) 80.9524 ), new CoordRec((float) 71.4286, (float) 95.2381 ), - new CoordRec((float) 57.1428, (float) 100 ), - new CoordRec((float) 47.619, (float) 100 ), + new CoordRec((float) 57.1428, 100 ), + new CoordRec((float) 47.619, 100 ), }; static final StrokeRec char48[] = { @@ -411,9 +411,9 @@ static final StrokeRec char48[] = { static final CoordRec char49_stroke0[] = { new CoordRec((float) 40.4762, (float) 80.9524 ), - new CoordRec((float) 50, (float) 85.7143 ), - new CoordRec((float) 64.2857, (float) 100 ), - new CoordRec((float) 64.2857, (float) 0 ), + new CoordRec(50, (float) 85.7143 ), + new CoordRec((float) 64.2857, 100 ), + new CoordRec((float) 64.2857, 0 ), }; static final StrokeRec char49[] = { @@ -427,16 +427,16 @@ static final CoordRec char50_stroke0[] = { new CoordRec((float) 23.8095, (float) 80.9524 ), new CoordRec((float) 28.5714, (float) 90.4762 ), new CoordRec((float) 33.3333, (float) 95.2381 ), - new CoordRec((float) 42.8571, (float) 100 ), - new CoordRec((float) 61.9047, (float) 100 ), + new CoordRec((float) 42.8571, 100 ), + new CoordRec((float) 61.9047, 100 ), new CoordRec((float) 71.4286, (float) 95.2381 ), new CoordRec((float) 76.1905, (float) 90.4762 ), new CoordRec((float) 80.9524, (float) 80.9524 ), new CoordRec((float) 80.9524, (float) 71.4286 ), new CoordRec((float) 76.1905, (float) 61.9048 ), new CoordRec((float) 66.6666, (float) 47.619 ), - new CoordRec((float) 19.0476, (float) 0 ), - new CoordRec((float) 85.7143, (float) 0 ), + new CoordRec((float) 19.0476, 0 ), + new CoordRec((float) 85.7143, 0 ), }; static final StrokeRec char50[] = { @@ -446,8 +446,8 @@ static final StrokeRec char50[] = { /* char: 51 '3' */ static final CoordRec char51_stroke0[] = { - new CoordRec((float) 28.5714, (float) 100 ), - new CoordRec((float) 80.9524, (float) 100 ), + new CoordRec((float) 28.5714, 100 ), + new CoordRec((float) 80.9524, 100 ), new CoordRec((float) 52.3809, (float) 61.9048 ), new CoordRec((float) 66.6666, (float) 61.9048 ), new CoordRec((float) 76.1905, (float) 57.1429 ), @@ -456,8 +456,8 @@ static final CoordRec char51_stroke0[] = { new CoordRec((float) 85.7143, (float) 28.5714 ), new CoordRec((float) 80.9524, (float) 14.2857 ), new CoordRec((float) 71.4286, (float) 4.7619 ), - new CoordRec((float) 57.1428, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 57.1428, 0 ), + new CoordRec((float) 42.8571, 0 ), new CoordRec((float) 28.5714, (float) 4.7619 ), new CoordRec((float) 23.8095, (float) 9.5238 ), new CoordRec((float) 19.0476, (float) 19.0476 ), @@ -470,14 +470,14 @@ static final StrokeRec char51[] = { /* char: 52 '4' */ static final CoordRec char52_stroke0[] = { - new CoordRec((float) 64.2857, (float) 100 ), + new CoordRec((float) 64.2857, 100 ), new CoordRec((float) 16.6667, (float) 33.3333 ), new CoordRec((float) 88.0952, (float) 33.3333 ), }; static final CoordRec char52_stroke1[] = { - new CoordRec((float) 64.2857, (float) 100 ), - new CoordRec((float) 64.2857, (float) 0 ), + new CoordRec((float) 64.2857, 100 ), + new CoordRec((float) 64.2857, 0 ), }; static final StrokeRec char52[] = { @@ -488,8 +488,8 @@ static final StrokeRec char52[] = { /* char: 53 '5' */ static final CoordRec char53_stroke0[] = { - new CoordRec((float) 76.1905, (float) 100 ), - new CoordRec((float) 28.5714, (float) 100 ), + new CoordRec((float) 76.1905, 100 ), + new CoordRec((float) 28.5714, 100 ), new CoordRec((float) 23.8095, (float) 57.1429 ), new CoordRec((float) 28.5714, (float) 61.9048 ), new CoordRec((float) 42.8571, (float) 66.6667 ), @@ -500,8 +500,8 @@ static final CoordRec char53_stroke0[] = { new CoordRec((float) 85.7143, (float) 28.5714 ), new CoordRec((float) 80.9524, (float) 14.2857 ), new CoordRec((float) 71.4286, (float) 4.7619 ), - new CoordRec((float) 57.1428, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 57.1428, 0 ), + new CoordRec((float) 42.8571, 0 ), new CoordRec((float) 28.5714, (float) 4.7619 ), new CoordRec((float) 23.8095, (float) 9.5238 ), new CoordRec((float) 19.0476, (float) 19.0476 ), @@ -516,16 +516,16 @@ static final StrokeRec char53[] = { static final CoordRec char54_stroke0[] = { new CoordRec((float) 78.5714, (float) 85.7143 ), new CoordRec((float) 73.8096, (float) 95.2381 ), - new CoordRec((float) 59.5238, (float) 100 ), - new CoordRec((float) 50, (float) 100 ), + new CoordRec((float) 59.5238, 100 ), + new CoordRec(50, 100 ), new CoordRec((float) 35.7143, (float) 95.2381 ), new CoordRec((float) 26.1905, (float) 80.9524 ), new CoordRec((float) 21.4286, (float) 57.1429 ), new CoordRec((float) 21.4286, (float) 33.3333 ), new CoordRec((float) 26.1905, (float) 14.2857 ), new CoordRec((float) 35.7143, (float) 4.7619 ), - new CoordRec((float) 50, (float) 0 ), - new CoordRec((float) 54.7619, (float) 0 ), + new CoordRec(50, 0 ), + new CoordRec((float) 54.7619, 0 ), new CoordRec((float) 69.0476, (float) 4.7619 ), new CoordRec((float) 78.5714, (float) 14.2857 ), new CoordRec((float) 83.3334, (float) 28.5714 ), @@ -533,7 +533,7 @@ static final CoordRec char54_stroke0[] = { new CoordRec((float) 78.5714, (float) 47.619 ), new CoordRec((float) 69.0476, (float) 57.1429 ), new CoordRec((float) 54.7619, (float) 61.9048 ), - new CoordRec((float) 50, (float) 61.9048 ), + new CoordRec(50, (float) 61.9048 ), new CoordRec((float) 35.7143, (float) 57.1429 ), new CoordRec((float) 26.1905, (float) 47.619 ), new CoordRec((float) 21.4286, (float) 33.3333 ), @@ -546,13 +546,13 @@ static final StrokeRec char54[] = { /* char: 55 '7' */ static final CoordRec char55_stroke0[] = { - new CoordRec((float) 85.7143, (float) 100 ), - new CoordRec((float) 38.0952, (float) 0 ), + new CoordRec((float) 85.7143, 100 ), + new CoordRec((float) 38.0952, 0 ), }; static final CoordRec char55_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 85.7143, (float) 100 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 85.7143, 100 ), }; static final StrokeRec char55[] = { @@ -563,7 +563,7 @@ static final StrokeRec char55[] = { /* char: 56 '8' */ static final CoordRec char56_stroke0[] = { - new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 42.8571, 100 ), new CoordRec((float) 28.5714, (float) 95.2381 ), new CoordRec((float) 23.8095, (float) 85.7143 ), new CoordRec((float) 23.8095, (float) 76.1905 ), @@ -576,8 +576,8 @@ static final CoordRec char56_stroke0[] = { new CoordRec((float) 85.7143, (float) 19.0476 ), new CoordRec((float) 80.9524, (float) 9.5238 ), new CoordRec((float) 76.1905, (float) 4.7619 ), - new CoordRec((float) 61.9047, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 61.9047, 0 ), + new CoordRec((float) 42.8571, 0 ), new CoordRec((float) 28.5714, (float) 4.7619 ), new CoordRec((float) 23.8095, (float) 9.5238 ), new CoordRec((float) 19.0476, (float) 19.0476 ), @@ -590,8 +590,8 @@ static final CoordRec char56_stroke0[] = { new CoordRec((float) 80.9524, (float) 76.1905 ), new CoordRec((float) 80.9524, (float) 85.7143 ), new CoordRec((float) 76.1905, (float) 95.2381 ), - new CoordRec((float) 61.9047, (float) 100 ), - new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 61.9047, 100 ), + new CoordRec((float) 42.8571, 100 ), }; static final StrokeRec char56[] = { @@ -605,23 +605,23 @@ static final CoordRec char57_stroke0[] = { new CoordRec((float) 78.5714, (float) 52.381 ), new CoordRec((float) 69.0476, (float) 42.8571 ), new CoordRec((float) 54.7619, (float) 38.0952 ), - new CoordRec((float) 50, (float) 38.0952 ), + new CoordRec(50, (float) 38.0952 ), new CoordRec((float) 35.7143, (float) 42.8571 ), new CoordRec((float) 26.1905, (float) 52.381 ), new CoordRec((float) 21.4286, (float) 66.6667 ), new CoordRec((float) 21.4286, (float) 71.4286 ), new CoordRec((float) 26.1905, (float) 85.7143 ), new CoordRec((float) 35.7143, (float) 95.2381 ), - new CoordRec((float) 50, (float) 100 ), - new CoordRec((float) 54.7619, (float) 100 ), + new CoordRec(50, 100 ), + new CoordRec((float) 54.7619, 100 ), new CoordRec((float) 69.0476, (float) 95.2381 ), new CoordRec((float) 78.5714, (float) 85.7143 ), new CoordRec((float) 83.3334, (float) 66.6667 ), new CoordRec((float) 83.3334, (float) 42.8571 ), new CoordRec((float) 78.5714, (float) 19.0476 ), new CoordRec((float) 69.0476, (float) 4.7619 ), - new CoordRec((float) 54.7619, (float) 0 ), - new CoordRec((float) 45.2381, (float) 0 ), + new CoordRec((float) 54.7619, 0 ), + new CoordRec((float) 45.2381, 0 ), new CoordRec((float) 30.9524, (float) 4.7619 ), new CoordRec((float) 26.1905, (float) 14.2857 ), }; @@ -643,7 +643,7 @@ static final CoordRec char58_stroke0[] = { static final CoordRec char58_stroke1[] = { new CoordRec((float) 52.381, (float) 9.5238 ), new CoordRec((float) 47.6191, (float) 4.7619 ), - new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 52.381, 0 ), new CoordRec((float) 57.1429, (float) 4.7619 ), new CoordRec((float) 52.381, (float) 9.5238 ), }; @@ -665,7 +665,7 @@ static final CoordRec char59_stroke0[] = { static final CoordRec char59_stroke1[] = { new CoordRec((float) 57.1429, (float) 4.7619 ), - new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 52.381, 0 ), new CoordRec((float) 47.6191, (float) 4.7619 ), new CoordRec((float) 52.381, (float) 9.5238 ), new CoordRec((float) 57.1429, (float) 4.7619 ), @@ -684,7 +684,7 @@ static final StrokeRec char59[] = { static final CoordRec char60_stroke0[] = { new CoordRec((float) 90.4762, (float) 85.7143 ), new CoordRec((float) 14.2857, (float) 42.8571 ), - new CoordRec((float) 90.4762, (float) 0 ), + new CoordRec((float) 90.4762, 0 ), }; static final StrokeRec char60[] = { @@ -713,7 +713,7 @@ static final StrokeRec char61[] = { static final CoordRec char62_stroke0[] = { new CoordRec((float) 14.2857, (float) 85.7143 ), new CoordRec((float) 90.4762, (float) 42.8571 ), - new CoordRec((float) 14.2857, (float) 0 ), + new CoordRec((float) 14.2857, 0 ), }; static final StrokeRec char62[] = { @@ -727,8 +727,8 @@ static final CoordRec char63_stroke0[] = { new CoordRec((float) 23.8095, (float) 80.9524 ), new CoordRec((float) 28.5714, (float) 90.4762 ), new CoordRec((float) 33.3333, (float) 95.2381 ), - new CoordRec((float) 42.8571, (float) 100 ), - new CoordRec((float) 61.9047, (float) 100 ), + new CoordRec((float) 42.8571, 100 ), + new CoordRec((float) 61.9047, 100 ), new CoordRec((float) 71.4285, (float) 95.2381 ), new CoordRec((float) 76.1905, (float) 90.4762 ), new CoordRec((float) 80.9524, (float) 80.9524 ), @@ -742,7 +742,7 @@ static final CoordRec char63_stroke0[] = { static final CoordRec char63_stroke1[] = { new CoordRec((float) 52.3809, (float) 9.5238 ), new CoordRec((float) 47.619, (float) 4.7619 ), - new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 52.3809, 0 ), new CoordRec((float) 57.1428, (float) 4.7619 ), new CoordRec((float) 52.3809, (float) 9.5238 ), }; @@ -775,14 +775,14 @@ static final CoordRec char64_stroke1[] = { new CoordRec((float) 78.5714, (float) 61.9048 ), new CoordRec((float) 69.0476, (float) 71.4286 ), new CoordRec((float) 54.7619, (float) 76.1905 ), - new CoordRec((float) 50, (float) 76.1905 ), + new CoordRec(50, (float) 76.1905 ), new CoordRec((float) 35.7143, (float) 71.4286 ), new CoordRec((float) 26.1905, (float) 61.9048 ), new CoordRec((float) 21.4286, (float) 47.619 ), new CoordRec((float) 21.4286, (float) 42.8571 ), new CoordRec((float) 26.1905, (float) 28.5714 ), new CoordRec((float) 35.7143, (float) 19.0476 ), - new CoordRec((float) 50, (float) 14.2857 ), + new CoordRec(50, (float) 14.2857 ), new CoordRec((float) 54.7619, (float) 14.2857 ), new CoordRec((float) 69.0476, (float) 19.0476 ), }; @@ -795,13 +795,13 @@ static final StrokeRec char64[] = { /* char: 65 'A' */ static final CoordRec char65_stroke0[] = { - new CoordRec((float) 52.3809, (float) 100 ), - new CoordRec((float) 14.2857, (float) 0 ), + new CoordRec((float) 52.3809, 100 ), + new CoordRec((float) 14.2857, 0 ), }; static final CoordRec char65_stroke1[] = { - new CoordRec((float) 52.3809, (float) 100 ), - new CoordRec((float) 90.4762, (float) 0 ), + new CoordRec((float) 52.3809, 100 ), + new CoordRec((float) 90.4762, 0 ), }; static final CoordRec char65_stroke2[] = { @@ -818,13 +818,13 @@ static final StrokeRec char65[] = { /* char: 66 'B' */ static final CoordRec char66_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 19.0476, 0 ), }; static final CoordRec char66_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 61.9047, (float) 100 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 61.9047, 100 ), new CoordRec((float) 76.1905, (float) 95.2381 ), new CoordRec((float) 80.9524, (float) 90.4762 ), new CoordRec((float) 85.7143, (float) 80.9524 ), @@ -843,8 +843,8 @@ static final CoordRec char66_stroke2[] = { new CoordRec((float) 85.7143, (float) 19.0476 ), new CoordRec((float) 80.9524, (float) 9.5238 ), new CoordRec((float) 76.1905, (float) 4.7619 ), - new CoordRec((float) 61.9047, (float) 0 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 61.9047, 0 ), + new CoordRec((float) 19.0476, 0 ), }; static final StrokeRec char66[] = { @@ -859,8 +859,8 @@ static final CoordRec char67_stroke0[] = { new CoordRec((float) 88.0952, (float) 76.1905 ), new CoordRec((float) 83.3334, (float) 85.7143 ), new CoordRec((float) 73.8096, (float) 95.2381 ), - new CoordRec((float) 64.2857, (float) 100 ), - new CoordRec((float) 45.2381, (float) 100 ), + new CoordRec((float) 64.2857, 100 ), + new CoordRec((float) 45.2381, 100 ), new CoordRec((float) 35.7143, (float) 95.2381 ), new CoordRec((float) 26.1905, (float) 85.7143 ), new CoordRec((float) 21.4286, (float) 76.1905 ), @@ -869,8 +869,8 @@ static final CoordRec char67_stroke0[] = { new CoordRec((float) 21.4286, (float) 23.8095 ), new CoordRec((float) 26.1905, (float) 14.2857 ), new CoordRec((float) 35.7143, (float) 4.7619 ), - new CoordRec((float) 45.2381, (float) 0 ), - new CoordRec((float) 64.2857, (float) 0 ), + new CoordRec((float) 45.2381, 0 ), + new CoordRec((float) 64.2857, 0 ), new CoordRec((float) 73.8096, (float) 4.7619 ), new CoordRec((float) 83.3334, (float) 14.2857 ), new CoordRec((float) 88.0952, (float) 23.8095 ), @@ -883,13 +883,13 @@ static final StrokeRec char67[] = { /* char: 68 'D' */ static final CoordRec char68_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 19.0476, 0 ), }; static final CoordRec char68_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 52.3809, (float) 100 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 52.3809, 100 ), new CoordRec((float) 66.6666, (float) 95.2381 ), new CoordRec((float) 76.1905, (float) 85.7143 ), new CoordRec((float) 80.9524, (float) 76.1905 ), @@ -898,8 +898,8 @@ static final CoordRec char68_stroke1[] = { new CoordRec((float) 80.9524, (float) 23.8095 ), new CoordRec((float) 76.1905, (float) 14.2857 ), new CoordRec((float) 66.6666, (float) 4.7619 ), - new CoordRec((float) 52.3809, (float) 0 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 52.3809, 0 ), + new CoordRec((float) 19.0476, 0 ), }; static final StrokeRec char68[] = { @@ -910,13 +910,13 @@ static final StrokeRec char68[] = { /* char: 69 'E' */ static final CoordRec char69_stroke0[] = { - new CoordRec((float) 21.4286, (float) 100 ), - new CoordRec((float) 21.4286, (float) 0 ), + new CoordRec((float) 21.4286, 100 ), + new CoordRec((float) 21.4286, 0 ), }; static final CoordRec char69_stroke1[] = { - new CoordRec((float) 21.4286, (float) 100 ), - new CoordRec((float) 83.3334, (float) 100 ), + new CoordRec((float) 21.4286, 100 ), + new CoordRec((float) 83.3334, 100 ), }; static final CoordRec char69_stroke2[] = { @@ -925,8 +925,8 @@ static final CoordRec char69_stroke2[] = { }; static final CoordRec char69_stroke3[] = { - new CoordRec((float) 21.4286, (float) 0 ), - new CoordRec((float) 83.3334, (float) 0 ), + new CoordRec((float) 21.4286, 0 ), + new CoordRec((float) 83.3334, 0 ), }; static final StrokeRec char69[] = { @@ -939,13 +939,13 @@ static final StrokeRec char69[] = { /* char: 70 'F' */ static final CoordRec char70_stroke0[] = { - new CoordRec((float) 21.4286, (float) 100 ), - new CoordRec((float) 21.4286, (float) 0 ), + new CoordRec((float) 21.4286, 100 ), + new CoordRec((float) 21.4286, 0 ), }; static final CoordRec char70_stroke1[] = { - new CoordRec((float) 21.4286, (float) 100 ), - new CoordRec((float) 83.3334, (float) 100 ), + new CoordRec((float) 21.4286, 100 ), + new CoordRec((float) 83.3334, 100 ), }; static final CoordRec char70_stroke2[] = { @@ -965,8 +965,8 @@ static final CoordRec char71_stroke0[] = { new CoordRec((float) 88.0952, (float) 76.1905 ), new CoordRec((float) 83.3334, (float) 85.7143 ), new CoordRec((float) 73.8096, (float) 95.2381 ), - new CoordRec((float) 64.2857, (float) 100 ), - new CoordRec((float) 45.2381, (float) 100 ), + new CoordRec((float) 64.2857, 100 ), + new CoordRec((float) 45.2381, 100 ), new CoordRec((float) 35.7143, (float) 95.2381 ), new CoordRec((float) 26.1905, (float) 85.7143 ), new CoordRec((float) 21.4286, (float) 76.1905 ), @@ -975,8 +975,8 @@ static final CoordRec char71_stroke0[] = { new CoordRec((float) 21.4286, (float) 23.8095 ), new CoordRec((float) 26.1905, (float) 14.2857 ), new CoordRec((float) 35.7143, (float) 4.7619 ), - new CoordRec((float) 45.2381, (float) 0 ), - new CoordRec((float) 64.2857, (float) 0 ), + new CoordRec((float) 45.2381, 0 ), + new CoordRec((float) 64.2857, 0 ), new CoordRec((float) 73.8096, (float) 4.7619 ), new CoordRec((float) 83.3334, (float) 14.2857 ), new CoordRec((float) 88.0952, (float) 23.8095 ), @@ -996,13 +996,13 @@ static final StrokeRec char71[] = { /* char: 72 'H' */ static final CoordRec char72_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 19.0476, 0 ), }; static final CoordRec char72_stroke1[] = { - new CoordRec((float) 85.7143, (float) 100 ), - new CoordRec((float) 85.7143, (float) 0 ), + new CoordRec((float) 85.7143, 100 ), + new CoordRec((float) 85.7143, 0 ), }; static final CoordRec char72_stroke2[] = { @@ -1019,8 +1019,8 @@ static final StrokeRec char72[] = { /* char: 73 'I' */ static final CoordRec char73_stroke0[] = { - new CoordRec((float) 52.381, (float) 100 ), - new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 52.381, 100 ), + new CoordRec((float) 52.381, 0 ), }; static final StrokeRec char73[] = { @@ -1030,12 +1030,12 @@ static final StrokeRec char73[] = { /* char: 74 'J' */ static final CoordRec char74_stroke0[] = { - new CoordRec((float) 76.1905, (float) 100 ), + new CoordRec((float) 76.1905, 100 ), new CoordRec((float) 76.1905, (float) 23.8095 ), new CoordRec((float) 71.4286, (float) 9.5238 ), new CoordRec((float) 66.6667, (float) 4.7619 ), - new CoordRec((float) 57.1429, (float) 0 ), - new CoordRec((float) 47.6191, (float) 0 ), + new CoordRec((float) 57.1429, 0 ), + new CoordRec((float) 47.6191, 0 ), new CoordRec((float) 38.0953, (float) 4.7619 ), new CoordRec((float) 33.3334, (float) 9.5238 ), new CoordRec((float) 28.5715, (float) 23.8095 ), @@ -1049,18 +1049,18 @@ static final StrokeRec char74[] = { /* char: 75 'K' */ static final CoordRec char75_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 19.0476, 0 ), }; static final CoordRec char75_stroke1[] = { - new CoordRec((float) 85.7143, (float) 100 ), + new CoordRec((float) 85.7143, 100 ), new CoordRec((float) 19.0476, (float) 33.3333 ), }; static final CoordRec char75_stroke2[] = { new CoordRec((float) 42.8571, (float) 57.1429 ), - new CoordRec((float) 85.7143, (float) 0 ), + new CoordRec((float) 85.7143, 0 ), }; static final StrokeRec char75[] = { @@ -1072,13 +1072,13 @@ static final StrokeRec char75[] = { /* char: 76 'L' */ static final CoordRec char76_stroke0[] = { - new CoordRec((float) 23.8095, (float) 100 ), - new CoordRec((float) 23.8095, (float) 0 ), + new CoordRec((float) 23.8095, 100 ), + new CoordRec((float) 23.8095, 0 ), }; static final CoordRec char76_stroke1[] = { - new CoordRec((float) 23.8095, (float) 0 ), - new CoordRec((float) 80.9524, (float) 0 ), + new CoordRec((float) 23.8095, 0 ), + new CoordRec((float) 80.9524, 0 ), }; static final StrokeRec char76[] = { @@ -1089,23 +1089,23 @@ static final StrokeRec char76[] = { /* char: 77 'M' */ static final CoordRec char77_stroke0[] = { - new CoordRec((float) 14.2857, (float) 100 ), - new CoordRec((float) 14.2857, (float) 0 ), + new CoordRec((float) 14.2857, 100 ), + new CoordRec((float) 14.2857, 0 ), }; static final CoordRec char77_stroke1[] = { - new CoordRec((float) 14.2857, (float) 100 ), - new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 14.2857, 100 ), + new CoordRec((float) 52.3809, 0 ), }; static final CoordRec char77_stroke2[] = { - new CoordRec((float) 90.4762, (float) 100 ), - new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 90.4762, 100 ), + new CoordRec((float) 52.3809, 0 ), }; static final CoordRec char77_stroke3[] = { - new CoordRec((float) 90.4762, (float) 100 ), - new CoordRec((float) 90.4762, (float) 0 ), + new CoordRec((float) 90.4762, 100 ), + new CoordRec((float) 90.4762, 0 ), }; static final StrokeRec char77[] = { @@ -1118,18 +1118,18 @@ static final StrokeRec char77[] = { /* char: 78 'N' */ static final CoordRec char78_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 19.0476, 0 ), }; static final CoordRec char78_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 85.7143, (float) 0 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 85.7143, 0 ), }; static final CoordRec char78_stroke2[] = { - new CoordRec((float) 85.7143, (float) 100 ), - new CoordRec((float) 85.7143, (float) 0 ), + new CoordRec((float) 85.7143, 100 ), + new CoordRec((float) 85.7143, 0 ), }; static final StrokeRec char78[] = { @@ -1141,7 +1141,7 @@ static final StrokeRec char78[] = { /* char: 79 'O' */ static final CoordRec char79_stroke0[] = { - new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 42.8571, 100 ), new CoordRec((float) 33.3333, (float) 95.2381 ), new CoordRec((float) 23.8095, (float) 85.7143 ), new CoordRec((float) 19.0476, (float) 76.1905 ), @@ -1150,8 +1150,8 @@ static final CoordRec char79_stroke0[] = { new CoordRec((float) 19.0476, (float) 23.8095 ), new CoordRec((float) 23.8095, (float) 14.2857 ), new CoordRec((float) 33.3333, (float) 4.7619 ), - new CoordRec((float) 42.8571, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 42.8571, 0 ), + new CoordRec((float) 61.9047, 0 ), new CoordRec((float) 71.4286, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 14.2857 ), new CoordRec((float) 85.7143, (float) 23.8095 ), @@ -1160,8 +1160,8 @@ static final CoordRec char79_stroke0[] = { new CoordRec((float) 85.7143, (float) 76.1905 ), new CoordRec((float) 80.9524, (float) 85.7143 ), new CoordRec((float) 71.4286, (float) 95.2381 ), - new CoordRec((float) 61.9047, (float) 100 ), - new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 61.9047, 100 ), + new CoordRec((float) 42.8571, 100 ), }; static final StrokeRec char79[] = { @@ -1171,13 +1171,13 @@ static final StrokeRec char79[] = { /* char: 80 'P' */ static final CoordRec char80_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 19.0476, 0 ), }; static final CoordRec char80_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 61.9047, (float) 100 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 61.9047, 100 ), new CoordRec((float) 76.1905, (float) 95.2381 ), new CoordRec((float) 80.9524, (float) 90.4762 ), new CoordRec((float) 85.7143, (float) 80.9524 ), @@ -1196,7 +1196,7 @@ static final StrokeRec char80[] = { /* char: 81 'Q' */ static final CoordRec char81_stroke0[] = { - new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 42.8571, 100 ), new CoordRec((float) 33.3333, (float) 95.2381 ), new CoordRec((float) 23.8095, (float) 85.7143 ), new CoordRec((float) 19.0476, (float) 76.1905 ), @@ -1205,8 +1205,8 @@ static final CoordRec char81_stroke0[] = { new CoordRec((float) 19.0476, (float) 23.8095 ), new CoordRec((float) 23.8095, (float) 14.2857 ), new CoordRec((float) 33.3333, (float) 4.7619 ), - new CoordRec((float) 42.8571, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 42.8571, 0 ), + new CoordRec((float) 61.9047, 0 ), new CoordRec((float) 71.4286, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 14.2857 ), new CoordRec((float) 85.7143, (float) 23.8095 ), @@ -1215,8 +1215,8 @@ static final CoordRec char81_stroke0[] = { new CoordRec((float) 85.7143, (float) 76.1905 ), new CoordRec((float) 80.9524, (float) 85.7143 ), new CoordRec((float) 71.4286, (float) 95.2381 ), - new CoordRec((float) 61.9047, (float) 100 ), - new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 61.9047, 100 ), + new CoordRec((float) 42.8571, 100 ), }; static final CoordRec char81_stroke1[] = { @@ -1232,13 +1232,13 @@ static final StrokeRec char81[] = { /* char: 82 'R' */ static final CoordRec char82_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 19.0476, 0 ), }; static final CoordRec char82_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 61.9047, (float) 100 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 61.9047, 100 ), new CoordRec((float) 76.1905, (float) 95.2381 ), new CoordRec((float) 80.9524, (float) 90.4762 ), new CoordRec((float) 85.7143, (float) 80.9524 ), @@ -1251,7 +1251,7 @@ static final CoordRec char82_stroke1[] = { static final CoordRec char82_stroke2[] = { new CoordRec((float) 52.3809, (float) 52.381 ), - new CoordRec((float) 85.7143, (float) 0 ), + new CoordRec((float) 85.7143, 0 ), }; static final StrokeRec char82[] = { @@ -1265,8 +1265,8 @@ static final StrokeRec char82[] = { static final CoordRec char83_stroke0[] = { new CoordRec((float) 85.7143, (float) 85.7143 ), new CoordRec((float) 76.1905, (float) 95.2381 ), - new CoordRec((float) 61.9047, (float) 100 ), - new CoordRec((float) 42.8571, (float) 100 ), + new CoordRec((float) 61.9047, 100 ), + new CoordRec((float) 42.8571, 100 ), new CoordRec((float) 28.5714, (float) 95.2381 ), new CoordRec((float) 19.0476, (float) 85.7143 ), new CoordRec((float) 19.0476, (float) 76.1905 ), @@ -1279,8 +1279,8 @@ static final CoordRec char83_stroke0[] = { new CoordRec((float) 85.7143, (float) 28.5714 ), new CoordRec((float) 85.7143, (float) 14.2857 ), new CoordRec((float) 76.1905, (float) 4.7619 ), - new CoordRec((float) 61.9047, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 61.9047, 0 ), + new CoordRec((float) 42.8571, 0 ), new CoordRec((float) 28.5714, (float) 4.7619 ), new CoordRec((float) 19.0476, (float) 14.2857 ), }; @@ -1292,13 +1292,13 @@ static final StrokeRec char83[] = { /* char: 84 'T' */ static final CoordRec char84_stroke0[] = { - new CoordRec((float) 52.3809, (float) 100 ), - new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 52.3809, 100 ), + new CoordRec((float) 52.3809, 0 ), }; static final CoordRec char84_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 85.7143, (float) 100 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 85.7143, 100 ), }; static final StrokeRec char84[] = { @@ -1309,16 +1309,16 @@ static final StrokeRec char84[] = { /* char: 85 'U' */ static final CoordRec char85_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 19.0476, 100 ), new CoordRec((float) 19.0476, (float) 28.5714 ), new CoordRec((float) 23.8095, (float) 14.2857 ), new CoordRec((float) 33.3333, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 57.1428, (float) 0 ), + new CoordRec((float) 47.619, 0 ), + new CoordRec((float) 57.1428, 0 ), new CoordRec((float) 71.4286, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 14.2857 ), new CoordRec((float) 85.7143, (float) 28.5714 ), - new CoordRec((float) 85.7143, (float) 100 ), + new CoordRec((float) 85.7143, 100 ), }; static final StrokeRec char85[] = { @@ -1328,13 +1328,13 @@ static final StrokeRec char85[] = { /* char: 86 'V' */ static final CoordRec char86_stroke0[] = { - new CoordRec((float) 14.2857, (float) 100 ), - new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 14.2857, 100 ), + new CoordRec((float) 52.3809, 0 ), }; static final CoordRec char86_stroke1[] = { - new CoordRec((float) 90.4762, (float) 100 ), - new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 90.4762, 100 ), + new CoordRec((float) 52.3809, 0 ), }; static final StrokeRec char86[] = { @@ -1345,23 +1345,23 @@ static final StrokeRec char86[] = { /* char: 87 'W' */ static final CoordRec char87_stroke0[] = { - new CoordRec((float) 4.7619, (float) 100 ), - new CoordRec((float) 28.5714, (float) 0 ), + new CoordRec((float) 4.7619, 100 ), + new CoordRec((float) 28.5714, 0 ), }; static final CoordRec char87_stroke1[] = { - new CoordRec((float) 52.3809, (float) 100 ), - new CoordRec((float) 28.5714, (float) 0 ), + new CoordRec((float) 52.3809, 100 ), + new CoordRec((float) 28.5714, 0 ), }; static final CoordRec char87_stroke2[] = { - new CoordRec((float) 52.3809, (float) 100 ), - new CoordRec((float) 76.1905, (float) 0 ), + new CoordRec((float) 52.3809, 100 ), + new CoordRec((float) 76.1905, 0 ), }; static final CoordRec char87_stroke3[] = { - new CoordRec((float) 100, (float) 100 ), - new CoordRec((float) 76.1905, (float) 0 ), + new CoordRec(100, 100 ), + new CoordRec((float) 76.1905, 0 ), }; static final StrokeRec char87[] = { @@ -1374,13 +1374,13 @@ static final StrokeRec char87[] = { /* char: 88 'X' */ static final CoordRec char88_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 85.7143, (float) 0 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 85.7143, 0 ), }; static final CoordRec char88_stroke1[] = { - new CoordRec((float) 85.7143, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 85.7143, 100 ), + new CoordRec((float) 19.0476, 0 ), }; static final StrokeRec char88[] = { @@ -1391,13 +1391,13 @@ static final StrokeRec char88[] = { /* char: 89 'Y' */ static final CoordRec char89_stroke0[] = { - new CoordRec((float) 14.2857, (float) 100 ), + new CoordRec((float) 14.2857, 100 ), new CoordRec((float) 52.3809, (float) 52.381 ), - new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 52.3809, 0 ), }; static final CoordRec char89_stroke1[] = { - new CoordRec((float) 90.4762, (float) 100 ), + new CoordRec((float) 90.4762, 100 ), new CoordRec((float) 52.3809, (float) 52.381 ), }; @@ -1409,18 +1409,18 @@ static final StrokeRec char89[] = { /* char: 90 'Z' */ static final CoordRec char90_stroke0[] = { - new CoordRec((float) 85.7143, (float) 100 ), - new CoordRec((float) 19.0476, (float) 0 ), + new CoordRec((float) 85.7143, 100 ), + new CoordRec((float) 19.0476, 0 ), }; static final CoordRec char90_stroke1[] = { - new CoordRec((float) 19.0476, (float) 100 ), - new CoordRec((float) 85.7143, (float) 100 ), + new CoordRec((float) 19.0476, 100 ), + new CoordRec((float) 85.7143, 100 ), }; static final CoordRec char90_stroke2[] = { - new CoordRec((float) 19.0476, (float) 0 ), - new CoordRec((float) 85.7143, (float) 0 ), + new CoordRec((float) 19.0476, 0 ), + new CoordRec((float) 85.7143, 0 ), }; static final StrokeRec char90[] = { @@ -1461,7 +1461,7 @@ static final StrokeRec char91[] = { /* char: 92 '\' */ static final CoordRec char92_stroke0[] = { - new CoordRec((float) 19.0476, (float) 100 ), + new CoordRec((float) 19.0476, 100 ), new CoordRec((float) 85.7143, (float) -14.2857 ), }; @@ -1518,11 +1518,11 @@ static final StrokeRec char94[] = { /* char: 95 '_' */ static final CoordRec char95_stroke0[] = { - new CoordRec((float) 0, (float) -33.3333 ), + new CoordRec(0, (float) -33.3333 ), new CoordRec((float) 104.762, (float) -33.3333 ), new CoordRec((float) 104.762, (float) -28.5714 ), - new CoordRec((float) 0, (float) -28.5714 ), - new CoordRec((float) 0, (float) -33.3333 ), + new CoordRec(0, (float) -28.5714 ), + new CoordRec(0, (float) -33.3333 ), }; static final StrokeRec char95[] = { @@ -1532,12 +1532,12 @@ static final StrokeRec char95[] = { /* char: 96 '`' */ static final CoordRec char96_stroke0[] = { - new CoordRec((float) 42.8572, (float) 100 ), + new CoordRec((float) 42.8572, 100 ), new CoordRec((float) 66.6667, (float) 71.4286 ), }; static final CoordRec char96_stroke1[] = { - new CoordRec((float) 42.8572, (float) 100 ), + new CoordRec((float) 42.8572, 100 ), new CoordRec((float) 38.0953, (float) 95.2381 ), new CoordRec((float) 66.6667, (float) 71.4286 ), }; @@ -1551,7 +1551,7 @@ static final StrokeRec char96[] = { static final CoordRec char97_stroke0[] = { new CoordRec((float) 80.9524, (float) 66.6667 ), - new CoordRec((float) 80.9524, (float) 0 ), + new CoordRec((float) 80.9524, 0 ), }; static final CoordRec char97_stroke1[] = { @@ -1565,8 +1565,8 @@ static final CoordRec char97_stroke1[] = { new CoordRec((float) 23.8095, (float) 28.5714 ), new CoordRec((float) 28.5714, (float) 14.2857 ), new CoordRec((float) 38.0952, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 47.619, 0 ), + new CoordRec((float) 61.9047, 0 ), new CoordRec((float) 71.4285, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 14.2857 ), }; @@ -1579,8 +1579,8 @@ static final StrokeRec char97[] = { /* char: 98 'b' */ static final CoordRec char98_stroke0[] = { - new CoordRec((float) 23.8095, (float) 100 ), - new CoordRec((float) 23.8095, (float) 0 ), + new CoordRec((float) 23.8095, 100 ), + new CoordRec((float) 23.8095, 0 ), }; static final CoordRec char98_stroke1[] = { @@ -1594,8 +1594,8 @@ static final CoordRec char98_stroke1[] = { new CoordRec((float) 80.9524, (float) 28.5714 ), new CoordRec((float) 76.1905, (float) 14.2857 ), new CoordRec((float) 66.6666, (float) 4.7619 ), - new CoordRec((float) 57.1428, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 57.1428, 0 ), + new CoordRec((float) 42.8571, 0 ), new CoordRec((float) 33.3333, (float) 4.7619 ), new CoordRec((float) 23.8095, (float) 14.2857 ), }; @@ -1618,8 +1618,8 @@ static final CoordRec char99_stroke0[] = { new CoordRec((float) 23.8095, (float) 28.5714 ), new CoordRec((float) 28.5714, (float) 14.2857 ), new CoordRec((float) 38.0952, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 47.619, 0 ), + new CoordRec((float) 61.9047, 0 ), new CoordRec((float) 71.4285, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 14.2857 ), }; @@ -1631,8 +1631,8 @@ static final StrokeRec char99[] = { /* char: 100 'd' */ static final CoordRec char100_stroke0[] = { - new CoordRec((float) 80.9524, (float) 100 ), - new CoordRec((float) 80.9524, (float) 0 ), + new CoordRec((float) 80.9524, 100 ), + new CoordRec((float) 80.9524, 0 ), }; static final CoordRec char100_stroke1[] = { @@ -1646,8 +1646,8 @@ static final CoordRec char100_stroke1[] = { new CoordRec((float) 23.8095, (float) 28.5714 ), new CoordRec((float) 28.5714, (float) 14.2857 ), new CoordRec((float) 38.0952, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 47.619, 0 ), + new CoordRec((float) 61.9047, 0 ), new CoordRec((float) 71.4285, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 14.2857 ), }; @@ -1673,8 +1673,8 @@ static final CoordRec char101_stroke0[] = { new CoordRec((float) 23.8095, (float) 28.5714 ), new CoordRec((float) 28.5714, (float) 14.2857 ), new CoordRec((float) 38.0952, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 47.619, 0 ), + new CoordRec((float) 61.9047, 0 ), new CoordRec((float) 71.4285, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 14.2857 ), }; @@ -1686,11 +1686,11 @@ static final StrokeRec char101[] = { /* char: 102 'f' */ static final CoordRec char102_stroke0[] = { - new CoordRec((float) 71.4286, (float) 100 ), - new CoordRec((float) 61.9048, (float) 100 ), + new CoordRec((float) 71.4286, 100 ), + new CoordRec((float) 61.9048, 100 ), new CoordRec((float) 52.381, (float) 95.2381 ), new CoordRec((float) 47.6191, (float) 80.9524 ), - new CoordRec((float) 47.6191, (float) 0 ), + new CoordRec((float) 47.6191, 0 ), }; static final CoordRec char102_stroke1[] = { @@ -1726,8 +1726,8 @@ static final CoordRec char103_stroke1[] = { new CoordRec((float) 23.8095, (float) 28.5714 ), new CoordRec((float) 28.5714, (float) 14.2857 ), new CoordRec((float) 38.0952, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 47.619, 0 ), + new CoordRec((float) 61.9047, 0 ), new CoordRec((float) 71.4285, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 14.2857 ), }; @@ -1740,18 +1740,18 @@ static final StrokeRec char103[] = { /* char: 104 'h' */ static final CoordRec char104_stroke0[] = { - new CoordRec((float) 26.1905, (float) 100 ), - new CoordRec((float) 26.1905, (float) 0 ), + new CoordRec((float) 26.1905, 100 ), + new CoordRec((float) 26.1905, 0 ), }; static final CoordRec char104_stroke1[] = { new CoordRec((float) 26.1905, (float) 47.619 ), new CoordRec((float) 40.4762, (float) 61.9048 ), - new CoordRec((float) 50, (float) 66.6667 ), + new CoordRec(50, (float) 66.6667 ), new CoordRec((float) 64.2857, (float) 66.6667 ), new CoordRec((float) 73.8095, (float) 61.9048 ), new CoordRec((float) 78.5715, (float) 47.619 ), - new CoordRec((float) 78.5715, (float) 0 ), + new CoordRec((float) 78.5715, 0 ), }; static final StrokeRec char104[] = { @@ -1762,16 +1762,16 @@ static final StrokeRec char104[] = { /* char: 105 'i' */ static final CoordRec char105_stroke0[] = { - new CoordRec((float) 47.6191, (float) 100 ), + new CoordRec((float) 47.6191, 100 ), new CoordRec((float) 52.381, (float) 95.2381 ), - new CoordRec((float) 57.1429, (float) 100 ), + new CoordRec((float) 57.1429, 100 ), new CoordRec((float) 52.381, (float) 104.762 ), - new CoordRec((float) 47.6191, (float) 100 ), + new CoordRec((float) 47.6191, 100 ), }; static final CoordRec char105_stroke1[] = { new CoordRec((float) 52.381, (float) 66.6667 ), - new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 52.381, 0 ), }; static final StrokeRec char105[] = { @@ -1782,11 +1782,11 @@ static final StrokeRec char105[] = { /* char: 106 'j' */ static final CoordRec char106_stroke0[] = { - new CoordRec((float) 57.1429, (float) 100 ), + new CoordRec((float) 57.1429, 100 ), new CoordRec((float) 61.9048, (float) 95.2381 ), - new CoordRec((float) 66.6667, (float) 100 ), + new CoordRec((float) 66.6667, 100 ), new CoordRec((float) 61.9048, (float) 104.762 ), - new CoordRec((float) 57.1429, (float) 100 ), + new CoordRec((float) 57.1429, 100 ), }; static final CoordRec char106_stroke1[] = { @@ -1805,8 +1805,8 @@ static final StrokeRec char106[] = { /* char: 107 'k' */ static final CoordRec char107_stroke0[] = { - new CoordRec((float) 26.1905, (float) 100 ), - new CoordRec((float) 26.1905, (float) 0 ), + new CoordRec((float) 26.1905, 100 ), + new CoordRec((float) 26.1905, 0 ), }; static final CoordRec char107_stroke1[] = { @@ -1816,7 +1816,7 @@ static final CoordRec char107_stroke1[] = { static final CoordRec char107_stroke2[] = { new CoordRec((float) 45.2381, (float) 38.0952 ), - new CoordRec((float) 78.5715, (float) 0 ), + new CoordRec((float) 78.5715, 0 ), }; static final StrokeRec char107[] = { @@ -1828,8 +1828,8 @@ static final StrokeRec char107[] = { /* char: 108 'l' */ static final CoordRec char108_stroke0[] = { - new CoordRec((float) 52.381, (float) 100 ), - new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 52.381, 100 ), + new CoordRec((float) 52.381, 0 ), }; static final StrokeRec char108[] = { @@ -1839,18 +1839,18 @@ static final StrokeRec char108[] = { /* char: 109 'm' */ static final CoordRec char109_stroke0[] = { - new CoordRec((float) 0, (float) 66.6667 ), - new CoordRec((float) 0, (float) 0 ), + new CoordRec(0, (float) 66.6667 ), + new CoordRec(0, 0 ), }; static final CoordRec char109_stroke1[] = { - new CoordRec((float) 0, (float) 47.619 ), + new CoordRec(0, (float) 47.619 ), new CoordRec((float) 14.2857, (float) 61.9048 ), new CoordRec((float) 23.8095, (float) 66.6667 ), new CoordRec((float) 38.0952, (float) 66.6667 ), new CoordRec((float) 47.619, (float) 61.9048 ), new CoordRec((float) 52.381, (float) 47.619 ), - new CoordRec((float) 52.381, (float) 0 ), + new CoordRec((float) 52.381, 0 ), }; static final CoordRec char109_stroke2[] = { @@ -1858,9 +1858,9 @@ static final CoordRec char109_stroke2[] = { new CoordRec((float) 66.6667, (float) 61.9048 ), new CoordRec((float) 76.1905, (float) 66.6667 ), new CoordRec((float) 90.4762, (float) 66.6667 ), - new CoordRec((float) 100, (float) 61.9048 ), + new CoordRec(100, (float) 61.9048 ), new CoordRec((float) 104.762, (float) 47.619 ), - new CoordRec((float) 104.762, (float) 0 ), + new CoordRec((float) 104.762, 0 ), }; static final StrokeRec char109[] = { @@ -1873,17 +1873,17 @@ static final StrokeRec char109[] = { static final CoordRec char110_stroke0[] = { new CoordRec((float) 26.1905, (float) 66.6667 ), - new CoordRec((float) 26.1905, (float) 0 ), + new CoordRec((float) 26.1905, 0 ), }; static final CoordRec char110_stroke1[] = { new CoordRec((float) 26.1905, (float) 47.619 ), new CoordRec((float) 40.4762, (float) 61.9048 ), - new CoordRec((float) 50, (float) 66.6667 ), + new CoordRec(50, (float) 66.6667 ), new CoordRec((float) 64.2857, (float) 66.6667 ), new CoordRec((float) 73.8095, (float) 61.9048 ), new CoordRec((float) 78.5715, (float) 47.619 ), - new CoordRec((float) 78.5715, (float) 0 ), + new CoordRec((float) 78.5715, 0 ), }; static final StrokeRec char110[] = { @@ -1901,8 +1901,8 @@ static final CoordRec char111_stroke0[] = { new CoordRec((float) 21.4286, (float) 28.5714 ), new CoordRec((float) 26.1905, (float) 14.2857 ), new CoordRec((float) 35.7143, (float) 4.7619 ), - new CoordRec((float) 45.2381, (float) 0 ), - new CoordRec((float) 59.5238, (float) 0 ), + new CoordRec((float) 45.2381, 0 ), + new CoordRec((float) 59.5238, 0 ), new CoordRec((float) 69.0476, (float) 4.7619 ), new CoordRec((float) 78.5714, (float) 14.2857 ), new CoordRec((float) 83.3334, (float) 28.5714 ), @@ -1935,8 +1935,8 @@ static final CoordRec char112_stroke1[] = { new CoordRec((float) 80.9524, (float) 28.5714 ), new CoordRec((float) 76.1905, (float) 14.2857 ), new CoordRec((float) 66.6666, (float) 4.7619 ), - new CoordRec((float) 57.1428, (float) 0 ), - new CoordRec((float) 42.8571, (float) 0 ), + new CoordRec((float) 57.1428, 0 ), + new CoordRec((float) 42.8571, 0 ), new CoordRec((float) 33.3333, (float) 4.7619 ), new CoordRec((float) 23.8095, (float) 14.2857 ), }; @@ -1964,8 +1964,8 @@ static final CoordRec char113_stroke1[] = { new CoordRec((float) 23.8095, (float) 28.5714 ), new CoordRec((float) 28.5714, (float) 14.2857 ), new CoordRec((float) 38.0952, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 61.9047, (float) 0 ), + new CoordRec((float) 47.619, 0 ), + new CoordRec((float) 61.9047, 0 ), new CoordRec((float) 71.4285, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 14.2857 ), }; @@ -1979,7 +1979,7 @@ static final StrokeRec char113[] = { static final CoordRec char114_stroke0[] = { new CoordRec((float) 33.3334, (float) 66.6667 ), - new CoordRec((float) 33.3334, (float) 0 ), + new CoordRec((float) 33.3334, 0 ), }; static final CoordRec char114_stroke1[] = { @@ -2011,8 +2011,8 @@ static final CoordRec char115_stroke0[] = { new CoordRec((float) 78.5715, (float) 19.0476 ), new CoordRec((float) 78.5715, (float) 14.2857 ), new CoordRec((float) 73.8095, (float) 4.7619 ), - new CoordRec((float) 59.5238, (float) 0 ), - new CoordRec((float) 45.2381, (float) 0 ), + new CoordRec((float) 59.5238, 0 ), + new CoordRec((float) 45.2381, 0 ), new CoordRec((float) 30.9524, (float) 4.7619 ), new CoordRec((float) 26.1905, (float) 14.2857 ), }; @@ -2024,11 +2024,11 @@ static final StrokeRec char115[] = { /* char: 116 't' */ static final CoordRec char116_stroke0[] = { - new CoordRec((float) 47.6191, (float) 100 ), + new CoordRec((float) 47.6191, 100 ), new CoordRec((float) 47.6191, (float) 19.0476 ), new CoordRec((float) 52.381, (float) 4.7619 ), - new CoordRec((float) 61.9048, (float) 0 ), - new CoordRec((float) 71.4286, (float) 0 ), + new CoordRec((float) 61.9048, 0 ), + new CoordRec((float) 71.4286, 0 ), }; static final CoordRec char116_stroke1[] = { @@ -2047,15 +2047,15 @@ static final CoordRec char117_stroke0[] = { new CoordRec((float) 26.1905, (float) 66.6667 ), new CoordRec((float) 26.1905, (float) 19.0476 ), new CoordRec((float) 30.9524, (float) 4.7619 ), - new CoordRec((float) 40.4762, (float) 0 ), - new CoordRec((float) 54.7619, (float) 0 ), + new CoordRec((float) 40.4762, 0 ), + new CoordRec((float) 54.7619, 0 ), new CoordRec((float) 64.2857, (float) 4.7619 ), new CoordRec((float) 78.5715, (float) 19.0476 ), }; static final CoordRec char117_stroke1[] = { new CoordRec((float) 78.5715, (float) 66.6667 ), - new CoordRec((float) 78.5715, (float) 0 ), + new CoordRec((float) 78.5715, 0 ), }; static final StrokeRec char117[] = { @@ -2067,12 +2067,12 @@ static final StrokeRec char117[] = { static final CoordRec char118_stroke0[] = { new CoordRec((float) 23.8095, (float) 66.6667 ), - new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 52.3809, 0 ), }; static final CoordRec char118_stroke1[] = { new CoordRec((float) 80.9524, (float) 66.6667 ), - new CoordRec((float) 52.3809, (float) 0 ), + new CoordRec((float) 52.3809, 0 ), }; static final StrokeRec char118[] = { @@ -2084,22 +2084,22 @@ static final StrokeRec char118[] = { static final CoordRec char119_stroke0[] = { new CoordRec((float) 14.2857, (float) 66.6667 ), - new CoordRec((float) 33.3333, (float) 0 ), + new CoordRec((float) 33.3333, 0 ), }; static final CoordRec char119_stroke1[] = { new CoordRec((float) 52.3809, (float) 66.6667 ), - new CoordRec((float) 33.3333, (float) 0 ), + new CoordRec((float) 33.3333, 0 ), }; static final CoordRec char119_stroke2[] = { new CoordRec((float) 52.3809, (float) 66.6667 ), - new CoordRec((float) 71.4286, (float) 0 ), + new CoordRec((float) 71.4286, 0 ), }; static final CoordRec char119_stroke3[] = { new CoordRec((float) 90.4762, (float) 66.6667 ), - new CoordRec((float) 71.4286, (float) 0 ), + new CoordRec((float) 71.4286, 0 ), }; static final StrokeRec char119[] = { @@ -2113,12 +2113,12 @@ static final StrokeRec char119[] = { static final CoordRec char120_stroke0[] = { new CoordRec((float) 26.1905, (float) 66.6667 ), - new CoordRec((float) 78.5715, (float) 0 ), + new CoordRec((float) 78.5715, 0 ), }; static final CoordRec char120_stroke1[] = { new CoordRec((float) 78.5715, (float) 66.6667 ), - new CoordRec((float) 26.1905, (float) 0 ), + new CoordRec((float) 26.1905, 0 ), }; static final StrokeRec char120[] = { @@ -2130,12 +2130,12 @@ static final StrokeRec char120[] = { static final CoordRec char121_stroke0[] = { new CoordRec((float) 26.1905, (float) 66.6667 ), - new CoordRec((float) 54.7619, (float) 0 ), + new CoordRec((float) 54.7619, 0 ), }; static final CoordRec char121_stroke1[] = { new CoordRec((float) 83.3334, (float) 66.6667 ), - new CoordRec((float) 54.7619, (float) 0 ), + new CoordRec((float) 54.7619, 0 ), new CoordRec((float) 45.2381, (float) -19.0476 ), new CoordRec((float) 35.7143, (float) -28.5714 ), new CoordRec((float) 26.1905, (float) -33.3333 ), @@ -2151,7 +2151,7 @@ static final StrokeRec char121[] = { static final CoordRec char122_stroke0[] = { new CoordRec((float) 78.5715, (float) 66.6667 ), - new CoordRec((float) 26.1905, (float) 0 ), + new CoordRec((float) 26.1905, 0 ), }; static final CoordRec char122_stroke1[] = { @@ -2160,8 +2160,8 @@ static final CoordRec char122_stroke1[] = { }; static final CoordRec char122_stroke2[] = { - new CoordRec((float) 26.1905, (float) 0 ), - new CoordRec((float) 78.5715, (float) 0 ), + new CoordRec((float) 26.1905, 0 ), + new CoordRec((float) 78.5715, 0 ), }; static final StrokeRec char122[] = { @@ -2175,20 +2175,20 @@ static final StrokeRec char122[] = { static final CoordRec char123_stroke0[] = { new CoordRec((float) 64.2857, (float) 119.048 ), new CoordRec((float) 54.7619, (float) 114.286 ), - new CoordRec((float) 50, (float) 109.524 ), - new CoordRec((float) 45.2381, (float) 100 ), + new CoordRec(50, (float) 109.524 ), + new CoordRec((float) 45.2381, 100 ), new CoordRec((float) 45.2381, (float) 90.4762 ), - new CoordRec((float) 50, (float) 80.9524 ), + new CoordRec(50, (float) 80.9524 ), new CoordRec((float) 54.7619, (float) 76.1905 ), new CoordRec((float) 59.5238, (float) 66.6667 ), new CoordRec((float) 59.5238, (float) 57.1429 ), - new CoordRec((float) 50, (float) 47.619 ), + new CoordRec(50, (float) 47.619 ), }; static final CoordRec char123_stroke1[] = { new CoordRec((float) 54.7619, (float) 114.286 ), - new CoordRec((float) 50, (float) 104.762 ), - new CoordRec((float) 50, (float) 95.2381 ), + new CoordRec(50, (float) 104.762 ), + new CoordRec(50, (float) 95.2381 ), new CoordRec((float) 54.7619, (float) 85.7143 ), new CoordRec((float) 59.5238, (float) 80.9524 ), new CoordRec((float) 64.2857, (float) 71.4286 ), @@ -2199,21 +2199,21 @@ static final CoordRec char123_stroke1[] = { new CoordRec((float) 64.2857, (float) 23.8095 ), new CoordRec((float) 64.2857, (float) 14.2857 ), new CoordRec((float) 59.5238, (float) 4.7619 ), - new CoordRec((float) 54.7619, (float) 0 ), - new CoordRec((float) 50, (float) -9.5238 ), - new CoordRec((float) 50, (float) -19.0476 ), + new CoordRec((float) 54.7619, 0 ), + new CoordRec(50, (float) -9.5238 ), + new CoordRec(50, (float) -19.0476 ), new CoordRec((float) 54.7619, (float) -28.5714 ), }; static final CoordRec char123_stroke2[] = { - new CoordRec((float) 50, (float) 38.0952 ), + new CoordRec(50, (float) 38.0952 ), new CoordRec((float) 59.5238, (float) 28.5714 ), new CoordRec((float) 59.5238, (float) 19.0476 ), new CoordRec((float) 54.7619, (float) 9.5238 ), - new CoordRec((float) 50, (float) 4.7619 ), + new CoordRec(50, (float) 4.7619 ), new CoordRec((float) 45.2381, (float) -4.7619 ), new CoordRec((float) 45.2381, (float) -14.2857 ), - new CoordRec((float) 50, (float) -23.8095 ), + new CoordRec(50, (float) -23.8095 ), new CoordRec((float) 54.7619, (float) -28.5714 ), new CoordRec((float) 64.2857, (float) -33.3333 ), }; @@ -2239,22 +2239,22 @@ static final StrokeRec char124[] = { static final CoordRec char125_stroke0[] = { new CoordRec((float) 40.4762, (float) 119.048 ), - new CoordRec((float) 50, (float) 114.286 ), + new CoordRec(50, (float) 114.286 ), new CoordRec((float) 54.7619, (float) 109.524 ), - new CoordRec((float) 59.5238, (float) 100 ), + new CoordRec((float) 59.5238, 100 ), new CoordRec((float) 59.5238, (float) 90.4762 ), new CoordRec((float) 54.7619, (float) 80.9524 ), - new CoordRec((float) 50, (float) 76.1905 ), + new CoordRec(50, (float) 76.1905 ), new CoordRec((float) 45.2381, (float) 66.6667 ), new CoordRec((float) 45.2381, (float) 57.1429 ), new CoordRec((float) 54.7619, (float) 47.619 ), }; static final CoordRec char125_stroke1[] = { - new CoordRec((float) 50, (float) 114.286 ), + new CoordRec(50, (float) 114.286 ), new CoordRec((float) 54.7619, (float) 104.762 ), new CoordRec((float) 54.7619, (float) 95.2381 ), - new CoordRec((float) 50, (float) 85.7143 ), + new CoordRec(50, (float) 85.7143 ), new CoordRec((float) 45.2381, (float) 80.9524 ), new CoordRec((float) 40.4762, (float) 71.4286 ), new CoordRec((float) 40.4762, (float) 61.9048 ), @@ -2264,22 +2264,22 @@ static final CoordRec char125_stroke1[] = { new CoordRec((float) 40.4762, (float) 23.8095 ), new CoordRec((float) 40.4762, (float) 14.2857 ), new CoordRec((float) 45.2381, (float) 4.7619 ), - new CoordRec((float) 50, (float) 0 ), + new CoordRec(50, 0 ), new CoordRec((float) 54.7619, (float) -9.5238 ), new CoordRec((float) 54.7619, (float) -19.0476 ), - new CoordRec((float) 50, (float) -28.5714 ), + new CoordRec(50, (float) -28.5714 ), }; static final CoordRec char125_stroke2[] = { new CoordRec((float) 54.7619, (float) 38.0952 ), new CoordRec((float) 45.2381, (float) 28.5714 ), new CoordRec((float) 45.2381, (float) 19.0476 ), - new CoordRec((float) 50, (float) 9.5238 ), + new CoordRec(50, (float) 9.5238 ), new CoordRec((float) 54.7619, (float) 4.7619 ), new CoordRec((float) 59.5238, (float) -4.7619 ), new CoordRec((float) 59.5238, (float) -14.2857 ), new CoordRec((float) 54.7619, (float) -23.8095 ), - new CoordRec((float) 50, (float) -28.5714 ), + new CoordRec(50, (float) -28.5714 ), new CoordRec((float) 40.4762, (float) -33.3333 ), }; @@ -2327,7 +2327,7 @@ static final StrokeRec char126[] = { /* char: 127 */ static final CoordRec char127_stroke0[] = { - new CoordRec((float) 71.4286, (float) 100 ), + new CoordRec((float) 71.4286, 100 ), new CoordRec((float) 33.3333, (float) -33.3333 ), }; @@ -2339,8 +2339,8 @@ static final CoordRec char127_stroke1[] = { new CoordRec((float) 19.0476, (float) 23.8095 ), new CoordRec((float) 23.8095, (float) 14.2857 ), new CoordRec((float) 33.3333, (float) 4.7619 ), - new CoordRec((float) 47.619, (float) 0 ), - new CoordRec((float) 57.1428, (float) 0 ), + new CoordRec((float) 47.619, 0 ), + new CoordRec((float) 57.1428, 0 ), new CoordRec((float) 71.4286, (float) 4.7619 ), new CoordRec((float) 80.9524, (float) 14.2857 ), new CoordRec((float) 85.7143, (float) 28.5714 ), @@ -2357,38 +2357,38 @@ static final StrokeRec char127[] = { }; static final StrokeCharRec chars[] = { - new StrokeCharRec(0, /* char0 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char1 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char2 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char3 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char4 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char5 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char6 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char7 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char8 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char9 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char10 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char11 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char12 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char13 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char14 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char15 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char16 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char17 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char18 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char19 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char20 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char21 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char22 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char23 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char24 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char25 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char26 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char27 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char28 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char29 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char30 */ null, (float) 0, (float) 0 ), - new StrokeCharRec(0, /* char31 */ null, (float) 0, (float) 0 ), + new StrokeCharRec(0, /* char0 */ null, 0, 0 ), + new StrokeCharRec(0, /* char1 */ null, 0, 0 ), + new StrokeCharRec(0, /* char2 */ null, 0, 0 ), + new StrokeCharRec(0, /* char3 */ null, 0, 0 ), + new StrokeCharRec(0, /* char4 */ null, 0, 0 ), + new StrokeCharRec(0, /* char5 */ null, 0, 0 ), + new StrokeCharRec(0, /* char6 */ null, 0, 0 ), + new StrokeCharRec(0, /* char7 */ null, 0, 0 ), + new StrokeCharRec(0, /* char8 */ null, 0, 0 ), + new StrokeCharRec(0, /* char9 */ null, 0, 0 ), + new StrokeCharRec(0, /* char10 */ null, 0, 0 ), + new StrokeCharRec(0, /* char11 */ null, 0, 0 ), + new StrokeCharRec(0, /* char12 */ null, 0, 0 ), + new StrokeCharRec(0, /* char13 */ null, 0, 0 ), + new StrokeCharRec(0, /* char14 */ null, 0, 0 ), + new StrokeCharRec(0, /* char15 */ null, 0, 0 ), + new StrokeCharRec(0, /* char16 */ null, 0, 0 ), + new StrokeCharRec(0, /* char17 */ null, 0, 0 ), + new StrokeCharRec(0, /* char18 */ null, 0, 0 ), + new StrokeCharRec(0, /* char19 */ null, 0, 0 ), + new StrokeCharRec(0, /* char20 */ null, 0, 0 ), + new StrokeCharRec(0, /* char21 */ null, 0, 0 ), + new StrokeCharRec(0, /* char22 */ null, 0, 0 ), + new StrokeCharRec(0, /* char23 */ null, 0, 0 ), + new StrokeCharRec(0, /* char24 */ null, 0, 0 ), + new StrokeCharRec(0, /* char25 */ null, 0, 0 ), + new StrokeCharRec(0, /* char26 */ null, 0, 0 ), + new StrokeCharRec(0, /* char27 */ null, 0, 0 ), + new StrokeCharRec(0, /* char28 */ null, 0, 0 ), + new StrokeCharRec(0, /* char29 */ null, 0, 0 ), + new StrokeCharRec(0, /* char30 */ null, 0, 0 ), + new StrokeCharRec(0, /* char31 */ null, 0, 0 ), new StrokeCharRec(0, /* char32 */ null, (float) 52.381, (float) 104.762 ), new StrokeCharRec(2, char33, (float) 52.381, (float) 104.762 ), new StrokeCharRec(2, char34, (float) 52.381, (float) 104.762 ), diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java index cf51ddd3c..5b614c64e 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/GLUTStrokeRoman.java @@ -46,14 +46,14 @@ class GLUTStrokeRoman { /* char: 33 '!' */ static final CoordRec char33_stroke0[] = { - new CoordRec((float) 13.3819, (float) 100), + new CoordRec((float) 13.3819, 100), new CoordRec((float) 13.3819, (float) 33.3333), }; static final CoordRec char33_stroke1[] = { new CoordRec((float) 13.3819, (float) 9.5238), new CoordRec((float) 8.62, (float) 4.7619), - new CoordRec((float) 13.3819, (float) 0), + new CoordRec((float) 13.3819, 0), new CoordRec((float) 18.1438, (float) 4.7619), new CoordRec((float) 13.3819, (float) 9.5238), }; @@ -66,12 +66,12 @@ static final StrokeRec char33[] = { /* char: 34 '"' */ static final CoordRec char34_stroke0[] = { - new CoordRec((float) 4.02, (float) 100), + new CoordRec((float) 4.02, 100), new CoordRec((float) 4.02, (float) 66.6667), }; static final CoordRec char34_stroke1[] = { - new CoordRec((float) 42.1152, (float) 100), + new CoordRec((float) 42.1152, 100), new CoordRec((float) 42.1152, (float) 66.6667), }; @@ -124,8 +124,8 @@ static final CoordRec char36_stroke1[] = { static final CoordRec char36_stroke2[] = { new CoordRec((float) 71.4867, (float) 85.7143), new CoordRec((float) 61.9629, (float) 95.2381), - new CoordRec((float) 47.6771, (float) 100), - new CoordRec((float) 28.6295, (float) 100), + new CoordRec((float) 47.6771, 100), + new CoordRec((float) 28.6295, 100), new CoordRec((float) 14.3438, (float) 95.2381), new CoordRec((float) 4.82, (float) 85.7143), new CoordRec((float) 4.82, (float) 76.1905), @@ -138,8 +138,8 @@ static final CoordRec char36_stroke2[] = { new CoordRec((float) 71.4867, (float) 28.5714), new CoordRec((float) 71.4867, (float) 14.2857), new CoordRec((float) 61.9629, (float) 4.7619), - new CoordRec((float) 47.6771, (float) 0), - new CoordRec((float) 28.6295, (float) 0), + new CoordRec((float) 47.6771, 0), + new CoordRec((float) 28.6295, 0), new CoordRec((float) 14.3438, (float) 4.7619), new CoordRec((float) 4.82, (float) 14.2857), }; @@ -153,12 +153,12 @@ static final StrokeRec char36[] = { /* char: 37 '%' */ static final CoordRec char37_stroke0[] = { - new CoordRec((float) 92.0743, (float) 100), - new CoordRec((float) 6.36, (float) 0), + new CoordRec((float) 92.0743, 100), + new CoordRec((float) 6.36, 0), }; static final CoordRec char37_stroke1[] = { - new CoordRec((float) 30.1695, (float) 100), + new CoordRec((float) 30.1695, 100), new CoordRec((float) 39.6933, (float) 90.4762), new CoordRec((float) 39.6933, (float) 80.9524), new CoordRec((float) 34.9314, (float) 71.4286), @@ -167,13 +167,13 @@ static final CoordRec char37_stroke1[] = { new CoordRec((float) 6.36, (float) 76.1905), new CoordRec((float) 6.36, (float) 85.7143), new CoordRec((float) 11.1219, (float) 95.2381), - new CoordRec((float) 20.6457, (float) 100), - new CoordRec((float) 30.1695, (float) 100), + new CoordRec((float) 20.6457, 100), + new CoordRec((float) 30.1695, 100), new CoordRec((float) 39.6933, (float) 95.2381), new CoordRec((float) 53.979, (float) 90.4762), new CoordRec((float) 68.2648, (float) 90.4762), new CoordRec((float) 82.5505, (float) 95.2381), - new CoordRec((float) 92.0743, (float) 100), + new CoordRec((float) 92.0743, 100), }; static final CoordRec char37_stroke2[] = { @@ -181,8 +181,8 @@ static final CoordRec char37_stroke2[] = { new CoordRec((float) 63.5029, (float) 28.5714), new CoordRec((float) 58.741, (float) 19.0476), new CoordRec((float) 58.741, (float) 9.5238), - new CoordRec((float) 68.2648, (float) 0), - new CoordRec((float) 77.7886, (float) 0), + new CoordRec((float) 68.2648, 0), + new CoordRec((float) 77.7886, 0), new CoordRec((float) 87.3124, (float) 4.7619), new CoordRec((float) 92.0743, (float) 14.2857), new CoordRec((float) 92.0743, (float) 23.8095), @@ -208,8 +208,8 @@ static final CoordRec char38_stroke0[] = { new CoordRec((float) 72.6467, (float) 28.5714), new CoordRec((float) 63.1229, (float) 14.2857), new CoordRec((float) 53.599, (float) 4.7619), - new CoordRec((float) 44.0752, (float) 0), - new CoordRec((float) 25.0276, (float) 0), + new CoordRec((float) 44.0752, 0), + new CoordRec((float) 25.0276, 0), new CoordRec((float) 15.5038, (float) 4.7619), new CoordRec((float) 10.7419, (float) 9.5238), new CoordRec((float) 5.98, (float) 19.0476), @@ -221,7 +221,7 @@ static final CoordRec char38_stroke0[] = { new CoordRec((float) 58.361, (float) 76.1905), new CoordRec((float) 58.361, (float) 85.7143), new CoordRec((float) 53.599, (float) 95.2381), - new CoordRec((float) 44.0752, (float) 100), + new CoordRec((float) 44.0752, 100), new CoordRec((float) 34.5514, (float) 95.2381), new CoordRec((float) 29.7895, (float) 85.7143), new CoordRec((float) 29.7895, (float) 76.1905), @@ -229,8 +229,8 @@ static final CoordRec char38_stroke0[] = { new CoordRec((float) 44.0752, (float) 47.619), new CoordRec((float) 67.8848, (float) 14.2857), new CoordRec((float) 77.4086, (float) 4.7619), - new CoordRec((float) 86.9324, (float) 0), - new CoordRec((float) 96.4562, (float) 0), + new CoordRec((float) 86.9324, 0), + new CoordRec((float) 96.4562, 0), new CoordRec((float) 101.218, (float) 4.7619), new CoordRec((float) 101.218, (float) 9.5238), }; @@ -242,7 +242,7 @@ static final StrokeRec char38[] = { /* char: 39 ''' */ static final CoordRec char39_stroke0[] = { - new CoordRec((float) 4.44, (float) 100), + new CoordRec((float) 4.44, 100), new CoordRec((float) 4.44, (float) 66.6667), }; @@ -315,7 +315,7 @@ static final StrokeRec char42[] = { static final CoordRec char43_stroke0[] = { new CoordRec((float) 48.8371, (float) 85.7143), - new CoordRec((float) 48.8371, (float) 0), + new CoordRec((float) 48.8371, 0), }; static final CoordRec char43_stroke1[] = { @@ -332,7 +332,7 @@ static final StrokeRec char43[] = { static final CoordRec char44_stroke0[] = { new CoordRec((float) 18.2838, (float) 4.7619), - new CoordRec((float) 13.5219, (float) 0), + new CoordRec((float) 13.5219, 0), new CoordRec((float) 8.76, (float) 4.7619), new CoordRec((float) 13.5219, (float) 9.5238), new CoordRec((float) 18.2838, (float) 4.7619), @@ -361,7 +361,7 @@ static final StrokeRec char45[] = { static final CoordRec char46_stroke0[] = { new CoordRec((float) 13.1019, (float) 9.5238), new CoordRec((float) 8.34, (float) 4.7619), - new CoordRec((float) 13.1019, (float) 0), + new CoordRec((float) 13.1019, 0), new CoordRec((float) 17.8638, (float) 4.7619), new CoordRec((float) 13.1019, (float) 9.5238), }; @@ -374,7 +374,7 @@ static final StrokeRec char46[] = { static final CoordRec char47_stroke0[] = { new CoordRec((float) 7.24, (float) -14.2857), - new CoordRec((float) 73.9067, (float) 100), + new CoordRec((float) 73.9067, 100), }; static final StrokeRec char47[] = { @@ -384,23 +384,23 @@ static final StrokeRec char47[] = { /* char: 48 '0' */ static final CoordRec char48_stroke0[] = { - new CoordRec((float) 33.5514, (float) 100), + new CoordRec((float) 33.5514, 100), new CoordRec((float) 19.2657, (float) 95.2381), new CoordRec((float) 9.7419, (float) 80.9524), new CoordRec((float) 4.98, (float) 57.1429), new CoordRec((float) 4.98, (float) 42.8571), new CoordRec((float) 9.7419, (float) 19.0476), new CoordRec((float) 19.2657, (float) 4.7619), - new CoordRec((float) 33.5514, (float) 0), - new CoordRec((float) 43.0752, (float) 0), + new CoordRec((float) 33.5514, 0), + new CoordRec((float) 43.0752, 0), new CoordRec((float) 57.361, (float) 4.7619), new CoordRec((float) 66.8848, (float) 19.0476), new CoordRec((float) 71.6467, (float) 42.8571), new CoordRec((float) 71.6467, (float) 57.1429), new CoordRec((float) 66.8848, (float) 80.9524), new CoordRec((float) 57.361, (float) 95.2381), - new CoordRec((float) 43.0752, (float) 100), - new CoordRec((float) 33.5514, (float) 100), + new CoordRec((float) 43.0752, 100), + new CoordRec((float) 33.5514, 100), }; static final StrokeRec char48[] = { @@ -412,8 +412,8 @@ static final StrokeRec char48[] = { static final CoordRec char49_stroke0[] = { new CoordRec((float) 11.82, (float) 80.9524), new CoordRec((float) 21.3438, (float) 85.7143), - new CoordRec((float) 35.6295, (float) 100), - new CoordRec((float) 35.6295, (float) 0), + new CoordRec((float) 35.6295, 100), + new CoordRec((float) 35.6295, 0), }; static final StrokeRec char49[] = { @@ -427,16 +427,16 @@ static final CoordRec char50_stroke0[] = { new CoordRec((float) 10.1819, (float) 80.9524), new CoordRec((float) 14.9438, (float) 90.4762), new CoordRec((float) 19.7057, (float) 95.2381), - new CoordRec((float) 29.2295, (float) 100), - new CoordRec((float) 48.2771, (float) 100), + new CoordRec((float) 29.2295, 100), + new CoordRec((float) 48.2771, 100), new CoordRec((float) 57.801, (float) 95.2381), new CoordRec((float) 62.5629, (float) 90.4762), new CoordRec((float) 67.3248, (float) 80.9524), new CoordRec((float) 67.3248, (float) 71.4286), new CoordRec((float) 62.5629, (float) 61.9048), new CoordRec((float) 53.039, (float) 47.619), - new CoordRec((float) 5.42, (float) 0), - new CoordRec((float) 72.0867, (float) 0), + new CoordRec((float) 5.42, 0), + new CoordRec((float) 72.0867, 0), }; static final StrokeRec char50[] = { @@ -446,8 +446,8 @@ static final StrokeRec char50[] = { /* char: 51 '3' */ static final CoordRec char51_stroke0[] = { - new CoordRec((float) 14.5238, (float) 100), - new CoordRec((float) 66.9048, (float) 100), + new CoordRec((float) 14.5238, 100), + new CoordRec((float) 66.9048, 100), new CoordRec((float) 38.3333, (float) 61.9048), new CoordRec((float) 52.619, (float) 61.9048), new CoordRec((float) 62.1429, (float) 57.1429), @@ -456,11 +456,11 @@ static final CoordRec char51_stroke0[] = { new CoordRec((float) 71.6667, (float) 28.5714), new CoordRec((float) 66.9048, (float) 14.2857), new CoordRec((float) 57.381, (float) 4.7619), - new CoordRec((float) 43.0952, (float) 0), - new CoordRec((float) 28.8095, (float) 0), + new CoordRec((float) 43.0952, 0), + new CoordRec((float) 28.8095, 0), new CoordRec((float) 14.5238, (float) 4.7619), new CoordRec((float) 9.7619, (float) 9.5238), - new CoordRec((float) 5, (float) 19.0476), + new CoordRec(5, (float) 19.0476), }; static final StrokeRec char51[] = { @@ -470,14 +470,14 @@ static final StrokeRec char51[] = { /* char: 52 '4' */ static final CoordRec char52_stroke0[] = { - new CoordRec((float) 51.499, (float) 100), + new CoordRec((float) 51.499, 100), new CoordRec((float) 3.88, (float) 33.3333), new CoordRec((float) 75.3086, (float) 33.3333), }; static final CoordRec char52_stroke1[] = { - new CoordRec((float) 51.499, (float) 100), - new CoordRec((float) 51.499, (float) 0), + new CoordRec((float) 51.499, 100), + new CoordRec((float) 51.499, 0), }; static final StrokeRec char52[] = { @@ -488,8 +488,8 @@ static final StrokeRec char52[] = { /* char: 53 '5' */ static final CoordRec char53_stroke0[] = { - new CoordRec((float) 62.0029, (float) 100), - new CoordRec((float) 14.3838, (float) 100), + new CoordRec((float) 62.0029, 100), + new CoordRec((float) 14.3838, 100), new CoordRec((float) 9.6219, (float) 57.1429), new CoordRec((float) 14.3838, (float) 61.9048), new CoordRec((float) 28.6695, (float) 66.6667), @@ -500,8 +500,8 @@ static final CoordRec char53_stroke0[] = { new CoordRec((float) 71.5267, (float) 28.5714), new CoordRec((float) 66.7648, (float) 14.2857), new CoordRec((float) 57.241, (float) 4.7619), - new CoordRec((float) 42.9552, (float) 0), - new CoordRec((float) 28.6695, (float) 0), + new CoordRec((float) 42.9552, 0), + new CoordRec((float) 28.6695, 0), new CoordRec((float) 14.3838, (float) 4.7619), new CoordRec((float) 9.6219, (float) 9.5238), new CoordRec((float) 4.86, (float) 19.0476), @@ -516,16 +516,16 @@ static final StrokeRec char53[] = { static final CoordRec char54_stroke0[] = { new CoordRec((float) 62.7229, (float) 85.7143), new CoordRec((float) 57.961, (float) 95.2381), - new CoordRec((float) 43.6752, (float) 100), - new CoordRec((float) 34.1514, (float) 100), + new CoordRec((float) 43.6752, 100), + new CoordRec((float) 34.1514, 100), new CoordRec((float) 19.8657, (float) 95.2381), new CoordRec((float) 10.3419, (float) 80.9524), new CoordRec((float) 5.58, (float) 57.1429), new CoordRec((float) 5.58, (float) 33.3333), new CoordRec((float) 10.3419, (float) 14.2857), new CoordRec((float) 19.8657, (float) 4.7619), - new CoordRec((float) 34.1514, (float) 0), - new CoordRec((float) 38.9133, (float) 0), + new CoordRec((float) 34.1514, 0), + new CoordRec((float) 38.9133, 0), new CoordRec((float) 53.199, (float) 4.7619), new CoordRec((float) 62.7229, (float) 14.2857), new CoordRec((float) 67.4848, (float) 28.5714), @@ -546,13 +546,13 @@ static final StrokeRec char54[] = { /* char: 55 '7' */ static final CoordRec char55_stroke0[] = { - new CoordRec((float) 72.2267, (float) 100), - new CoordRec((float) 24.6076, (float) 0), + new CoordRec((float) 72.2267, 100), + new CoordRec((float) 24.6076, 0), }; static final CoordRec char55_stroke1[] = { - new CoordRec((float) 5.56, (float) 100), - new CoordRec((float) 72.2267, (float) 100), + new CoordRec((float) 5.56, 100), + new CoordRec((float) 72.2267, 100), }; static final StrokeRec char55[] = { @@ -563,7 +563,7 @@ static final StrokeRec char55[] = { /* char: 56 '8' */ static final CoordRec char56_stroke0[] = { - new CoordRec((float) 29.4095, (float) 100), + new CoordRec((float) 29.4095, 100), new CoordRec((float) 15.1238, (float) 95.2381), new CoordRec((float) 10.3619, (float) 85.7143), new CoordRec((float) 10.3619, (float) 76.1905), @@ -576,8 +576,8 @@ static final CoordRec char56_stroke0[] = { new CoordRec((float) 72.2667, (float) 19.0476), new CoordRec((float) 67.5048, (float) 9.5238), new CoordRec((float) 62.7429, (float) 4.7619), - new CoordRec((float) 48.4571, (float) 0), - new CoordRec((float) 29.4095, (float) 0), + new CoordRec((float) 48.4571, 0), + new CoordRec((float) 29.4095, 0), new CoordRec((float) 15.1238, (float) 4.7619), new CoordRec((float) 10.3619, (float) 9.5238), new CoordRec((float) 5.6, (float) 19.0476), @@ -590,8 +590,8 @@ static final CoordRec char56_stroke0[] = { new CoordRec((float) 67.5048, (float) 76.1905), new CoordRec((float) 67.5048, (float) 85.7143), new CoordRec((float) 62.7429, (float) 95.2381), - new CoordRec((float) 48.4571, (float) 100), - new CoordRec((float) 29.4095, (float) 100), + new CoordRec((float) 48.4571, 100), + new CoordRec((float) 29.4095, 100), }; static final StrokeRec char56[] = { @@ -612,16 +612,16 @@ static final CoordRec char57_stroke0[] = { new CoordRec((float) 6.6, (float) 71.4286), new CoordRec((float) 11.3619, (float) 85.7143), new CoordRec((float) 20.8857, (float) 95.2381), - new CoordRec((float) 35.1714, (float) 100), - new CoordRec((float) 39.9333, (float) 100), + new CoordRec((float) 35.1714, 100), + new CoordRec((float) 39.9333, 100), new CoordRec((float) 54.219, (float) 95.2381), new CoordRec((float) 63.7429, (float) 85.7143), new CoordRec((float) 68.5048, (float) 66.6667), new CoordRec((float) 68.5048, (float) 42.8571), new CoordRec((float) 63.7429, (float) 19.0476), new CoordRec((float) 54.219, (float) 4.7619), - new CoordRec((float) 39.9333, (float) 0), - new CoordRec((float) 30.4095, (float) 0), + new CoordRec((float) 39.9333, 0), + new CoordRec((float) 30.4095, 0), new CoordRec((float) 16.1238, (float) 4.7619), new CoordRec((float) 11.3619, (float) 14.2857), }; @@ -643,7 +643,7 @@ static final CoordRec char58_stroke0[] = { static final CoordRec char58_stroke1[] = { new CoordRec((float) 14.0819, (float) 9.5238), new CoordRec((float) 9.32, (float) 4.7619), - new CoordRec((float) 14.0819, (float) 0), + new CoordRec((float) 14.0819, 0), new CoordRec((float) 18.8438, (float) 4.7619), new CoordRec((float) 14.0819, (float) 9.5238), }; @@ -665,7 +665,7 @@ static final CoordRec char59_stroke0[] = { static final CoordRec char59_stroke1[] = { new CoordRec((float) 17.7238, (float) 4.7619), - new CoordRec((float) 12.9619, (float) 0), + new CoordRec((float) 12.9619, 0), new CoordRec((float) 8.2, (float) 4.7619), new CoordRec((float) 12.9619, (float) 9.5238), new CoordRec((float) 17.7238, (float) 4.7619), @@ -684,7 +684,7 @@ static final StrokeRec char59[] = { static final CoordRec char60_stroke0[] = { new CoordRec((float) 79.2505, (float) 85.7143), new CoordRec((float) 3.06, (float) 42.8571), - new CoordRec((float) 79.2505, (float) 0), + new CoordRec((float) 79.2505, 0), }; static final StrokeRec char60[] = { @@ -713,7 +713,7 @@ static final StrokeRec char61[] = { static final CoordRec char62_stroke0[] = { new CoordRec((float) 2.78, (float) 85.7143), new CoordRec((float) 78.9705, (float) 42.8571), - new CoordRec((float) 2.78, (float) 0), + new CoordRec((float) 2.78, 0), }; static final StrokeRec char62[] = { @@ -727,8 +727,8 @@ static final CoordRec char63_stroke0[] = { new CoordRec((float) 8.42, (float) 80.9524), new CoordRec((float) 13.1819, (float) 90.4762), new CoordRec((float) 17.9438, (float) 95.2381), - new CoordRec((float) 27.4676, (float) 100), - new CoordRec((float) 46.5152, (float) 100), + new CoordRec((float) 27.4676, 100), + new CoordRec((float) 46.5152, 100), new CoordRec((float) 56.039, (float) 95.2381), new CoordRec((float) 60.801, (float) 90.4762), new CoordRec((float) 65.5629, (float) 80.9524), @@ -742,7 +742,7 @@ static final CoordRec char63_stroke0[] = { static final CoordRec char63_stroke1[] = { new CoordRec((float) 36.9914, (float) 9.5238), new CoordRec((float) 32.2295, (float) 4.7619), - new CoordRec((float) 36.9914, (float) 0), + new CoordRec((float) 36.9914, 0), new CoordRec((float) 41.7533, (float) 4.7619), new CoordRec((float) 36.9914, (float) 9.5238), }; @@ -795,13 +795,13 @@ static final StrokeRec char64[] = { /* char: 65 'A' */ static final CoordRec char65_stroke0[] = { - new CoordRec((float) 40.5952, (float) 100), - new CoordRec((float) 2.5, (float) 0), + new CoordRec((float) 40.5952, 100), + new CoordRec((float) 2.5, 0), }; static final CoordRec char65_stroke1[] = { - new CoordRec((float) 40.5952, (float) 100), - new CoordRec((float) 78.6905, (float) 0), + new CoordRec((float) 40.5952, 100), + new CoordRec((float) 78.6905, 0), }; static final CoordRec char65_stroke2[] = { @@ -818,13 +818,13 @@ static final StrokeRec char65[] = { /* char: 66 'B' */ static final CoordRec char66_stroke0[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 11.42, (float) 0), + new CoordRec((float) 11.42, 100), + new CoordRec((float) 11.42, 0), }; static final CoordRec char66_stroke1[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 54.2771, (float) 100), + new CoordRec((float) 11.42, 100), + new CoordRec((float) 54.2771, 100), new CoordRec((float) 68.5629, (float) 95.2381), new CoordRec((float) 73.3248, (float) 90.4762), new CoordRec((float) 78.0867, (float) 80.9524), @@ -843,8 +843,8 @@ static final CoordRec char66_stroke2[] = { new CoordRec((float) 78.0867, (float) 19.0476), new CoordRec((float) 73.3248, (float) 9.5238), new CoordRec((float) 68.5629, (float) 4.7619), - new CoordRec((float) 54.2771, (float) 0), - new CoordRec((float) 11.42, (float) 0), + new CoordRec((float) 54.2771, 0), + new CoordRec((float) 11.42, 0), }; static final StrokeRec char66[] = { @@ -859,8 +859,8 @@ static final CoordRec char67_stroke0[] = { new CoordRec((float) 78.0886, (float) 76.1905), new CoordRec((float) 73.3267, (float) 85.7143), new CoordRec((float) 63.8029, (float) 95.2381), - new CoordRec((float) 54.279, (float) 100), - new CoordRec((float) 35.2314, (float) 100), + new CoordRec((float) 54.279, 100), + new CoordRec((float) 35.2314, 100), new CoordRec((float) 25.7076, (float) 95.2381), new CoordRec((float) 16.1838, (float) 85.7143), new CoordRec((float) 11.4219, (float) 76.1905), @@ -869,8 +869,8 @@ static final CoordRec char67_stroke0[] = { new CoordRec((float) 11.4219, (float) 23.8095), new CoordRec((float) 16.1838, (float) 14.2857), new CoordRec((float) 25.7076, (float) 4.7619), - new CoordRec((float) 35.2314, (float) 0), - new CoordRec((float) 54.279, (float) 0), + new CoordRec((float) 35.2314, 0), + new CoordRec((float) 54.279, 0), new CoordRec((float) 63.8029, (float) 4.7619), new CoordRec((float) 73.3267, (float) 14.2857), new CoordRec((float) 78.0886, (float) 23.8095), @@ -883,13 +883,13 @@ static final StrokeRec char67[] = { /* char: 68 'D' */ static final CoordRec char68_stroke0[] = { - new CoordRec((float) 11.96, (float) 100), - new CoordRec((float) 11.96, (float) 0), + new CoordRec((float) 11.96, 100), + new CoordRec((float) 11.96, 0), }; static final CoordRec char68_stroke1[] = { - new CoordRec((float) 11.96, (float) 100), - new CoordRec((float) 45.2933, (float) 100), + new CoordRec((float) 11.96, 100), + new CoordRec((float) 45.2933, 100), new CoordRec((float) 59.579, (float) 95.2381), new CoordRec((float) 69.1029, (float) 85.7143), new CoordRec((float) 73.8648, (float) 76.1905), @@ -898,8 +898,8 @@ static final CoordRec char68_stroke1[] = { new CoordRec((float) 73.8648, (float) 23.8095), new CoordRec((float) 69.1029, (float) 14.2857), new CoordRec((float) 59.579, (float) 4.7619), - new CoordRec((float) 45.2933, (float) 0), - new CoordRec((float) 11.96, (float) 0), + new CoordRec((float) 45.2933, 0), + new CoordRec((float) 11.96, 0), }; static final StrokeRec char68[] = { @@ -910,13 +910,13 @@ static final StrokeRec char68[] = { /* char: 69 'E' */ static final CoordRec char69_stroke0[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 11.42, (float) 0), + new CoordRec((float) 11.42, 100), + new CoordRec((float) 11.42, 0), }; static final CoordRec char69_stroke1[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 73.3248, (float) 100), + new CoordRec((float) 11.42, 100), + new CoordRec((float) 73.3248, 100), }; static final CoordRec char69_stroke2[] = { @@ -925,8 +925,8 @@ static final CoordRec char69_stroke2[] = { }; static final CoordRec char69_stroke3[] = { - new CoordRec((float) 11.42, (float) 0), - new CoordRec((float) 73.3248, (float) 0), + new CoordRec((float) 11.42, 0), + new CoordRec((float) 73.3248, 0), }; static final StrokeRec char69[] = { @@ -939,13 +939,13 @@ static final StrokeRec char69[] = { /* char: 70 'F' */ static final CoordRec char70_stroke0[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 11.42, (float) 0), + new CoordRec((float) 11.42, 100), + new CoordRec((float) 11.42, 0), }; static final CoordRec char70_stroke1[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 73.3248, (float) 100), + new CoordRec((float) 11.42, 100), + new CoordRec((float) 73.3248, 100), }; static final CoordRec char70_stroke2[] = { @@ -965,8 +965,8 @@ static final CoordRec char71_stroke0[] = { new CoordRec((float) 78.4886, (float) 76.1905), new CoordRec((float) 73.7267, (float) 85.7143), new CoordRec((float) 64.2029, (float) 95.2381), - new CoordRec((float) 54.679, (float) 100), - new CoordRec((float) 35.6314, (float) 100), + new CoordRec((float) 54.679, 100), + new CoordRec((float) 35.6314, 100), new CoordRec((float) 26.1076, (float) 95.2381), new CoordRec((float) 16.5838, (float) 85.7143), new CoordRec((float) 11.8219, (float) 76.1905), @@ -975,8 +975,8 @@ static final CoordRec char71_stroke0[] = { new CoordRec((float) 11.8219, (float) 23.8095), new CoordRec((float) 16.5838, (float) 14.2857), new CoordRec((float) 26.1076, (float) 4.7619), - new CoordRec((float) 35.6314, (float) 0), - new CoordRec((float) 54.679, (float) 0), + new CoordRec((float) 35.6314, 0), + new CoordRec((float) 54.679, 0), new CoordRec((float) 64.2029, (float) 4.7619), new CoordRec((float) 73.7267, (float) 14.2857), new CoordRec((float) 78.4886, (float) 23.8095), @@ -996,13 +996,13 @@ static final StrokeRec char71[] = { /* char: 72 'H' */ static final CoordRec char72_stroke0[] = { - new CoordRec((float) 11.42, (float) 100), - new CoordRec((float) 11.42, (float) 0), + new CoordRec((float) 11.42, 100), + new CoordRec((float) 11.42, 0), }; static final CoordRec char72_stroke1[] = { - new CoordRec((float) 78.0867, (float) 100), - new CoordRec((float) 78.0867, (float) 0), + new CoordRec((float) 78.0867, 100), + new CoordRec((float) 78.0867, 0), }; static final CoordRec char72_stroke2[] = { @@ -1019,8 +1019,8 @@ static final StrokeRec char72[] = { /* char: 73 'I' */ static final CoordRec char73_stroke0[] = { - new CoordRec((float) 10.86, (float) 100), - new CoordRec((float) 10.86, (float) 0), + new CoordRec((float) 10.86, 100), + new CoordRec((float) 10.86, 0), }; static final StrokeRec char73[] = { @@ -1030,12 +1030,12 @@ static final StrokeRec char73[] = { /* char: 74 'J' */ static final CoordRec char74_stroke0[] = { - new CoordRec((float) 50.119, (float) 100), + new CoordRec((float) 50.119, 100), new CoordRec((float) 50.119, (float) 23.8095), new CoordRec((float) 45.3571, (float) 9.5238), new CoordRec((float) 40.5952, (float) 4.7619), - new CoordRec((float) 31.0714, (float) 0), - new CoordRec((float) 21.5476, (float) 0), + new CoordRec((float) 31.0714, 0), + new CoordRec((float) 21.5476, 0), new CoordRec((float) 12.0238, (float) 4.7619), new CoordRec((float) 7.2619, (float) 9.5238), new CoordRec((float) 2.5, (float) 23.8095), @@ -1049,18 +1049,18 @@ static final StrokeRec char74[] = { /* char: 75 'K' */ static final CoordRec char75_stroke0[] = { - new CoordRec((float) 11.28, (float) 100), - new CoordRec((float) 11.28, (float) 0), + new CoordRec((float) 11.28, 100), + new CoordRec((float) 11.28, 0), }; static final CoordRec char75_stroke1[] = { - new CoordRec((float) 77.9467, (float) 100), + new CoordRec((float) 77.9467, 100), new CoordRec((float) 11.28, (float) 33.3333), }; static final CoordRec char75_stroke2[] = { new CoordRec((float) 35.0895, (float) 57.1429), - new CoordRec((float) 77.9467, (float) 0), + new CoordRec((float) 77.9467, 0), }; static final StrokeRec char75[] = { @@ -1072,13 +1072,13 @@ static final StrokeRec char75[] = { /* char: 76 'L' */ static final CoordRec char76_stroke0[] = { - new CoordRec((float) 11.68, (float) 100), - new CoordRec((float) 11.68, (float) 0), + new CoordRec((float) 11.68, 100), + new CoordRec((float) 11.68, 0), }; static final CoordRec char76_stroke1[] = { - new CoordRec((float) 11.68, (float) 0), - new CoordRec((float) 68.8229, (float) 0), + new CoordRec((float) 11.68, 0), + new CoordRec((float) 68.8229, 0), }; static final StrokeRec char76[] = { @@ -1089,23 +1089,23 @@ static final StrokeRec char76[] = { /* char: 77 'M' */ static final CoordRec char77_stroke0[] = { - new CoordRec((float) 10.86, (float) 100), - new CoordRec((float) 10.86, (float) 0), + new CoordRec((float) 10.86, 100), + new CoordRec((float) 10.86, 0), }; static final CoordRec char77_stroke1[] = { - new CoordRec((float) 10.86, (float) 100), - new CoordRec((float) 48.9552, (float) 0), + new CoordRec((float) 10.86, 100), + new CoordRec((float) 48.9552, 0), }; static final CoordRec char77_stroke2[] = { - new CoordRec((float) 87.0505, (float) 100), - new CoordRec((float) 48.9552, (float) 0), + new CoordRec((float) 87.0505, 100), + new CoordRec((float) 48.9552, 0), }; static final CoordRec char77_stroke3[] = { - new CoordRec((float) 87.0505, (float) 100), - new CoordRec((float) 87.0505, (float) 0), + new CoordRec((float) 87.0505, 100), + new CoordRec((float) 87.0505, 0), }; static final StrokeRec char77[] = { @@ -1118,18 +1118,18 @@ static final StrokeRec char77[] = { /* char: 78 'N' */ static final CoordRec char78_stroke0[] = { - new CoordRec((float) 11.14, (float) 100), - new CoordRec((float) 11.14, (float) 0), + new CoordRec((float) 11.14, 100), + new CoordRec((float) 11.14, 0), }; static final CoordRec char78_stroke1[] = { - new CoordRec((float) 11.14, (float) 100), - new CoordRec((float) 77.8067, (float) 0), + new CoordRec((float) 11.14, 100), + new CoordRec((float) 77.8067, 0), }; static final CoordRec char78_stroke2[] = { - new CoordRec((float) 77.8067, (float) 100), - new CoordRec((float) 77.8067, (float) 0), + new CoordRec((float) 77.8067, 100), + new CoordRec((float) 77.8067, 0), }; static final StrokeRec char78[] = { @@ -1141,7 +1141,7 @@ static final StrokeRec char78[] = { /* char: 79 'O' */ static final CoordRec char79_stroke0[] = { - new CoordRec((float) 34.8114, (float) 100), + new CoordRec((float) 34.8114, 100), new CoordRec((float) 25.2876, (float) 95.2381), new CoordRec((float) 15.7638, (float) 85.7143), new CoordRec((float) 11.0019, (float) 76.1905), @@ -1150,8 +1150,8 @@ static final CoordRec char79_stroke0[] = { new CoordRec((float) 11.0019, (float) 23.8095), new CoordRec((float) 15.7638, (float) 14.2857), new CoordRec((float) 25.2876, (float) 4.7619), - new CoordRec((float) 34.8114, (float) 0), - new CoordRec((float) 53.859, (float) 0), + new CoordRec((float) 34.8114, 0), + new CoordRec((float) 53.859, 0), new CoordRec((float) 63.3829, (float) 4.7619), new CoordRec((float) 72.9067, (float) 14.2857), new CoordRec((float) 77.6686, (float) 23.8095), @@ -1160,8 +1160,8 @@ static final CoordRec char79_stroke0[] = { new CoordRec((float) 77.6686, (float) 76.1905), new CoordRec((float) 72.9067, (float) 85.7143), new CoordRec((float) 63.3829, (float) 95.2381), - new CoordRec((float) 53.859, (float) 100), - new CoordRec((float) 34.8114, (float) 100), + new CoordRec((float) 53.859, 100), + new CoordRec((float) 34.8114, 100), }; static final StrokeRec char79[] = { @@ -1171,13 +1171,13 @@ static final StrokeRec char79[] = { /* char: 80 'P' */ static final CoordRec char80_stroke0[] = { - new CoordRec((float) 12.1, (float) 100), - new CoordRec((float) 12.1, (float) 0), + new CoordRec((float) 12.1, 100), + new CoordRec((float) 12.1, 0), }; static final CoordRec char80_stroke1[] = { - new CoordRec((float) 12.1, (float) 100), - new CoordRec((float) 54.9571, (float) 100), + new CoordRec((float) 12.1, 100), + new CoordRec((float) 54.9571, 100), new CoordRec((float) 69.2429, (float) 95.2381), new CoordRec((float) 74.0048, (float) 90.4762), new CoordRec((float) 78.7667, (float) 80.9524), @@ -1196,7 +1196,7 @@ static final StrokeRec char80[] = { /* char: 81 'Q' */ static final CoordRec char81_stroke0[] = { - new CoordRec((float) 33.8714, (float) 100), + new CoordRec((float) 33.8714, 100), new CoordRec((float) 24.3476, (float) 95.2381), new CoordRec((float) 14.8238, (float) 85.7143), new CoordRec((float) 10.0619, (float) 76.1905), @@ -1205,8 +1205,8 @@ static final CoordRec char81_stroke0[] = { new CoordRec((float) 10.0619, (float) 23.8095), new CoordRec((float) 14.8238, (float) 14.2857), new CoordRec((float) 24.3476, (float) 4.7619), - new CoordRec((float) 33.8714, (float) 0), - new CoordRec((float) 52.919, (float) 0), + new CoordRec((float) 33.8714, 0), + new CoordRec((float) 52.919, 0), new CoordRec((float) 62.4429, (float) 4.7619), new CoordRec((float) 71.9667, (float) 14.2857), new CoordRec((float) 76.7286, (float) 23.8095), @@ -1215,8 +1215,8 @@ static final CoordRec char81_stroke0[] = { new CoordRec((float) 76.7286, (float) 76.1905), new CoordRec((float) 71.9667, (float) 85.7143), new CoordRec((float) 62.4429, (float) 95.2381), - new CoordRec((float) 52.919, (float) 100), - new CoordRec((float) 33.8714, (float) 100), + new CoordRec((float) 52.919, 100), + new CoordRec((float) 33.8714, 100), }; static final CoordRec char81_stroke1[] = { @@ -1232,13 +1232,13 @@ static final StrokeRec char81[] = { /* char: 82 'R' */ static final CoordRec char82_stroke0[] = { - new CoordRec((float) 11.68, (float) 100), - new CoordRec((float) 11.68, (float) 0), + new CoordRec((float) 11.68, 100), + new CoordRec((float) 11.68, 0), }; static final CoordRec char82_stroke1[] = { - new CoordRec((float) 11.68, (float) 100), - new CoordRec((float) 54.5371, (float) 100), + new CoordRec((float) 11.68, 100), + new CoordRec((float) 54.5371, 100), new CoordRec((float) 68.8229, (float) 95.2381), new CoordRec((float) 73.5848, (float) 90.4762), new CoordRec((float) 78.3467, (float) 80.9524), @@ -1251,7 +1251,7 @@ static final CoordRec char82_stroke1[] = { static final CoordRec char82_stroke2[] = { new CoordRec((float) 45.0133, (float) 52.381), - new CoordRec((float) 78.3467, (float) 0), + new CoordRec((float) 78.3467, 0), }; static final StrokeRec char82[] = { @@ -1265,11 +1265,11 @@ static final StrokeRec char82[] = { static final CoordRec char83_stroke0[] = { new CoordRec((float) 74.6667, (float) 85.7143), new CoordRec((float) 65.1429, (float) 95.2381), - new CoordRec((float) 50.8571, (float) 100), - new CoordRec((float) 31.8095, (float) 100), + new CoordRec((float) 50.8571, 100), + new CoordRec((float) 31.8095, 100), new CoordRec((float) 17.5238, (float) 95.2381), - new CoordRec((float) 8, (float) 85.7143), - new CoordRec((float) 8, (float) 76.1905), + new CoordRec(8, (float) 85.7143), + new CoordRec(8, (float) 76.1905), new CoordRec((float) 12.7619, (float) 66.6667), new CoordRec((float) 17.5238, (float) 61.9048), new CoordRec((float) 27.0476, (float) 57.1429), @@ -1279,10 +1279,10 @@ static final CoordRec char83_stroke0[] = { new CoordRec((float) 74.6667, (float) 28.5714), new CoordRec((float) 74.6667, (float) 14.2857), new CoordRec((float) 65.1429, (float) 4.7619), - new CoordRec((float) 50.8571, (float) 0), - new CoordRec((float) 31.8095, (float) 0), + new CoordRec((float) 50.8571, 0), + new CoordRec((float) 31.8095, 0), new CoordRec((float) 17.5238, (float) 4.7619), - new CoordRec((float) 8, (float) 14.2857), + new CoordRec(8, (float) 14.2857), }; static final StrokeRec char83[] = { @@ -1292,13 +1292,13 @@ static final StrokeRec char83[] = { /* char: 84 'T' */ static final CoordRec char84_stroke0[] = { - new CoordRec((float) 35.6933, (float) 100), - new CoordRec((float) 35.6933, (float) 0), + new CoordRec((float) 35.6933, 100), + new CoordRec((float) 35.6933, 0), }; static final CoordRec char84_stroke1[] = { - new CoordRec((float) 2.36, (float) 100), - new CoordRec((float) 69.0267, (float) 100), + new CoordRec((float) 2.36, 100), + new CoordRec((float) 69.0267, 100), }; static final StrokeRec char84[] = { @@ -1309,16 +1309,16 @@ static final StrokeRec char84[] = { /* char: 85 'U' */ static final CoordRec char85_stroke0[] = { - new CoordRec((float) 11.54, (float) 100), + new CoordRec((float) 11.54, 100), new CoordRec((float) 11.54, (float) 28.5714), new CoordRec((float) 16.3019, (float) 14.2857), new CoordRec((float) 25.8257, (float) 4.7619), - new CoordRec((float) 40.1114, (float) 0), - new CoordRec((float) 49.6352, (float) 0), + new CoordRec((float) 40.1114, 0), + new CoordRec((float) 49.6352, 0), new CoordRec((float) 63.921, (float) 4.7619), new CoordRec((float) 73.4448, (float) 14.2857), new CoordRec((float) 78.2067, (float) 28.5714), - new CoordRec((float) 78.2067, (float) 100), + new CoordRec((float) 78.2067, 100), }; static final StrokeRec char85[] = { @@ -1328,13 +1328,13 @@ static final StrokeRec char85[] = { /* char: 86 'V' */ static final CoordRec char86_stroke0[] = { - new CoordRec((float) 2.36, (float) 100), - new CoordRec((float) 40.4552, (float) 0), + new CoordRec((float) 2.36, 100), + new CoordRec((float) 40.4552, 0), }; static final CoordRec char86_stroke1[] = { - new CoordRec((float) 78.5505, (float) 100), - new CoordRec((float) 40.4552, (float) 0), + new CoordRec((float) 78.5505, 100), + new CoordRec((float) 40.4552, 0), }; static final StrokeRec char86[] = { @@ -1345,23 +1345,23 @@ static final StrokeRec char86[] = { /* char: 87 'W' */ static final CoordRec char87_stroke0[] = { - new CoordRec((float) 2.22, (float) 100), - new CoordRec((float) 26.0295, (float) 0), + new CoordRec((float) 2.22, 100), + new CoordRec((float) 26.0295, 0), }; static final CoordRec char87_stroke1[] = { - new CoordRec((float) 49.839, (float) 100), - new CoordRec((float) 26.0295, (float) 0), + new CoordRec((float) 49.839, 100), + new CoordRec((float) 26.0295, 0), }; static final CoordRec char87_stroke2[] = { - new CoordRec((float) 49.839, (float) 100), - new CoordRec((float) 73.6486, (float) 0), + new CoordRec((float) 49.839, 100), + new CoordRec((float) 73.6486, 0), }; static final CoordRec char87_stroke3[] = { - new CoordRec((float) 97.4581, (float) 100), - new CoordRec((float) 73.6486, (float) 0), + new CoordRec((float) 97.4581, 100), + new CoordRec((float) 73.6486, 0), }; static final StrokeRec char87[] = { @@ -1374,13 +1374,13 @@ static final StrokeRec char87[] = { /* char: 88 'X' */ static final CoordRec char88_stroke0[] = { - new CoordRec((float) 2.5, (float) 100), - new CoordRec((float) 69.1667, (float) 0), + new CoordRec((float) 2.5, 100), + new CoordRec((float) 69.1667, 0), }; static final CoordRec char88_stroke1[] = { - new CoordRec((float) 69.1667, (float) 100), - new CoordRec((float) 2.5, (float) 0), + new CoordRec((float) 69.1667, 100), + new CoordRec((float) 2.5, 0), }; static final StrokeRec char88[] = { @@ -1391,13 +1391,13 @@ static final StrokeRec char88[] = { /* char: 89 'Y' */ static final CoordRec char89_stroke0[] = { - new CoordRec((float) 1.52, (float) 100), + new CoordRec((float) 1.52, 100), new CoordRec((float) 39.6152, (float) 52.381), - new CoordRec((float) 39.6152, (float) 0), + new CoordRec((float) 39.6152, 0), }; static final CoordRec char89_stroke1[] = { - new CoordRec((float) 77.7105, (float) 100), + new CoordRec((float) 77.7105, 100), new CoordRec((float) 39.6152, (float) 52.381), }; @@ -1409,18 +1409,18 @@ static final StrokeRec char89[] = { /* char: 90 'Z' */ static final CoordRec char90_stroke0[] = { - new CoordRec((float) 69.1667, (float) 100), - new CoordRec((float) 2.5, (float) 0), + new CoordRec((float) 69.1667, 100), + new CoordRec((float) 2.5, 0), }; static final CoordRec char90_stroke1[] = { - new CoordRec((float) 2.5, (float) 100), - new CoordRec((float) 69.1667, (float) 100), + new CoordRec((float) 2.5, 100), + new CoordRec((float) 69.1667, 100), }; static final CoordRec char90_stroke2[] = { - new CoordRec((float) 2.5, (float) 0), - new CoordRec((float) 69.1667, (float) 0), + new CoordRec((float) 2.5, 0), + new CoordRec((float) 69.1667, 0), }; static final StrokeRec char90[] = { @@ -1461,7 +1461,7 @@ static final StrokeRec char91[] = { /* char: 92 '\' */ static final CoordRec char92_stroke0[] = { - new CoordRec((float) 5.84, (float) 100), + new CoordRec((float) 5.84, 100), new CoordRec((float) 72.5067, (float) -14.2857), }; @@ -1532,12 +1532,12 @@ static final StrokeRec char95[] = { /* char: 96 '`' */ static final CoordRec char96_stroke0[] = { - new CoordRec((float) 33.0219, (float) 100), + new CoordRec((float) 33.0219, 100), new CoordRec((float) 56.8314, (float) 71.4286), }; static final CoordRec char96_stroke1[] = { - new CoordRec((float) 33.0219, (float) 100), + new CoordRec((float) 33.0219, 100), new CoordRec((float) 28.26, (float) 95.2381), new CoordRec((float) 56.8314, (float) 71.4286), }; @@ -1551,7 +1551,7 @@ static final StrokeRec char96[] = { static final CoordRec char97_stroke0[] = { new CoordRec((float) 63.8229, (float) 66.6667), - new CoordRec((float) 63.8229, (float) 0), + new CoordRec((float) 63.8229, 0), }; static final CoordRec char97_stroke1[] = { @@ -1565,8 +1565,8 @@ static final CoordRec char97_stroke1[] = { new CoordRec((float) 6.68, (float) 28.5714), new CoordRec((float) 11.4419, (float) 14.2857), new CoordRec((float) 20.9657, (float) 4.7619), - new CoordRec((float) 30.4895, (float) 0), - new CoordRec((float) 44.7752, (float) 0), + new CoordRec((float) 30.4895, 0), + new CoordRec((float) 44.7752, 0), new CoordRec((float) 54.299, (float) 4.7619), new CoordRec((float) 63.8229, (float) 14.2857), }; @@ -1579,8 +1579,8 @@ static final StrokeRec char97[] = { /* char: 98 'b' */ static final CoordRec char98_stroke0[] = { - new CoordRec((float) 8.76, (float) 100), - new CoordRec((float) 8.76, (float) 0), + new CoordRec((float) 8.76, 100), + new CoordRec((float) 8.76, 0), }; static final CoordRec char98_stroke1[] = { @@ -1594,8 +1594,8 @@ static final CoordRec char98_stroke1[] = { new CoordRec((float) 65.9029, (float) 28.5714), new CoordRec((float) 61.141, (float) 14.2857), new CoordRec((float) 51.6171, (float) 4.7619), - new CoordRec((float) 42.0933, (float) 0), - new CoordRec((float) 27.8076, (float) 0), + new CoordRec((float) 42.0933, 0), + new CoordRec((float) 27.8076, 0), new CoordRec((float) 18.2838, (float) 4.7619), new CoordRec((float) 8.76, (float) 14.2857), }; @@ -1618,8 +1618,8 @@ static final CoordRec char99_stroke0[] = { new CoordRec((float) 5.52, (float) 28.5714), new CoordRec((float) 10.2819, (float) 14.2857), new CoordRec((float) 19.8057, (float) 4.7619), - new CoordRec((float) 29.3295, (float) 0), - new CoordRec((float) 43.6152, (float) 0), + new CoordRec((float) 29.3295, 0), + new CoordRec((float) 43.6152, 0), new CoordRec((float) 53.139, (float) 4.7619), new CoordRec((float) 62.6629, (float) 14.2857), }; @@ -1631,8 +1631,8 @@ static final StrokeRec char99[] = { /* char: 100 'd' */ static final CoordRec char100_stroke0[] = { - new CoordRec((float) 61.7829, (float) 100), - new CoordRec((float) 61.7829, (float) 0), + new CoordRec((float) 61.7829, 100), + new CoordRec((float) 61.7829, 0), }; static final CoordRec char100_stroke1[] = { @@ -1646,8 +1646,8 @@ static final CoordRec char100_stroke1[] = { new CoordRec((float) 4.64, (float) 28.5714), new CoordRec((float) 9.4019, (float) 14.2857), new CoordRec((float) 18.9257, (float) 4.7619), - new CoordRec((float) 28.4495, (float) 0), - new CoordRec((float) 42.7352, (float) 0), + new CoordRec((float) 28.4495, 0), + new CoordRec((float) 42.7352, 0), new CoordRec((float) 52.259, (float) 4.7619), new CoordRec((float) 61.7829, (float) 14.2857), }; @@ -1673,8 +1673,8 @@ static final CoordRec char101_stroke0[] = { new CoordRec((float) 5.72, (float) 28.5714), new CoordRec((float) 10.4819, (float) 14.2857), new CoordRec((float) 20.0057, (float) 4.7619), - new CoordRec((float) 29.5295, (float) 0), - new CoordRec((float) 43.8152, (float) 0), + new CoordRec((float) 29.5295, 0), + new CoordRec((float) 43.8152, 0), new CoordRec((float) 53.339, (float) 4.7619), new CoordRec((float) 62.8629, (float) 14.2857), }; @@ -1686,11 +1686,11 @@ static final StrokeRec char101[] = { /* char: 102 'f' */ static final CoordRec char102_stroke0[] = { - new CoordRec((float) 38.7752, (float) 100), - new CoordRec((float) 29.2514, (float) 100), + new CoordRec((float) 38.7752, 100), + new CoordRec((float) 29.2514, 100), new CoordRec((float) 19.7276, (float) 95.2381), new CoordRec((float) 14.9657, (float) 80.9524), - new CoordRec((float) 14.9657, (float) 0), + new CoordRec((float) 14.9657, 0), }; static final CoordRec char102_stroke1[] = { @@ -1726,8 +1726,8 @@ static final CoordRec char103_stroke1[] = { new CoordRec((float) 5.36, (float) 28.5714), new CoordRec((float) 10.1219, (float) 14.2857), new CoordRec((float) 19.6457, (float) 4.7619), - new CoordRec((float) 29.1695, (float) 0), - new CoordRec((float) 43.4552, (float) 0), + new CoordRec((float) 29.1695, 0), + new CoordRec((float) 43.4552, 0), new CoordRec((float) 52.979, (float) 4.7619), new CoordRec((float) 62.5029, (float) 14.2857), }; @@ -1740,8 +1740,8 @@ static final StrokeRec char103[] = { /* char: 104 'h' */ static final CoordRec char104_stroke0[] = { - new CoordRec((float) 9.6, (float) 100), - new CoordRec((float) 9.6, (float) 0), + new CoordRec((float) 9.6, 100), + new CoordRec((float) 9.6, 0), }; static final CoordRec char104_stroke1[] = { @@ -1751,7 +1751,7 @@ static final CoordRec char104_stroke1[] = { new CoordRec((float) 47.6952, (float) 66.6667), new CoordRec((float) 57.219, (float) 61.9048), new CoordRec((float) 61.981, (float) 47.619), - new CoordRec((float) 61.981, (float) 0), + new CoordRec((float) 61.981, 0), }; static final StrokeRec char104[] = { @@ -1762,16 +1762,16 @@ static final StrokeRec char104[] = { /* char: 105 'i' */ static final CoordRec char105_stroke0[] = { - new CoordRec((float) 10.02, (float) 100), + new CoordRec((float) 10.02, 100), new CoordRec((float) 14.7819, (float) 95.2381), - new CoordRec((float) 19.5438, (float) 100), + new CoordRec((float) 19.5438, 100), new CoordRec((float) 14.7819, (float) 104.762), - new CoordRec((float) 10.02, (float) 100), + new CoordRec((float) 10.02, 100), }; static final CoordRec char105_stroke1[] = { new CoordRec((float) 14.7819, (float) 66.6667), - new CoordRec((float) 14.7819, (float) 0), + new CoordRec((float) 14.7819, 0), }; static final StrokeRec char105[] = { @@ -1782,11 +1782,11 @@ static final StrokeRec char105[] = { /* char: 106 'j' */ static final CoordRec char106_stroke0[] = { - new CoordRec((float) 17.3876, (float) 100), + new CoordRec((float) 17.3876, 100), new CoordRec((float) 22.1495, (float) 95.2381), - new CoordRec((float) 26.9114, (float) 100), + new CoordRec((float) 26.9114, 100), new CoordRec((float) 22.1495, (float) 104.762), - new CoordRec((float) 17.3876, (float) 100), + new CoordRec((float) 17.3876, 100), }; static final CoordRec char106_stroke1[] = { @@ -1805,8 +1805,8 @@ static final StrokeRec char106[] = { /* char: 107 'k' */ static final CoordRec char107_stroke0[] = { - new CoordRec((float) 9.6, (float) 100), - new CoordRec((float) 9.6, (float) 0), + new CoordRec((float) 9.6, 100), + new CoordRec((float) 9.6, 0), }; static final CoordRec char107_stroke1[] = { @@ -1816,7 +1816,7 @@ static final CoordRec char107_stroke1[] = { static final CoordRec char107_stroke2[] = { new CoordRec((float) 28.6476, (float) 38.0952), - new CoordRec((float) 61.981, (float) 0), + new CoordRec((float) 61.981, 0), }; static final StrokeRec char107[] = { @@ -1828,8 +1828,8 @@ static final StrokeRec char107[] = { /* char: 108 'l' */ static final CoordRec char108_stroke0[] = { - new CoordRec((float) 10.02, (float) 100), - new CoordRec((float) 10.02, (float) 0), + new CoordRec((float) 10.02, 100), + new CoordRec((float) 10.02, 0), }; static final StrokeRec char108[] = { @@ -1840,7 +1840,7 @@ static final StrokeRec char108[] = { static final CoordRec char109_stroke0[] = { new CoordRec((float) 9.6, (float) 66.6667), - new CoordRec((float) 9.6, (float) 0), + new CoordRec((float) 9.6, 0), }; static final CoordRec char109_stroke1[] = { @@ -1850,7 +1850,7 @@ static final CoordRec char109_stroke1[] = { new CoordRec((float) 47.6952, (float) 66.6667), new CoordRec((float) 57.219, (float) 61.9048), new CoordRec((float) 61.981, (float) 47.619), - new CoordRec((float) 61.981, (float) 0), + new CoordRec((float) 61.981, 0), }; static final CoordRec char109_stroke2[] = { @@ -1860,7 +1860,7 @@ static final CoordRec char109_stroke2[] = { new CoordRec((float) 100.076, (float) 66.6667), new CoordRec((float) 109.6, (float) 61.9048), new CoordRec((float) 114.362, (float) 47.619), - new CoordRec((float) 114.362, (float) 0), + new CoordRec((float) 114.362, 0), }; static final StrokeRec char109[] = { @@ -1873,7 +1873,7 @@ static final StrokeRec char109[] = { static final CoordRec char110_stroke0[] = { new CoordRec((float) 9.18, (float) 66.6667), - new CoordRec((float) 9.18, (float) 0), + new CoordRec((float) 9.18, 0), }; static final CoordRec char110_stroke1[] = { @@ -1883,7 +1883,7 @@ static final CoordRec char110_stroke1[] = { new CoordRec((float) 47.2752, (float) 66.6667), new CoordRec((float) 56.799, (float) 61.9048), new CoordRec((float) 61.561, (float) 47.619), - new CoordRec((float) 61.561, (float) 0), + new CoordRec((float) 61.561, 0), }; static final StrokeRec char110[] = { @@ -1901,8 +1901,8 @@ static final CoordRec char111_stroke0[] = { new CoordRec((float) 4.98, (float) 28.5714), new CoordRec((float) 9.7419, (float) 14.2857), new CoordRec((float) 19.2657, (float) 4.7619), - new CoordRec((float) 28.7895, (float) 0), - new CoordRec((float) 43.0752, (float) 0), + new CoordRec((float) 28.7895, 0), + new CoordRec((float) 43.0752, 0), new CoordRec((float) 52.599, (float) 4.7619), new CoordRec((float) 62.1229, (float) 14.2857), new CoordRec((float) 66.8848, (float) 28.5714), @@ -1935,8 +1935,8 @@ static final CoordRec char112_stroke1[] = { new CoordRec((float) 66.6029, (float) 28.5714), new CoordRec((float) 61.841, (float) 14.2857), new CoordRec((float) 52.3171, (float) 4.7619), - new CoordRec((float) 42.7933, (float) 0), - new CoordRec((float) 28.5076, (float) 0), + new CoordRec((float) 42.7933, 0), + new CoordRec((float) 28.5076, 0), new CoordRec((float) 18.9838, (float) 4.7619), new CoordRec((float) 9.46, (float) 14.2857), }; @@ -1964,8 +1964,8 @@ static final CoordRec char113_stroke1[] = { new CoordRec((float) 4.84, (float) 28.5714), new CoordRec((float) 9.6019, (float) 14.2857), new CoordRec((float) 19.1257, (float) 4.7619), - new CoordRec((float) 28.6495, (float) 0), - new CoordRec((float) 42.9352, (float) 0), + new CoordRec((float) 28.6495, 0), + new CoordRec((float) 42.9352, 0), new CoordRec((float) 52.459, (float) 4.7619), new CoordRec((float) 61.9829, (float) 14.2857), }; @@ -1979,7 +1979,7 @@ static final StrokeRec char113[] = { static final CoordRec char114_stroke0[] = { new CoordRec((float) 9.46, (float) 66.6667), - new CoordRec((float) 9.46, (float) 0), + new CoordRec((float) 9.46, 0), }; static final CoordRec char114_stroke1[] = { @@ -2011,8 +2011,8 @@ static final CoordRec char115_stroke0[] = { new CoordRec((float) 57.081, (float) 19.0476), new CoordRec((float) 57.081, (float) 14.2857), new CoordRec((float) 52.319, (float) 4.7619), - new CoordRec((float) 38.0333, (float) 0), - new CoordRec((float) 23.7476, (float) 0), + new CoordRec((float) 38.0333, 0), + new CoordRec((float) 23.7476, 0), new CoordRec((float) 9.4619, (float) 4.7619), new CoordRec((float) 4.7, (float) 14.2857), }; @@ -2024,11 +2024,11 @@ static final StrokeRec char115[] = { /* char: 116 't' */ static final CoordRec char116_stroke0[] = { - new CoordRec((float) 14.8257, (float) 100), + new CoordRec((float) 14.8257, 100), new CoordRec((float) 14.8257, (float) 19.0476), new CoordRec((float) 19.5876, (float) 4.7619), - new CoordRec((float) 29.1114, (float) 0), - new CoordRec((float) 38.6352, (float) 0), + new CoordRec((float) 29.1114, 0), + new CoordRec((float) 38.6352, 0), }; static final CoordRec char116_stroke1[] = { @@ -2047,15 +2047,15 @@ static final CoordRec char117_stroke0[] = { new CoordRec((float) 9.46, (float) 66.6667), new CoordRec((float) 9.46, (float) 19.0476), new CoordRec((float) 14.2219, (float) 4.7619), - new CoordRec((float) 23.7457, (float) 0), - new CoordRec((float) 38.0314, (float) 0), + new CoordRec((float) 23.7457, 0), + new CoordRec((float) 38.0314, 0), new CoordRec((float) 47.5552, (float) 4.7619), new CoordRec((float) 61.841, (float) 19.0476), }; static final CoordRec char117_stroke1[] = { new CoordRec((float) 61.841, (float) 66.6667), - new CoordRec((float) 61.841, (float) 0), + new CoordRec((float) 61.841, 0), }; static final StrokeRec char117[] = { @@ -2067,12 +2067,12 @@ static final StrokeRec char117[] = { static final CoordRec char118_stroke0[] = { new CoordRec((float) 1.8, (float) 66.6667), - new CoordRec((float) 30.3714, (float) 0), + new CoordRec((float) 30.3714, 0), }; static final CoordRec char118_stroke1[] = { new CoordRec((float) 58.9429, (float) 66.6667), - new CoordRec((float) 30.3714, (float) 0), + new CoordRec((float) 30.3714, 0), }; static final StrokeRec char118[] = { @@ -2084,22 +2084,22 @@ static final StrokeRec char118[] = { static final CoordRec char119_stroke0[] = { new CoordRec((float) 2.5, (float) 66.6667), - new CoordRec((float) 21.5476, (float) 0), + new CoordRec((float) 21.5476, 0), }; static final CoordRec char119_stroke1[] = { new CoordRec((float) 40.5952, (float) 66.6667), - new CoordRec((float) 21.5476, (float) 0), + new CoordRec((float) 21.5476, 0), }; static final CoordRec char119_stroke2[] = { new CoordRec((float) 40.5952, (float) 66.6667), - new CoordRec((float) 59.6429, (float) 0), + new CoordRec((float) 59.6429, 0), }; static final CoordRec char119_stroke3[] = { new CoordRec((float) 78.6905, (float) 66.6667), - new CoordRec((float) 59.6429, (float) 0), + new CoordRec((float) 59.6429, 0), }; static final StrokeRec char119[] = { @@ -2113,12 +2113,12 @@ static final StrokeRec char119[] = { static final CoordRec char120_stroke0[] = { new CoordRec((float) 1.66, (float) 66.6667), - new CoordRec((float) 54.041, (float) 0), + new CoordRec((float) 54.041, 0), }; static final CoordRec char120_stroke1[] = { new CoordRec((float) 54.041, (float) 66.6667), - new CoordRec((float) 1.66, (float) 0), + new CoordRec((float) 1.66, 0), }; static final StrokeRec char120[] = { @@ -2130,12 +2130,12 @@ static final StrokeRec char120[] = { static final CoordRec char121_stroke0[] = { new CoordRec((float) 6.5619, (float) 66.6667), - new CoordRec((float) 35.1333, (float) 0), + new CoordRec((float) 35.1333, 0), }; static final CoordRec char121_stroke1[] = { new CoordRec((float) 63.7048, (float) 66.6667), - new CoordRec((float) 35.1333, (float) 0), + new CoordRec((float) 35.1333, 0), new CoordRec((float) 25.6095, (float) -19.0476), new CoordRec((float) 16.0857, (float) -28.5714), new CoordRec((float) 6.5619, (float) -33.3333), @@ -2151,7 +2151,7 @@ static final StrokeRec char121[] = { static final CoordRec char122_stroke0[] = { new CoordRec((float) 56.821, (float) 66.6667), - new CoordRec((float) 4.44, (float) 0), + new CoordRec((float) 4.44, 0), }; static final CoordRec char122_stroke1[] = { @@ -2160,8 +2160,8 @@ static final CoordRec char122_stroke1[] = { }; static final CoordRec char122_stroke2[] = { - new CoordRec((float) 4.44, (float) 0), - new CoordRec((float) 56.821, (float) 0), + new CoordRec((float) 4.44, 0), + new CoordRec((float) 56.821, 0), }; static final StrokeRec char122[] = { @@ -2176,7 +2176,7 @@ static final CoordRec char123_stroke0[] = { new CoordRec((float) 31.1895, (float) 119.048), new CoordRec((float) 21.6657, (float) 114.286), new CoordRec((float) 16.9038, (float) 109.524), - new CoordRec((float) 12.1419, (float) 100), + new CoordRec((float) 12.1419, 100), new CoordRec((float) 12.1419, (float) 90.4762), new CoordRec((float) 16.9038, (float) 80.9524), new CoordRec((float) 21.6657, (float) 76.1905), @@ -2199,7 +2199,7 @@ static final CoordRec char123_stroke1[] = { new CoordRec((float) 31.1895, (float) 23.8095), new CoordRec((float) 31.1895, (float) 14.2857), new CoordRec((float) 26.4276, (float) 4.7619), - new CoordRec((float) 21.6657, (float) 0), + new CoordRec((float) 21.6657, 0), new CoordRec((float) 16.9038, (float) -9.5238), new CoordRec((float) 16.9038, (float) -19.0476), new CoordRec((float) 21.6657, (float) -28.5714), @@ -2241,7 +2241,7 @@ static final CoordRec char125_stroke0[] = { new CoordRec((float) 9.18, (float) 119.048), new CoordRec((float) 18.7038, (float) 114.286), new CoordRec((float) 23.4657, (float) 109.524), - new CoordRec((float) 28.2276, (float) 100), + new CoordRec((float) 28.2276, 100), new CoordRec((float) 28.2276, (float) 90.4762), new CoordRec((float) 23.4657, (float) 80.9524), new CoordRec((float) 18.7038, (float) 76.1905), @@ -2264,7 +2264,7 @@ static final CoordRec char125_stroke1[] = { new CoordRec((float) 9.18, (float) 23.8095), new CoordRec((float) 9.18, (float) 14.2857), new CoordRec((float) 13.9419, (float) 4.7619), - new CoordRec((float) 18.7038, (float) 0), + new CoordRec((float) 18.7038, 0), new CoordRec((float) 23.4657, (float) -9.5238), new CoordRec((float) 23.4657, (float) -19.0476), new CoordRec((float) 18.7038, (float) -28.5714), @@ -2327,7 +2327,7 @@ static final StrokeRec char126[] = { /* char: 127 */ static final CoordRec char127_stroke0[] = { - new CoordRec((float) 52.381, (float) 100), + new CoordRec((float) 52.381, 100), new CoordRec((float) 14.2857, (float) -33.3333), }; @@ -2335,12 +2335,12 @@ static final CoordRec char127_stroke1[] = { new CoordRec((float) 28.5714, (float) 66.6667), new CoordRec((float) 14.2857, (float) 61.9048), new CoordRec((float) 4.7619, (float) 52.381), - new CoordRec((float) 0, (float) 38.0952), - new CoordRec((float) 0, (float) 23.8095), + new CoordRec(0, (float) 38.0952), + new CoordRec(0, (float) 23.8095), new CoordRec((float) 4.7619, (float) 14.2857), new CoordRec((float) 14.2857, (float) 4.7619), - new CoordRec((float) 28.5714, (float) 0), - new CoordRec((float) 38.0952, (float) 0), + new CoordRec((float) 28.5714, 0), + new CoordRec((float) 38.0952, 0), new CoordRec((float) 52.381, (float) 4.7619), new CoordRec((float) 61.9048, (float) 14.2857), new CoordRec((float) 66.6667, (float) 28.5714), @@ -2357,38 +2357,38 @@ static final StrokeRec char127[] = { }; static final StrokeCharRec chars[] = { - new StrokeCharRec( 0, /* char0 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char1 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char2 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char3 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char4 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char5 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char6 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char7 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char8 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char9 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char10 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char11 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char12 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char13 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char14 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char15 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char16 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char17 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char18 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char19 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char20 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char21 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char22 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char23 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char24 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char25 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char26 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char27 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char28 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char29 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char30 */ null, (float) 0, (float) 0 ), - new StrokeCharRec( 0, /* char31 */ null, (float) 0, (float) 0 ), + new StrokeCharRec( 0, /* char0 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char1 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char2 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char3 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char4 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char5 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char6 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char7 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char8 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char9 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char10 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char11 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char12 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char13 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char14 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char15 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char16 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char17 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char18 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char19 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char20 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char21 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char22 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char23 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char24 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char25 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char26 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char27 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char28 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char29 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char30 */ null, 0, 0 ), + new StrokeCharRec( 0, /* char31 */ null, 0, 0 ), new StrokeCharRec( 0, /* char32 */ null, (float) 52.381, (float) 104.762 ), new StrokeCharRec( 2, char33, (float) 13.3819, (float) 26.6238 ), new StrokeCharRec( 2, char34, (float) 23.0676, (float) 51.4352 ), diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java index 515212f0e..59935e358 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeCharRec.java @@ -51,10 +51,10 @@ class StrokeCharRec { public float center; public float right; - public StrokeCharRec(int num_strokes, - StrokeRec[] stroke, - float center, - float right) { + public StrokeCharRec(final int num_strokes, + final StrokeRec[] stroke, + final float center, + final float right) { this.num_strokes = num_strokes; this.stroke = stroke; this.center = center; diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java index 5335c8523..5810ac38a 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeFontRec.java @@ -52,11 +52,11 @@ class StrokeFontRec { public float top; public float bottom; - public StrokeFontRec(String name, - int num_chars, - StrokeCharRec[] ch, - float top, - float bottom) { + public StrokeFontRec(final String name, + final int num_chars, + final StrokeCharRec[] ch, + final float top, + final float bottom) { this.name = name; this.num_chars = num_chars; this.ch = ch; diff --git a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java index b0c91c696..fcb7c912a 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java +++ b/src/jogl/classes/com/jogamp/opengl/util/gl2/StrokeRec.java @@ -49,8 +49,8 @@ class StrokeRec { public int num_coords; public CoordRec[] coord; - public StrokeRec(int num_coords, - CoordRec[] coord) { + public StrokeRec(final int num_coords, + final CoordRec[] coord) { this.num_coords = num_coords; this.coord = coord; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java index 7c6a40468..4a3e5b2e1 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderCode.java @@ -96,7 +96,7 @@ public class ShaderCode { * * @throws IllegalArgumentException if count and source.length do not match */ - public ShaderCode(int type, int count, CharSequence[][] source) { + public ShaderCode(final int type, final int count, final CharSequence[][] source) { if(source.length != count) { throw new IllegalArgumentException("shader number ("+count+") and sourceFiles array ("+source.length+") of different lenght."); } @@ -126,7 +126,7 @@ public class ShaderCode { * @param count number of shaders * @param binary binary buffer containing the shader binaries, */ - public ShaderCode(int type, int count, int binFormat, Buffer binary) { + public ShaderCode(final int type, final int count, final int binFormat, final Buffer binary) { switch (type) { case GL2ES2.GL_VERTEX_SHADER: case GL2ES2.GL_FRAGMENT_SHADER: @@ -162,7 +162,7 @@ public class ShaderCode { * @throws IllegalArgumentException if count and sourceFiles.length do not match * @see #readShaderSource(Class, String) */ - public static ShaderCode create(GL2ES2 gl, int type, int count, Class context, String[] sourceFiles, boolean mutableStringBuilder) { + public static ShaderCode create(final GL2ES2 gl, final int type, final int count, final Class context, final String[] sourceFiles, final boolean mutableStringBuilder) { if(null != gl && !ShaderUtil.isShaderCompilerAvailable(gl)) { return null; } @@ -174,7 +174,7 @@ public class ShaderCode { for(int i=0; i context, int binFormat, String binaryFile) { + public static ShaderCode create(final int type, final int count, final Class context, int binFormat, final String binaryFile) { ByteBuffer shaderBinary = null; if(null!=binaryFile && 0<=binFormat) { try { shaderBinary = readShaderBinary(context, binaryFile); - } catch (IOException ioe) { + } catch (final IOException ioe) { throw new RuntimeException("readShaderBinary("+binaryFile+") error: ", ioe); } if(null == shaderBinary) { @@ -238,7 +238,7 @@ public class ShaderCode { * * @see #create(GL2ES2, int, Class, String, String, String, boolean) */ - public static String getFileSuffix(boolean binary, int type) { + public static String getFileSuffix(final boolean binary, final int type) { switch (type) { case GL2ES2.GL_VERTEX_SHADER: return binary?SUFFIX_VERTEX_BINARY:SUFFIX_VERTEX_SOURCE; @@ -261,7 +261,7 @@ public class ShaderCode { * * @see #create(GL2ES2, int, Class, String, String, String, boolean) */ - public static String getBinarySubPath(int binFormat) { + public static String getBinarySubPath(final int binFormat) { switch (binFormat) { case GLES2.GL_NVIDIA_PLATFORM_BINARY_NV: return SUB_PATH_NVIDIA; @@ -347,9 +347,9 @@ public class ShaderCode { * @see ShaderUtil#getShaderBinaryFormats(GL) * @see #getBinarySubPath(int) */ - public static ShaderCode create(GL2ES2 gl, int type, int count, Class context, - String srcRoot, String[] srcBasenames, String binRoot, String binBasename, - boolean mutableStringBuilder) { + public static ShaderCode create(final GL2ES2 gl, final int type, final int count, final Class context, + final String srcRoot, final String[] srcBasenames, final String binRoot, final String binBasename, + final boolean mutableStringBuilder) { ShaderCode res = null; final String srcPath[]; String srcPathString = null; @@ -376,10 +376,10 @@ public class ShaderCode { srcPath = null; } if( null!=binBasename ) { - Set binFmts = ShaderUtil.getShaderBinaryFormats(gl); + final Set binFmts = ShaderUtil.getShaderBinaryFormats(gl); final String binSuffix = getFileSuffix(true, type); - for(Iterator iter=binFmts.iterator(); iter.hasNext(); ) { - int bFmt = iter.next().intValue(); + for(final Iterator iter=binFmts.iterator(); iter.hasNext(); ) { + final int bFmt = iter.next().intValue(); final String bFmtPath = getBinarySubPath(bFmt); if(null==bFmtPath) continue; binFileName = binRoot + '/' + bFmtPath + '/' + binBasename + "." + binSuffix; @@ -447,8 +447,8 @@ public class ShaderCode { * * @see #create(GL2ES2, int, int, Class, String, String[], String, String) */ - public static ShaderCode create(GL2ES2 gl, int type, Class context, - String srcRoot, String binRoot, String basename, boolean mutableStringBuilder) { + public static ShaderCode create(final GL2ES2 gl, final int type, final Class context, + final String srcRoot, final String binRoot, final String basename, final boolean mutableStringBuilder) { return create(gl, type, 1, context, srcRoot, new String[] { basename }, binRoot, basename, mutableStringBuilder ); } @@ -460,7 +460,7 @@ public class ShaderCode { public int shaderType() { return shaderType; } public String shaderTypeStr() { return shaderTypeStr(shaderType); } - public static String shaderTypeStr(int type) { + public static String shaderTypeStr(final int type) { switch (type) { case GL2ES2.GL_VERTEX_SHADER: return "VERTEX_SHADER"; @@ -480,10 +480,10 @@ public class ShaderCode { public IntBuffer shader() { return shader; } - public boolean compile(GL2ES2 gl) { + public boolean compile(final GL2ES2 gl) { return compile(gl, null); } - public boolean compile(GL2ES2 gl, PrintStream verboseOut) { + public boolean compile(final GL2ES2 gl, final PrintStream verboseOut) { if(isValid()) return true; // Create & Compile the vertex/fragment shader objects @@ -503,7 +503,7 @@ public class ShaderCode { return valid; } - public void destroy(GL2ES2 gl) { + public void destroy(final GL2ES2 gl) { if(isValid()) { if(null!=gl) { ShaderUtil.deleteShader(gl, shader()); @@ -521,7 +521,7 @@ public class ShaderCode { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if(this==obj) { return true; } if(obj instanceof ShaderCode) { return id()==((ShaderCode)obj).id(); @@ -534,7 +534,7 @@ public class ShaderCode { } @Override public String toString() { - StringBuilder buf = new StringBuilder("ShaderCode[id="+id+", type="+shaderTypeStr()+", valid="+valid+", shader: "); + final StringBuilder buf = new StringBuilder("ShaderCode[id="+id+", type="+shaderTypeStr()+", valid="+valid+", shader: "); for(int i=0; i"); return; @@ -560,7 +560,7 @@ public class ShaderCode { if(i>=sourceCount) { out.println(""); } else { - CharSequence[] src = shaderSource[i]; + final CharSequence[] src = shaderSource[i]; int lineno=0; for(int j=0; jStringBuilder */ - public int insertShaderSource(int shaderIdx, String tag, int fromIndex, CharSequence data) { + public int insertShaderSource(final int shaderIdx, final String tag, final int fromIndex, final CharSequence data) { if(null==shaderSource) { throw new IllegalStateException("no shader source"); } @@ -650,7 +650,7 @@ public class ShaderCode { * * @throws IllegalStateException if the shader source's CharSequence is immutable, i.e. not of type StringBuilder */ - public int replaceInShaderSource(String oldName, String newName) { + public int replaceInShaderSource(final String oldName, final String newName) { if(null==shaderSource) { throw new IllegalStateException("no shader source"); } @@ -670,9 +670,9 @@ public class ShaderCode { final StringBuilder sb = (StringBuilder)src[j]; int curPos = 0; while(curPosStringBuilder */ - public int insertShaderSource(int shaderIdx, int position, CharSequence data) { + public int insertShaderSource(final int shaderIdx, int position, final CharSequence data) { if(null==shaderSource) { throw new IllegalStateException("no shader source"); } @@ -750,7 +750,7 @@ public class ShaderCode { * @throws IllegalStateException if the shader source's CharSequence is immutable, i.e. not of type StringBuilder * @see IOUtil#getResource(Class, String) */ - public int insertShaderSource(int shaderIdx, int position, Class context, String path) throws IOException { + public int insertShaderSource(final int shaderIdx, final int position, final Class context, final String path) throws IOException { final CharSequence data = readShaderSource(context, path, true); if( null != data ) { return insertShaderSource(shaderIdx, position, data); @@ -760,7 +760,7 @@ public class ShaderCode { } @SuppressWarnings("resource") - private static int readShaderSource(Class context, URLConnection conn, StringBuilder result, int lineno) throws IOException { + private static int readShaderSource(final Class context, final URLConnection conn, final StringBuilder result, int lineno) throws IOException { if(DEBUG_CODE) { if(0 == lineno) { result.append("// "+conn.getURL().toExternalForm()+"\n"); @@ -774,7 +774,7 @@ public class ShaderCode { while ((line = reader.readLine()) != null) { lineno++; if (line.startsWith("#include ")) { - String includeFile = line.substring(9).trim(); + final String includeFile = line.substring(9).trim(); URLConnection nextConn = null; // Try relative of current shader location @@ -805,7 +805,7 @@ public class ShaderCode { * @param result * @throws IOException */ - public static void readShaderSource(Class context, URLConnection conn, StringBuilder result) throws IOException { + public static void readShaderSource(final Class context, final URLConnection conn, final StringBuilder result) throws IOException { readShaderSource(context, conn, result, 0); } @@ -829,12 +829,12 @@ public class ShaderCode { * * @see IOUtil#getResource(Class, String) */ - public static CharSequence readShaderSource(Class context, String path, boolean mutableStringBuilder) throws IOException { - URLConnection conn = IOUtil.getResource(context, path); + public static CharSequence readShaderSource(final Class context, final String path, final boolean mutableStringBuilder) throws IOException { + final URLConnection conn = IOUtil.getResource(context, path); if (conn == null) { return null; } - StringBuilder result = new StringBuilder(); + final StringBuilder result = new StringBuilder(); readShaderSource(context, conn, result); return mutableStringBuilder ? result : result.toString(); } @@ -853,7 +853,7 @@ public class ShaderCode { * * @see IOUtil#getResource(Class, String) */ - public static ByteBuffer readShaderBinary(Class context, String path) throws IOException { + public static ByteBuffer readShaderBinary(final Class context, final String path) throws IOException { final URLConnection conn = IOUtil.getResource(context, path); if (conn == null) { return null; @@ -901,7 +901,7 @@ public class ShaderCode { * @param behavior shall be either {@link #REQUIRE}, {@link #ENABLE}, {@link #DISABLE} or {@link #WARN} * @return the complete extension directive */ - public static String createExtensionDirective(String extensionName, String behavior) { + public static String createExtensionDirective(final String extensionName, final String behavior) { return "#extension " + extensionName + " : " + behavior + "\n"; } @@ -913,7 +913,7 @@ public class ShaderCode { * @param gl a GL context, which must have been made current once * @return the index after the inserted data, maybe 0 if nothing has be inserted. */ - public final int addGLSLVersion(GL2ES2 gl) { + public final int addGLSLVersion(final GL2ES2 gl) { return insertShaderSource(0, 0, gl.getContext().getGLSLVersionString()); } @@ -929,7 +929,7 @@ public class ShaderCode { * @param pos position within this mutable shader source. * @return the index after the inserted data, maybe 0 if nothing has be inserted. */ - public final int addDefaultShaderPrecision(GL2ES2 gl, int pos) { + public final int addDefaultShaderPrecision(final GL2ES2 gl, int pos) { final String defaultPrecision; if( gl.isGLES3() ) { switch ( shaderType ) { @@ -973,7 +973,7 @@ public class ShaderCode { } /** Returns true, if GLSL version requires default precision, i.e. ES2 or GLSL [1.30 .. 1.50[. */ - public static final boolean requiresDefaultPrecision(GL2ES2 gl) { + public static final boolean requiresDefaultPrecision(final GL2ES2 gl) { if( gl.isGLES() ) { return true; } @@ -981,7 +981,7 @@ public class ShaderCode { } /** Returns true, if GL3 GLSL version requires default precision, i.e. GLSL [1.30 .. 1.50[. */ - public static final boolean requiresGL3DefaultPrecision(GL2ES2 gl) { + public static final boolean requiresGL3DefaultPrecision(final GL2ES2 gl) { if( gl.isGL3() ) { final VersionNumber glslVersion = gl.getContext().getGLSLVersionNumber(); return glslVersion.compareTo(GLContext.Version130) >= 0 && glslVersion.compareTo(GLContext.Version150) < 0 ; @@ -1005,7 +1005,7 @@ public class ShaderCode { * @see #addGLSLVersion(GL2ES2) * @see #addDefaultShaderPrecision(GL2ES2, int) */ - public final int defaultShaderCustomization(GL2ES2 gl, boolean preludeVersion, boolean addDefaultPrecision) { + public final int defaultShaderCustomization(final GL2ES2 gl, final boolean preludeVersion, final boolean addDefaultPrecision) { int pos; if( preludeVersion ) { pos = addGLSLVersion(gl); @@ -1031,7 +1031,7 @@ public class ShaderCode { * @see #addGLSLVersion(GL2ES2) * @see #addDefaultShaderPrecision(GL2ES2, int) */ - public final int defaultShaderCustomization(GL2ES2 gl, boolean preludeVersion, String esDefaultPrecision) { + public final int defaultShaderCustomization(final GL2ES2 gl, final boolean preludeVersion, final String esDefaultPrecision) { int pos; if( preludeVersion ) { pos = addGLSLVersion(gl); diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java index 3ac17b0c5..a9b0bddc6 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderProgram.java @@ -65,7 +65,7 @@ public class ShaderProgram { * * @see #release(GL2ES2, boolean) */ - public synchronized void destroy(GL2ES2 gl) { + public synchronized void destroy(final GL2ES2 gl) { release(gl, true); } @@ -76,7 +76,7 @@ public class ShaderProgram { * * @see #release(GL2ES2, boolean) */ - public synchronized void release(GL2ES2 gl) { + public synchronized void release(final GL2ES2 gl) { release(gl, false); } @@ -84,12 +84,12 @@ public class ShaderProgram { * Detaches all shader codes and deletes the program. * If destroyShaderCode is true it destroys the shader codes as well. */ - public synchronized void release(GL2ES2 gl, boolean destroyShaderCode) { + public synchronized void release(final GL2ES2 gl, final boolean destroyShaderCode) { if( programLinked ) { useProgram(gl, false); } - for(Iterator iter=allShaderCode.iterator(); iter.hasNext(); ) { - ShaderCode shaderCode = iter.next(); + for(final Iterator iter=allShaderCode.iterator(); iter.hasNext(); ) { + final ShaderCode shaderCode = iter.next(); if(attachedShaderCode.remove(shaderCode)) { ShaderUtil.detachShader(gl, shaderProgram, shaderCode.shader()); } @@ -115,11 +115,11 @@ public class ShaderProgram { *

This command does not compile and attach the shader, * use {@link #add(GL2ES2, ShaderCode)} for this purpose.

*/ - public synchronized void add(ShaderCode shaderCode) throws GLException { + public synchronized void add(final ShaderCode shaderCode) throws GLException { allShaderCode.add(shaderCode); } - public synchronized boolean contains(ShaderCode shaderCode) { + public synchronized boolean contains(final ShaderCode shaderCode) { return allShaderCode.contains(shaderCode); } @@ -128,9 +128,9 @@ public class ShaderProgram { * @param id * @return */ - public synchronized ShaderCode getShader(int id) { - for(Iterator iter=allShaderCode.iterator(); iter.hasNext(); ) { - ShaderCode shaderCode = iter.next(); + public synchronized ShaderCode getShader(final int id) { + for(final Iterator iter=allShaderCode.iterator(); iter.hasNext(); ) { + final ShaderCode shaderCode = iter.next(); if(shaderCode.id() == id) { return shaderCode; } @@ -149,7 +149,7 @@ public class ShaderProgram { * @param gl * @return true if shader program is valid, i.e. not zero */ - public synchronized final boolean init(GL2ES2 gl) { + public synchronized final boolean init(final GL2ES2 gl) { if( 0 == shaderProgram ) { shaderProgram = gl.glCreateProgram(); } @@ -163,7 +163,7 @@ public class ShaderProgram { * * @return true if the shader was successfully added, false if compilation failed. */ - public synchronized boolean add(GL2ES2 gl, ShaderCode shaderCode, PrintStream verboseOut) { + public synchronized boolean add(final GL2ES2 gl, final ShaderCode shaderCode, final PrintStream verboseOut) { if( !init(gl) ) { return false; } if( allShaderCode.add(shaderCode) ) { if( !shaderCode.compile(gl, verboseOut) ) { @@ -195,12 +195,12 @@ public class ShaderProgram { * @see ShaderState#glResetAllVertexAttributes * @see ShaderState#glResetAllVertexAttributes */ - public synchronized boolean replaceShader(GL2ES2 gl, ShaderCode oldShader, ShaderCode newShader, PrintStream verboseOut) { + public synchronized boolean replaceShader(final GL2ES2 gl, final ShaderCode oldShader, final ShaderCode newShader, final PrintStream verboseOut) { if(!init(gl) || !newShader.compile(gl, verboseOut)) { return false; } - boolean shaderWasInUse = inUse(); + final boolean shaderWasInUse = inUse(); if(shaderWasInUse) { useProgram(gl, false); } @@ -238,13 +238,13 @@ public class ShaderProgram { * * @see #init(GL2ES2) */ - public synchronized boolean link(GL2ES2 gl, PrintStream verboseOut) { + public synchronized boolean link(final GL2ES2 gl, final PrintStream verboseOut) { if( !init(gl) ) { programLinked = false; // mark unlinked due to user attempt to [re]link return false; } - for(Iterator iter=allShaderCode.iterator(); iter.hasNext(); ) { + for(final Iterator iter=allShaderCode.iterator(); iter.hasNext(); ) { final ShaderCode shaderCode = iter.next(); if(!shaderCode.compile(gl, verboseOut)) { programLinked = false; // mark unlinked due to user attempt to [re]link @@ -264,7 +264,7 @@ public class ShaderProgram { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if(this == obj) { return true; } if(obj instanceof ShaderProgram) { return id()==((ShaderProgram)obj).id(); @@ -283,7 +283,7 @@ public class ShaderProgram { } sb.append("ShaderProgram[id=").append(id); sb.append(", linked="+programLinked+", inUse="+programInUse+", program: "+shaderProgram+","); - for(Iterator iter=allShaderCode.iterator(); iter.hasNext(); ) { + for(final Iterator iter=allShaderCode.iterator(); iter.hasNext(); ) { sb.append(Platform.getNewline()).append(" ").append(iter.next()); } sb.append("]"); @@ -299,11 +299,11 @@ public class ShaderProgram { * Performs {@link GL2ES2#glValidateProgram(int)} via {@link ShaderUtil#isProgramExecStatusValid(GL, int, PrintStream)}. * @see ShaderUtil#isProgramExecStatusValid(GL, int, PrintStream) **/ - public synchronized boolean validateProgram(GL2ES2 gl, PrintStream verboseOut) { + public synchronized boolean validateProgram(final GL2ES2 gl, final PrintStream verboseOut) { return ShaderUtil.isProgramExecStatusValid(gl, shaderProgram, verboseOut); } - public synchronized void useProgram(GL2ES2 gl, boolean on) { + public synchronized void useProgram(final GL2ES2 gl, boolean on) { if(!programLinked) { throw new GLException("Program is not linked"); } if(programInUse==on) { return; } if( 0 == shaderProgram ) { diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java index 64dd589b8..c841f2f09 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderState.java @@ -41,6 +41,7 @@ import javax.media.opengl.GLUniformData; import jogamp.opengl.Debug; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.opengl.util.GLArrayDataEditable; /** @@ -60,7 +61,7 @@ public class ShaderState { static { Debug.initSingleton(); - DEBUG = Debug.isPropertyDefined("jogl.debug.GLSLState", true); + DEBUG = PropertyAccess.isPropertyDefined("jogl.debug.GLSLState", true); } public ShaderState() { @@ -68,12 +69,12 @@ public class ShaderState { public boolean verbose() { return verbose; } - public void setVerbose(boolean v) { verbose = DEBUG || v; } + public void setVerbose(final boolean v) { verbose = DEBUG || v; } /** * Returns the attached user object for the given name to this ShaderState. */ - public final Object getAttachedObject(String name) { + public final Object getAttachedObject(final String name) { return attachedObjectsByString.get(name); } @@ -83,7 +84,7 @@ public class ShaderState { * * @return the previous mapped object or null if none */ - public final Object attachObject(String name, Object obj) { + public final Object attachObject(final String name, final Object obj) { return attachedObjectsByString.put(name, obj); } @@ -92,7 +93,7 @@ public class ShaderState { * * @return the previous mapped object or null if none */ - public final Object detachObject(String name) { + public final Object detachObject(final String name) { return attachedObjectsByString.remove(name); } @@ -103,7 +104,7 @@ public class ShaderState { * * @see com.jogamp.opengl.util.glsl.ShaderState#useProgram(GL2ES2, boolean) */ - public synchronized void useProgram(GL2ES2 gl, boolean on) throws GLException { + public synchronized void useProgram(final GL2ES2 gl, final boolean on) throws GLException { if(null==shaderProgram) { throw new GLException("No program is attached"); } if(on) { if(shaderProgram.linked()) { @@ -154,10 +155,10 @@ public class ShaderState { * * @throws GLException if program was not linked and linking fails */ - public synchronized boolean attachShaderProgram(GL2ES2 gl, ShaderProgram prog, boolean enable) throws GLException { + public synchronized boolean attachShaderProgram(final GL2ES2 gl, final ShaderProgram prog, final boolean enable) throws GLException { if(verbose) { - int curId = (null!=shaderProgram)?shaderProgram.id():-1; - int newId = (null!=prog)?prog.id():-1; + final int curId = (null!=shaderProgram)?shaderProgram.id():-1; + final int newId = (null!=prog)?prog.id():-1; System.err.println("ShaderState: attachShaderProgram: "+curId+" -> "+newId+" (enable: "+enable+")\n\t"+shaderProgram+"\n\t"+prog); if(DEBUG) { Thread.dumpStack(); @@ -213,7 +214,7 @@ public class ShaderState { * @see #glReleaseAllUniforms * @see #release(GL2ES2, boolean, boolean, boolean) */ - public synchronized void destroy(GL2ES2 gl) { + public synchronized void destroy(final GL2ES2 gl) { release(gl, true, true, true); attachedObjectsByString.clear(); } @@ -225,7 +226,7 @@ public class ShaderState { * @see #glReleaseAllUniforms * @see #release(GL2ES2, boolean, boolean, boolean) */ - public synchronized void releaseAllData(GL2ES2 gl) { + public synchronized void releaseAllData(final GL2ES2 gl) { release(gl, false, false, false); } @@ -234,12 +235,12 @@ public class ShaderState { * @see #glReleaseAllUniforms * @see ShaderProgram#release(GL2ES2, boolean) */ - public synchronized void release(GL2ES2 gl, boolean destroyBoundAttributes, boolean destroyShaderProgram, boolean destroyShaderCode) { + public synchronized void release(final GL2ES2 gl, final boolean destroyBoundAttributes, final boolean destroyShaderProgram, final boolean destroyShaderCode) { if(null!=shaderProgram && shaderProgram.linked() ) { shaderProgram.useProgram(gl, false); } if(destroyBoundAttributes) { - for(Iterator iter = managedAttributes.iterator(); iter.hasNext(); ) { + for(final Iterator iter = managedAttributes.iterator(); iter.hasNext(); ) { iter.next().destroy(gl); } } @@ -265,8 +266,8 @@ public class ShaderState { * @see #getAttribLocation(GL2ES2, String) * @see GL2ES2#glGetAttribLocation(int, String) */ - public int getCachedAttribLocation(String name) { - Integer idx = activeAttribLocationMap.get(name); + public int getCachedAttribLocation(final String name) { + final Integer idx = activeAttribLocationMap.get(name); return (null!=idx)?idx.intValue():-1; } @@ -285,11 +286,11 @@ public class ShaderState { * @see #glResetAllVertexAttributes * @see ShaderProgram#glReplaceShader */ - public GLArrayData getAttribute(String name) { + public GLArrayData getAttribute(final String name) { return activeAttribDataMap.get(name); } - public boolean isActiveAttribute(GLArrayData attribute) { + public boolean isActiveAttribute(final GLArrayData attribute) { return attribute == activeAttribDataMap.get(attribute.getName()); } @@ -313,7 +314,7 @@ public class ShaderState { * @see #getAttribute(String) * @see GLArrayData#associate(Object, boolean) */ - public void ownAttribute(GLArrayData attribute, boolean own) { + public void ownAttribute(final GLArrayData attribute, final boolean own) { if(own) { final int location = getCachedAttribLocation(attribute.getName()); if(0<=location) { @@ -326,7 +327,7 @@ public class ShaderState { attribute.associate(this, own); } - public boolean ownsAttribute(GLArrayData attribute) { + public boolean ownsAttribute(final GLArrayData attribute) { return managedAttributes.contains(attribute); } @@ -343,7 +344,7 @@ public class ShaderState { * @see #getAttribLocation(GL2ES2, String) * @see #getCachedAttribLocation(String) */ - public void bindAttribLocation(GL2ES2 gl, int location, String name) { + public void bindAttribLocation(final GL2ES2 gl, final int location, final String name) { if(null==shaderProgram) throw new GLException("No program is attached"); if(shaderProgram.linked()) throw new GLException("Program is already linked"); final Integer loc = new Integer(location); @@ -366,7 +367,7 @@ public class ShaderState { * @see #getCachedAttribLocation(String) * @see #getAttribute(String) */ - public void bindAttribLocation(GL2ES2 gl, int location, GLArrayData data) { + public void bindAttribLocation(final GL2ES2 gl, final int location, final GLArrayData data) { if(null==shaderProgram) throw new GLException("No program is attached"); if(shaderProgram.linked()) throw new GLException("Program is already linked"); final String name = data.getName(); @@ -391,7 +392,7 @@ public class ShaderState { * @see #bindAttribLocation(GL2ES2, int, String) * @see GL2ES2#glGetAttribLocation(int, String) */ - public int getAttribLocation(GL2ES2 gl, String name) { + public int getAttribLocation(final GL2ES2 gl, final String name) { if(null==shaderProgram) throw new GLException("No program is attached"); int location = getCachedAttribLocation(name); if(0>location) { @@ -431,7 +432,7 @@ public class ShaderState { * @see GL2ES2#glGetAttribLocation(int, String) * @see #getAttribute(String) */ - public int getAttribLocation(GL2ES2 gl, GLArrayData data) { + public int getAttribLocation(final GL2ES2 gl, final GLArrayData data) { if(null==shaderProgram) throw new GLException("No program is attached"); final String name = data.getName(); int location = getCachedAttribLocation(name); @@ -441,7 +442,7 @@ public class ShaderState { if(!shaderProgram.linked()) throw new GLException("Program is not linked"); location = data.setLocation(gl, shaderProgram.program()); if(0<=location) { - Integer idx = new Integer(location); + final Integer idx = new Integer(location); activeAttribLocationMap.put(name, idx); if(DEBUG) { System.err.println("ShaderState: glGetAttribLocation: "+name+", loc: "+location); @@ -464,7 +465,7 @@ public class ShaderState { /** * @return true if the named attribute is enable */ - public final boolean isVertexAttribArrayEnabled(String name) { + public final boolean isVertexAttribArrayEnabled(final String name) { final Boolean v = activedAttribEnabledMap.get(name); return null != v && v.booleanValue(); } @@ -472,11 +473,11 @@ public class ShaderState { /** * @return true if the {@link GLArrayData} attribute is enable */ - public final boolean isVertexAttribArrayEnabled(GLArrayData data) { + public final boolean isVertexAttribArrayEnabled(final GLArrayData data) { return isVertexAttribArrayEnabled(data.getName()); } - private boolean enableVertexAttribArray(GL2ES2 gl, String name, int location) { + private boolean enableVertexAttribArray(final GL2ES2 gl, final String name, int location) { activedAttribEnabledMap.put(name, Boolean.TRUE); if(0>location) { location = getAttribLocation(gl, name); @@ -515,7 +516,7 @@ public class ShaderState { * @see #glVertexAttribPointer * @see #getVertexAttribPointer */ - public boolean enableVertexAttribArray(GL2ES2 gl, String name) { + public boolean enableVertexAttribArray(final GL2ES2 gl, final String name) { return enableVertexAttribArray(gl, name, -1); } @@ -541,7 +542,7 @@ public class ShaderState { * @see #getVertexAttribPointer * @see GLArrayDataEditable#enableBuffer(GL, boolean) */ - public boolean enableVertexAttribArray(GL2ES2 gl, GLArrayData data) { + public boolean enableVertexAttribArray(final GL2ES2 gl, final GLArrayData data) { if(0 > data.getLocation()) { getAttribLocation(gl, data); } else { @@ -551,7 +552,7 @@ public class ShaderState { return enableVertexAttribArray(gl, data.getName(), data.getLocation()); } - private boolean disableVertexAttribArray(GL2ES2 gl, String name, int location) { + private boolean disableVertexAttribArray(final GL2ES2 gl, final String name, int location) { activedAttribEnabledMap.put(name, Boolean.FALSE); if(0>location) { location = getAttribLocation(gl, name); @@ -591,7 +592,7 @@ public class ShaderState { * @see #glVertexAttribPointer * @see #getVertexAttribPointer */ - public boolean disableVertexAttribArray(GL2ES2 gl, String name) { + public boolean disableVertexAttribArray(final GL2ES2 gl, final String name) { return disableVertexAttribArray(gl, name, -1); } @@ -616,7 +617,7 @@ public class ShaderState { * @see #glVertexAttribPointer * @see #getVertexAttribPointer */ - public boolean disableVertexAttribArray(GL2ES2 gl, GLArrayData data) { + public boolean disableVertexAttribArray(final GL2ES2 gl, final GLArrayData data) { if(0 > data.getLocation()) { getAttribLocation(gl, data); } @@ -641,7 +642,7 @@ public class ShaderState { * @see #glVertexAttribPointer * @see #getVertexAttribPointer */ - public boolean vertexAttribPointer(GL2ES2 gl, GLArrayData data) { + public boolean vertexAttribPointer(final GL2ES2 gl, final GLArrayData data) { int location = data.getLocation(); if(0 > location) { location = getAttribLocation(gl, data); @@ -670,12 +671,12 @@ public class ShaderState { * @see #glResetAllVertexAttributes * @see ShaderProgram#glReplaceShader */ - public void releaseAllAttributes(GL2ES2 gl) { + public void releaseAllAttributes(final GL2ES2 gl) { if(null!=shaderProgram) { - for(Iterator iter = activeAttribDataMap.values().iterator(); iter.hasNext(); ) { + for(final Iterator iter = activeAttribDataMap.values().iterator(); iter.hasNext(); ) { disableVertexAttribArray(gl, iter.next()); } - for(Iterator iter = activedAttribEnabledMap.keySet().iterator(); iter.hasNext(); ) { + for(final Iterator iter = activedAttribEnabledMap.keySet().iterator(); iter.hasNext(); ) { disableVertexAttribArray(gl, iter.next()); } } @@ -702,8 +703,8 @@ public class ShaderState { * @see #glResetAllVertexAttributes * @see ShaderProgram#glReplaceShader */ - public void disableAllVertexAttributeArrays(GL2ES2 gl, boolean removeFromState) { - for(Iterator iter = activedAttribEnabledMap.keySet().iterator(); iter.hasNext(); ) { + public void disableAllVertexAttributeArrays(final GL2ES2 gl, final boolean removeFromState) { + for(final Iterator iter = activedAttribEnabledMap.keySet().iterator(); iter.hasNext(); ) { final String name = iter.next(); if(removeFromState) { activedAttribEnabledMap.remove(name); @@ -715,7 +716,7 @@ public class ShaderState { } } - private final void relocateAttribute(GL2ES2 gl, GLArrayData attribute) { + private final void relocateAttribute(final GL2ES2 gl, final GLArrayData attribute) { // get new location .. note: 'activeAttribLocationMap' is cleared before final String name = attribute.getName(); final int loc = attribute.setLocation(gl, shaderProgram.program()); @@ -760,19 +761,19 @@ public class ShaderState { * * @see #attachShaderProgram(GL2ES2, ShaderProgram) */ - private final void resetAllAttributes(GL2ES2 gl) { + private final void resetAllAttributes(final GL2ES2 gl) { if(!shaderProgram.linked()) throw new GLException("Program is not linked"); activeAttribLocationMap.clear(); for(int i=0; i iter = activeAttribDataMap.values().iterator(); iter.hasNext(); ) { + for(final Iterator iter = activeAttribDataMap.values().iterator(); iter.hasNext(); ) { relocateAttribute(gl, iter.next()); } } - private final void setAttribute(GL2ES2 gl, GLArrayData attribute) { + private final void setAttribute(final GL2ES2 gl, final GLArrayData attribute) { // get new location .. final String name = attribute.getName(); final int loc = attribute.getLocation(); @@ -798,8 +799,8 @@ public class ShaderState { /** * preserves the attribute location .. (program not linked) */ - private final void setAllAttributes(GL2ES2 gl) { - for(Iterator iter = activeAttribDataMap.values().iterator(); iter.hasNext(); ) { + private final void setAllAttributes(final GL2ES2 gl) { + for(final Iterator iter = activeAttribDataMap.values().iterator(); iter.hasNext(); ) { setAttribute(gl, iter.next()); } } @@ -814,8 +815,8 @@ public class ShaderState { * @return -1 if there is no such uniform available, * otherwise >= 0 */ - public final int getCachedUniformLocation(String name) { - Integer idx = activeUniformLocationMap.get(name); + public final int getCachedUniformLocation(final String name) { + final Integer idx = activeUniformLocationMap.get(name); return (null!=idx)?idx.intValue():-1; } @@ -833,7 +834,7 @@ public class ShaderState { * * @see #getUniform(String) */ - public void ownUniform(GLUniformData uniform) { + public void ownUniform(final GLUniformData uniform) { final int location = getCachedUniformLocation(uniform.getName()); if(0<=location) { uniform.setLocation(location); @@ -842,7 +843,7 @@ public class ShaderState { managedUniforms.add(uniform); } - public boolean ownsUniform(GLUniformData uniform) { + public boolean ownsUniform(final GLUniformData uniform) { return managedUniforms.contains(uniform); } @@ -865,14 +866,14 @@ public class ShaderState { * @see #getUniformLocation * @see ShaderProgram#glReplaceShader */ - public final int getUniformLocation(GL2ES2 gl, String name) { + public final int getUniformLocation(final GL2ES2 gl, final String name) { if(!shaderProgram.inUse()) throw new GLException("Program is not in use"); int location = getCachedUniformLocation(name); if(0>location) { if(!shaderProgram.linked()) throw new GLException("Program is not linked"); location = gl.glGetUniformLocation(shaderProgram.program(), name); if(0<=location) { - Integer idx = new Integer(location); + final Integer idx = new Integer(location); activeUniformLocationMap.put(name, idx); } else if(verbose) { System.err.println("ShaderState: glUniform failed, no location for: "+name+", index: "+location); @@ -904,7 +905,7 @@ public class ShaderState { * @see #getUniformLocation * @see ShaderProgram#glReplaceShader */ - public int getUniformLocation(GL2ES2 gl, GLUniformData data) { + public int getUniformLocation(final GL2ES2 gl, final GLUniformData data) { if(!shaderProgram.inUse()) throw new GLException("Program is not in use"); final String name = data.getName(); int location = getCachedUniformLocation(name); @@ -942,7 +943,7 @@ public class ShaderState { * @see #getUniformLocation * @see ShaderProgram#glReplaceShader */ - public boolean uniform(GL2ES2 gl, GLUniformData data) { + public boolean uniform(final GL2ES2 gl, final GLUniformData data) { if(!shaderProgram.inUse()) throw new GLException("Program is not in use"); int location = data.getLocation(); if(0>location) { @@ -964,7 +965,7 @@ public class ShaderState { * * @return the GLUniformData object, null if not previously set. */ - public GLUniformData getUniform(String name) { + public GLUniformData getUniform(final String name) { return activeUniformDataMap.get(name); } @@ -972,7 +973,7 @@ public class ShaderState { * Releases all mapped uniform data * and loses all indices */ - public void releaseAllUniforms(GL2ES2 gl) { + public void releaseAllUniforms(final GL2ES2 gl) { activeUniformDataMap.clear(); activeUniformLocationMap.clear(); managedUniforms.clear(); @@ -993,13 +994,13 @@ public class ShaderState { * * @see #attachShaderProgram(GL2ES2, ShaderProgram) */ - private final void resetAllUniforms(GL2ES2 gl) { + private final void resetAllUniforms(final GL2ES2 gl) { if(!shaderProgram.inUse()) throw new GLException("Program is not in use"); activeUniformLocationMap.clear(); - for(Iterator iter = managedUniforms.iterator(); iter.hasNext(); ) { + for(final Iterator iter = managedUniforms.iterator(); iter.hasNext(); ) { iter.next().setLocation(-1); } - for(Iterator iter = activeUniformDataMap.values().iterator(); iter.hasNext(); ) { + for(final Iterator iter = activeUniformDataMap.values().iterator(); iter.hasNext(); ) { final GLUniformData data = iter.next(); final int loc = data.setLocation(gl, shaderProgram.program()); if( 0 <= loc ) { @@ -1013,7 +1014,7 @@ public class ShaderState { } } - public StringBuilder toString(StringBuilder sb, boolean alsoUnlocated) { + public StringBuilder toString(StringBuilder sb, final boolean alsoUnlocated) { if(null==sb) { sb = new StringBuilder(); } @@ -1028,35 +1029,35 @@ public class ShaderState { } sb.append(Platform.getNewline()).append(" enabledAttributes ["); { - Iterator names = activedAttribEnabledMap.keySet().iterator(); - Iterator values = activedAttribEnabledMap.values().iterator(); + final Iterator names = activedAttribEnabledMap.keySet().iterator(); + final Iterator values = activedAttribEnabledMap.values().iterator(); while( names.hasNext() ) { sb.append(Platform.getNewline()).append(" ").append(names.next()).append(": ").append(values.next()); } } sb.append(Platform.getNewline()).append(" ],").append(" activeAttributes ["); - for(Iterator iter = activeAttribDataMap.values().iterator(); iter.hasNext(); ) { + for(final Iterator iter = activeAttribDataMap.values().iterator(); iter.hasNext(); ) { final GLArrayData ad = iter.next(); if( alsoUnlocated || 0 <= ad.getLocation() ) { sb.append(Platform.getNewline()).append(" ").append(ad); } } sb.append(Platform.getNewline()).append(" ],").append(" managedAttributes ["); - for(Iterator iter = managedAttributes.iterator(); iter.hasNext(); ) { + for(final Iterator iter = managedAttributes.iterator(); iter.hasNext(); ) { final GLArrayData ad = iter.next(); if( alsoUnlocated || 0 <= ad.getLocation() ) { sb.append(Platform.getNewline()).append(" ").append(ad); } } sb.append(Platform.getNewline()).append(" ],").append(" activeUniforms ["); - for(Iterator iter=activeUniformDataMap.values().iterator(); iter.hasNext(); ) { + for(final Iterator iter=activeUniformDataMap.values().iterator(); iter.hasNext(); ) { final GLUniformData ud = iter.next(); if( alsoUnlocated || 0 <= ud.getLocation() ) { sb.append(Platform.getNewline()).append(" ").append(ud); } } sb.append(Platform.getNewline()).append(" ],").append(" managedUniforms ["); - for(Iterator iter = managedUniforms.iterator(); iter.hasNext(); ) { + for(final Iterator iter = managedUniforms.iterator(); iter.hasNext(); ) { final GLUniformData ud = iter.next(); if( alsoUnlocated || 0 <= ud.getLocation() ) { sb.append(Platform.getNewline()).append(" ").append(ud); diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java index ad5331a28..b927e8ceb 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/ShaderUtil.java @@ -43,49 +43,49 @@ import com.jogamp.common.nio.Buffers; import com.jogamp.opengl.GLExtensions; public class ShaderUtil { - public static String getShaderInfoLog(GL _gl, int shaderObj) { + public static String getShaderInfoLog(final GL _gl, final int shaderObj) { final GL2ES2 gl = _gl.getGL2ES2(); - int[] infoLogLength=new int[1]; + final int[] infoLogLength=new int[1]; gl.glGetShaderiv(shaderObj, GL2ES2.GL_INFO_LOG_LENGTH, infoLogLength, 0); if(infoLogLength[0]==0) { return "(no info log)"; } - int[] charsWritten=new int[1]; - byte[] infoLogBytes = new byte[infoLogLength[0]]; + final int[] charsWritten=new int[1]; + final byte[] infoLogBytes = new byte[infoLogLength[0]]; gl.glGetShaderInfoLog(shaderObj, infoLogLength[0], charsWritten, 0, infoLogBytes, 0); return new String(infoLogBytes, 0, charsWritten[0]); } - public static String getProgramInfoLog(GL _gl, int programObj) { + public static String getProgramInfoLog(final GL _gl, final int programObj) { final GL2ES2 gl = _gl.getGL2ES2(); - int[] infoLogLength=new int[1]; + final int[] infoLogLength=new int[1]; gl.glGetProgramiv(programObj, GL2ES2.GL_INFO_LOG_LENGTH, infoLogLength, 0); if(infoLogLength[0]==0) { return "(no info log)"; } - int[] charsWritten=new int[1]; - byte[] infoLogBytes = new byte[infoLogLength[0]]; + final int[] charsWritten=new int[1]; + final byte[] infoLogBytes = new byte[infoLogLength[0]]; gl.glGetProgramInfoLog(programObj, infoLogLength[0], charsWritten, 0, infoLogBytes, 0); return new String(infoLogBytes, 0, charsWritten[0]); } - public static boolean isShaderStatusValid(GL _gl, int shaderObj, int name, PrintStream verboseOut) { + public static boolean isShaderStatusValid(final GL _gl, final int shaderObj, final int name, final PrintStream verboseOut) { final GL2ES2 gl = _gl.getGL2ES2(); - int[] ires = new int[1]; + final int[] ires = new int[1]; gl.glGetShaderiv(shaderObj, name, ires, 0); - boolean res = ires[0]==1; + final boolean res = ires[0]==1; if(!res && null!=verboseOut) { verboseOut.println("Shader status invalid: "+ getShaderInfoLog(gl, shaderObj)); } return res; } - public static boolean isShaderStatusValid(GL _gl, IntBuffer shaders, int name, PrintStream verboseOut) { + public static boolean isShaderStatusValid(final GL _gl, final IntBuffer shaders, final int name, final PrintStream verboseOut) { boolean res = true; for (int i = shaders.position(); i < shaders.limit(); i++) { res = isShaderStatusValid(_gl, shaders.get(i), name, verboseOut) && res; @@ -93,15 +93,15 @@ public class ShaderUtil { return res; } - public static boolean isProgramStatusValid(GL _gl, int programObj, int name) { + public static boolean isProgramStatusValid(final GL _gl, final int programObj, final int name) { final GL2ES2 gl = _gl.getGL2ES2(); - int[] ires = new int[1]; + final int[] ires = new int[1]; gl.glGetProgramiv(programObj, name, ires, 0); return ires[0]==1; } - public static boolean isProgramLinkStatusValid(GL _gl, int programObj, PrintStream verboseOut) { + public static boolean isProgramLinkStatusValid(final GL _gl, final int programObj, final PrintStream verboseOut) { final GL2ES2 gl = _gl.getGL2ES2(); if(!gl.glIsProgram(programObj)) { if(null!=verboseOut) { @@ -130,7 +130,7 @@ public class ShaderUtil { *

* @see GL2ES2#glValidateProgram(int) **/ - public static boolean isProgramExecStatusValid(GL _gl, int programObj, PrintStream verboseOut) { + public static boolean isProgramExecStatusValid(final GL _gl, final int programObj, final PrintStream verboseOut) { final GL2ES2 gl = _gl.getGL2ES2(); gl.glValidateProgram(programObj); if(!isProgramStatusValid(gl, programObj, GL2ES2.GL_VALIDATE_STATUS)) { @@ -142,7 +142,7 @@ public class ShaderUtil { return true; } - public static void createShader(GL _gl, int type, IntBuffer shaders) { + public static void createShader(final GL _gl, final int type, final IntBuffer shaders) { final GL2ES2 gl = _gl.getGL2ES2(); for (int i = shaders.position(); i < shaders.limit(); i++) { shaders.put(i, gl.glCreateShader(type)); @@ -154,7 +154,7 @@ public class ShaderUtil { * {@link GL2ES2#GL_NUM_SHADER_BINARY_FORMATS} and {@link GL2ES2#GL_SHADER_BINARY_FORMATS} * via {@link GL2ES2#glGetIntegerv(int, int[], int)}. */ - public static Set getShaderBinaryFormats(GL _gl) { + public static Set getShaderBinaryFormats(final GL _gl) { final GL2ES2 gl = _gl.getGL2ES2(); final ProfileInformation info = getProfileInformation(gl); if(null == info.shaderBinaryFormats) { @@ -166,13 +166,13 @@ public class ShaderUtil { final int err = gl.glGetError(); final int numFormats = GL.GL_NO_ERROR == err ? param[0] : 0; if(numFormats>0) { - int[] formats = new int[numFormats]; + final int[] formats = new int[numFormats]; gl.glGetIntegerv(GL2ES2.GL_SHADER_BINARY_FORMATS, formats, 0); for(int i=0; i= 0 || ctx.isExtensionAvailable(GLExtensions.ARB_geometry_shader4); } - public static void shaderSource(GL _gl, int shader, CharSequence[] source) + public static void shaderSource(final GL _gl, final int shader, final CharSequence[] source) { final GL2ES2 gl = _gl.getGL2ES2(); if(!isShaderCompilerAvailable(_gl)) { throw new GLException("No compiler is available"); } - int count = (null!=source)?source.length:0; + final int count = (null!=source)?source.length:0; if(count==0) { throw new GLException("No sources specified"); } - IntBuffer lengths = Buffers.newDirectIntBuffer(count); + final IntBuffer lengths = Buffers.newDirectIntBuffer(count); for(int i=0; i=binLength) { throw new GLException("Empty shader binary (remaining == 0)"); } gl.glShaderBinary(shaderNum, shaders, binFormat, bin, binLength); } - public static void compileShader(GL _gl, IntBuffer shaders) + public static void compileShader(final GL _gl, final IntBuffer shaders) { final GL2ES2 gl = _gl.getGL2ES2(); for (int i = shaders.position(); i < shaders.limit(); i++) { @@ -302,7 +302,7 @@ public class ShaderUtil { } } - public static void attachShader(GL _gl, int program, IntBuffer shaders) + public static void attachShader(final GL _gl, final int program, final IntBuffer shaders) { final GL2ES2 gl = _gl.getGL2ES2(); for (int i = shaders.position(); i < shaders.limit(); i++) { @@ -310,7 +310,7 @@ public class ShaderUtil { } } - public static void detachShader(GL _gl, int program, IntBuffer shaders) + public static void detachShader(final GL _gl, final int program, final IntBuffer shaders) { final GL2ES2 gl = _gl.getGL2ES2(); for (int i = shaders.position(); i < shaders.limit(); i++) { @@ -318,7 +318,7 @@ public class ShaderUtil { } } - public static void deleteShader(GL _gl, IntBuffer shaders) + public static void deleteShader(final GL _gl, final IntBuffer shaders) { final GL2ES2 gl = _gl.getGL2ES2(); for (int i = shaders.position(); i < shaders.limit(); i++) { @@ -327,9 +327,9 @@ public class ShaderUtil { } } - public static boolean createAndLoadShader(GL _gl, IntBuffer shader, int shaderType, - int binFormat, java.nio.Buffer bin, - PrintStream verboseOut) + public static boolean createAndLoadShader(final GL _gl, final IntBuffer shader, final int shaderType, + final int binFormat, final java.nio.Buffer bin, + final PrintStream verboseOut) { final GL2ES2 gl = _gl.getGL2ES2(); int err = gl.glGetError(); // flush previous errors .. @@ -352,9 +352,9 @@ public class ShaderUtil { return err == GL.GL_NO_ERROR; } - public static boolean createAndCompileShader(GL _gl, IntBuffer shader, int shaderType, - CharSequence[][] sources, - PrintStream verboseOut) + public static boolean createAndCompileShader(final GL _gl, final IntBuffer shader, final int shaderType, + final CharSequence[][] sources, + final PrintStream verboseOut) { final GL2ES2 gl = _gl.getGL2ES2(); int err = gl.glGetError(); // flush previous errors .. @@ -390,7 +390,7 @@ public class ShaderUtil { Set shaderBinaryFormats = null; } - private static ProfileInformation getProfileInformation(GL gl) { + private static ProfileInformation getProfileInformation(final GL gl) { final GLContext context = gl.getContext(); context.validateCurrent(); ProfileInformation data = (ProfileInformation) context.getAttachedObject(implObjectKey); diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java index 2f8884a3a..1ed875f27 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/fixedfunc/FixedFuncUtil.java @@ -37,7 +37,7 @@ public class FixedFuncUtil { * @see ShaderSelectionMode#COLOR_TEXTURE * @see ShaderSelectionMode#COLOR_TEXTURE_LIGHT_PER_VERTEX */ - public static final GL2ES1 wrapFixedFuncEmul(GL gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix, boolean force, boolean verbose) { + public static final GL2ES1 wrapFixedFuncEmul(final GL gl, final ShaderSelectionMode mode, final PMVMatrix pmvMatrix, final boolean force, final boolean verbose) { if(gl.isGL2ES2() && ( !gl.isGL2ES1() || force ) ) { final GL2ES2 es2 = gl.getGL2ES2(); final FixedFuncHook hook = new FixedFuncHook(es2, mode, pmvMatrix); @@ -66,7 +66,7 @@ public class FixedFuncUtil { * @see ShaderSelectionMode#COLOR_TEXTURE * @see ShaderSelectionMode#COLOR_TEXTURE_LIGHT_PER_VERTEX */ - public static final GL2ES1 wrapFixedFuncEmul(GL gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix) { + public static final GL2ES1 wrapFixedFuncEmul(final GL gl, final ShaderSelectionMode mode, final PMVMatrix pmvMatrix) { return wrapFixedFuncEmul(gl, mode, null, false, false); } @@ -90,7 +90,7 @@ public class FixedFuncUtil { * @see javax.media.opengl.fixedfunc.GLPointerFunc#glNormalPointer * @see javax.media.opengl.fixedfunc.GLPointerFunc#glTexCoordPointer */ - public static String getPredefinedArrayIndexName(int glArrayIndex) { + public static String getPredefinedArrayIndexName(final int glArrayIndex) { return GLPointerFuncUtil.getPredefinedArrayIndexName(glArrayIndex); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java index 44fbf1c6d..f113be2b2 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShader.java @@ -30,7 +30,7 @@ public abstract class CompileShader { public abstract String getFragmentShaderCompiler(); - public void processOneShader(String resourceName) + public void processOneShader(final String resourceName) throws IOException, UnsupportedEncodingException, InterruptedException { int type = -1; @@ -49,11 +49,11 @@ public abstract class CompileShader { suffixLen = 4; type = GL2ES2.GL_VERTEX_SHADER; } - String justName = basename(resourceName); + final String justName = basename(resourceName); outName = justName.substring(0, justName.length() - suffixLen) + ShaderCode.getFileSuffix(true, type); - URL resourceURL = IOUtil.getResource(null, resourceName).getURL(); - String dirName = dirname(resourceURL.getPath()); + final URL resourceURL = IOUtil.getResource(null, resourceName).getURL(); + final String dirName = dirname(resourceURL.getPath()); outName = dirName + File.separator + "bin" + File.separator + ShaderCode.getBinarySubPath(getBinaryFormat()) + File.separator + @@ -61,19 +61,19 @@ public abstract class CompileShader { processOneShader(resourceName, outName, type); } - public void processOneShader(String resourceName, String outName, int type) + public void processOneShader(final String resourceName, final String outName, final int type) throws IOException, UnsupportedEncodingException, InterruptedException { - URL resourceURL = IOUtil.getResource(null, resourceName).getURL(); - String dirName = dirname(resourceURL.getPath()); + final URL resourceURL = IOUtil.getResource(null, resourceName).getURL(); + final String dirName = dirname(resourceURL.getPath()); - CharSequence shader = ShaderCode.readShaderSource(null, resourceName, false); + final CharSequence shader = ShaderCode.readShaderSource(null, resourceName, false); if(null==shader) { System.err.println("Can't find shader source " + resourceName + " - ignored"); return; } System.err.println("Preprocessing: "+ resourceName+", in dir: "+dirName); - String justName = basename(resourceName); + final String justName = basename(resourceName); String processor; switch (type) { case GL2ES2.GL_VERTEX_SHADER: @@ -85,26 +85,26 @@ public abstract class CompileShader { default: throw new GLException("Unknown shader type: "+type); } - File outputFile = new File(outName); + final File outputFile = new File(outName); // Write shader to a file in java.io.tmpdir - File tmpDir = new File(dirName+File.separator+"tmp"); + final File tmpDir = new File(dirName+File.separator+"tmp"); tmpDir.mkdirs(); - File tmpFile = new File(tmpDir, justName); - Writer writer = new BufferedWriter(new FileWriter(tmpFile)); + final File tmpFile = new File(tmpDir, justName); + final Writer writer = new BufferedWriter(new FileWriter(tmpFile)); writer.write(shader.toString(), 0, shader.length()); writer.flush(); writer.close(); System.err.println("Preprocessed: "+ tmpFile.getAbsolutePath()); - File processorDir = getSDKCompilerDir(); + final File processorDir = getSDKCompilerDir(); System.err.println("SDK: "+ processorDir.getAbsolutePath() + ", compiler: "+processor); System.err.println("Output: "+ outputFile.getAbsolutePath()); // Run the tool - Process process = Runtime.getRuntime().exec(new String[] { + final Process process = Runtime.getRuntime().exec(new String[] { processorDir.getAbsolutePath() + File.separator + processor, tmpFile.getAbsolutePath(), outputFile.getAbsolutePath() @@ -116,7 +116,7 @@ public abstract class CompileShader { // tmpFile.delete(); } - protected static String basename(String path) { + protected static String basename(final String path) { int lastSlash = path.lastIndexOf("/"); if (lastSlash < 0) { lastSlash = path.lastIndexOf("\\"); @@ -130,7 +130,7 @@ public abstract class CompileShader { return basename; } - protected static String dirname(String path) { + protected static String dirname(final String path) { int lastSlash = path.lastIndexOf("/"); if (lastSlash < 0) { lastSlash = path.lastIndexOf("\\"); @@ -144,19 +144,19 @@ public abstract class CompileShader { return dirname; } - public void run(String[] args) { + public void run(final String[] args) { try { for (int i = 0; i < args.length; i++) { processOneShader(args[i]); } - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } private static class StreamMonitor implements Runnable { - private InputStream istream; - public StreamMonitor(InputStream stream) { + private final InputStream istream; + public StreamMonitor(final InputStream stream) { istream = stream; new Thread(this, "Output Reader Thread").start(); } @@ -164,7 +164,7 @@ public abstract class CompileShader { @Override public void run() { - byte[] buffer = new byte[4096]; + final byte[] buffer = new byte[4096]; try { int numRead = 0; do { @@ -175,10 +175,10 @@ public abstract class CompileShader { } } while (numRead >= 0); } - catch (IOException e) { + catch (final IOException e) { try { istream.close(); - } catch (IOException e2) { + } catch (final IOException e2) { } // Should allow clean exit when process shuts down } diff --git a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShaderNVidia.java b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShaderNVidia.java index 215cf592b..9ff37c7ee 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShaderNVidia.java +++ b/src/jogl/classes/com/jogamp/opengl/util/glsl/sdk/CompileShaderNVidia.java @@ -13,7 +13,7 @@ public class CompileShaderNVidia extends CompileShader { private static final String NVAPSDK; static { - String nvapSDKProp = System.getProperty("NVAPSDK"); + final String nvapSDKProp = System.getProperty("NVAPSDK"); if (nvapSDKProp != null) { NVAPSDK = nvapSDKProp; } else { @@ -51,7 +51,7 @@ public class CompileShaderNVidia extends CompileShader { return "glslf.bat"; } - public static void main(String[] args) { + public static void main(final String[] args) { new CompileShaderNVidia().run(args); } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java index 9aadfba93..e694f1b33 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java +++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/Level.java @@ -42,29 +42,29 @@ package com.jogamp.opengl.util.packrect; import java.util.*; public class Level { - private int width; + private final int width; private int height; - private int yPos; - private LevelSet holder; + private final int yPos; + private final LevelSet holder; - private List rects = new ArrayList(); + private final List rects = new ArrayList(); private List freeList; private int nextAddX; static class RectXComparator implements Comparator { @Override - public int compare(Rect r1, Rect r2) { + public int compare(final Rect r1, final Rect r2) { return r1.x() - r2.x(); } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { return this == obj; } } private static final Comparator rectXComparator = new RectXComparator(); - public Level(int width, int height, int yPos, LevelSet holder) { + public Level(final int width, final int height, final int yPos, final LevelSet holder) { this.width = width; this.height = height; this.yPos = yPos; @@ -80,7 +80,7 @@ public class Level { in the RectanglePacker and allocation from the free list. More disruptive changes like compaction of the level must be requested explicitly. */ - public boolean add(Rect rect) { + public boolean add(final Rect rect) { if (rect.h() > height) { // See whether it's worth trying to expand vertically if (nextAddX + rect.w() > width) { @@ -108,8 +108,8 @@ public class Level { // See whether we can add from the free list if (freeList != null) { Rect candidate = null; - for (Iterator iter = freeList.iterator(); iter.hasNext(); ) { - Rect cur = iter.next(); + for (final Iterator iter = freeList.iterator(); iter.hasNext(); ) { + final Rect cur = iter.next(); if (cur.canContain(rect)) { candidate = cur; break; @@ -139,7 +139,7 @@ public class Level { } /** Removes the given Rect from this Level. */ - public boolean remove(Rect rect) { + public boolean remove(final Rect rect) { if (!rects.remove(rect)) return false; @@ -165,14 +165,14 @@ public class Level { /** Indicates whether this Level could satisfy an allocation request if it were compacted. */ - public boolean couldAllocateIfCompacted(Rect rect) { + public boolean couldAllocateIfCompacted(final Rect rect) { if (rect.h() > height) return false; if (freeList == null) return false; int freeListWidth = 0; - for (Iterator iter = freeList.iterator(); iter.hasNext(); ) { - Rect cur = iter.next(); + for (final Iterator iter = freeList.iterator(); iter.hasNext(); ) { + final Rect cur = iter.next(); freeListWidth += cur.w(); } // Add on the remaining space at the end @@ -180,12 +180,12 @@ public class Level { return (freeListWidth >= rect.w()); } - public void compact(Object backingStore, BackingStoreManager manager) { + public void compact(final Object backingStore, final BackingStoreManager manager) { Collections.sort(rects, rectXComparator); int nextCompactionDest = 0; manager.beginMovement(backingStore, backingStore); - for (Iterator iter = rects.iterator(); iter.hasNext(); ) { - Rect cur = iter.next(); + for (final Iterator iter = rects.iterator(); iter.hasNext(); ) { + final Rect cur = iter.next(); if (cur.x() != nextCompactionDest) { manager.move(backingStore, cur, backingStore, new Rect(nextCompactionDest, cur.y(), cur.w(), cur.h(), null)); @@ -203,9 +203,9 @@ public class Level { } /** Visits all Rects contained in this Level. */ - public void visit(RectVisitor visitor) { - for (Iterator iter = rects.iterator(); iter.hasNext(); ) { - Rect rect = iter.next(); + public void visit(final RectVisitor visitor) { + for (final Iterator iter = rects.iterator(); iter.hasNext(); ) { + final Rect rect = iter.next(); visitor.visit(rect); } } @@ -216,8 +216,8 @@ public class Level { original Rects. */ public void updateRectangleReferences() { for (int i = 0; i < rects.size(); i++) { - Rect cur = rects.get(i); - Rect next = cur.getNextLocation(); + final Rect cur = rects.get(i); + final Rect next = cur.getNextLocation(); next.setPosition(cur.x(), cur.y()); if (cur.w() != next.w() || cur.h() != next.h()) throw new RuntimeException("Unexpected disparity in rectangle sizes during updateRectangleReferences"); @@ -235,8 +235,8 @@ public class Level { Collections.sort(freeList, rectXComparator); int i = 0; while (i < freeList.size() - 1) { - Rect r1 = freeList.get(i); - Rect r2 = freeList.get(i+1); + final Rect r1 = freeList.get(i); + final Rect r2 = freeList.get(i+1); if (r1.maxX() + 1 == r2.x()) { // Coalesce r1 and r2 into one block freeList.remove(i+1); @@ -246,7 +246,7 @@ public class Level { } } // See whether the last block bumps up against the addition point - Rect last = freeList.get(freeList.size() - 1); + final Rect last = freeList.get(freeList.size() - 1); if (last.maxX() + 1 == nextAddX) { nextAddX -= last.w(); freeList.remove(freeList.size() - 1); @@ -262,8 +262,8 @@ public class Level { public void dumpFreeSpace() { int freeListWidth = 0; - for (Iterator iter = freeList.iterator(); iter.hasNext(); ) { - Rect cur = iter.next(); + for (final Iterator iter = freeList.iterator(); iter.hasNext(); ) { + final Rect cur = iter.next(); System.err.println(" Free rectangle at " + cur); freeListWidth += cur.w(); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java index 433421f1a..803ca28cf 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java +++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/LevelSet.java @@ -47,14 +47,14 @@ import java.util.*; public class LevelSet { // Maintained in sorted order by increasing Y coordinate - private List levels = new ArrayList(); + private final List levels = new ArrayList(); private int nextAddY; - private int w; + private final int w; private int h; /** A LevelSet manages all of the backing store for a region of a specified width and height. */ - public LevelSet(int w, int h) { + public LevelSet(final int w, final int h) { this.w = w; this.h = h; } @@ -66,14 +66,14 @@ public class LevelSet { the LevelSet given its current dimensions, false if not. Caller is responsible for performing compaction, expansion, etc. as a consequence. */ - public boolean add(Rect rect) { + public boolean add(final Rect rect) { if (rect.w() > w) return false; // Go in reverse order through the levels seeing whether we can // trivially satisfy the allocation request for (int i = levels.size() - 1; i >= 0; --i) { - Level level = levels.get(i); + final Level level = levels.get(i); if (level.add(rect)) return true; } @@ -82,7 +82,7 @@ public class LevelSet { // increases the computational complexity of the addition process, // but prevents us from expanding unnecessarily. for (int i = levels.size() - 1; i >= 0; --i) { - Level level = levels.get(i); + final Level level = levels.get(i); if (level.couldAllocateIfCompacted(rect)) return false; } @@ -92,19 +92,19 @@ public class LevelSet { if (nextAddY + rect.h() > h) return false; - Level newLevel = new Level(w, rect.h(), nextAddY, this); + final Level newLevel = new Level(w, rect.h(), nextAddY, this); levels.add(newLevel); nextAddY += rect.h(); - boolean res = newLevel.add(rect); + final boolean res = newLevel.add(rect); if (!res) throw new RuntimeException("Unexpected failure in addition to new Level"); return true; } /** Removes the given Rect from this LevelSet. */ - public boolean remove(Rect rect) { + public boolean remove(final Rect rect) { for (int i = levels.size() - 1; i >= 0; --i) { - Level level = levels.get(i); + final Level level = levels.get(i); if (level.remove(rect)) return true; } @@ -116,14 +116,14 @@ public class LevelSet { if necessary. This is the correct fallback path to {@link #add(Rect)} above. Returns true if allocated successfully, false otherwise (indicating the need to expand the backing store). */ - public boolean compactAndAdd(Rect rect, - Object backingStore, - BackingStoreManager manager) { + public boolean compactAndAdd(final Rect rect, + final Object backingStore, + final BackingStoreManager manager) { for (int i = levels.size() - 1; i >= 0; --i) { - Level level = levels.get(i); + final Level level = levels.get(i); if (level.couldAllocateIfCompacted(rect)) { level.compact(backingStore, manager); - boolean res = level.add(rect); + final boolean res = level.add(rect); if (!res) throw new RuntimeException("Unexpected failure to add after compaction"); return true; @@ -136,7 +136,7 @@ public class LevelSet { /** Indicates whether it's legal to trivially increase the height of the given Level. This is only possible if it's the last Level added and there's enough room in the backing store. */ - public boolean canExpand(Level level, int height) { + public boolean canExpand(final Level level, final int height) { if (levels.isEmpty()) return false; // Should not happen if (levels.get(levels.size() - 1) == level && @@ -145,7 +145,7 @@ public class LevelSet { return false; } - public void expand(Level level, int oldHeight, int newHeight) { + public void expand(final Level level, final int oldHeight, final int newHeight) { nextAddY += (newHeight - oldHeight); } @@ -156,7 +156,7 @@ public class LevelSet { /** Sets the height of this LevelSet. It is only legal to reduce the height to greater than or equal to the currently used height. */ - public void setHeight(int height) throws IllegalArgumentException { + public void setHeight(final int height) throws IllegalArgumentException { if (height < getUsedHeight()) { throw new IllegalArgumentException("May not reduce height below currently used height"); } @@ -170,11 +170,11 @@ public class LevelSet { it may be profitable to perform a compaction. */ public float verticalFragmentationRatio() { int freeHeight = 0; - int usedHeight = getUsedHeight(); + final int usedHeight = getUsedHeight(); if (usedHeight == 0) return 0.0f; - for (Iterator iter = iterator(); iter.hasNext(); ) { - Level level = iter.next(); + for (final Iterator iter = iterator(); iter.hasNext(); ) { + final Level level = iter.next(); if (level.isEmpty()) { freeHeight += level.h(); } @@ -187,9 +187,9 @@ public class LevelSet { } /** Visits all Rects contained in this LevelSet. */ - public void visit(RectVisitor visitor) { - for (Iterator iter = levels.iterator(); iter.hasNext(); ) { - Level level = iter.next(); + public void visit(final RectVisitor visitor) { + for (final Iterator iter = levels.iterator(); iter.hasNext(); ) { + final Level level = iter.next(); level.visit(visitor); } } @@ -199,8 +199,8 @@ public class LevelSet { update the new Rects in a newly laid-out LevelSet with the original Rects. */ public void updateRectangleReferences() { - for (Iterator iter = levels.iterator(); iter.hasNext(); ) { - Level level = iter.next(); + for (final Iterator iter = levels.iterator(); iter.hasNext(); ) { + final Level level = iter.next(); level.updateRectangleReferences(); } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java index 89f594230..cbf6b933c 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java +++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/Rect.java @@ -77,11 +77,11 @@ public class Rect { this(null); } - public Rect(Object userData) { + public Rect(final Object userData) { this(0, 0, 0, 0, userData); } - public Rect(int x, int y, int w, int h, Object userData) { + public Rect(final int x, final int y, final int w, final int h, final Object userData) { setPosition(x, y); setSize(w, h); setUserData(userData); @@ -94,7 +94,7 @@ public class Rect { public Object getUserData() { return userData; } public Rect getNextLocation() { return nextLocation; } - public void setPosition(int x, int y) { + public void setPosition(final int x, final int y) { if (x < 0) throw new IllegalArgumentException("Negative x"); if (y < 0) @@ -103,7 +103,7 @@ public class Rect { this.y = y; } - public void setSize(int w, int h) throws IllegalArgumentException { + public void setSize(final int w, final int h) throws IllegalArgumentException { if (w < 0) throw new IllegalArgumentException("Negative width"); if (h < 0) @@ -112,8 +112,8 @@ public class Rect { this.h = h; } - public void setUserData(Object obj) { userData = obj; } - public void setNextLocation(Rect nextLocation) { this.nextLocation = nextLocation; } + public void setUserData(final Object obj) { userData = obj; } + public void setNextLocation(final Rect nextLocation) { this.nextLocation = nextLocation; } // Helpers for computations. @@ -139,7 +139,7 @@ public class Rect { return y() + h() - 1; } - public boolean canContain(Rect other) { + public boolean canContain(final Rect other) { return (w() >= other.w() && h() >= other.h()); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java b/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java index 44faa44b0..65f59ba53 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java +++ b/src/jogl/classes/com/jogamp/opengl/util/packrect/RectanglePacker.java @@ -48,34 +48,34 @@ import java.util.*; backing store, when necessary. */ public class RectanglePacker { - private BackingStoreManager manager; + private final BackingStoreManager manager; private Object backingStore; private LevelSet levels; - private float EXPANSION_FACTOR = 0.5f; - private float SHRINK_FACTOR = 0.3f; + private final float EXPANSION_FACTOR = 0.5f; + private final float SHRINK_FACTOR = 0.3f; - private int initialWidth; - private int initialHeight; + private final int initialWidth; + private final int initialHeight; private int maxWidth = -1; private int maxHeight = -1; static class RectHComparator implements Comparator { @Override - public int compare(Rect r1, Rect r2) { + public int compare(final Rect r1, final Rect r2) { return r2.h() - r1.h(); } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { return this == obj; } } private static final Comparator rectHComparator = new RectHComparator(); - public RectanglePacker(BackingStoreManager manager, - int initialWidth, - int initialHeight) { + public RectanglePacker(final BackingStoreManager manager, + final int initialWidth, + final int initialHeight) { this.manager = manager; levels = new LevelSet(initialWidth, initialHeight); this.initialWidth = initialWidth; @@ -95,7 +95,7 @@ public class RectanglePacker { necessary. Setting up a maximum width and height introduces the possibility that additions will fail; these are handled with the BackingStoreManager's allocationFailed notification. */ - public void setMaxSize(int maxWidth, int maxHeight) { + public void setMaxSize(final int maxWidth, final int maxHeight) { this.maxWidth = maxWidth; this.maxHeight = maxHeight; } @@ -107,7 +107,7 @@ public class RectanglePacker { BackingStoreManager#preExpand BackingStoreManager.preExpand} does not clear enough space for the incoming rectangle, then this method will throw a RuntimeException. */ - public void add(Rect rect) throws RuntimeException { + public void add(final Rect rect) throws RuntimeException { // Allocate backing store if we don't have any yet if (backingStore == null) backingStore = manager.allocateBackingStore(levels.w(), levels.h()); @@ -143,12 +143,12 @@ public class RectanglePacker { } /** Removes the given rectangle from this RectanglePacker. */ - public void remove(Rect rect) { + public void remove(final Rect rect) { levels.remove(rect); } /** Visits all Rects contained in this RectanglePacker. */ - public void visit(RectVisitor visitor) { + public void visit(final RectVisitor visitor) { levels.visit(visitor); } @@ -168,7 +168,7 @@ public class RectanglePacker { } // The "cause" rect may be null - private void compactImpl(Rect cause) { + private void compactImpl(final Rect cause) { // Have to either expand, compact or both. Need to figure out what // direction to go. Prefer to expand vertically. Expand // horizontally only if rectangle being added is too wide. FIXME: @@ -205,12 +205,12 @@ public class RectanglePacker { nextLevelSet = new LevelSet(newWidth, newHeight); // Make copies of all existing rectangles - List newRects = new ArrayList(); - for (Iterator i1 = levels.iterator(); i1.hasNext(); ) { - Level level = i1.next(); - for (Iterator i2 = level.iterator(); i2.hasNext(); ) { - Rect cur = i2.next(); - Rect newRect = new Rect(0, 0, cur.w(), cur.h(), null); + final List newRects = new ArrayList(); + for (final Iterator i1 = levels.iterator(); i1.hasNext(); ) { + final Level level = i1.next(); + for (final Iterator i2 = level.iterator(); i2.hasNext(); ) { + final Rect cur = i2.next(); + final Rect newRect = new Rect(0, 0, cur.w(), cur.h(), null); cur.setNextLocation(newRect); // Hook up the reverse mapping too for easier replacement newRect.setNextLocation(cur); @@ -222,7 +222,7 @@ public class RectanglePacker { Collections.sort(newRects, rectHComparator); // Try putting all of these rectangles into the new level set done = true; - for (Iterator iter = newRects.iterator(); iter.hasNext(); ) { + for (final Iterator iter = newRects.iterator(); iter.hasNext(); ) { if (!nextLevelSet.add(iter.next())) { done = false; break; @@ -268,13 +268,13 @@ public class RectanglePacker { // new locations of rectangles on the backing store. Allocate a // new backing store, move the contents over and deallocate the // old one. - Object newBackingStore = manager.allocateBackingStore(nextLevelSet.w(), + final Object newBackingStore = manager.allocateBackingStore(nextLevelSet.w(), nextLevelSet.h()); manager.beginMovement(backingStore, newBackingStore); - for (Iterator i1 = levels.iterator(); i1.hasNext(); ) { - Level level = i1.next(); - for (Iterator i2 = level.iterator(); i2.hasNext(); ) { - Rect cur = i2.next(); + for (final Iterator i1 = levels.iterator(); i1.hasNext(); ) { + final Level level = i1.next(); + for (final Iterator i2 = level.iterator(); i2.hasNext(); ) { + final Rect cur = i2.next(); manager.move(backingStore, cur, newBackingStore, cur.getNextLocation()); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java b/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java index a2d202d11..f5ef5672f 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/ImageSequence.java @@ -77,7 +77,7 @@ public class ImageSequence implements TextureSequence { } public final void addFrame(final GL gl, final Class context, final String imageResourcePath, final String imageSuffix) throws IOException { - URLConnection urlConn = IOUtil.getResource(context, imageResourcePath); + final URLConnection urlConn = IOUtil.getResource(context, imageResourcePath); if(null != urlConn) { final TextureData texData = TextureIO.newTextureData(GLProfile.getGL2ES2(), urlConn.getInputStream(), false, imageSuffix); final Texture tex = new Texture(getTextureTarget()); @@ -97,7 +97,7 @@ public class ImageSequence implements TextureSequence { public final boolean getManualStepping() { return manualStepping; } public final TextureSequence.TextureFrame getFrame(final int idx) { return frames.get(idx); } - public void destroy(GL gl) throws GLException { + public void destroy(final GL gl) throws GLException { for(int i=frames.size()-1; i>=0; i--) { frames.get(i).getTexture().destroy(gl); } @@ -133,7 +133,7 @@ public class ImageSequence implements TextureSequence { } @Override - public TextureSequence.TextureFrame getNextTexture(GL gl) throws IllegalStateException { + public TextureSequence.TextureFrame getNextTexture(final GL gl) throws IllegalStateException { if( !manualStepping ) { frameIdx = ( frameIdx + 1 ) % frames.size(); } @@ -153,7 +153,7 @@ public class ImageSequence implements TextureSequence { private String textureLookupFunctionName = "myTexture2D"; @Override - public String getTextureLookupFunctionName(String desiredFuncName) throws IllegalStateException { + public String getTextureLookupFunctionName(final String desiredFuncName) throws IllegalStateException { if(useBuildInTexLookup) { return "texture2D"; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java index 47be0714e..e7693f4a6 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/Texture.java @@ -205,7 +205,7 @@ public class Texture { private static final boolean disableNPOT = Debug.isPropertyDefined("jogl.texture.nonpot", true); private static final boolean disableTexRect = Debug.isPropertyDefined("jogl.texture.notexrect", true); - public Texture(GL gl, TextureData data) throws GLException { + public Texture(final GL gl, final TextureData data) throws GLException { texID = 0; updateImage(gl, data); } @@ -216,7 +216,7 @@ public class Texture { * @param target the OpenGL texture target, eg GL.GL_TEXTURE_2D, * GL2.GL_TEXTURE_RECTANGLE */ - public Texture(int target) { + public Texture(final int target) { texID = 0; this.target = target; } @@ -278,7 +278,7 @@ public class Texture { * @throws GLException if no OpenGL context was current or if any * OpenGL-related errors occurred */ - public void enable(GL gl) throws GLException { + public void enable(final GL gl) throws GLException { if( !gl.isGLcore() && GLES2.GL_TEXTURE_EXTERNAL_OES != target) { gl.glEnable(target); } @@ -305,7 +305,7 @@ public class Texture { * @throws GLException if no OpenGL context was current or if any * OpenGL-related errors occurred */ - public void disable(GL gl) throws GLException { + public void disable(final GL gl) throws GLException { if( !gl.isGLcore() && GLES2.GL_TEXTURE_EXTERNAL_OES != target ) { gl.glDisable(target); } @@ -325,7 +325,7 @@ public class Texture { * @throws GLException if no OpenGL context was current or if any * OpenGL-related errors occurred */ - public void bind(GL gl) throws GLException { + public void bind(final GL gl) throws GLException { validateTexID(gl, true); gl.glBindTexture(target, texID); } @@ -335,7 +335,7 @@ public class Texture { * * @throws GLException if any OpenGL-related errors occurred */ - public void destroy(GL gl) throws GLException { + public void destroy(final GL gl) throws GLException { if(0!=texID) { gl.glDeleteTextures(1, new int[] {texID}, 0); texID = 0; @@ -437,7 +437,7 @@ public class Texture { * * @return the texture coordinates corresponding to the specified sub-image */ - public TextureCoords getSubImageTexCoords(int x1, int y1, int x2, int y2) { + public TextureCoords getSubImageTexCoords(final int x1, final int y1, final int x2, final int y2) { if (target == GL2.GL_TEXTURE_RECTANGLE_ARB) { if (mustFlipVertically) { return new TextureCoords(x1, texHeight - y1, x2, texHeight - y2); @@ -445,12 +445,12 @@ public class Texture { return new TextureCoords(x1, y1, x2, y2); } } else { - float tx1 = (float)x1 / (float)texWidth; - float ty1 = (float)y1 / (float)texHeight; - float tx2 = (float)x2 / (float)texWidth; - float ty2 = (float)y2 / (float)texHeight; + final float tx1 = (float)x1 / (float)texWidth; + final float ty1 = (float)y1 / (float)texHeight; + final float tx2 = (float)x2 / (float)texWidth; + final float ty2 = (float)y2 / (float)texHeight; if (mustFlipVertically) { - float yMax = (float) imgHeight / (float) texHeight; + final float yMax = (float) imgHeight / (float) texHeight; return new TextureCoords(tx1, yMax - ty1, tx2, yMax - ty2); } else { return new TextureCoords(tx1, ty1, tx2, ty2); @@ -464,7 +464,7 @@ public class Texture { * * @throws GLException if any OpenGL-related errors occurred */ - public void updateImage(GL gl, TextureData data) throws GLException { + public void updateImage(final GL gl, final TextureData data) throws GLException { updateImage(gl, data, 0); } @@ -487,7 +487,7 @@ public class Texture { * No-op if no change, otherwise generates new {@link TextureCoords}. *

*/ - public void setMustFlipVertically(boolean v) { + public void setMustFlipVertically(final boolean v) { if( v != mustFlipVertically ) { mustFlipVertically = v; updateTexCoords(); @@ -501,7 +501,7 @@ public class Texture { * * @throws GLException if any OpenGL-related errors occurred */ - public void updateImage(GL gl, TextureData data, int targetOverride) throws GLException { + public void updateImage(final GL gl, final TextureData data, final int targetOverride) throws GLException { validateTexID(gl, true); imgWidth = data.getWidth(); @@ -522,7 +522,7 @@ public class Texture { data.setHaveGL12(gl.isExtensionAvailable(GLExtensions.VERSION_1_2)); // Indicates whether both width and height are power of two - boolean isPOT = isPowerOfTwo(imgWidth) && isPowerOfTwo(imgHeight); + final boolean isPOT = isPowerOfTwo(imgWidth) && isPowerOfTwo(imgHeight); // Note that automatic mipmap generation doesn't work for // GL_ARB_texture_rectangle @@ -634,7 +634,7 @@ public class Texture { } if (data.getMipmap() && !haveAutoMipmapGeneration) { - int[] align = new int[1]; + final int[] align = new int[1]; gl.glGetIntegerv(GL.GL_UNPACK_ALIGNMENT, align, 0); // save alignment gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, data.getAlignment()); @@ -644,7 +644,7 @@ public class Texture { try { // FIXME: may need check for GLUnsupportedException - GLU glu = GLU.createGLU(gl); + final GLU glu = GLU.createGLU(gl); glu.gluBuild2DMipmaps(texTarget, data.getInternalFormat(), data.getWidth(), data.getHeight(), data.getPixelFormat(), data.getPixelType(), data.getBuffer()); @@ -653,7 +653,7 @@ public class Texture { } } else { checkCompressedTextureExtensions(gl, data); - Buffer[] mipmapData = data.getMipmapData(); + final Buffer[] mipmapData = data.getMipmapData(); if (mipmapData != null) { int width = texWidth; int height = texHeight; @@ -684,7 +684,7 @@ public class Texture { texWidth, texHeight, data.getBorder(), data.getBuffer().capacity(), data.getBuffer()); } else { - ByteBuffer buf = DDSImage.allocateBlankBuffer(texWidth, + final ByteBuffer buf = DDSImage.allocateBlankBuffer(texWidth, texHeight, data.getInternalFormat()); gl.glCompressedTexImage2D(texTarget, 0, data.getInternalFormat(), @@ -710,9 +710,9 @@ public class Texture { } } - int minFilter = (data.getMipmap() ? GL.GL_LINEAR_MIPMAP_LINEAR : GL.GL_LINEAR); - int magFilter = GL.GL_LINEAR; - int wrapMode = (gl.isExtensionAvailable(GLExtensions.VERSION_1_2) || !gl.isGL2()) ? GL.GL_CLAMP_TO_EDGE : GL2.GL_CLAMP; + final int minFilter = (data.getMipmap() ? GL.GL_LINEAR_MIPMAP_LINEAR : GL.GL_LINEAR); + final int magFilter = GL.GL_LINEAR; + final int wrapMode = (gl.isExtensionAvailable(GLExtensions.VERSION_1_2) || !gl.isGL2()) ? GL.GL_CLAMP_TO_EDGE : GL2.GL_CLAMP; // REMIND: figure out what to do for GL_TEXTURE_RECTANGLE_ARB if (texTarget != GL2.GL_TEXTURE_RECTANGLE_ARB) { @@ -720,8 +720,8 @@ public class Texture { gl.glTexParameteri(texParamTarget, GL.GL_TEXTURE_MAG_FILTER, magFilter); gl.glTexParameteri(texParamTarget, GL.GL_TEXTURE_WRAP_S, wrapMode); gl.glTexParameteri(texParamTarget, GL.GL_TEXTURE_WRAP_T, wrapMode); - if (this.target == GL2.GL_TEXTURE_CUBE_MAP) { - gl.glTexParameteri(texParamTarget, GL2.GL_TEXTURE_WRAP_R, wrapMode); + if (this.target == GL.GL_TEXTURE_CUBE_MAP) { + gl.glTexParameteri(texParamTarget, GL2ES2.GL_TEXTURE_WRAP_R, wrapMode); } } @@ -758,7 +758,7 @@ public class Texture { * * @throws GLException if any OpenGL-related errors occurred */ - public void updateSubImage(GL gl, TextureData data, int mipmapLevel, int x, int y) throws GLException { + public void updateSubImage(final GL gl, final TextureData data, final int mipmapLevel, final int x, final int y) throws GLException { if (usingAutoMipmapGeneration && mipmapLevel != 0) { // When we're using mipmap generation via GL_GENERATE_MIPMAP, we // don't need to update other mipmap levels @@ -798,10 +798,10 @@ public class Texture { * @throws GLException if no OpenGL context was current or if any * OpenGL-related errors occurred */ - public void updateSubImage(GL gl, TextureData data, int mipmapLevel, - int dstx, int dsty, - int srcx, int srcy, - int width, int height) throws GLException { + public void updateSubImage(final GL gl, final TextureData data, final int mipmapLevel, + final int dstx, final int dsty, + final int srcx, final int srcy, + final int width, final int height) throws GLException { if (data.isDataCompressed()) { throw new GLException("updateSubImage specifying a sub-rectangle is not supported for compressed TextureData"); } @@ -823,8 +823,8 @@ public class Texture { * @throws GLException if no OpenGL context was current or if any * OpenGL-related errors occurred */ - public void setTexParameterf(GL gl, int parameterName, - float value) { + public void setTexParameterf(final GL gl, final int parameterName, + final float value) { bind(gl); gl.glTexParameterf(target, parameterName, value); } @@ -836,8 +836,8 @@ public class Texture { * * @throws GLException if any OpenGL-related errors occurred */ - public void setTexParameterfv(GL gl, int parameterName, - FloatBuffer params) { + public void setTexParameterfv(final GL gl, final int parameterName, + final FloatBuffer params) { bind(gl); gl.glTexParameterfv(target, parameterName, params); } @@ -849,8 +849,8 @@ public class Texture { * * @throws GLException if any OpenGL-related errors occurred */ - public void setTexParameterfv(GL gl, int parameterName, - float[] params, int params_offset) { + public void setTexParameterfv(final GL gl, final int parameterName, + final float[] params, final int params_offset) { bind(gl); gl.glTexParameterfv(target, parameterName, params, params_offset); } @@ -865,8 +865,8 @@ public class Texture { * * @throws GLException if any OpenGL-related errors occurred */ - public void setTexParameteri(GL gl, int parameterName, - int value) { + public void setTexParameteri(final GL gl, final int parameterName, + final int value) { bind(gl); gl.glTexParameteri(target, parameterName, value); } @@ -878,8 +878,8 @@ public class Texture { * * @throws GLException if any OpenGL-related errors occurred */ - public void setTexParameteriv(GL gl, int parameterName, - IntBuffer params) { + public void setTexParameteriv(final GL gl, final int parameterName, + final IntBuffer params) { bind(gl); gl.glTexParameteriv(target, parameterName, params); } @@ -891,8 +891,8 @@ public class Texture { * * @throws GLException if any OpenGL-related errors occurred */ - public void setTexParameteriv(GL gl, int parameterName, - int[] params, int params_offset) { + public void setTexParameteriv(final GL gl, final int parameterName, + final int[] params, final int params_offset) { bind(gl); gl.glTexParameteriv(target, parameterName, params, params_offset); } @@ -908,7 +908,7 @@ public class Texture { * otherwise it may be null. * @see #getTextureObject() */ - public int getTextureObject(GL gl) { + public int getTextureObject(final GL gl) { validateTexID(gl, false); return texID; } @@ -957,7 +957,7 @@ public class Texture { * * @return true if the given value is a power of two, false otherwise */ - private static boolean isPowerOfTwo(int val) { + private static boolean isPowerOfTwo(final int val) { return ((val & (val - 1)) == 0); } @@ -969,7 +969,7 @@ public class Texture { * @param val the value * @return the next power of two */ - private static int nextPowerOfTwo(int val) { + private static int nextPowerOfTwo(final int val) { int ret = 1; while (ret < val) { ret <<= 1; @@ -981,7 +981,7 @@ public class Texture { * Updates the actual image dimensions; usually only called from * updateImage. */ - private void setImageSize(int width, int height, int target) { + private void setImageSize(final int width, final int height, final int target) { imgWidth = width; imgHeight = height; updateTexCoords(); @@ -1010,7 +1010,7 @@ public class Texture { } } - private void updateSubImageImpl(GL gl, TextureData data, int newTarget, int mipmapLevel, + private void updateSubImageImpl(final GL gl, final TextureData data, final int newTarget, final int mipmapLevel, int dstx, int dsty, int srcx, int srcy, int width, int height) throws GLException { data.setHaveEXTABGR(gl.isExtensionAvailable(GLExtensions.EXT_abgr)); @@ -1081,15 +1081,15 @@ public class Texture { data.getInternalFormat(), buffer.remaining(), buffer); } else { - int[] align = { 0 }; - int[] rowLength = { 0 }; - int[] skipRows = { 0 }; - int[] skipPixels = { 0 }; + final int[] align = { 0 }; + final int[] rowLength = { 0 }; + final int[] skipRows = { 0 }; + final int[] skipPixels = { 0 }; gl.glGetIntegerv(GL.GL_UNPACK_ALIGNMENT, align, 0); // save alignment if(gl.isGL2GL3()) { - gl.glGetIntegerv(GL2GL3.GL_UNPACK_ROW_LENGTH, rowLength, 0); // save row length - gl.glGetIntegerv(GL2GL3.GL_UNPACK_SKIP_ROWS, skipRows, 0); // save skipped rows - gl.glGetIntegerv(GL2GL3.GL_UNPACK_SKIP_PIXELS, skipPixels, 0); // save skipped pixels + gl.glGetIntegerv(GL2ES2.GL_UNPACK_ROW_LENGTH, rowLength, 0); // save row length + gl.glGetIntegerv(GL2ES2.GL_UNPACK_SKIP_ROWS, skipRows, 0); // save skipped rows + gl.glGetIntegerv(GL2ES2.GL_UNPACK_SKIP_PIXELS, skipPixels, 0); // save skipped pixels } gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, data.getAlignment()); if (DEBUG && VERBOSE) { @@ -1102,9 +1102,9 @@ public class Texture { System.out.println("height = " + height); } if(gl.isGL2GL3()) { - gl.glPixelStorei(GL2GL3.GL_UNPACK_ROW_LENGTH, rowlen); - gl.glPixelStorei(GL2GL3.GL_UNPACK_SKIP_ROWS, srcy); - gl.glPixelStorei(GL2GL3.GL_UNPACK_SKIP_PIXELS, srcx); + gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, rowlen); + gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_ROWS, srcy); + gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_PIXELS, srcx); } else { if ( rowlen!=0 && rowlen!=width && srcy!=0 && srcx!=0 ) { @@ -1118,14 +1118,14 @@ public class Texture { buffer); gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, align[0]); // restore alignment if(gl.isGL2GL3()) { - gl.glPixelStorei(GL2GL3.GL_UNPACK_ROW_LENGTH, rowLength[0]); // restore row length - gl.glPixelStorei(GL2GL3.GL_UNPACK_SKIP_ROWS, skipRows[0]); // restore skipped rows - gl.glPixelStorei(GL2GL3.GL_UNPACK_SKIP_PIXELS, skipPixels[0]); // restore skipped pixels + gl.glPixelStorei(GL2ES2.GL_UNPACK_ROW_LENGTH, rowLength[0]); // restore row length + gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_ROWS, skipRows[0]); // restore skipped rows + gl.glPixelStorei(GL2ES2.GL_UNPACK_SKIP_PIXELS, skipPixels[0]); // restore skipped pixels } } } - private void checkCompressedTextureExtensions(GL gl, TextureData data) { + private void checkCompressedTextureExtensions(final GL gl, final TextureData data) { if (data.isDataCompressed()) { switch (data.getInternalFormat()) { case GL.GL_COMPRESSED_RGB_S3TC_DXT1_EXT: @@ -1145,10 +1145,10 @@ public class Texture { } } - private boolean validateTexID(GL gl, boolean throwException) { + private boolean validateTexID(final GL gl, final boolean throwException) { if( 0 == texID ) { if( null != gl ) { - int[] tmp = new int[1]; + final int[] tmp = new int[1]; gl.glGenTextures(1, tmp, 0); texID = tmp[0]; if ( 0 == texID && throwException ) { @@ -1162,22 +1162,22 @@ public class Texture { } // Helper routines for disabling certain codepaths - private static boolean haveNPOT(GL gl) { + private static boolean haveNPOT(final GL gl) { return !disableNPOT && gl.isNPOTTextureAvailable(); } - private static boolean haveTexRect(GL gl) { + private static boolean haveTexRect(final GL gl) { return (!disableTexRect && TextureIO.isTexRectEnabled() && gl.isExtensionAvailable(GLExtensions.ARB_texture_rectangle)); } - private static boolean preferTexRect(GL gl) { + private static boolean preferTexRect(final GL gl) { // Prefer GL_ARB_texture_rectangle on ATI hardware on Mac OS X // due to software fallbacks if (NativeWindowFactory.TYPE_MACOSX == NativeWindowFactory.getNativeWindowType(false)) { - String vendor = gl.glGetString(GL.GL_VENDOR); + final String vendor = gl.glGetString(GL.GL_VENDOR); if (vendor != null && vendor.startsWith("ATI")) { return true; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java index ba59f89c5..17fcc7016 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureCoords.java @@ -48,14 +48,14 @@ package com.jogamp.opengl.util.texture; public class TextureCoords { // These represent the lower-left point - private float left; - private float bottom; + private final float left; + private final float bottom; // These represent the upper-right point - private float right; - private float top; + private final float right; + private final float top; - public TextureCoords(float left, float bottom, - float right, float top) { + public TextureCoords(final float left, final float bottom, + final float right, final float top) { this.left = left; this.bottom = bottom; this.right = right; @@ -70,7 +70,7 @@ public class TextureCoords { * right top * */ - public float[] getST_LB_RB_LT_RT(float[] d, int d_off, float ss, float ts) { + public float[] getST_LB_RB_LT_RT(final float[] d, final int d_off, final float ss, final float ts) { d[0+d_off] = left *ss; d[1+d_off] = bottom*ts; d[2+d_off] = right *ss; d[3+d_off] = bottom*ts; d[4+d_off] = left *ss; d[5+d_off] = top *ts; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java index 5d88a76c0..5b2e4fc00 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureData.java @@ -41,6 +41,7 @@ import java.nio.Buffer; import javax.media.opengl.GLProfile; +import com.jogamp.common.nio.Buffers; import com.jogamp.opengl.util.GLBuffers; import com.jogamp.opengl.util.GLPixelBuffer.GLPixelAttributes; @@ -123,18 +124,18 @@ public class TextureData { * data were invalid, such as requesting mipmap generation for a * compressed texture */ - public TextureData(GLProfile glp, - int internalFormat, - int width, - int height, - int border, - int pixelFormat, - int pixelType, - boolean mipmap, - boolean dataIsCompressed, - boolean mustFlipVertically, - Buffer buffer, - Flusher flusher) throws IllegalArgumentException { + public TextureData(final GLProfile glp, + final int internalFormat, + final int width, + final int height, + final int border, + final int pixelFormat, + final int pixelType, + final boolean mipmap, + final boolean dataIsCompressed, + final boolean mustFlipVertically, + final Buffer buffer, + final Flusher flusher) throws IllegalArgumentException { this(glp, internalFormat, width, height, border, new GLPixelAttributes(pixelFormat, pixelType), mipmap, dataIsCompressed, mustFlipVertically, buffer, flusher); } @@ -178,17 +179,17 @@ public class TextureData { * data were invalid, such as requesting mipmap generation for a * compressed texture */ - public TextureData(GLProfile glp, - int internalFormat, - int width, - int height, - int border, - GLPixelAttributes pixelAttributes, - boolean mipmap, - boolean dataIsCompressed, - boolean mustFlipVertically, - Buffer buffer, - Flusher flusher) throws IllegalArgumentException { + public TextureData(final GLProfile glp, + final int internalFormat, + final int width, + final int height, + final int border, + final GLPixelAttributes pixelAttributes, + final boolean mipmap, + final boolean dataIsCompressed, + final boolean mustFlipVertically, + final Buffer buffer, + final Flusher flusher) throws IllegalArgumentException { if (mipmap && dataIsCompressed) { throw new IllegalArgumentException("Can not generate mipmaps for compressed textures"); } @@ -247,17 +248,17 @@ public class TextureData { * data were invalid, such as requesting mipmap generation for a * compressed texture */ - public TextureData(GLProfile glp, - int internalFormat, - int width, - int height, - int border, - int pixelFormat, - int pixelType, - boolean dataIsCompressed, - boolean mustFlipVertically, - Buffer[] mipmapData, - Flusher flusher) throws IllegalArgumentException { + public TextureData(final GLProfile glp, + final int internalFormat, + final int width, + final int height, + final int border, + final int pixelFormat, + final int pixelType, + final boolean dataIsCompressed, + final boolean mustFlipVertically, + final Buffer[] mipmapData, + final Flusher flusher) throws IllegalArgumentException { this(glp, internalFormat, width, height, border, new GLPixelAttributes(pixelFormat, pixelType), dataIsCompressed, mustFlipVertically, mipmapData, flusher); } @@ -300,16 +301,16 @@ public class TextureData { * data were invalid, such as requesting mipmap generation for a * compressed texture */ - public TextureData(GLProfile glp, - int internalFormat, - int width, - int height, - int border, - GLPixelAttributes pixelAttributes, - boolean dataIsCompressed, - boolean mustFlipVertically, - Buffer[] mipmapData, - Flusher flusher) throws IllegalArgumentException { + public TextureData(final GLProfile glp, + final int internalFormat, + final int width, + final int height, + final int border, + final GLPixelAttributes pixelAttributes, + final boolean dataIsCompressed, + final boolean mustFlipVertically, + final Buffer[] mipmapData, + final Flusher flusher) throws IllegalArgumentException { this.glProfile = glp; this.width = width; this.height = height; @@ -318,7 +319,7 @@ public class TextureData { this.internalFormat = internalFormat; this.dataIsCompressed = dataIsCompressed; this.mustFlipVertically = mustFlipVertically; - this.mipmapData = (Buffer[]) mipmapData.clone(); + this.mipmapData = mipmapData.clone(); this.flusher = flusher; alignment = 1; // FIXME: is this correct enough in all situations? for (int i = 0; i < mipmapData.length; i++) { @@ -336,10 +337,10 @@ public class TextureData { * Set the color space of the pixel data, which defaults to {@link ColorSpace#RGB}. * @see #getColorSpace() */ - public void setColorSpace(ColorSpace cs) { pixelCS = cs; } + public void setColorSpace(final ColorSpace cs) { pixelCS = cs; } /** Used only by subclasses */ - protected TextureData(GLProfile glp) { this.glProfile = glp; this.pixelAttributes = GLPixelAttributes.UNDEF; } + protected TextureData(final GLProfile glp) { this.glProfile = glp; this.pixelAttributes = GLPixelAttributes.UNDEF; } /** Returns the width in pixels of the texture data. */ public int getWidth() { return width; } @@ -399,20 +400,20 @@ public class TextureData { } /** Sets the width in pixels of the texture data. */ - public void setWidth(int width) { this.width = width; } + public void setWidth(final int width) { this.width = width; } /** Sets the height in pixels of the texture data. */ - public void setHeight(int height) { this.height = height; } + public void setHeight(final int height) { this.height = height; } /** Sets the border in pixels of the texture data. */ - public void setBorder(int border) { this.border = border; } + public void setBorder(final int border) { this.border = border; } /** Sets the intended OpenGL pixel format of the texture data. */ - public void setPixelAttributes(GLPixelAttributes pixelAttributes) { this.pixelAttributes = pixelAttributes; } + public void setPixelAttributes(final GLPixelAttributes pixelAttributes) { this.pixelAttributes = pixelAttributes; } /** * Sets the intended OpenGL pixel format component of {@link GLPixelAttributes} of the texture data. *

* Use {@link #setPixelAttributes(GLPixelAttributes)}, if setting format and type. *

*/ - public void setPixelFormat(int pixelFormat) { + public void setPixelFormat(final int pixelFormat) { if( pixelAttributes.format != pixelFormat ) { pixelAttributes = new GLPixelAttributes(pixelFormat, pixelAttributes.type); } @@ -423,42 +424,42 @@ public class TextureData { * Use {@link #setPixelAttributes(GLPixelAttributes)}, if setting format and type. *

*/ - public void setPixelType(int pixelType) { + public void setPixelType(final int pixelType) { if( pixelAttributes.type != pixelType) { pixelAttributes = new GLPixelAttributes(pixelAttributes.format, pixelType); } } /** Sets the intended OpenGL internal format of the texture data. */ - public void setInternalFormat(int internalFormat) { this.internalFormat = internalFormat; } + public void setInternalFormat(final int internalFormat) { this.internalFormat = internalFormat; } /** Sets whether mipmaps should be generated for the texture data. */ - public void setMipmap(boolean mipmap) { this.mipmap = mipmap; } + public void setMipmap(final boolean mipmap) { this.mipmap = mipmap; } /** Sets whether the texture data is in compressed form. */ - public void setIsDataCompressed(boolean compressed) { this.dataIsCompressed = compressed; } + public void setIsDataCompressed(final boolean compressed) { this.dataIsCompressed = compressed; } /** Sets whether the texture coordinates must be flipped vertically for proper display. */ - public void setMustFlipVertically(boolean mustFlipVertically) { this.mustFlipVertically = mustFlipVertically; } + public void setMustFlipVertically(final boolean mustFlipVertically) { this.mustFlipVertically = mustFlipVertically; } /** Sets the texture data. */ - public void setBuffer(Buffer buffer) { + public void setBuffer(final Buffer buffer) { this.buffer = buffer; estimatedMemorySize = estimatedMemorySize(buffer); } /** Sets the required byte alignment for the texture data. */ - public void setAlignment(int alignment) { this.alignment = alignment; } + public void setAlignment(final int alignment) { this.alignment = alignment; } /** Sets the row length needed for correct GL_UNPACK_ROW_LENGTH specification. This is currently only supported for non-mipmapped, non-compressed textures. */ - public void setRowLength(int rowLength) { this.rowLength = rowLength; } + public void setRowLength(final int rowLength) { this.rowLength = rowLength; } /** Indicates to this TextureData whether the GL_EXT_abgr extension is available. Used for optimization along some code paths to avoid data copies. */ - public void setHaveEXTABGR(boolean haveEXTABGR) { + public void setHaveEXTABGR(final boolean haveEXTABGR) { this.haveEXTABGR = haveEXTABGR; } /** Indicates to this TextureData whether OpenGL version 1.2 is available. If not, falls back to relatively inefficient code paths for several input data types (several kinds of packed pixel formats, in particular). */ - public void setHaveGL12(boolean haveGL12) { + public void setHaveGL12(final boolean haveGL12) { this.haveGL12 = haveGL12; } @@ -509,10 +510,10 @@ public class TextureData { // Internals only below this point // - protected static int estimatedMemorySize(Buffer buffer) { + protected static int estimatedMemorySize(final Buffer buffer) { if (buffer == null) { return 0; } - return buffer.capacity() * GLBuffers.sizeOfBufferElem(buffer); + return buffer.capacity() * Buffers.sizeOfBufferElem(buffer); } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java index b2bcd0de3..19f2fc05b 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureIO.java @@ -60,6 +60,7 @@ import javax.media.nativewindow.util.DimensionImmutable; import javax.media.nativewindow.util.PixelFormat; import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES3; import javax.media.opengl.GL2GL3; import javax.media.opengl.GLContext; import javax.media.opengl.GLException; @@ -209,8 +210,8 @@ public class TextureIO { * registered texture providers could read the file * @throws IOException if an error occurred while reading the file */ - public static TextureData newTextureData(GLProfile glp, File file, - boolean mipmap, + public static TextureData newTextureData(final GLProfile glp, final File file, + final boolean mipmap, String fileSuffix) throws IOException { if (fileSuffix == null) { fileSuffix = IOUtil.getFileSuffix(file); @@ -239,9 +240,9 @@ public class TextureIO { * registered texture providers could read the stream * @throws IOException if an error occurred while reading the stream */ - public static TextureData newTextureData(GLProfile glp, InputStream stream, - boolean mipmap, - String fileSuffix) throws IOException { + public static TextureData newTextureData(final GLProfile glp, final InputStream stream, + final boolean mipmap, + final String fileSuffix) throws IOException { return newTextureDataImpl(glp, stream, 0, 0, mipmap, fileSuffix); } @@ -266,8 +267,8 @@ public class TextureIO { * registered texture providers could read the URL * @throws IOException if an error occurred while reading the URL */ - public static TextureData newTextureData(GLProfile glp, URL url, - boolean mipmap, + public static TextureData newTextureData(final GLProfile glp, final URL url, + final boolean mipmap, String fileSuffix) throws IOException { if (fileSuffix == null) { fileSuffix = IOUtil.getFileSuffix(url.getPath()); @@ -314,10 +315,10 @@ public class TextureIO { * pixelFormat was 0 * @throws IOException if an error occurred while reading the file */ - public static TextureData newTextureData(GLProfile glp, File file, - int internalFormat, - int pixelFormat, - boolean mipmap, + public static TextureData newTextureData(final GLProfile glp, final File file, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, String fileSuffix) throws IOException, IllegalArgumentException { if ((internalFormat == 0) || (pixelFormat == 0)) { throw new IllegalArgumentException("internalFormat and pixelFormat must be non-zero"); @@ -362,11 +363,11 @@ public class TextureIO { * pixelFormat was 0 * @throws IOException if an error occurred while reading the stream */ - public static TextureData newTextureData(GLProfile glp, InputStream stream, - int internalFormat, - int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException, IllegalArgumentException { + public static TextureData newTextureData(final GLProfile glp, final InputStream stream, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, + final String fileSuffix) throws IOException, IllegalArgumentException { if ((internalFormat == 0) || (pixelFormat == 0)) { throw new IllegalArgumentException("internalFormat and pixelFormat must be non-zero"); } @@ -406,10 +407,10 @@ public class TextureIO { * pixelFormat was 0 * @throws IOException if an error occurred while reading the URL */ - public static TextureData newTextureData(GLProfile glp, URL url, - int internalFormat, - int pixelFormat, - boolean mipmap, + public static TextureData newTextureData(final GLProfile glp, final URL url, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, String fileSuffix) throws IOException, IllegalArgumentException { if ((internalFormat == 0) || (pixelFormat == 0)) { throw new IllegalArgumentException("internalFormat and pixelFormat must be non-zero"); @@ -435,7 +436,7 @@ public class TextureIO { * OpenGL error occurred * @throws IllegalArgumentException if the passed TextureData was null */ - public static Texture newTexture(TextureData data) throws GLException, IllegalArgumentException { + public static Texture newTexture(final TextureData data) throws GLException, IllegalArgumentException { return newTexture(GLContext.getCurrentGL(), data); } @@ -448,7 +449,7 @@ public class TextureIO { * OpenGL error occurred * @throws IllegalArgumentException if the passed TextureData was null */ - public static Texture newTexture(GL gl, TextureData data) throws GLException, IllegalArgumentException { + public static Texture newTexture(final GL gl, final TextureData data) throws GLException, IllegalArgumentException { if (data == null) { throw new IllegalArgumentException("Null TextureData"); } @@ -470,11 +471,11 @@ public class TextureIO { * @throws GLException if no OpenGL context is current or if an * OpenGL error occurred */ - public static Texture newTexture(File file, boolean mipmap) throws IOException, GLException { - GL gl = GLContext.getCurrentGL(); - GLProfile glp = gl.getGLProfile(); - TextureData data = newTextureData(glp, file, mipmap, IOUtil.getFileSuffix(file)); - Texture texture = newTexture(gl, data); + public static Texture newTexture(final File file, final boolean mipmap) throws IOException, GLException { + final GL gl = GLContext.getCurrentGL(); + final GLProfile glp = gl.getGLProfile(); + final TextureData data = newTextureData(glp, file, mipmap, IOUtil.getFileSuffix(file)); + final Texture texture = newTexture(gl, data); data.flush(); return texture; } @@ -499,11 +500,11 @@ public class TextureIO { * @throws GLException if no OpenGL context is current or if an * OpenGL error occurred */ - public static Texture newTexture(InputStream stream, boolean mipmap, String fileSuffix) throws IOException, GLException { - GL gl = GLContext.getCurrentGL(); - GLProfile glp = gl.getGLProfile(); - TextureData data = newTextureData(glp, stream, mipmap, fileSuffix); - Texture texture = newTexture(gl, data); + public static Texture newTexture(final InputStream stream, final boolean mipmap, final String fileSuffix) throws IOException, GLException { + final GL gl = GLContext.getCurrentGL(); + final GLProfile glp = gl.getGLProfile(); + final TextureData data = newTextureData(glp, stream, mipmap, fileSuffix); + final Texture texture = newTexture(gl, data); data.flush(); return texture; } @@ -528,14 +529,14 @@ public class TextureIO { * @throws GLException if no OpenGL context is current or if an * OpenGL error occurred */ - public static Texture newTexture(URL url, boolean mipmap, String fileSuffix) throws IOException, GLException { + public static Texture newTexture(final URL url, final boolean mipmap, String fileSuffix) throws IOException, GLException { if (fileSuffix == null) { fileSuffix = IOUtil.getFileSuffix(url.getPath()); } - GL gl = GLContext.getCurrentGL(); - GLProfile glp = gl.getGLProfile(); - TextureData data = newTextureData(glp, url, mipmap, fileSuffix); - Texture texture = newTexture(gl, data); + final GL gl = GLContext.getCurrentGL(); + final GLProfile glp = gl.getGLProfile(); + final TextureData data = newTextureData(glp, url, mipmap, fileSuffix); + final Texture texture = newTexture(gl, data); data.flush(); return texture; } @@ -549,7 +550,7 @@ public class TextureIO { * @param target the OpenGL target type, eg GL.GL_TEXTURE_2D, * GL.GL_TEXTURE_RECTANGLE_ARB */ - public static Texture newTexture(int target) { + public static Texture newTexture(final int target) { return new Texture(target); } @@ -579,31 +580,31 @@ public class TextureIO { * @throws GLException if no OpenGL context was current or an * OpenGL-related error occurred */ - public static void write(Texture texture, File file) throws IOException, GLException { + public static void write(final Texture texture, final File file) throws IOException, GLException { if (texture.getTarget() != GL.GL_TEXTURE_2D) { throw new GLException("Only GL_TEXTURE_2D textures are supported"); } // First fetch the texture data - GL _gl = GLContext.getCurrentGL(); + final GL _gl = GLContext.getCurrentGL(); if (!_gl.isGL2GL3()) { throw new GLException("Implementation only supports GL2GL3 (Use GLReadBufferUtil and the TextureData variant), have: " + _gl); } - GL2GL3 gl = _gl.getGL2(); + final GL2GL3 gl = _gl.getGL2(); texture.bind(gl); - int internalFormat = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2.GL_TEXTURE_INTERNAL_FORMAT); - int width = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2.GL_TEXTURE_WIDTH); - int height = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2.GL_TEXTURE_HEIGHT); - int border = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2.GL_TEXTURE_BORDER); + final int internalFormat = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2GL3.GL_TEXTURE_INTERNAL_FORMAT); + final int width = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2GL3.GL_TEXTURE_WIDTH); + final int height = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2GL3.GL_TEXTURE_HEIGHT); + final int border = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2.GL_TEXTURE_BORDER); TextureData data = null; if (internalFormat == GL.GL_COMPRESSED_RGB_S3TC_DXT1_EXT || internalFormat == GL.GL_COMPRESSED_RGBA_S3TC_DXT1_EXT || internalFormat == GL.GL_COMPRESSED_RGBA_S3TC_DXT3_EXT || internalFormat == GL.GL_COMPRESSED_RGBA_S3TC_DXT5_EXT) { // Fetch using glGetCompressedTexImage - int size = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2.GL_TEXTURE_COMPRESSED_IMAGE_SIZE); - ByteBuffer res = ByteBuffer.allocate(size); + final int size = glGetTexLevelParameteri(gl, GL.GL_TEXTURE_2D, 0, GL2GL3.GL_TEXTURE_COMPRESSED_IMAGE_SIZE); + final ByteBuffer res = ByteBuffer.allocate(size); gl.glGetCompressedTexImage(GL.GL_TEXTURE_2D, 0, res); data = new TextureData(gl.getGLProfile(), internalFormat, width, height, border, internalFormat, GL.GL_UNSIGNED_BYTE, false, true, true, res, null); @@ -612,7 +613,7 @@ public class TextureIO { int fetchedFormat = 0; switch (internalFormat) { case GL.GL_RGB: - case GL2.GL_BGR: + case GL2GL3.GL_BGR: case GL.GL_RGB8: bytesPerPixel = 3; fetchedFormat = GL.GL_RGB; @@ -629,19 +630,19 @@ public class TextureIO { } // Fetch using glGetTexImage - int packAlignment = glGetInteger(gl, GL.GL_PACK_ALIGNMENT); - int packRowLength = glGetInteger(gl, GL2.GL_PACK_ROW_LENGTH); - int packSkipRows = glGetInteger(gl, GL2.GL_PACK_SKIP_ROWS); - int packSkipPixels = glGetInteger(gl, GL2.GL_PACK_SKIP_PIXELS); - int packSwapBytes = glGetInteger(gl, GL2.GL_PACK_SWAP_BYTES); + final int packAlignment = glGetInteger(gl, GL.GL_PACK_ALIGNMENT); + final int packRowLength = glGetInteger(gl, GL2ES3.GL_PACK_ROW_LENGTH); + final int packSkipRows = glGetInteger(gl, GL2ES3.GL_PACK_SKIP_ROWS); + final int packSkipPixels = glGetInteger(gl, GL2ES3.GL_PACK_SKIP_PIXELS); + final int packSwapBytes = glGetInteger(gl, GL2GL3.GL_PACK_SWAP_BYTES); gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, 1); - gl.glPixelStorei(GL2.GL_PACK_ROW_LENGTH, 0); - gl.glPixelStorei(GL2.GL_PACK_SKIP_ROWS, 0); - gl.glPixelStorei(GL2.GL_PACK_SKIP_PIXELS, 0); - gl.glPixelStorei(GL2.GL_PACK_SWAP_BYTES, 0); + gl.glPixelStorei(GL2ES3.GL_PACK_ROW_LENGTH, 0); + gl.glPixelStorei(GL2ES3.GL_PACK_SKIP_ROWS, 0); + gl.glPixelStorei(GL2ES3.GL_PACK_SKIP_PIXELS, 0); + gl.glPixelStorei(GL2GL3.GL_PACK_SWAP_BYTES, 0); - ByteBuffer res = ByteBuffer.allocate((width + (2 * border)) * + final ByteBuffer res = ByteBuffer.allocate((width + (2 * border)) * (height + (2 * border)) * bytesPerPixel); if (DEBUG) { @@ -651,10 +652,10 @@ public class TextureIO { gl.glGetTexImage(GL.GL_TEXTURE_2D, 0, fetchedFormat, GL.GL_UNSIGNED_BYTE, res); gl.glPixelStorei(GL.GL_PACK_ALIGNMENT, packAlignment); - gl.glPixelStorei(GL2.GL_PACK_ROW_LENGTH, packRowLength); - gl.glPixelStorei(GL2.GL_PACK_SKIP_ROWS, packSkipRows); - gl.glPixelStorei(GL2.GL_PACK_SKIP_PIXELS, packSkipPixels); - gl.glPixelStorei(GL2.GL_PACK_SWAP_BYTES, packSwapBytes); + gl.glPixelStorei(GL2ES3.GL_PACK_ROW_LENGTH, packRowLength); + gl.glPixelStorei(GL2ES3.GL_PACK_SKIP_ROWS, packSkipRows); + gl.glPixelStorei(GL2ES3.GL_PACK_SKIP_PIXELS, packSkipPixels); + gl.glPixelStorei(GL2GL3.GL_PACK_SWAP_BYTES, packSwapBytes); data = new TextureData(gl.getGLProfile(), internalFormat, width, height, border, fetchedFormat, GL.GL_UNSIGNED_BYTE, false, false, false, res, null); @@ -668,9 +669,9 @@ public class TextureIO { write(data, file); } - public static void write(TextureData data, File file) throws IOException, GLException { - for (Iterator iter = textureWriters.iterator(); iter.hasNext(); ) { - TextureWriter writer = iter.next(); + public static void write(final TextureData data, final File file) throws IOException, GLException { + for (final Iterator iter = textureWriters.iterator(); iter.hasNext(); ) { + final TextureWriter writer = iter.next(); if (writer.write(file, data)) { return; } @@ -689,7 +690,7 @@ public class TextureIO { * The last provider added, will be the first provider to be tested. *

*/ - public static void addTextureProvider(TextureProvider provider) { + public static void addTextureProvider(final TextureProvider provider) { // Must always add at the front so the ImageIO provider is last, // so we don't accidentally use it instead of a user's possibly // more optimal provider @@ -702,7 +703,7 @@ public class TextureIO { * The last provider added, will be the first provider to be tested. *

*/ - public static void addTextureWriter(TextureWriter writer) { + public static void addTextureWriter(final TextureWriter writer) { // Must always add at the front so the ImageIO writer is last, // so we don't accidentally use it instead of a user's possibly // more optimal writer @@ -727,7 +728,7 @@ public class TextureIO { the GL_ARB_texture_rectangle extension to be turned off globally for this purpose. The default is that the use of the extension is enabled. */ - public static void setTexRectEnabled(boolean enabled) { + public static void setTexRectEnabled(final boolean enabled) { texRectEnabled = enabled; } @@ -750,10 +751,10 @@ public class TextureIO { if(GLProfile.isAWTAvailable()) { try { // Use reflection to avoid compile-time dependencies on AWT-related classes - TextureProvider provider = (TextureProvider) + final TextureProvider provider = (TextureProvider) Class.forName("com.jogamp.opengl.util.texture.spi.awt.IIOTextureProvider").newInstance(); addTextureProvider(provider); - } catch (Exception e) { + } catch (final Exception e) { if (DEBUG) { e.printStackTrace(); } @@ -771,14 +772,14 @@ public class TextureIO { if(GLProfile.isAWTAvailable()) { try { // Use reflection to avoid compile-time dependencies on AWT-related classes - TextureWriter writer = (TextureWriter) + final TextureWriter writer = (TextureWriter) Class.forName("com.jogamp.opengl.util.texture.spi.awt.IIOTextureWriter").newInstance(); addTextureWriter(writer); - } catch (Exception e) { + } catch (final Exception e) { if (DEBUG) { e.printStackTrace(); } - } catch (Error e) { + } catch (final Error e) { if (DEBUG) { e.printStackTrace(); } @@ -794,10 +795,10 @@ public class TextureIO { } // Implementation methods - private static TextureData newTextureDataImpl(GLProfile glp, File file, - int internalFormat, - int pixelFormat, - boolean mipmap, + private static TextureData newTextureDataImpl(final GLProfile glp, final File file, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, String fileSuffix) throws IOException { if (file == null) { throw new IOException("File was null"); @@ -805,9 +806,9 @@ public class TextureIO { fileSuffix = toLowerCase(fileSuffix); - for (Iterator iter = textureProviders.iterator(); iter.hasNext(); ) { - TextureProvider provider = iter.next(); - TextureData data = provider.newTextureData(glp, file, + for (final Iterator iter = textureProviders.iterator(); iter.hasNext(); ) { + final TextureProvider provider = iter.next(); + final TextureData data = provider.newTextureData(glp, file, internalFormat, pixelFormat, mipmap, @@ -820,10 +821,10 @@ public class TextureIO { throw new IOException("No suitable reader for given file "+file.getAbsolutePath()); } - private static TextureData newTextureDataImpl(GLProfile glp, InputStream stream, - int internalFormat, - int pixelFormat, - boolean mipmap, + private static TextureData newTextureDataImpl(final GLProfile glp, InputStream stream, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, String fileSuffix) throws IOException { if (stream == null) { throw new IOException("Stream was null"); @@ -836,9 +837,9 @@ public class TextureIO { stream = new BufferedInputStream(stream); } - for (Iterator iter = textureProviders.iterator(); iter.hasNext(); ) { - TextureProvider provider = iter.next(); - TextureData data = provider.newTextureData(glp, stream, + for (final Iterator iter = textureProviders.iterator(); iter.hasNext(); ) { + final TextureProvider provider = iter.next(); + final TextureData data = provider.newTextureData(glp, stream, internalFormat, pixelFormat, mipmap, @@ -851,10 +852,10 @@ public class TextureIO { throw new IOException("No suitable reader for given stream"); } - private static TextureData newTextureDataImpl(GLProfile glp, URL url, - int internalFormat, - int pixelFormat, - boolean mipmap, + private static TextureData newTextureDataImpl(final GLProfile glp, final URL url, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, String fileSuffix) throws IOException { if (url == null) { throw new IOException("URL was null"); @@ -862,9 +863,9 @@ public class TextureIO { fileSuffix = toLowerCase(fileSuffix); - for (Iterator iter = textureProviders.iterator(); iter.hasNext(); ) { - TextureProvider provider = iter.next(); - TextureData data = provider.newTextureData(glp, url, + for (final Iterator iter = textureProviders.iterator(); iter.hasNext(); ) { + final TextureProvider provider = iter.next(); + final TextureData data = provider.newTextureData(glp, url, internalFormat, pixelFormat, mipmap, @@ -881,14 +882,14 @@ public class TextureIO { // DDS provider -- supports files only for now static class DDSTextureProvider implements TextureProvider { @Override - public TextureData newTextureData(GLProfile glp, File file, - int internalFormat, - int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { + public TextureData newTextureData(final GLProfile glp, final File file, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, + final String fileSuffix) throws IOException { if (DDS.equals(fileSuffix) || DDS.equals(IOUtil.getFileSuffix(file))) { - DDSImage image = DDSImage.read(file); + final DDSImage image = DDSImage.read(file); return newTextureData(glp, image, internalFormat, pixelFormat, mipmap); } @@ -896,16 +897,16 @@ public class TextureIO { } @Override - public TextureData newTextureData(GLProfile glp, InputStream stream, - int internalFormat, - int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { + public TextureData newTextureData(final GLProfile glp, final InputStream stream, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, + final String fileSuffix) throws IOException { if (DDS.equals(fileSuffix) || DDSImage.isDDSImage(stream)) { - byte[] data = IOUtil.copyStream2ByteArray(stream); - ByteBuffer buf = ByteBuffer.wrap(data); - DDSImage image = DDSImage.read(buf); + final byte[] data = IOUtil.copyStream2ByteArray(stream); + final ByteBuffer buf = ByteBuffer.wrap(data); + final DDSImage image = DDSImage.read(buf); return newTextureData(glp, image, internalFormat, pixelFormat, mipmap); } @@ -913,12 +914,12 @@ public class TextureIO { } @Override - public TextureData newTextureData(GLProfile glp, URL url, - int internalFormat, - int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { - InputStream stream = new BufferedInputStream(url.openStream()); + public TextureData newTextureData(final GLProfile glp, final URL url, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, + final String fileSuffix) throws IOException { + final InputStream stream = new BufferedInputStream(url.openStream()); try { return newTextureData(glp, stream, internalFormat, pixelFormat, mipmap, fileSuffix); } finally { @@ -926,11 +927,11 @@ public class TextureIO { } } - private TextureData newTextureData(GLProfile glp, final DDSImage image, + private TextureData newTextureData(final GLProfile glp, final DDSImage image, int internalFormat, int pixelFormat, boolean mipmap) { - DDSImage.ImageInfo info = image.getMipMap(0); + final DDSImage.ImageInfo info = image.getMipMap(0); if (pixelFormat == 0) { switch (image.getPixelFormat()) { case DDSImage.D3DFMT_R8G8B8: @@ -967,7 +968,7 @@ public class TextureIO { break; } } - TextureData.Flusher flusher = new TextureData.Flusher() { + final TextureData.Flusher flusher = new TextureData.Flusher() { @Override public void flush() { image.close(); @@ -975,7 +976,7 @@ public class TextureIO { }; TextureData data; if (mipmap && image.getNumMipMaps() > 0) { - Buffer[] mipmapData = new Buffer[image.getNumMipMaps()]; + final Buffer[] mipmapData = new Buffer[image.getNumMipMaps()]; for (int i = 0; i < image.getNumMipMaps(); i++) { mipmapData[i] = image.getMipMap(i).getData(); } @@ -1013,12 +1014,12 @@ public class TextureIO { // Base class for SGI RGB and TGA image providers static abstract class StreamBasedTextureProvider implements TextureProvider { @Override - public TextureData newTextureData(GLProfile glp, File file, - int internalFormat, - int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { - InputStream inStream = new BufferedInputStream(new FileInputStream(file)); + public TextureData newTextureData(final GLProfile glp, final File file, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, + final String fileSuffix) throws IOException { + final InputStream inStream = new BufferedInputStream(new FileInputStream(file)); try { // The SGIImage and TGAImage implementations use InputStreams // anyway so there isn't much point in having a separate code @@ -1034,12 +1035,12 @@ public class TextureIO { } @Override - public TextureData newTextureData(GLProfile glp, URL url, - int internalFormat, - int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { - InputStream stream = new BufferedInputStream(url.openStream()); + public TextureData newTextureData(final GLProfile glp, final URL url, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, + final String fileSuffix) throws IOException { + final InputStream stream = new BufferedInputStream(url.openStream()); try { return newTextureData(glp, stream, internalFormat, pixelFormat, mipmap, fileSuffix); } finally { @@ -1052,15 +1053,15 @@ public class TextureIO { // SGI RGB image provider static class SGITextureProvider extends StreamBasedTextureProvider { @Override - public TextureData newTextureData(GLProfile glp, InputStream stream, + public TextureData newTextureData(final GLProfile glp, final InputStream stream, int internalFormat, int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { + final boolean mipmap, + final String fileSuffix) throws IOException { if (SGI.equals(fileSuffix) || SGI_RGB.equals(fileSuffix) || SGIImage.isSGIImage(stream)) { - SGIImage image = SGIImage.read(stream); + final SGIImage image = SGIImage.read(stream); if (pixelFormat == 0) { pixelFormat = image.getFormat(); } @@ -1088,13 +1089,13 @@ public class TextureIO { // TGA (Targa) image provider static class TGATextureProvider extends StreamBasedTextureProvider { @Override - public TextureData newTextureData(GLProfile glp, InputStream stream, + public TextureData newTextureData(final GLProfile glp, final InputStream stream, int internalFormat, int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { + final boolean mipmap, + final String fileSuffix) throws IOException { if (TGA.equals(fileSuffix)) { - TGAImage image = TGAImage.read(glp, stream); + final TGAImage image = TGAImage.read(glp, stream); if (pixelFormat == 0) { pixelFormat = image.getGLFormat(); } @@ -1126,11 +1127,11 @@ public class TextureIO { // PNG image provider static class PNGTextureProvider extends StreamBasedTextureProvider { @Override - public TextureData newTextureData(GLProfile glp, InputStream stream, + public TextureData newTextureData(final GLProfile glp, final InputStream stream, int internalFormat, int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { + final boolean mipmap, + final String fileSuffix) throws IOException { if (PNG.equals(fileSuffix)) { final PNGPixelRect image = PNGPixelRect.read(stream, null, true /* directBuffer */, 0 /* destMinStrideInBytes */, true /* destIsGLOriented */); final GLPixelAttributes glpa = GLPixelAttributes.convert(image.getPixelformat(), glp); @@ -1166,13 +1167,13 @@ public class TextureIO { // JPEG image provider static class JPGTextureProvider extends StreamBasedTextureProvider { @Override - public TextureData newTextureData(GLProfile glp, InputStream stream, + public TextureData newTextureData(final GLProfile glp, final InputStream stream, int internalFormat, int pixelFormat, - boolean mipmap, - String fileSuffix) throws IOException { + final boolean mipmap, + final String fileSuffix) throws IOException { if (JPG.equals(fileSuffix)) { - JPEGImage image = JPEGImage.read(/*glp, */ stream); + final JPEGImage image = JPEGImage.read(/*glp, */ stream); if (pixelFormat == 0) { pixelFormat = image.getGLFormat(); } @@ -1205,8 +1206,8 @@ public class TextureIO { // static class DDSTextureWriter implements TextureWriter { @Override - public boolean write(File file, - TextureData data) throws IOException { + public boolean write(final File file, + final TextureData data) throws IOException { if (DDS.equals(IOUtil.getFileSuffix(file))) { // See whether the DDS writer can handle this TextureData final GLPixelAttributes pixelAttribs = data.getPixelAttributes(); @@ -1239,7 +1240,7 @@ public class TextureIO { mipmaps = new ByteBuffer[] { (ByteBuffer) data.getBuffer() }; } - DDSImage image = DDSImage.createFromData(d3dFormat, + final DDSImage image = DDSImage.createFromData(d3dFormat, data.getWidth(), data.getHeight(), mipmaps); @@ -1256,9 +1257,9 @@ public class TextureIO { // static class SGITextureWriter implements TextureWriter { @Override - public boolean write(File file, - TextureData data) throws IOException { - String fileSuffix = IOUtil.getFileSuffix(file); + public boolean write(final File file, + final TextureData data) throws IOException { + final String fileSuffix = IOUtil.getFileSuffix(file); if (SGI.equals(fileSuffix) || SGI_RGB.equals(fileSuffix)) { // See whether the SGI writer can handle this TextureData @@ -1269,7 +1270,7 @@ public class TextureIO { pixelFormat == GL.GL_RGBA) && (pixelType == GL.GL_BYTE || pixelType == GL.GL_UNSIGNED_BYTE)) { - ByteBuffer buf = ((data.getBuffer() != null) ? + final ByteBuffer buf = ((data.getBuffer() != null) ? (ByteBuffer) data.getBuffer() : (ByteBuffer) data.getMipmapData()[0]); byte[] bytes; @@ -1282,7 +1283,7 @@ public class TextureIO { buf.rewind(); } - SGIImage image = SGIImage.createFromData(data.getWidth(), + final SGIImage image = SGIImage.createFromData(data.getWidth(), data.getHeight(), (pixelFormat == GL.GL_RGBA), bytes); @@ -1302,8 +1303,8 @@ public class TextureIO { static class TGATextureWriter implements TextureWriter { @Override - public boolean write(File file, - TextureData data) throws IOException { + public boolean write(final File file, + final TextureData data) throws IOException { if (TGA.equals(IOUtil.getFileSuffix(file))) { // See whether the TGA writer can handle this TextureData final GLPixelAttributes pixelAttribs = data.getPixelAttributes(); @@ -1311,7 +1312,7 @@ public class TextureIO { final int pixelType = pixelAttribs.type; if ((pixelFormat == GL.GL_RGB || pixelFormat == GL.GL_RGBA || - pixelFormat == GL2.GL_BGR || + pixelFormat == GL2GL3.GL_BGR || pixelFormat == GL.GL_BGRA ) && (pixelType == GL.GL_BYTE || pixelType == GL.GL_UNSIGNED_BYTE)) { @@ -1324,16 +1325,16 @@ public class TextureIO { if( pixelFormat == GL.GL_RGB || pixelFormat == GL.GL_RGBA ) { // Must reverse order of red and blue channels to get correct results - int skip = ((pixelFormat == GL.GL_RGB) ? 3 : 4); + final int skip = ((pixelFormat == GL.GL_RGB) ? 3 : 4); for (int i = 0; i < buf.remaining(); i += skip) { - byte red = buf.get(i + 0); - byte blue = buf.get(i + 2); + final byte red = buf.get(i + 0); + final byte blue = buf.get(i + 2); buf.put(i + 0, blue); buf.put(i + 2, red); } } - TGAImage image = TGAImage.createFromData(data.getWidth(), + final TGAImage image = TGAImage.createFromData(data.getWidth(), data.getHeight(), (pixelFormat == GL.GL_RGBA || pixelFormat == GL.GL_BGRA), false, buf); @@ -1353,7 +1354,7 @@ public class TextureIO { static class PNGTextureWriter implements TextureWriter { @Override - public boolean write(File file, TextureData data) throws IOException { + public boolean write(final File file, final TextureData data) throws IOException { if (PNG.equals(IOUtil.getFileSuffix(file))) { // See whether the PNG writer can handle this TextureData final GLPixelAttributes pixelAttribs = data.getPixelAttributes(); @@ -1403,19 +1404,19 @@ public class TextureIO { // Helper routines // - private static int glGetInteger(GL gl, int pname) { - int[] tmp = new int[1]; + private static int glGetInteger(final GL gl, final int pname) { + final int[] tmp = new int[1]; gl.glGetIntegerv(pname, tmp, 0); return tmp[0]; } - private static int glGetTexLevelParameteri(GL2GL3 gl, int target, int level, int pname) { - int[] tmp = new int[1]; + private static int glGetTexLevelParameteri(final GL2GL3 gl, final int target, final int level, final int pname) { + final int[] tmp = new int[1]; gl.glGetTexLevelParameteriv(target, 0, pname, tmp, 0); return tmp[0]; } - private static String toLowerCase(String arg) { + private static String toLowerCase(final String arg) { if (arg == null) { return null; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java index ee3b600a5..5add4f695 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureSequence.java @@ -114,11 +114,11 @@ public interface TextureSequence { * to associated related data. */ public static class TextureFrame extends TimeFrameI { - public TextureFrame(Texture t, int pts, int duration) { + public TextureFrame(final Texture t, final int pts, final int duration) { super(pts, duration); texture = t; } - public TextureFrame(Texture t) { + public TextureFrame(final Texture t) { texture = t; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java index d8320c690..467ab41c5 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/TextureState.java @@ -53,7 +53,7 @@ public class TextureState { * Returns 0 is textureTarget is not supported. *

*/ - public static final int getTextureTargetQueryName(int textureTarget) { + public static final int getTextureTargetQueryName(final int textureTarget) { final int texBindQName; switch(textureTarget) { case GL.GL_TEXTURE_2D: texBindQName = GL.GL_TEXTURE_BINDING_2D; break; @@ -61,7 +61,7 @@ public class TextureState { case GL2ES2.GL_TEXTURE_3D: texBindQName = GL2ES2.GL_TEXTURE_BINDING_3D; break; case GL2GL3.GL_TEXTURE_1D: texBindQName = GL2GL3.GL_TEXTURE_BINDING_1D; break; case GL2GL3.GL_TEXTURE_1D_ARRAY: texBindQName = GL2GL3.GL_TEXTURE_BINDING_1D_ARRAY; break; - case GL2GL3.GL_TEXTURE_2D_ARRAY: texBindQName = GL2GL3.GL_TEXTURE_BINDING_2D_ARRAY; break; + case GL.GL_TEXTURE_2D_ARRAY: texBindQName = GL.GL_TEXTURE_BINDING_2D_ARRAY; break; case GL2GL3.GL_TEXTURE_RECTANGLE: texBindQName = GL2GL3.GL_TEXTURE_BINDING_RECTANGLE; break; case GL2GL3.GL_TEXTURE_BUFFER: texBindQName = GL2GL3.GL_TEXTURE_BINDING_BUFFER; break; case GL3.GL_TEXTURE_2D_MULTISAMPLE: texBindQName = GL3.GL_TEXTURE_BINDING_2D_MULTISAMPLE; break; @@ -84,9 +84,9 @@ public class TextureState { */ private final int[] state = new int[] { 0, 0, 0, 0, 0, 0 }; - private static final String toHexString(int i) { return "0x"+Integer.toHexString(i); } + private static final String toHexString(final int i) { return "0x"+Integer.toHexString(i); } - private static final int activeTexture(GL gl) { + private static final int activeTexture(final GL gl) { final int[] vi = { 0 }; gl.glGetIntegerv(GL.GL_ACTIVE_TEXTURE, vi, 0); return vi[0]; @@ -99,7 +99,7 @@ public class TextureState { * @param textureTarget * @throws GLException if textureTarget is not supported */ - public TextureState(GL gl, int textureTarget) throws GLException { + public TextureState(final GL gl, final int textureTarget) throws GLException { this(gl, activeTexture(gl), textureTarget); } @@ -111,7 +111,7 @@ public class TextureState { * @param textureTarget * @throws GLException if textureTarget is not supported */ - public TextureState(GL gl, int textureUnit, int textureTarget) throws GLException { + public TextureState(final GL gl, final int textureUnit, final int textureTarget) throws GLException { target = textureTarget; state[0] = textureUnit; final int texBindQName = getTextureTargetQueryName(textureTarget); @@ -132,7 +132,7 @@ public class TextureState { *

* @param gl current GL context's GL object */ - public final void restore(GL gl) { + public final void restore(final GL gl) { gl.glActiveTexture(state[0]); gl.glBindTexture(target, state[1]); gl.glTexParameteri(target, GL.GL_TEXTURE_MAG_FILTER, state[2]); diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java index 202c08e4e..ccb3ecc3c 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureData.java @@ -113,11 +113,11 @@ public class AWTTextureData extends TextureData { * texture * @param image the image containing the texture data */ - public AWTTextureData(GLProfile glp, - int internalFormat, - int pixelFormat, - boolean mipmap, - BufferedImage image) { + public AWTTextureData(final GLProfile glp, + final int internalFormat, + final int pixelFormat, + final boolean mipmap, + final BufferedImage image) { super(glp); if (internalFormat == 0) { this.internalFormat = image.getColorModel().hasAlpha() ? GL.GL_RGBA : GL.GL_RGB; @@ -176,7 +176,7 @@ public class AWTTextureData extends TextureData { return buffer; } - private void createFromImage(GLProfile glp, BufferedImage image) { + private void createFromImage(final GLProfile glp, final BufferedImage image) { pixelAttributes = GLPixelAttributes.UNDEF; // Determine from image mustFlipVertically = true; @@ -185,7 +185,7 @@ public class AWTTextureData extends TextureData { int scanlineStride; - SampleModel sm = image.getRaster().getSampleModel(); + final SampleModel sm = image.getRaster().getSampleModel(); if (sm instanceof SinglePixelPackedSampleModel) { scanlineStride = ((SinglePixelPackedSampleModel)sm).getScanlineStride(); @@ -300,7 +300,7 @@ public class AWTTextureData extends TextureData { case BufferedImage.TYPE_BYTE_INDEXED: case BufferedImage.TYPE_CUSTOM: default: - java.awt.image.ColorModel cm = image.getColorModel(); + final java.awt.image.ColorModel cm = image.getColorModel(); if (cm.equals(rgbColorModel)) { pixelAttributes = new GLPixelAttributes(GL.GL_RGB, GL.GL_UNSIGNED_BYTE); rowLength = scanlineStride / 3; @@ -362,7 +362,7 @@ public class AWTTextureData extends TextureData { case BufferedImage.TYPE_BYTE_INDEXED: case BufferedImage.TYPE_CUSTOM: default: - java.awt.image.ColorModel cm = image.getColorModel(); + final java.awt.image.ColorModel cm = image.getColorModel(); if (cm.equals(rgbColorModel)) { pixelAttributes = new GLPixelAttributes(GL.GL_RGB, GL.GL_UNSIGNED_BYTE); rowLength = scanlineStride / 3; @@ -382,9 +382,9 @@ public class AWTTextureData extends TextureData { createNIOBufferFromImage(image); } - private void setupLazyCustomConversion(BufferedImage image) { + private void setupLazyCustomConversion(final BufferedImage image) { imageForLazyCustomConversion = image; - boolean hasAlpha = image.getColorModel().hasAlpha(); + final boolean hasAlpha = image.getColorModel().hasAlpha(); int pixelFormat = pixelAttributes.format; int pixelType = pixelAttributes.type; if (pixelFormat == 0) { @@ -395,7 +395,7 @@ public class AWTTextureData extends TextureData { // Allow previously-selected pixelType (if any) to override that // we can infer from the DataBuffer - DataBuffer data = image.getRaster().getDataBuffer(); + final DataBuffer data = image.getRaster().getDataBuffer(); if (data instanceof DataBufferByte || isPackedInt(image)) { // Don't use GL_UNSIGNED_INT for BufferedImage packed int images if (pixelType == 0) pixelType = GL.GL_UNSIGNED_BYTE; @@ -405,7 +405,7 @@ public class AWTTextureData extends TextureData { if (pixelType == 0) pixelType = GL.GL_FLOAT; } else if (data instanceof DataBufferInt) { // FIXME: should we support signed ints? - if (pixelType == 0) pixelType = GL2GL3.GL_UNSIGNED_INT; + if (pixelType == 0) pixelType = GL.GL_UNSIGNED_INT; } else if (data instanceof DataBufferShort) { if (pixelType == 0) pixelType = GL.GL_SHORT; } else if (data instanceof DataBufferUShort) { @@ -416,12 +416,12 @@ public class AWTTextureData extends TextureData { pixelAttributes = new GLPixelAttributes(pixelFormat, pixelType); } - private void createFromCustom(BufferedImage image) { - int width = image.getWidth(); - int height = image.getHeight(); + private void createFromCustom(final BufferedImage image) { + final int width = image.getWidth(); + final int height = image.getHeight(); // create a temporary image that is compatible with OpenGL - boolean hasAlpha = image.getColorModel().hasAlpha(); + final boolean hasAlpha = image.getColorModel().hasAlpha(); java.awt.image.ColorModel cm = null; int dataBufferType = image.getRaster().getDataBuffer().getDataType(); // Don't use integer components for packed int images @@ -444,13 +444,13 @@ public class AWTTextureData extends TextureData { } } - boolean premult = cm.isAlphaPremultiplied(); - WritableRaster raster = + final boolean premult = cm.isAlphaPremultiplied(); + final WritableRaster raster = cm.createCompatibleWritableRaster(width, height); - BufferedImage texImage = new BufferedImage(cm, raster, premult, null); + final BufferedImage texImage = new BufferedImage(cm, raster, premult, null); // copy the source image into the temporary image - Graphics2D g = texImage.createGraphics(); + final Graphics2D g = texImage.createGraphics(); g.setComposite(AlphaComposite.Src); g.drawImage(image, 0, 0, null); g.dispose(); @@ -459,8 +459,8 @@ public class AWTTextureData extends TextureData { createNIOBufferFromImage(texImage); } - private boolean isPackedInt(BufferedImage image) { - int imgType = image.getType(); + private boolean isPackedInt(final BufferedImage image) { + final int imgType = image.getType(); return (imgType == BufferedImage.TYPE_INT_RGB || imgType == BufferedImage.TYPE_INT_BGR || imgType == BufferedImage.TYPE_INT_ARGB || @@ -476,11 +476,11 @@ public class AWTTextureData extends TextureData { setupLazyCustomConversion(imageForLazyCustomConversion); } - private void createNIOBufferFromImage(BufferedImage image) { + private void createNIOBufferFromImage(final BufferedImage image) { buffer = wrapImageDataBuffer(image); } - private Buffer wrapImageDataBuffer(BufferedImage image) { + private Buffer wrapImageDataBuffer(final BufferedImage image) { // // Note: Grabbing the DataBuffer will defeat Java2D's image // management mechanism (as of JDK 5/6, at least). This shouldn't @@ -490,7 +490,7 @@ public class AWTTextureData extends TextureData { // it could be. // - DataBuffer data = image.getRaster().getDataBuffer(); + final DataBuffer data = image.getRaster().getDataBuffer(); if (data instanceof DataBufferByte) { return ByteBuffer.wrap(((DataBufferByte) data).getData()); } else if (data instanceof DataBufferDouble) { diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java index c70f5d0f3..c3b3adc75 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/awt/AWTTextureIO.java @@ -59,8 +59,8 @@ public class AWTTextureIO extends TextureIO { * * @see #newTextureData(GLProfile, BufferedImage, boolean) */ - public static TextureData newTextureData(GLProfile glp, BufferedImage image, - boolean mipmap) { + public static TextureData newTextureData(final GLProfile glp, final BufferedImage image, + final boolean mipmap) { return newTextureDataImpl(glp, image, 0, 0, mipmap); } @@ -89,10 +89,10 @@ public class AWTTextureIO extends TextureIO { * @throws IllegalArgumentException if either internalFormat or * pixelFormat was 0 */ - public static TextureData newTextureData(GLProfile glp, BufferedImage image, - int internalFormat, - int pixelFormat, - boolean mipmap) throws IllegalArgumentException { + public static TextureData newTextureData(final GLProfile glp, final BufferedImage image, + final int internalFormat, + final int pixelFormat, + final boolean mipmap) throws IllegalArgumentException { if ((internalFormat == 0) || (pixelFormat == 0)) { throw new IllegalArgumentException("internalFormat and pixelFormat must be non-zero"); } @@ -112,18 +112,18 @@ public class AWTTextureIO extends TextureIO { * @throws GLException if no OpenGL context is current or if an * OpenGL error occurred */ - public static Texture newTexture(GLProfile glp, BufferedImage image, boolean mipmap) throws GLException { - TextureData data = newTextureData(glp, image, mipmap); - Texture texture = newTexture(data); + public static Texture newTexture(final GLProfile glp, final BufferedImage image, final boolean mipmap) throws GLException { + final TextureData data = newTextureData(glp, image, mipmap); + final Texture texture = newTexture(data); data.flush(); return texture; } - private static TextureData newTextureDataImpl(GLProfile glp, - BufferedImage image, - int internalFormat, - int pixelFormat, - boolean mipmap) { + private static TextureData newTextureDataImpl(final GLProfile glp, + final BufferedImage image, + final int internalFormat, + final int pixelFormat, + final boolean mipmap) { return new AWTTextureData(glp, internalFormat, pixelFormat, mipmap, image); } } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java index 7311f20b3..20fc92819 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/DDSImage.java @@ -52,6 +52,7 @@ import java.nio.channels.FileChannel; import javax.media.opengl.GL; +import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.IOUtil; import com.jogamp.opengl.util.GLBuffers; @@ -67,13 +68,13 @@ public class DDSImage { that information in another way. */ public static class ImageInfo { - private ByteBuffer data; - private int width; - private int height; - private boolean isCompressed; - private int compressionFormat; + private final ByteBuffer data; + private final int width; + private final int height; + private final boolean isCompressed; + private final int compressionFormat; - public ImageInfo(ByteBuffer data, int width, int height, boolean compressed, int compressionFormat) { + public ImageInfo(final ByteBuffer data, final int width, final int height, final boolean compressed, final int compressionFormat) { this.data = data; this.width = width; this.height = height; this.isCompressed = compressed; this.compressionFormat = compressionFormat; } @@ -163,7 +164,7 @@ public class DDSImage { @return DDS image object @throws java.io.IOException if an I/O exception occurred */ - public static DDSImage read(String filename) throws IOException { + public static DDSImage read(final String filename) throws IOException { return read(new File(filename)); } @@ -174,8 +175,8 @@ public class DDSImage { @return DDS image object @throws java.io.IOException if an I/O exception occurred */ - public static DDSImage read(File file) throws IOException { - DDSImage image = new DDSImage(); + public static DDSImage read(final File file) throws IOException { + final DDSImage image = new DDSImage(); image.readFromFile(file); return image; } @@ -187,8 +188,8 @@ public class DDSImage { @return DDS image object @throws java.io.IOException if an I/O exception occurred */ - public static DDSImage read(ByteBuffer buf) throws IOException { - DDSImage image = new DDSImage(); + public static DDSImage read(final ByteBuffer buf) throws IOException { + final DDSImage image = new DDSImage(); image.readFromBuffer(buf); return image; } @@ -207,7 +208,7 @@ public class DDSImage { fis = null; } buf = null; - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } } @@ -228,11 +229,11 @@ public class DDSImage { * specified arguments * @return DDS image object */ - public static DDSImage createFromData(int d3dFormat, - int width, - int height, - ByteBuffer[] mipmapData) throws IllegalArgumentException { - DDSImage image = new DDSImage(); + public static DDSImage createFromData(final int d3dFormat, + final int width, + final int height, + final ByteBuffer[] mipmapData) throws IllegalArgumentException { + final DDSImage image = new DDSImage(); image.initFromData(d3dFormat, width, height, mipmapData); return image; } @@ -256,7 +257,7 @@ public class DDSImage { in.mark(4); int magic = 0; for (int i = 0; i < 4; i++) { - int tmp = in.read(); + final int tmp = in.read(); if (tmp < 0) { in.reset(); return false; @@ -272,7 +273,7 @@ public class DDSImage { * @param filename File name to write to * @throws java.io.IOException if an I/O exception occurred */ - public void write(String filename) throws IOException { + public void write(final String filename) throws IOException { write(new File(filename)); } @@ -281,12 +282,12 @@ public class DDSImage { * @param file File object to write to * @throws java.io.IOException if an I/O exception occurred */ - public void write(File file) throws IOException { - FileOutputStream stream = IOUtil.getFileOutputStream(file, true); - FileChannel chan = stream.getChannel(); + public void write(final File file) throws IOException { + final FileOutputStream stream = IOUtil.getFileOutputStream(file, true); + final FileChannel chan = stream.getChannel(); // Create ByteBuffer for header in case the start of our // ByteBuffer isn't actually memory-mapped - ByteBuffer hdr = ByteBuffer.allocate(Header.writtenSize()); + final ByteBuffer hdr = ByteBuffer.allocate(Header.writtenSize()); hdr.order(ByteOrder.LITTLE_ENDIAN); header.write(hdr); hdr.rewind(); @@ -302,12 +303,12 @@ public class DDSImage { * @param flag DDSD_* flags set to test * @return true if flag present or false otherwise */ - public boolean isSurfaceDescFlagSet(int flag) { + public boolean isSurfaceDescFlagSet(final int flag) { return ((header.flags & flag) != 0); } /** Test for presence/absence of pixel format flags (DDPF_*) */ - public boolean isPixelFormatFlagSet(int flag) { + public boolean isPixelFormatFlagSet(final int flag) { return ((header.pfFlags & flag) != 0); } @@ -357,7 +358,7 @@ public class DDSImage { * @param side Side to test * @return true if side present or false otherwise */ - public boolean isCubemapSidePresent(int side) { + public boolean isCubemapSidePresent(final int side) { return isCubemap() && (header.ddsCaps2 & side) != 0; } @@ -402,7 +403,7 @@ public class DDSImage { * @param map Mipmap index * @return Image object */ - public ImageInfo getMipMap(int map) { + public ImageInfo getMipMap(final int map) { return getMipMap( 0, map ); } @@ -412,7 +413,7 @@ public class DDSImage { * @param map Mipmap index * @return Image object */ - public ImageInfo getMipMap(int side, int map) { + public ImageInfo getMipMap(final int side, final int map) { if (!isCubemap() && (side != 0)) { throw new RuntimeException( "Illegal side for 2D texture: " + side ); } @@ -434,7 +435,7 @@ public class DDSImage { } buf.limit(seek + mipMapSizeInBytes(map)); buf.position(seek); - ByteBuffer next = buf.slice(); + final ByteBuffer next = buf.slice(); buf.position(0); buf.limit(buf.capacity()); return new ImageInfo(next, mipMapWidth(map), mipMapHeight(map), isCompressed(), getCompressionFormat()); @@ -454,12 +455,12 @@ public class DDSImage { * @param side Cubemap side or 0 for 2D texture * @return Mipmap image objects set */ - public ImageInfo[] getAllMipMaps( int side ) { + public ImageInfo[] getAllMipMaps( final int side ) { int numLevels = getNumMipMaps(); if (numLevels == 0) { numLevels = 1; } - ImageInfo[] result = new ImageInfo[numLevels]; + final ImageInfo[] result = new ImageInfo[numLevels]; for (int i = 0; i < numLevels; i++) { result[i] = getMipMap(side, i); } @@ -472,9 +473,9 @@ public class DDSImage { @return String format code */ public static String getCompressionFormatName(int compressionFormat) { - StringBuilder buf = new StringBuilder(); + final StringBuilder buf = new StringBuilder(); for (int i = 0; i < 4; i++) { - char c = (char) (compressionFormat & 0xFF); + final char c = (char) (compressionFormat & 0xFF); buf.append(c); compressionFormat = compressionFormat >> 8; } @@ -491,9 +492,9 @@ public class DDSImage { GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, or GL_COMPRESSED_RGBA_S3TC_DXT5_EXT. */ - public static ByteBuffer allocateBlankBuffer(int width, - int height, - int openGLInternalFormat) { + public static ByteBuffer allocateBlankBuffer(final int width, + final int height, + final int openGLInternalFormat) { int size = width * height; switch (openGLInternalFormat) { case GL.GL_COMPRESSED_RGB_S3TC_DXT1_EXT: @@ -511,15 +512,15 @@ public class DDSImage { } if (size == 0) size = 1; - return GLBuffers.newDirectByteBuffer(size); + return Buffers.newDirectByteBuffer(size); } public void debugPrint() { - PrintStream tty = System.err; + final PrintStream tty = System.err; tty.println("Compressed texture: " + isCompressed()); if (isCompressed()) { - int fmt = getCompressionFormat(); - String name = getCompressionFormatName(fmt); + final int fmt = getCompressionFormat(); + final String name = getCompressionFormatName(fmt); tty.println("Compression format: 0x" + Integer.toHexString(fmt) + " (" + name + ")"); } tty.println("Width: " + header.width + " Height: " + header.height); @@ -567,7 +568,7 @@ public class DDSImage { tty.println("Raw pixel format flags: 0x" + Integer.toHexString(header.pfFlags)); tty.println("Depth: " + getDepth()); tty.println("Number of mip maps: " + getNumMipMaps()); - int fmt = getPixelFormat(); + final int fmt = getPixelFormat(); tty.print("Pixel format: "); switch (fmt) { case D3DFMT_R8G8B8: tty.println("D3DFMT_R8G8B8"); break; @@ -629,8 +630,8 @@ public class DDSImage { int ddsCapsReserved2; int textureStage; // stage in multitexture cascade - void read(ByteBuffer buf) throws IOException { - int magic = buf.getInt(); + void read(final ByteBuffer buf) throws IOException { + final int magic = buf.getInt(); if (magic != MAGIC) { throw new IOException("Incorrect magic number 0x" + Integer.toHexString(magic) + @@ -671,7 +672,7 @@ public class DDSImage { } // buf must be in little-endian byte order - void write(ByteBuffer buf) { + void write(final ByteBuffer buf) { buf.putInt(MAGIC); buf.putInt(size); buf.putInt(flags); @@ -722,15 +723,15 @@ public class DDSImage { private DDSImage() { } - private void readFromFile(File file) throws IOException { + private void readFromFile(final File file) throws IOException { fis = new FileInputStream(file); chan = fis.getChannel(); - ByteBuffer buf = chan.map(FileChannel.MapMode.READ_ONLY, + final ByteBuffer buf = chan.map(FileChannel.MapMode.READ_ONLY, 0, (int) file.length()); readFromBuffer(buf); } - private void readFromBuffer(ByteBuffer buf) throws IOException { + private void readFromBuffer(final ByteBuffer buf) throws IOException { this.buf = buf; buf.order(ByteOrder.LITTLE_ENDIAN); header = new Header(); @@ -738,10 +739,10 @@ public class DDSImage { fixupHeader(); } - private void initFromData(int d3dFormat, - int width, - int height, - ByteBuffer[] mipmapData) throws IllegalArgumentException { + private void initFromData(final int d3dFormat, + final int width, + final int height, + final ByteBuffer[] mipmapData) throws IllegalArgumentException { // Check size of mipmap data compared against format, width and // height int topmostMipmapSize = width * height; @@ -784,7 +785,7 @@ public class DDSImage { // OK, create one large ByteBuffer to hold all of the mipmap data totalSize += Header.writtenSize(); - ByteBuffer buf = ByteBuffer.allocate(totalSize); + final ByteBuffer buf = ByteBuffer.allocate(totalSize); buf.position(Header.writtenSize()); for (int i = 0; i < mipmapData.length; i++) { buf.put(mipmapData[i]); @@ -845,10 +846,10 @@ public class DDSImage { } } - private static int computeCompressedBlockSize(int width, - int height, - int depth, - int compressionFormat) { + private static int computeCompressedBlockSize(final int width, + final int height, + final int depth, + final int compressionFormat) { int blockSize = ((width + 3)/4) * ((height + 3)/4) * ((depth + 3)/4); switch (compressionFormat) { case D3DFMT_DXT1: blockSize *= 8; break; @@ -857,10 +858,10 @@ public class DDSImage { return blockSize; } - private static int computeBlockSize(int width, - int height, - int depth, - int pixelFormat) { + private static int computeBlockSize(final int width, + final int height, + final int depth, + final int pixelFormat) { int blocksize; switch (pixelFormat) { case D3DFMT_R8G8B8: @@ -883,7 +884,7 @@ public class DDSImage { return blocksize; } - private int mipMapWidth(int map) { + private int mipMapWidth(final int map) { int width = getWidth(); for (int i = 0; i < map; i++) { width >>= 1; @@ -891,7 +892,7 @@ public class DDSImage { return Math.max(width, 1); } - private int mipMapHeight(int map) { + private int mipMapHeight(final int map) { int height = getHeight(); for (int i = 0; i < map; i++) { height >>= 1; @@ -899,11 +900,11 @@ public class DDSImage { return Math.max(height, 1); } - private int mipMapSizeInBytes(int map) { - int width = mipMapWidth(map); - int height = mipMapHeight(map); + private int mipMapSizeInBytes(final int map) { + final int width = mipMapWidth(map); + final int height = mipMapHeight(map); if (isCompressed()) { - int blockSize = (getCompressionFormat() == D3DFMT_DXT1 ? 8 : 16); + final int blockSize = (getCompressionFormat() == D3DFMT_DXT1 ? 8 : 16); return ((width+3)/4)*((height+3)/4)*blockSize; } else { return width * height * (getDepth() / 8); @@ -924,8 +925,8 @@ public class DDSImage { return size; } - private int sideShiftInBytes(int side) { - int[] sides = { + private int sideShiftInBytes(final int side) { + final int[] sides = { DDSCAPS2_CUBEMAP_POSITIVEX, DDSCAPS2_CUBEMAP_NEGATIVEX, DDSCAPS2_CUBEMAP_POSITIVEY, @@ -935,9 +936,9 @@ public class DDSImage { }; int shift = 0; - int sideSize = sideSizeInBytes(); + final int sideSize = sideSizeInBytes(); for (int i = 0; i < sides.length; i++) { - int temp = sides[i]; + final int temp = sides[i]; if ((temp & side) != 0) { return shift; } @@ -948,7 +949,7 @@ public class DDSImage { throw new RuntimeException("Illegal side: " + side); } - private boolean printIfRecognized(PrintStream tty, int flags, int flag, String what) { + private boolean printIfRecognized(final PrintStream tty, final int flags, final int flag, final String what) { if ((flags & flag) != 0) { tty.println(what); return true; diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java index 2081788ba..66a486f9b 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/JPEGImage.java @@ -51,12 +51,12 @@ public class JPEGImage { * @return * @throws IOException */ - public static JPEGImage read(InputStream in, ColorSpace cs) throws IOException { + public static JPEGImage read(final InputStream in, final ColorSpace cs) throws IOException { return new JPEGImage(in, cs); } /** Reads a JPEG image from the specified InputStream, using the {@link ColorSpace#RGB}. */ - public static JPEGImage read(InputStream in) throws IOException { + public static JPEGImage read(final InputStream in) throws IOException { return new JPEGImage(in, ColorSpace.RGB); } @@ -68,7 +68,7 @@ public class JPEGImage { final ColorSpace storageCS; ByteBuffer data = null; - JPEGColorSink(ColorSpace storageCM) { + JPEGColorSink(final ColorSpace storageCM) { this.storageCS = storageCM; switch(storageCS) { case RGB: @@ -81,7 +81,7 @@ public class JPEGImage { } @Override - public final ColorSpace allocate(int width, int height, ColorSpace sourceCM, int sourceComponents) throws RuntimeException { + public final ColorSpace allocate(final int width, final int height, final ColorSpace sourceCM, final int sourceComponents) throws RuntimeException { this.width = width; this.height = height; this.sourceComponents = sourceComponents; @@ -91,7 +91,7 @@ public class JPEGImage { } @Override - public final void storeRGB(int x, int y, byte r, byte g, byte b) { + public final void storeRGB(final int x, final int y, final byte r, final byte g, final byte b) { int i = ( ( height - y - 1 ) * width + x ) * storageComponents; data.put(i++, r); data.put(i++, g); @@ -100,12 +100,12 @@ public class JPEGImage { } @Override - public final void store2(int x, int y, byte c1, byte c2) { + public final void store2(final int x, final int y, final byte c1, final byte c2) { throw new RuntimeException("not supported yet"); } @Override - public final void storeYCbCr(int x, int y, byte Y, byte Cb, byte Cr) { + public final void storeYCbCr(final int x, final int y, final byte Y, final byte Cb, final byte Cr) { int i = ( ( height - y - 1 ) * width + x ) * storageComponents; data.put(i++, Y); data.put(i++, Cb); @@ -118,7 +118,7 @@ public class JPEGImage { } }; - private JPEGImage(InputStream in, ColorSpace cs) throws IOException { + private JPEGImage(final InputStream in, final ColorSpace cs) throws IOException { pixelStorage = new JPEGColorSink(cs); final JPEGDecoder decoder = new JPEGDecoder(); decoder.parse(in); @@ -139,9 +139,9 @@ public class JPEGImage { } decoder.clear(null); } - private JPEGColorSink pixelStorage; + private final JPEGColorSink pixelStorage; private final int pixelWidth, pixelHeight, glFormat, bytesPerPixel; - private boolean reversedChannels; + private final boolean reversedChannels; private final ByteBuffer data; /** Returns the color space of the pixel data */ diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java index 3c90d96e4..f121478e7 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataInputStream.java @@ -76,7 +76,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput */ DataInputStream dataIn; - public LEDataInputStream(InputStream in) + public LEDataInputStream(final InputStream in) { super(in); dataIn = new DataInputStream(in); @@ -90,32 +90,32 @@ public class LEDataInputStream extends FilterInputStream implements DataInput } @Override - public synchronized final int read(byte b[]) throws IOException + public synchronized final int read(final byte b[]) throws IOException { return dataIn.read(b, 0, b.length); } @Override - public synchronized final int read(byte b[], int off, int len) throws IOException + public synchronized final int read(final byte b[], final int off, final int len) throws IOException { - int rl = dataIn.read(b, off, len); + final int rl = dataIn.read(b, off, len); return rl; } @Override - public final void readFully(byte b[]) throws IOException + public final void readFully(final byte b[]) throws IOException { dataIn.readFully(b, 0, b.length); } @Override - public final void readFully(byte b[], int off, int len) throws IOException + public final void readFully(final byte b[], final int off, final int len) throws IOException { dataIn.readFully(b, off, len); } @Override - public final int skipBytes(int n) throws IOException + public final int skipBytes(final int n) throws IOException { return dataIn.skipBytes(n); } @@ -123,7 +123,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput @Override public final boolean readBoolean() throws IOException { - int ch = dataIn.read(); + final int ch = dataIn.read(); if (ch < 0) throw new EOFException(); return (ch != 0); @@ -132,7 +132,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput @Override public final byte readByte() throws IOException { - int ch = dataIn.read(); + final int ch = dataIn.read(); if (ch < 0) throw new EOFException(); return (byte)(ch); @@ -141,7 +141,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput @Override public final int readUnsignedByte() throws IOException { - int ch = dataIn.read(); + final int ch = dataIn.read(); if (ch < 0) throw new EOFException(); return ch; @@ -150,8 +150,8 @@ public class LEDataInputStream extends FilterInputStream implements DataInput @Override public final short readShort() throws IOException { - int ch1 = dataIn.read(); - int ch2 = dataIn.read(); + final int ch1 = dataIn.read(); + final int ch2 = dataIn.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (short)((ch1 << 0) + (ch2 << 8)); @@ -160,8 +160,8 @@ public class LEDataInputStream extends FilterInputStream implements DataInput @Override public final int readUnsignedShort() throws IOException { - int ch1 = dataIn.read(); - int ch2 = dataIn.read(); + final int ch1 = dataIn.read(); + final int ch2 = dataIn.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (ch1 << 0) + (ch2 << 8); @@ -170,8 +170,8 @@ public class LEDataInputStream extends FilterInputStream implements DataInput @Override public final char readChar() throws IOException { - int ch1 = dataIn.read(); - int ch2 = dataIn.read(); + final int ch1 = dataIn.read(); + final int ch2 = dataIn.read(); if ((ch1 | ch2) < 0) throw new EOFException(); return (char)((ch1 << 0) + (ch2 << 8)); @@ -180,10 +180,10 @@ public class LEDataInputStream extends FilterInputStream implements DataInput @Override public final int readInt() throws IOException { - int ch1 = dataIn.read(); - int ch2 = dataIn.read(); - int ch3 = dataIn.read(); - int ch4 = dataIn.read(); + final int ch1 = dataIn.read(); + final int ch2 = dataIn.read(); + final int ch3 = dataIn.read(); + final int ch4 = dataIn.read(); if ((ch1 | ch2 | ch3 | ch4) < 0) throw new EOFException(); return ((ch1 << 0) + (ch2 << 8) + (ch3 << 16) + (ch4 << 24)); @@ -192,9 +192,9 @@ public class LEDataInputStream extends FilterInputStream implements DataInput @Override public final long readLong() throws IOException { - int i1 = readInt(); - int i2 = readInt(); - return ((long)i1 & 0xFFFFFFFFL) + ((long)i2 << 32); + final int i1 = readInt(); + final int i2 = readInt(); + return (i1 & 0xFFFFFFFFL) + ((long)i2 << 32); } @Override @@ -233,7 +233,7 @@ public class LEDataInputStream extends FilterInputStream implements DataInput * dont call this it is not implemented * @return empty new string **/ - public final static String readUTF(DataInput in) throws IOException + public final static String readUTF(final DataInput in) throws IOException { return new String(); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java index 93b097500..add177546 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/LEDataOutputStream.java @@ -72,7 +72,7 @@ public class LEDataOutputStream extends FilterOutputStream implements DataOutput */ DataOutputStream dataOut; - public LEDataOutputStream(OutputStream out) + public LEDataOutputStream(final OutputStream out) { super(out); dataOut = new DataOutputStream(out); @@ -86,44 +86,44 @@ public class LEDataOutputStream extends FilterOutputStream implements DataOutput } @Override - public synchronized final void write(byte b[]) throws IOException + public synchronized final void write(final byte b[]) throws IOException { dataOut.write(b, 0, b.length); } @Override - public synchronized final void write(byte b[], int off, int len) throws IOException + public synchronized final void write(final byte b[], final int off, final int len) throws IOException { dataOut.write(b, off, len); } @Override - public final void write(int b) throws IOException + public final void write(final int b) throws IOException { dataOut.write(b); } @Override - public final void writeBoolean(boolean v) throws IOException + public final void writeBoolean(final boolean v) throws IOException { dataOut.writeBoolean(v); } @Override - public final void writeByte(int v) throws IOException + public final void writeByte(final int v) throws IOException { dataOut.writeByte(v); } /** Don't call this -- not implemented */ @Override - public final void writeBytes(String s) throws IOException + public final void writeBytes(final String s) throws IOException { throw new UnsupportedOperationException(); } @Override - public final void writeChar(int v) throws IOException + public final void writeChar(final int v) throws IOException { dataOut.writeChar(((v >> 8) & 0xff) | ((v & 0xff) << 8)); @@ -131,25 +131,25 @@ public class LEDataOutputStream extends FilterOutputStream implements DataOutput /** Don't call this -- not implemented */ @Override - public final void writeChars(String s) throws IOException + public final void writeChars(final String s) throws IOException { throw new UnsupportedOperationException(); } @Override - public final void writeDouble(double v) throws IOException + public final void writeDouble(final double v) throws IOException { writeLong(Double.doubleToRawLongBits(v)); } @Override - public final void writeFloat(float v) throws IOException + public final void writeFloat(final float v) throws IOException { writeInt(Float.floatToRawIntBits(v)); } @Override - public final void writeInt(int v) throws IOException + public final void writeInt(final int v) throws IOException { dataOut.writeInt((v >>> 24) | ((v >>> 8) & 0xff00) | @@ -158,14 +158,14 @@ public class LEDataOutputStream extends FilterOutputStream implements DataOutput } @Override - public final void writeLong(long v) throws IOException + public final void writeLong(final long v) throws IOException { writeInt((int) v); writeInt((int) (v >>> 32)); } @Override - public final void writeShort(int v) throws IOException + public final void writeShort(final int v) throws IOException { dataOut.writeShort(((v >> 8) & 0xff) | ((v & 0xff) << 8)); @@ -173,7 +173,7 @@ public class LEDataOutputStream extends FilterOutputStream implements DataOutput /** Don't call this -- not implemented */ @Override - public final void writeUTF(String s) throws IOException + public final void writeUTF(final String s) throws IOException { throw new UnsupportedOperationException(); } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java index cabf4ebc5..461ddceb8 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/NetPbmTextureWriter.java @@ -63,7 +63,7 @@ public class NetPbmTextureWriter implements TextureWriter { * magic 7 - PAM binary RGB or RGBA * */ - public NetPbmTextureWriter(int magic) { + public NetPbmTextureWriter(final int magic) { switch(magic) { case 0: case 6: @@ -85,7 +85,7 @@ public class NetPbmTextureWriter implements TextureWriter { public String getSuffix() { return (magic==6)?PPM:PAM; } @Override - public boolean write(File file, TextureData data) throws IOException { + public boolean write(final File file, final TextureData data) throws IOException { boolean res; final int magic_old = magic; @@ -107,12 +107,12 @@ public class NetPbmTextureWriter implements TextureWriter { return res; } - private boolean writeImpl(File file, TextureData data) throws IOException { + private boolean writeImpl(final File file, final TextureData data) throws IOException { int pixelFormat = data.getPixelFormat(); final int pixelType = data.getPixelType(); if ((pixelFormat == GL.GL_RGB || pixelFormat == GL.GL_RGBA || - pixelFormat == GL2.GL_BGR || + pixelFormat == GL2GL3.GL_BGR || pixelFormat == GL.GL_BGRA ) && (pixelType == GL.GL_BYTE || pixelType == GL.GL_UNSIGNED_BYTE)) { @@ -123,13 +123,13 @@ public class NetPbmTextureWriter implements TextureWriter { } buf.rewind(); - int comps = ( pixelFormat == GL.GL_RGBA || pixelFormat == GL.GL_BGRA ) ? 4 : 3 ; + final int comps = ( pixelFormat == GL.GL_RGBA || pixelFormat == GL.GL_BGRA ) ? 4 : 3 ; - if( pixelFormat == GL2.GL_BGR || pixelFormat == GL.GL_BGRA ) { + if( pixelFormat == GL2GL3.GL_BGR || pixelFormat == GL.GL_BGRA ) { // Must reverse order of red and blue channels to get correct results for (int i = 0; i < buf.remaining(); i += comps) { - byte red = buf.get(i + 0); - byte blue = buf.get(i + 2); + final byte red = buf.get(i + 0); + final byte blue = buf.get(i + 2); buf.put(i + 0, blue); buf.put(i + 2, red); } @@ -141,9 +141,9 @@ public class NetPbmTextureWriter implements TextureWriter { throw new IOException("NetPbmTextureWriter magic 6 (PPM) doesn't RGBA pixel format, use magic 7 (PAM)"); } - FileOutputStream fos = IOUtil.getFileOutputStream(file, true); + final FileOutputStream fos = IOUtil.getFileOutputStream(file, true); - StringBuilder header = new StringBuilder(); + final StringBuilder header = new StringBuilder(); header.append("P"); header.append(magic); header.append("\n"); @@ -173,7 +173,7 @@ public class NetPbmTextureWriter implements TextureWriter { fos.write(header.toString().getBytes()); - FileChannel fosc = fos.getChannel(); + final FileChannel fosc = fos.getChannel(); fosc.write(buf); fosc.force(true); fosc.close(); diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java index cbc8e652f..27549dfe3 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/SGIImage.java @@ -54,7 +54,7 @@ import com.jogamp.common.util.IOUtil; */ public class SGIImage { - private Header header; + private final Header header; private int format; private byte[] data; // Used for decoding RLE-compressed images @@ -105,7 +105,7 @@ public class SGIImage { magic = MAGIC; } - Header(DataInputStream in) throws IOException { + Header(final DataInputStream in) throws IOException { magic = in.readShort(); storage = in.readByte(); bpc = in.readByte(); @@ -116,13 +116,13 @@ public class SGIImage { pixmin = in.readInt(); pixmax = in.readInt(); dummy = in.readInt(); - byte[] tmpname = new byte[80]; + final byte[] tmpname = new byte[80]; in.read(tmpname); int numChars = 0; while (tmpname[numChars++] != 0); imagename = new String(tmpname, 0, numChars); colormap = in.readInt(); - byte[] tmp = new byte[404]; + final byte[] tmp = new byte[404]; in.read(tmp); } @@ -142,21 +142,21 @@ public class SGIImage { } } - private SGIImage(Header header) { + private SGIImage(final Header header) { this.header = header; } /** Reads an SGI image from the specified file. */ - public static SGIImage read(String filename) throws IOException { + public static SGIImage read(final String filename) throws IOException { return read(new FileInputStream(filename)); } /** Reads an SGI image from the specified InputStream. */ - public static SGIImage read(InputStream in) throws IOException { - DataInputStream dIn = new DataInputStream(new BufferedInputStream(in)); + public static SGIImage read(final InputStream in) throws IOException { + final DataInputStream dIn = new DataInputStream(new BufferedInputStream(in)); - Header header = new Header(dIn); - SGIImage res = new SGIImage(header); + final Header header = new Header(dIn); + final SGIImage res = new SGIImage(header); res.decodeImage(dIn); return res; } @@ -164,28 +164,28 @@ public class SGIImage { /** Writes this SGIImage to the specified file name. If flipVertically is set, outputs the scanlines from top to bottom rather than the default bottom to top order. */ - public void write(String filename, boolean flipVertically) throws IOException { + public void write(final String filename, final boolean flipVertically) throws IOException { write(new File(filename), flipVertically); } /** Writes this SGIImage to the specified file. If flipVertically is set, outputs the scanlines from top to bottom rather than the default bottom to top order. */ - public void write(File file, boolean flipVertically) throws IOException { + public void write(final File file, final boolean flipVertically) throws IOException { writeImage(file, data, header.xsize, header.ysize, header.zsize, flipVertically); } /** Creates an SGIImage from the specified data in either RGB or RGBA format. */ - public static SGIImage createFromData(int width, - int height, - boolean hasAlpha, - byte[] data) { - Header header = new Header(); + public static SGIImage createFromData(final int width, + final int height, + final boolean hasAlpha, + final byte[] data) { + final Header header = new Header(); header.xsize = (short) width; header.ysize = (short) height; header.zsize = (short) (hasAlpha ? 4 : 3); - SGIImage image = new SGIImage(header); + final SGIImage image = new SGIImage(header); image.data = data; return image; } @@ -201,9 +201,9 @@ public class SGIImage { if (!in.markSupported()) { throw new IOException("Can not test non-destructively whether given InputStream is an SGI RGB image"); } - DataInputStream dIn = new DataInputStream(in); + final DataInputStream dIn = new DataInputStream(in); dIn.mark(4); - short magic = dIn.readShort(); + final short magic = dIn.readShort(); dIn.reset(); return (magic == MAGIC); } @@ -236,10 +236,10 @@ public class SGIImage { // Internals only below this point // - private void decodeImage(DataInputStream in) throws IOException { + private void decodeImage(final DataInputStream in) throws IOException { if (header.storage == 1) { // Read RLE compression data; row starts and sizes - int x = header.ysize * header.zsize; + final int x = header.ysize * header.zsize; rowStart = new int[x]; rowSize = new int[x]; rleEnd = 4 * 2 * x + 512; @@ -253,16 +253,16 @@ public class SGIImage { } tmpData = readAll(in); - int xsize = header.xsize; - int ysize = header.ysize; - int zsize = header.zsize; + final int xsize = header.xsize; + final int ysize = header.ysize; + final int zsize = header.zsize; int lptr = 0; data = new byte[xsize * ysize * 4]; - byte[] rbuf = new byte[xsize]; - byte[] gbuf = new byte[xsize]; - byte[] bbuf = new byte[xsize]; - byte[] abuf = new byte[xsize]; + final byte[] rbuf = new byte[xsize]; + final byte[] gbuf = new byte[xsize]; + final byte[] bbuf = new byte[xsize]; + final byte[] abuf = new byte[xsize]; for (int y = 0; y < ysize; y++) { if (zsize >= 4) { getRow(rbuf, y, 0); @@ -293,15 +293,15 @@ public class SGIImage { header.zsize = 4; } - private void getRow(byte[] buf, int y, int z) { + private void getRow(final byte[] buf, final int y, final int z) { if (header.storage == 1) { - int offs = rowStart[y + z * header.ysize] - rleEnd; + final int offs = rowStart[y + z * header.ysize] - rleEnd; System.arraycopy(tmpData, offs, tmpRead, 0, rowSize[y + z * header.ysize]); int iPtr = 0; int oPtr = 0; for (;;) { byte pixel = tmpRead[iPtr++]; - int count = (int) (pixel & 0x7F); + int count = pixel & 0x7F; if (count == 0) { return; } @@ -317,12 +317,12 @@ public class SGIImage { } } } else { - int offs = (y * header.xsize) + (z * header.xsize * header.ysize); + final int offs = (y * header.xsize) + (z * header.xsize * header.ysize); System.arraycopy(tmpData, offs, buf, 0, header.xsize); } } - private void bwtorgba(byte[] b, byte[] dest, int lptr) { + private void bwtorgba(final byte[] b, final byte[] dest, final int lptr) { for (int i = 0; i < b.length; i++) { dest[4 * i + lptr + 0] = b[i]; dest[4 * i + lptr + 1] = b[i]; @@ -331,7 +331,7 @@ public class SGIImage { } } - private void latorgba(byte[] b, byte[] a, byte[] dest, int lptr) { + private void latorgba(final byte[] b, final byte[] a, final byte[] dest, final int lptr) { for (int i = 0; i < b.length; i++) { dest[4 * i + lptr + 0] = b[i]; dest[4 * i + lptr + 1] = b[i]; @@ -340,7 +340,7 @@ public class SGIImage { } } - private void rgbtorgba(byte[] r, byte[] g, byte[] b, byte[] dest, int lptr) { + private void rgbtorgba(final byte[] r, final byte[] g, final byte[] b, final byte[] dest, final int lptr) { for (int i = 0; i < b.length; i++) { dest[4 * i + lptr + 0] = r[i]; dest[4 * i + lptr + 1] = g[i]; @@ -349,7 +349,7 @@ public class SGIImage { } } - private void rgbatorgba(byte[] r, byte[] g, byte[] b, byte[] a, byte[] dest, int lptr) { + private void rgbatorgba(final byte[] r, final byte[] g, final byte[] b, final byte[] a, final byte[] dest, final int lptr) { for (int i = 0; i < b.length; i++) { dest[4 * i + lptr + 0] = r[i]; dest[4 * i + lptr + 1] = g[i]; @@ -358,19 +358,19 @@ public class SGIImage { } } - private static byte imgref(byte[] i, - int x, - int y, - int z, - int xs, - int ys, - int zs) { + private static byte imgref(final byte[] i, + final int x, + final int y, + final int z, + final int xs, + final int ys, + final int zs) { return i[(xs*ys*z)+(xs*y)+x]; } - private void writeHeader(DataOutputStream stream, - int xsize, int ysize, int zsize, boolean rle) throws IOException { + private void writeHeader(final DataOutputStream stream, + final int xsize, final int ysize, final int zsize, final boolean rle) throws IOException { // effects: outputs the 512-byte IRIS RGB header to STREAM, using xsize, // ysize, and depth as the dimensions of the image. NOTE that // the following defaults are used: @@ -415,14 +415,14 @@ public class SGIImage { stream.write(0); } - private void writeImage(File file, + private void writeImage(final File file, byte[] data, - int xsize, - int ysize, - int zsize, - boolean yflip) throws IOException { + final int xsize, + final int ysize, + final int zsize, + final boolean yflip) throws IOException { // Input data is in RGBRGBRGB or RGBARGBARGBA format; first unswizzle it - byte[] tmpData = new byte[xsize * ysize * zsize]; + final byte[] tmpData = new byte[xsize * ysize * zsize]; int dest = 0; for (int i = 0; i < zsize; i++) { for (int j = i; j < (xsize * ysize * zsize); j += zsize) { @@ -447,8 +447,8 @@ public class SGIImage { // x axis). // Build the offset tables - int[] starttab = new int[ysize * zsize]; - int[] lengthtab = new int[ysize * zsize]; + final int[] starttab = new int[ysize * zsize]; + final int[] lengthtab = new int[ysize * zsize]; // Temporary buffer for holding RLE data. // Note that this makes the assumption that RLE-compressed data will @@ -459,8 +459,8 @@ public class SGIImage { // empirical evidence here; the break-even point seems to be a look- // ahead of 3. (That is, if the three values following this one are all // the same as the current value, switch to repeat mode.) - int lookahead = 3; - byte[] rlebuf = new byte[2 * xsize * ysize * zsize]; + final int lookahead = 3; + final byte[] rlebuf = new byte[2 * xsize * ysize * zsize]; int cur_loc = 0; // current offset location. int ptr = 0; @@ -475,7 +475,7 @@ public class SGIImage { yincr = -1; } - boolean DEBUG = false; + final boolean DEBUG = false; for (int z = 0; z < zsize; z++) { for (int y = ystart; y != yend; y += yincr) { @@ -485,7 +485,7 @@ public class SGIImage { byte count = 0; boolean repeat_mode = false; boolean should_switch = false; - int start_ptr = ptr; + final int start_ptr = ptr; int num_ptr = ptr++; byte repeat_val = 0; @@ -566,7 +566,7 @@ public class SGIImage { x++; } // output this row's length into the length table - int rowlen = ptr - start_ptr; + final int rowlen = ptr - start_ptr; if (yflip) lengthtab[ysize*z+(ysize-y-1)] = rowlen; else @@ -587,11 +587,11 @@ public class SGIImage { if (DEBUG) System.err.println("total_size was " + total_size); - DataOutputStream stream = new DataOutputStream(new BufferedOutputStream(IOUtil.getFileOutputStream(file, true))); + final DataOutputStream stream = new DataOutputStream(new BufferedOutputStream(IOUtil.getFileOutputStream(file, true))); writeHeader(stream, xsize, ysize, zsize, true); - int SIZEOF_INT = 4; + final int SIZEOF_INT = 4; for (int i = 0; i < (ysize * zsize); i++) stream.writeInt(starttab[i] + 512 + (2 * ysize * zsize * SIZEOF_INT)); for (int i = 0; i < (ysize * zsize); i++) @@ -602,7 +602,7 @@ public class SGIImage { stream.close(); } - private byte[] readAll(DataInputStream in) throws IOException { + private byte[] readAll(final DataInputStream in) throws IOException { byte[] dest = new byte[16384]; int pos = 0; int numRead = 0; @@ -613,7 +613,7 @@ public class SGIImage { numRead = in.read(dest, pos, dest.length - pos); if (pos == dest.length) { // Resize destination buffer - byte[] newDest = new byte[2 * dest.length]; + final byte[] newDest = new byte[2 * dest.length]; System.arraycopy(dest, 0, newDest, 0, pos); dest = newDest; } @@ -626,7 +626,7 @@ public class SGIImage { // Trim destination buffer if (pos != dest.length) { - byte[] finalDest = new byte[pos]; + final byte[] finalDest = new byte[pos]; System.arraycopy(dest, 0, finalDest, 0, pos); dest = finalDest; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java index 15cd63eb3..28823abb3 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java +++ b/src/jogl/classes/com/jogamp/opengl/util/texture/spi/TGAImage.java @@ -71,12 +71,12 @@ import com.jogamp.common.util.IOUtil; */ public class TGAImage { - private Header header; + private final Header header; private int format; private int bpp; private ByteBuffer data; - private TGAImage(Header header) { + private TGAImage(final Header header) { this.header = header; } @@ -114,7 +114,7 @@ public class TGAImage { public final static int I_FOURWAY = 2; /** Type of this TGA file format */ - private int tgaType; + private final int tgaType; /** initial TGA image data fields */ private int idLength; // byte value @@ -142,7 +142,7 @@ public class TGAImage { tgaType = TYPE_OLD; // dont try and get footer. } - Header(LEDataInputStream in) throws IOException { + Header(final LEDataInputStream in) throws IOException { tgaType = TYPE_OLD; // dont try and get footer. // initial header fields @@ -220,24 +220,24 @@ public class TGAImage { public int size() { return 18 + idLength; } // buf must be in little-endian byte order - private void write(ByteBuffer buf) { + private void write(final ByteBuffer buf) { buf.put((byte) idLength); buf.put((byte) colorMapType); buf.put((byte) imageType); buf.putShort((short) firstEntryIndex); buf.putShort((short) colorMapLength); - buf.put((byte) colorMapEntrySize); + buf.put(colorMapEntrySize); buf.putShort((short) xOrigin); buf.putShort((short) yOrigin); buf.putShort((short) width); buf.putShort((short) height); - buf.put((byte) pixelDepth); - buf.put((byte) imageDescriptor); + buf.put(pixelDepth); + buf.put(imageDescriptor); if (idLength > 0) { try { - byte[] chars = imageID.getBytes("US-ASCII"); + final byte[] chars = imageID.getBytes("US-ASCII"); buf.put(chars); - } catch (UnsupportedEncodingException e) { + } catch (final UnsupportedEncodingException e) { throw new RuntimeException(e); } } @@ -250,7 +250,7 @@ public class TGAImage { * it into the JimiImage structure. This was taken from the * prototype and modified for the new Jimi structure */ - private void decodeImage(GLProfile glp, LEDataInputStream dIn) throws IOException { + private void decodeImage(final GLProfile glp, final LEDataInputStream dIn) throws IOException { switch (header.imageType()) { case Header.UCOLORMAPPED: throw new IOException("TGADecoder Uncompressed Colormapped images not supported"); @@ -294,14 +294,14 @@ public class TGAImage { * This assumes that the body is for a 24 bit or 32 bit for a * RGB or ARGB image respectively. */ - private void decodeRGBImageU24_32(GLProfile glp, LEDataInputStream dIn) throws IOException { + private void decodeRGBImageU24_32(final GLProfile glp, final LEDataInputStream dIn) throws IOException { setupImage24_32(glp); int i; // row index int y; // output row index - int rawWidth = header.width() * bpp; - byte[] rawBuf = new byte[rawWidth]; - byte[] tmpData = new byte[rawWidth * header.height()]; + final int rawWidth = header.width() * bpp; + final byte[] rawBuf = new byte[rawWidth]; + final byte[] tmpData = new byte[rawWidth * header.height()]; for (i = 0; i < header.height(); ++i) { dIn.readFully(rawBuf, 0, rawWidth); @@ -323,12 +323,12 @@ public class TGAImage { * This assumes that the body is for a 24 bit or 32 bit for a * RGB or ARGB image respectively. */ - private void decodeRGBImageRLE24_32(GLProfile glp, LEDataInputStream dIn) throws IOException { + private void decodeRGBImageRLE24_32(final GLProfile glp, final LEDataInputStream dIn) throws IOException { setupImage24_32(glp); - byte[] pixel = new byte[bpp]; - int rawWidth = header.width() * bpp; - byte[] tmpData = new byte[rawWidth * header.height()]; + final byte[] pixel = new byte[bpp]; + final int rawWidth = header.width() * bpp; + final byte[] tmpData = new byte[rawWidth * header.height()]; int i = 0, j; int packet, len; while (i < tmpData.length) { @@ -348,7 +348,7 @@ public class TGAImage { data = ByteBuffer.wrap(tmpData); } - private void setupImage24_32(GLProfile glp) { + private void setupImage24_32(final GLProfile glp) { bpp = header.pixelDepth / 8; switch (header.pixelDepth) { case 24: @@ -367,7 +367,7 @@ public class TGAImage { } } - private static void swapBGR(byte[] data, int bWidth, int height, int bpp) { + private static void swapBGR(final byte[] data, final int bWidth, final int height, final int bpp) { byte r,b; int k; for(int i=0; i */ public class DebugGL2 extends DebugGL4bc { - public DebugGL2(GL2 downstream) { + public DebugGL2(final GL2 downstream) { super((GL4bc)downstream); } } diff --git a/src/jogl/classes/javax/media/opengl/DebugGL3.java b/src/jogl/classes/javax/media/opengl/DebugGL3.java index b490a63f4..678e800f6 100644 --- a/src/jogl/classes/javax/media/opengl/DebugGL3.java +++ b/src/jogl/classes/javax/media/opengl/DebugGL3.java @@ -15,7 +15,7 @@ package javax.media.opengl; *

*/ public class DebugGL3 extends DebugGL4bc { - public DebugGL3(GL3 downstream) { + public DebugGL3(final GL3 downstream) { super((GL4bc)downstream); } } diff --git a/src/jogl/classes/javax/media/opengl/DebugGL3bc.java b/src/jogl/classes/javax/media/opengl/DebugGL3bc.java index 1d42afbc6..2636e9428 100644 --- a/src/jogl/classes/javax/media/opengl/DebugGL3bc.java +++ b/src/jogl/classes/javax/media/opengl/DebugGL3bc.java @@ -15,7 +15,7 @@ package javax.media.opengl; *

*/ public class DebugGL3bc extends DebugGL4bc { - public DebugGL3bc(GL3bc downstream) { + public DebugGL3bc(final GL3bc downstream) { super((GL4bc)downstream); } } diff --git a/src/jogl/classes/javax/media/opengl/DebugGL4.java b/src/jogl/classes/javax/media/opengl/DebugGL4.java index 249d850a3..c4f8764cb 100644 --- a/src/jogl/classes/javax/media/opengl/DebugGL4.java +++ b/src/jogl/classes/javax/media/opengl/DebugGL4.java @@ -15,7 +15,7 @@ package javax.media.opengl; *

*/ public class DebugGL4 extends DebugGL4bc { - public DebugGL4(GL4 downstream) { + public DebugGL4(final GL4 downstream) { super((GL4bc)downstream); } } diff --git a/src/jogl/classes/javax/media/opengl/DebugGLES2.java b/src/jogl/classes/javax/media/opengl/DebugGLES2.java index 6d666d82a..c4e06f347 100644 --- a/src/jogl/classes/javax/media/opengl/DebugGLES2.java +++ b/src/jogl/classes/javax/media/opengl/DebugGLES2.java @@ -15,7 +15,7 @@ package javax.media.opengl; *

*/ public class DebugGLES2 extends DebugGLES3 { - public DebugGLES2(GLES2 downstream) { + public DebugGLES2(final GLES2 downstream) { super((GLES3)downstream); } } diff --git a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java index 7e243471e..412af25e0 100644 --- a/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java +++ b/src/jogl/classes/javax/media/opengl/DefaultGLCapabilitiesChooser.java @@ -41,9 +41,13 @@ package javax.media.opengl; import javax.media.nativewindow.NativeWindowException; + import java.util.List; + import javax.media.nativewindow.CapabilitiesImmutable; +import com.jogamp.common.util.PropertyAccess; + import jogamp.opengl.Debug; /**

The default implementation of the {@link @@ -89,7 +93,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { static { Debug.initSingleton(); - DEBUG = Debug.isPropertyDefined("jogl.debug.CapabilitiesChooser", true); + DEBUG = PropertyAccess.isPropertyDefined("jogl.debug.CapabilitiesChooser", true); } private final static int NO_SCORE = -9999999; @@ -142,7 +146,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { } // Create score array - int[] scores = new int[availnum]; + final int[] scores = new int[availnum]; for (int i = 0; i < scores.length; i++) { scores[i] = NO_SCORE; @@ -218,13 +222,13 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { boolean gotHW = false; int maxAbsoluteHWScore = 0; for (int i = 0; i < availnum; i++) { - int score = scores[i]; + final int score = scores[i]; if (score == NO_SCORE) { continue; } final GLCapabilitiesImmutable cur = (GLCapabilitiesImmutable) available.get(i); if (cur.getHardwareAccelerated()) { - int absScore = Math.abs(score); + final int absScore = Math.abs(score); if (!gotHW || (absScore > maxAbsoluteHWScore)) { gotHW = true; @@ -265,7 +269,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { int scoreClosestToZero = NO_SCORE; int chosenIndex = -1; for (int i = 0; i < availnum; i++) { - int score = scores[i]; + final int score = scores[i]; if (score == NO_SCORE) { continue; } @@ -289,7 +293,7 @@ public class DefaultGLCapabilitiesChooser implements GLCapabilitiesChooser { return chosenIndex; } - private static int sign(int score) { + private static int sign(final int score) { if (score < 0) { return -1; } diff --git a/src/jogl/classes/javax/media/opengl/GLCapabilities.java b/src/jogl/classes/javax/media/opengl/GLCapabilities.java index 4dafe5262..0d65d35cb 100644 --- a/src/jogl/classes/javax/media/opengl/GLCapabilities.java +++ b/src/jogl/classes/javax/media/opengl/GLCapabilities.java @@ -80,7 +80,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil * @param glp GLProfile, or null for the default GLProfile * @throws GLException if no profile is given and no default profile is available for the default device. */ - public GLCapabilities(GLProfile glp) throws GLException { + public GLCapabilities(final GLProfile glp) throws GLException { glProfile = (null!=glp)?glp:GLProfile.getDefault(GLProfile.getDefaultDevice()); } @@ -93,7 +93,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil public Object clone() { try { return super.clone(); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { throw new GLException(e); } } @@ -103,7 +103,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil * from source into this instance. * @return this instance */ - public GLCapabilities copyFrom(GLCapabilitiesImmutable source) { + public GLCapabilities copyFrom(final GLCapabilitiesImmutable source) { super.copyFrom(source); glProfile = source.getGLProfile(); isPBuffer = source.isPBuffer(); @@ -145,12 +145,12 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if(this == obj) { return true; } if(!(obj instanceof GLCapabilitiesImmutable)) { return false; } - GLCapabilitiesImmutable other = (GLCapabilitiesImmutable)obj; + final GLCapabilitiesImmutable other = (GLCapabilitiesImmutable)obj; boolean res = super.equals(obj) && other.getGLProfile()==glProfile && other.isPBuffer()==isPBuffer && @@ -176,7 +176,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil @Override public int compareTo(final CapabilitiesImmutable o) { if ( ! ( o instanceof GLCapabilitiesImmutable ) ) { - Class c = (null != o) ? o.getClass() : null ; + final Class c = (null != o) ? o.getClass() : null ; throw new ClassCastException("Not a GLCapabilitiesImmutable object, but " + c); } final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) o; @@ -235,7 +235,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil } /** Sets the GL profile you desire */ - public void setGLProfile(GLProfile profile) { + public void setGLProfile(final GLProfile profile) { glProfile=profile; } @@ -256,7 +256,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil * Requesting offscreen pbuffer mode disables the offscreen auto selection. *

*/ - public void setPBuffer(boolean enable) { + public void setPBuffer(final boolean enable) { if(enable) { setOnscreen(false); } @@ -280,7 +280,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil * Requesting offscreen FBO mode disables the offscreen auto selection. *

*/ - public void setFBO(boolean enable) { + public void setFBO(final boolean enable) { if(enable) { setOnscreen(false); } @@ -293,7 +293,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil } /** Enables or disables double buffering. */ - public void setDoubleBuffered(boolean enable) { + public void setDoubleBuffered(final boolean enable) { doubleBuffered = enable; } @@ -303,7 +303,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil } /** Enables or disables stereo viewing. */ - public void setStereo(boolean enable) { + public void setStereo(final boolean enable) { stereo = enable; } @@ -313,7 +313,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil } /** Enables or disables hardware acceleration. */ - public void setHardwareAccelerated(boolean enable) { + public void setHardwareAccelerated(final boolean enable) { hardwareAccelerated = enable; } @@ -323,7 +323,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil } /** Sets the number of bits requested for the depth buffer. */ - public void setDepthBits(int depthBits) { + public void setDepthBits(final int depthBits) { this.depthBits = depthBits; } @@ -333,7 +333,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil } /** Sets the number of bits requested for the stencil buffer. */ - public void setStencilBits(int stencilBits) { + public void setStencilBits(final int stencilBits) { this.stencilBits = stencilBits; } @@ -346,7 +346,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil red component. On some systems only the accumulation buffer depth, which is the sum of the red, green, and blue bits, is considered. */ - public void setAccumRedBits(int accumRedBits) { + public void setAccumRedBits(final int accumRedBits) { this.accumRedBits = accumRedBits; } @@ -359,7 +359,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil green component. On some systems only the accumulation buffer depth, which is the sum of the red, green, and blue bits, is considered. */ - public void setAccumGreenBits(int accumGreenBits) { + public void setAccumGreenBits(final int accumGreenBits) { this.accumGreenBits = accumGreenBits; } @@ -372,7 +372,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil blue component. On some systems only the accumulation buffer depth, which is the sum of the red, green, and blue bits, is considered. */ - public void setAccumBlueBits(int accumBlueBits) { + public void setAccumBlueBits(final int accumBlueBits) { this.accumBlueBits = accumBlueBits; } @@ -385,7 +385,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil component. On some systems only the accumulation buffer depth, which is the sum of the red, green, and blue bits, is considered. */ - public void setAccumAlphaBits(int accumAlphaBits) { + public void setAccumAlphaBits(final int accumAlphaBits) { this.accumAlphaBits = accumAlphaBits; } @@ -393,7 +393,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil * Sets the desired extension for full-scene antialiasing * (FSAA), default is {@link #DEFAULT_SAMPLE_EXTENSION}. */ - public void setSampleExtension(String se) { + public void setSampleExtension(final String se) { sampleExtension = se; } @@ -410,7 +410,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil * If enabled this method also invokes {@link #setAlphaBits(int) setAlphaBits(1)} * if {@link #getAlphaBits()} == 0.
*/ - public void setSampleBuffers(boolean enable) { + public void setSampleBuffers(final boolean enable) { sampleBuffers = enable; if(sampleBuffers && getAlphaBits()==0) { setAlphaBits(1); @@ -427,7 +427,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil * to be allocated. Defaults to 2. * @see #getNumSamples() */ - public void setNumSamples(int numSamples) { + public void setNumSamples(final int numSamples) { this.numSamples = numSamples; } @@ -503,7 +503,7 @@ public class GLCapabilities extends Capabilities implements Cloneable, GLCapabil object. */ @Override public String toString() { - StringBuilder msg = new StringBuilder(); + final StringBuilder msg = new StringBuilder(); msg.append("GLCaps["); toString(msg); msg.append("]"); diff --git a/src/jogl/classes/javax/media/opengl/GLContext.java b/src/jogl/classes/javax/media/opengl/GLContext.java index 9a4311772..16399799f 100644 --- a/src/jogl/classes/javax/media/opengl/GLContext.java +++ b/src/jogl/classes/javax/media/opengl/GLContext.java @@ -227,7 +227,7 @@ public abstract class GLContext { /** * @param isInit true if called for class initialization, otherwise false (re-init or destruction). */ - protected void resetStates(boolean isInit) { + protected void resetStates(final boolean isInit) { if (DEBUG) { System.err.println(getThreadName() + ": GLContext.resetStates(isInit "+isInit+")"); // Thread.dumpStack(); @@ -277,7 +277,7 @@ public abstract class GLContext { * @param quirk the quirk to be tested, e.g. {@link GLRendererQuirks#NoDoubleBufferedPBuffer}. * @throws IllegalArgumentException if the quirk is out of range */ - public final boolean hasRendererQuirk(int quirk) throws IllegalArgumentException { + public final boolean hasRendererQuirk(final int quirk) throws IllegalArgumentException { return null != glRendererQuirks ? glRendererQuirks.exist(quirk) : false ; } @@ -460,7 +460,7 @@ public abstract class GLContext { * @throws GLException if no context is current */ public static GL getCurrentGL() throws GLException { - GLContext glc = getCurrent(); + final GLContext glc = getCurrent(); if(null==glc) { throw new GLException(getThreadName()+": No OpenGL context current on this thread"); } @@ -495,7 +495,7 @@ public abstract class GLContext { } /** Returns a String representation of the {@link #makeCurrent()} result. */ - public static final String makeCurrentResultToString(int res) { + public static final String makeCurrentResultToString(final int res) { switch(res) { case CONTEXT_NOT_CURRENT: return "CONTEXT_NOT_CURRENT"; case CONTEXT_CURRENT: return "CONTEXT_CURRENT"; @@ -509,7 +509,7 @@ public abstract class GLContext { * and has no other side-effects. For use by third parties adding * new GLContext implementations; not for use by end users. */ - protected static void setCurrent(GLContext cur) { + protected static void setCurrent(final GLContext cur) { if( TRACE_SWITCH ) { if(null == cur) { System.err.println(getThreadName()+": GLContext.ContextSwitch: - setCurrent() - NULL"); @@ -570,7 +570,7 @@ public abstract class GLContext { /** * Returns the attached user object for the given name to this GLContext. */ - public final Object getAttachedObject(String name) { + public final Object getAttachedObject(final String name) { return attachedObjects.get(name); } @@ -578,11 +578,11 @@ public abstract class GLContext { * Sets the attached user object for the given name to this GLContext. * Returns the previously set object or null. */ - public final Object attachObject(String name, Object obj) { + public final Object attachObject(final String name, final Object obj) { return attachedObjects.put(name, obj); } - public final Object detachObject(String name) { + public final Object detachObject(final String name) { return attachedObjects.remove(name); } @@ -591,7 +591,7 @@ public abstract class GLContext { */ @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); this.append(sb); @@ -599,7 +599,7 @@ public abstract class GLContext { return sb.toString(); } - public final StringBuilder append(StringBuilder sb) { + public final StringBuilder append(final StringBuilder sb) { sb.append("Version ").append(getGLVersion()).append(" [GL ").append(getGLVersionNumber()).append(", vendor ").append(getGLVendorVersionNumber()); sb.append("], options 0x"); sb.append(Integer.toHexString(ctxOptions)); @@ -816,7 +816,7 @@ public abstract class GLContext { return "#version " + ctxGLSLVersion.getMajor() + ( minor < 10 ? "0"+minor : minor ) + esSuffix + "\n" ; } - protected static final VersionNumber getStaticGLSLVersionNumber(int glMajorVersion, int glMinorVersion, int ctxOptions) { + protected static final VersionNumber getStaticGLSLVersionNumber(final int glMajorVersion, final int glMinorVersion, final int ctxOptions) { if( 0 != ( CTX_PROFILE_ES & ctxOptions ) ) { if( 3 == glMajorVersion ) { return Version300; // ES 3.0 -> GLSL 3.00 @@ -938,14 +938,14 @@ public abstract class GLContext { final GL gl = getGL(); final int[] val = new int[] { 0 } ; try { - gl.glGetIntegerv(GL2GL3.GL_MAX_SAMPLES, val, 0); + gl.glGetIntegerv(GL2ES3.GL_MAX_SAMPLES, val, 0); final int glerr = gl.glGetError(); if(GL.GL_NO_ERROR == glerr) { return val[0]; } else if(DEBUG) { System.err.println("GLContext.getMaxRenderbufferSamples: GL_MAX_SAMPLES query GL Error 0x"+Integer.toHexString(glerr)); } - } catch (GLException gle) { gle.printStackTrace(); } + } catch (final GLException gle) { gle.printStackTrace(); } } return 0; } @@ -1188,7 +1188,7 @@ public abstract class GLContext { * * @throws GLException if the context is not current. */ - public final boolean setSwapInterval(int interval) throws GLException { + public final boolean setSwapInterval(final int interval) throws GLException { validateCurrent(); if(0<=interval) { if( !drawableRetargeted || !hasRendererQuirk(GLRendererQuirks.NoSetSwapIntervalPostRetarget) ) { @@ -1200,7 +1200,7 @@ public abstract class GLContext { } return false; } - protected boolean setSwapIntervalImpl(int interval) { + protected boolean setSwapIntervalImpl(final int interval) { return false; } /** Return the current swap interval. @@ -1225,27 +1225,27 @@ public abstract class GLContext { } } - public final boolean queryMaxSwapGroups(int[] maxGroups, int maxGroups_offset, - int[] maxBarriers, int maxBarriers_offset) { + public final boolean queryMaxSwapGroups(final int[] maxGroups, final int maxGroups_offset, + final int[] maxBarriers, final int maxBarriers_offset) { validateCurrent(); return queryMaxSwapGroupsImpl(maxGroups, maxGroups_offset, maxBarriers, maxBarriers_offset); } - protected boolean queryMaxSwapGroupsImpl(int[] maxGroups, int maxGroups_offset, - int[] maxBarriers, int maxBarriers_offset) { return false; } - public final boolean joinSwapGroup(int group) { + protected boolean queryMaxSwapGroupsImpl(final int[] maxGroups, final int maxGroups_offset, + final int[] maxBarriers, final int maxBarriers_offset) { return false; } + public final boolean joinSwapGroup(final int group) { validateCurrent(); return joinSwapGroupImpl(group); } - protected boolean joinSwapGroupImpl(int group) { /** nop per default .. **/ return false; } + protected boolean joinSwapGroupImpl(final int group) { /** nop per default .. **/ return false; } protected int currentSwapGroup = -1; // default: not set yet .. public int getSwapGroup() { return currentSwapGroup; } - public final boolean bindSwapBarrier(int group, int barrier) { + public final boolean bindSwapBarrier(final int group, final int barrier) { validateCurrent(); return bindSwapBarrierImpl(group, barrier); } - protected boolean bindSwapBarrierImpl(int group, int barrier) { /** nop per default .. **/ return false; } + protected boolean bindSwapBarrierImpl(final int group, final int barrier) { /** nop per default .. **/ return false; } /** * Return the framebuffer name bound to this context, @@ -1406,11 +1406,11 @@ public abstract class GLContext { /* 2.*/ { 0 }, /* 3.*/ { 0 } }; - public static final int getMaxMajor(int ctxProfile) { + public static final int getMaxMajor(final int ctxProfile) { return ( 0 != ( CTX_PROFILE_ES & ctxProfile ) ) ? ES_VERSIONS.length-1 : GL_VERSIONS.length-1; } - public static final int getMaxMinor(int ctxProfile, int major) { + public static final int getMaxMinor(final int ctxProfile, final int major) { if( 1>major ) { return -1; } @@ -1439,7 +1439,7 @@ public abstract class GLContext { * and {@link #decrementGLVersion(int, int[], int[])} until invalid. *

*/ - public static final boolean isValidGLVersion(int ctxProfile, int major, int minor) { + public static final boolean isValidGLVersion(final int ctxProfile, final int major, final int minor) { if( 1>major || 0>minor ) { return false; } @@ -1455,7 +1455,7 @@ public abstract class GLContext { * Clip the given GL version to the maximum known valid version if exceeding. * @return true if clipped, i.e. given value exceeds maximum, otherwise false. */ - public static final boolean clipGLVersion(int ctxProfile, int major[], int minor[]) { + public static final boolean clipGLVersion(final int ctxProfile, final int major[], final int minor[]) { final int m = major[0]; final int n = minor[0]; @@ -1494,7 +1494,7 @@ public abstract class GLContext { * @param minor * @return */ - public static final boolean decrementGLVersion(int ctxProfile, int major[], int minor[]) { + public static final boolean decrementGLVersion(final int ctxProfile, final int major[], final int minor[]) { if( !clipGLVersion(ctxProfile, major, minor) ) { int m = major[0]; int n = minor[0] - 1; @@ -1520,13 +1520,13 @@ public abstract class GLContext { return true; } - protected static int composeBits(int a8, int b8, int c16) { + protected static int composeBits(final int a8, final int b8, final int c16) { return ( ( a8 & 0x000000FF ) << 24 ) | ( ( b8 & 0x000000FF ) << 16 ) | ( ( c16 & 0x0000FFFF ) ) ; } - private static void validateProfileBits(int bits, String argName) { + private static void validateProfileBits(final int bits, final String argName) { int num = 0; if( 0 != ( CTX_PROFILE_COMPAT & bits ) ) { num++; } if( 0 != ( CTX_PROFILE_CORE & bits ) ) { num++; } @@ -1557,13 +1557,13 @@ public abstract class GLContext { GLContextImpl.shutdownImpl(); // well .. } - protected static boolean getAvailableGLVersionsSet(AbstractGraphicsDevice device) { + protected static boolean getAvailableGLVersionsSet(final AbstractGraphicsDevice device) { synchronized ( deviceVersionsAvailableSet ) { return deviceVersionsAvailableSet.containsKey(device.getUniqueID()); } } - protected static void setAvailableGLVersionsSet(AbstractGraphicsDevice device) { + protected static void setAvailableGLVersionsSet(final AbstractGraphicsDevice device) { synchronized ( deviceVersionsAvailableSet ) { final String devKey = device.getUniqueID(); if( null != deviceVersionsAvailableSet.put(devKey, devKey) ) { @@ -1580,7 +1580,7 @@ public abstract class GLContext { * Returns a unique String object using {@link String#intern()} for the given arguments, * which object reference itself can be used as a key. */ - protected static String getDeviceVersionAvailableKey(AbstractGraphicsDevice device, int major, int profile) { + protected static String getDeviceVersionAvailableKey(final AbstractGraphicsDevice device, final int major, final int profile) { final String r = device.getUniqueID() + "-" + toHexString(composeBits(major, profile, 0)); return r.intern(); } @@ -1597,8 +1597,8 @@ public abstract class GLContext { * * @see #createContextARBMapVersionsAvailable */ - protected static Integer mapAvailableGLVersion(AbstractGraphicsDevice device, - int reqMajor, int profile, int resMajor, int resMinor, int resCtp) + protected static Integer mapAvailableGLVersion(final AbstractGraphicsDevice device, + final int reqMajor, final int profile, final int resMajor, final int resMinor, int resCtp) { validateProfileBits(profile, "profile"); validateProfileBits(resCtp, "resCtp"); @@ -1624,7 +1624,7 @@ public abstract class GLContext { synchronized(deviceVersionAvailable) { final Set keys = deviceVersionAvailable.keySet(); boolean needsSeparator = false; - for(Iterator i = keys.iterator(); i.hasNext(); ) { + for(final Iterator i = keys.iterator(); i.hasNext(); ) { if(needsSeparator) { sb.append(Platform.getNewline()); } @@ -1652,7 +1652,7 @@ public abstract class GLContext { * @param reqProfile Key Value either {@link #CTX_PROFILE_COMPAT}, {@link #CTX_PROFILE_CORE} or {@link #CTX_PROFILE_ES} * @return the available GL version as encoded with {@link #composeBits(int, int, int), otherwise null */ - protected static Integer getAvailableGLVersion(AbstractGraphicsDevice device, int reqMajor, int reqProfile) { + protected static Integer getAvailableGLVersion(final AbstractGraphicsDevice device, final int reqMajor, final int reqProfile) { final String objectKey = getDeviceVersionAvailableKey(device, reqMajor, reqProfile); Integer val; synchronized(deviceVersionAvailable) { @@ -1668,8 +1668,8 @@ public abstract class GLContext { * @param minor if not null, returns the used minor version * @param ctp if not null, returns the used context profile */ - protected static boolean getAvailableGLVersion(AbstractGraphicsDevice device, int reqMajor, int reqProfile, - int[] major, int minor[], int ctp[]) { + protected static boolean getAvailableGLVersion(final AbstractGraphicsDevice device, final int reqMajor, final int reqProfile, + final int[] major, final int minor[], final int ctp[]) { final Integer valI = getAvailableGLVersion(device, reqMajor, reqProfile); if(null==valI) { @@ -1694,7 +1694,7 @@ public abstract class GLContext { * returns the highest GLProfile string regarding the implementation version and context profile bits. * @throws GLException if version and context profile bits could not be mapped to a GLProfile */ - protected static String getGLProfile(int major, int minor, int ctp) + protected static String getGLProfile(final int major, final int minor, final int ctp) throws GLException { if(0 != ( CTX_PROFILE_COMPAT & ctp )) { if(major >= 4) { return GLProfile.GL4bc; } @@ -1714,7 +1714,7 @@ public abstract class GLContext { /** * Returns the GLProfile's major version number at reqMajorCTP[0] and it's context property (CTP) at reqMajorCTP[1] for availability mapping request. */ - protected static final void getRequestMajorAndCompat(final GLProfile glp, int[/*2*/] reqMajorCTP) { + protected static final void getRequestMajorAndCompat(final GLProfile glp, final int[/*2*/] reqMajorCTP) { final GLProfile glpImpl = glp.getImpl(); if( glpImpl.isGL4() ) { reqMajorCTP[0]=4; @@ -1743,9 +1743,9 @@ public abstract class GLContext { final int[] reqMajorCTP = new int[] { 0, 0 }; getRequestMajorAndCompat(glp, reqMajorCTP); - int _major[] = { 0 }; - int _minor[] = { 0 }; - int _ctp[] = { 0 }; + final int _major[] = { 0 }; + final int _minor[] = { 0 }; + final int _ctp[] = { 0 }; if( GLContext.getAvailableGLVersion(device, reqMajorCTP[0], reqMajorCTP[1], _major, _minor, _ctp)) { return _ctp[0]; } @@ -1758,7 +1758,7 @@ public abstract class GLContext { * @param profile Key Value either {@link #CTX_PROFILE_COMPAT}, {@link #CTX_PROFILE_CORE} or {@link #CTX_PROFILE_ES} * @return the highest GLProfile for the device regarding availability, version and profile bits. */ - protected static GLProfile getAvailableGLProfile(AbstractGraphicsDevice device, int reqMajor, int reqProfile) + protected static GLProfile getAvailableGLProfile(final AbstractGraphicsDevice device, final int reqMajor, final int reqProfile) throws GLException { final String glpName = getAvailableGLProfileName(device, reqMajor, reqProfile); return null != glpName ? GLProfile.get(device, glpName) : null; @@ -1770,11 +1770,11 @@ public abstract class GLContext { * @param profile Key Value either {@link #CTX_PROFILE_COMPAT}, {@link #CTX_PROFILE_CORE} or {@link #CTX_PROFILE_ES} * @return the highest GLProfile name for the device regarding availability, version and profile bits. */ - /* package */ static String getAvailableGLProfileName(AbstractGraphicsDevice device, int reqMajor, int reqProfile) + /* package */ static String getAvailableGLProfileName(final AbstractGraphicsDevice device, final int reqMajor, final int reqProfile) throws GLException { - int major[] = { 0 }; - int minor[] = { 0 }; - int ctp[] = { 0 }; + final int major[] = { 0 }; + final int minor[] = { 0 }; + final int ctp[] = { 0 }; if(GLContext.getAvailableGLVersion(device, reqMajor, reqProfile, major, minor, ctp)) { return GLContext.getGLProfile(major[0], minor[0], ctp[0]); } @@ -1786,10 +1786,10 @@ public abstract class GLContext { * @param major Key Value either 1, 2, 3 or 4 * @param profile Key Value either {@link #CTX_PROFILE_COMPAT}, {@link #CTX_PROFILE_CORE} or {@link #CTX_PROFILE_ES} */ - protected static String getAvailableGLVersionAsString(AbstractGraphicsDevice device, int major, int profile) { - int _major[] = { 0 }; - int _minor[] = { 0 }; - int _ctp[] = { 0 }; + protected static String getAvailableGLVersionAsString(final AbstractGraphicsDevice device, final int major, final int profile) { + final int _major[] = { 0 }; + final int _minor[] = { 0 }; + final int _ctp[] = { 0 }; if(getAvailableGLVersion(device, major, profile, _major, _minor, _ctp)) { return getGLVersion(_major[0], _minor[0], _ctp[0], null); } @@ -1809,7 +1809,7 @@ public abstract class GLContext { * @param glp {@link GLProfile} to check for FBO capabilities * @see GLContext#hasBasicFBOSupport() */ - public static final boolean isFBOAvailable(AbstractGraphicsDevice device, GLProfile glp) { + public static final boolean isFBOAvailable(final AbstractGraphicsDevice device, final GLProfile glp) { return 0 != ( CTX_IMPL_FBO & getAvailableContextProperties(device, glp) ); } @@ -1818,7 +1818,7 @@ public abstract class GLContext { * @see GLContext#isHardwareRasterizer() * @see GLProfile#isHardwareRasterizer() */ - public static final int isHardwareRasterizer(AbstractGraphicsDevice device, GLProfile glp) { + public static final int isHardwareRasterizer(final AbstractGraphicsDevice device, final GLProfile glp) { final int r; final int ctp = getAvailableContextProperties(device, glp); if(0 == ctp) { @@ -1838,8 +1838,8 @@ public abstract class GLContext { * @param isHardware return value of one boolean, whether the profile is a hardware rasterizer or not * @return true if the requested GL version is available regardless of a software or hardware rasterizer, otherwise false. */ - protected static boolean isGLVersionAvailable(AbstractGraphicsDevice device, int reqMajor, int reqProfile, boolean isHardware[]) { - Integer valI = getAvailableGLVersion(device, reqMajor, reqProfile); + protected static boolean isGLVersionAvailable(final AbstractGraphicsDevice device, final int reqMajor, final int reqProfile, final boolean isHardware[]) { + final Integer valI = getAvailableGLVersion(device, reqMajor, reqProfile); if(null==valI) { return false; } @@ -1847,15 +1847,15 @@ public abstract class GLContext { return true; } - public static boolean isGLES1Available(AbstractGraphicsDevice device, boolean isHardware[]) { + public static boolean isGLES1Available(final AbstractGraphicsDevice device, final boolean isHardware[]) { return isGLVersionAvailable(device, 1, GLContext.CTX_PROFILE_ES, isHardware); } - public static boolean isGLES2Available(AbstractGraphicsDevice device, boolean isHardware[]) { + public static boolean isGLES2Available(final AbstractGraphicsDevice device, final boolean isHardware[]) { return isGLVersionAvailable(device, 2, GLContext.CTX_PROFILE_ES, isHardware); } - public static boolean isGLES3Available(AbstractGraphicsDevice device, boolean isHardware[]) { + public static boolean isGLES3Available(final AbstractGraphicsDevice device, final boolean isHardware[]) { return isGLVersionAvailable(device, 3, GLContext.CTX_PROFILE_ES, isHardware); } @@ -1867,10 +1867,10 @@ public abstract class GLContext { * Includes [ GL ≥ 4.3, GL ≥ 3.1 w/ GL_ARB_ES3_compatibility and GLES3 ] *

*/ - public static final boolean isGLES3CompatibleAvailable(AbstractGraphicsDevice device) { - int major[] = { 0 }; - int minor[] = { 0 }; - int ctp[] = { 0 }; + public static final boolean isGLES3CompatibleAvailable(final AbstractGraphicsDevice device) { + final int major[] = { 0 }; + final int minor[] = { 0 }; + final int ctp[] = { 0 }; boolean ok; ok = GLContext.getAvailableGLVersion(device, 3, GLContext.CTX_PROFILE_ES, major, minor, ctp); @@ -1883,29 +1883,29 @@ public abstract class GLContext { return 0 != ( ctp[0] & CTX_IMPL_ES3_COMPAT ); } - public static boolean isGL4bcAvailable(AbstractGraphicsDevice device, boolean isHardware[]) { + public static boolean isGL4bcAvailable(final AbstractGraphicsDevice device, final boolean isHardware[]) { return isGLVersionAvailable(device, 4, CTX_PROFILE_COMPAT, isHardware); } - public static boolean isGL4Available(AbstractGraphicsDevice device, boolean isHardware[]) { + public static boolean isGL4Available(final AbstractGraphicsDevice device, final boolean isHardware[]) { return isGLVersionAvailable(device, 4, CTX_PROFILE_CORE, isHardware); } - public static boolean isGL3bcAvailable(AbstractGraphicsDevice device, boolean isHardware[]) { + public static boolean isGL3bcAvailable(final AbstractGraphicsDevice device, final boolean isHardware[]) { return isGLVersionAvailable(device, 3, CTX_PROFILE_COMPAT, isHardware); } - public static boolean isGL3Available(AbstractGraphicsDevice device, boolean isHardware[]) { + public static boolean isGL3Available(final AbstractGraphicsDevice device, final boolean isHardware[]) { return isGLVersionAvailable(device, 3, CTX_PROFILE_CORE, isHardware); } - public static boolean isGL2Available(AbstractGraphicsDevice device, boolean isHardware[]) { + public static boolean isGL2Available(final AbstractGraphicsDevice device, final boolean isHardware[]) { return isGLVersionAvailable(device, 2, CTX_PROFILE_COMPAT, isHardware); } - protected static String getGLVersion(int major, int minor, int ctp, String gl_version) { + protected static String getGLVersion(final int major, final int minor, final int ctp, final String gl_version) { boolean needColon = false; - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(major); sb.append("."); sb.append(minor); @@ -1937,15 +1937,15 @@ public abstract class GLContext { // internal string utils // - protected static String toHexString(int hex) { + protected static String toHexString(final int hex) { return "0x" + Integer.toHexString(hex); } - protected static String toHexString(long hex) { + protected static String toHexString(final long hex) { return "0x" + Long.toHexString(hex); } - private static boolean appendString(StringBuilder sb, String string, boolean needColon, boolean condition) { + private static boolean appendString(final StringBuilder sb, final String string, boolean needColon, final boolean condition) { if(condition) { if(needColon) { sb.append(", "); diff --git a/src/jogl/classes/javax/media/opengl/GLDebugMessage.java b/src/jogl/classes/javax/media/opengl/GLDebugMessage.java index acb33b058..325345012 100644 --- a/src/jogl/classes/javax/media/opengl/GLDebugMessage.java +++ b/src/jogl/classes/javax/media/opengl/GLDebugMessage.java @@ -51,7 +51,7 @@ public class GLDebugMessage { * @param dbgSeverity The ARB severity level * @param dbgMsg The debug message */ - public GLDebugMessage(GLContext source, long when, int dbgSource, int dbgType, int dbgId, int dbgSeverity, String dbgMsg) { + public GLDebugMessage(final GLContext source, final long when, final int dbgSource, final int dbgType, final int dbgId, final int dbgSeverity, final String dbgMsg) { this.source = source; this.when = when; this.dbgSource = dbgSource; @@ -71,14 +71,14 @@ public class GLDebugMessage { * @param dbgMsg * @return */ - public static GLDebugMessage translateAMDEvent(GLContext source, long when, int dbgId, int amdDbgCategory, int dbgSeverity, String dbgMsg) { + public static GLDebugMessage translateAMDEvent(final GLContext source, final long when, final int dbgId, final int amdDbgCategory, final int dbgSeverity, final String dbgMsg) { int dbgSource, dbgType; // AMD category == ARB source/type switch(amdDbgCategory) { case GL2GL3.GL_DEBUG_CATEGORY_API_ERROR_AMD: - dbgSource = GL2GL3.GL_DEBUG_SOURCE_API; - dbgType = GL2GL3.GL_DEBUG_TYPE_ERROR; + dbgSource = GL2ES2.GL_DEBUG_SOURCE_API; + dbgType = GL2ES2.GL_DEBUG_TYPE_ERROR; break; // @@ -86,18 +86,18 @@ public class GLDebugMessage { // case GL2GL3.GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD: - dbgSource = GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM; - dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER; + dbgSource = GL2ES2.GL_DEBUG_SOURCE_WINDOW_SYSTEM; + dbgType = GL2ES2.GL_DEBUG_TYPE_OTHER; break; case GL2GL3.GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD: - dbgSource = GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER; - dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER; + dbgSource = GL2ES2.GL_DEBUG_SOURCE_SHADER_COMPILER; + dbgType = GL2ES2.GL_DEBUG_TYPE_OTHER; break; case GL2GL3.GL_DEBUG_CATEGORY_APPLICATION_AMD: - dbgSource = GL2GL3.GL_DEBUG_SOURCE_APPLICATION; - dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER; + dbgSource = GL2ES2.GL_DEBUG_SOURCE_APPLICATION; + dbgType = GL2ES2.GL_DEBUG_TYPE_OTHER; break; @@ -106,49 +106,49 @@ public class GLDebugMessage { // case GL2GL3.GL_DEBUG_CATEGORY_DEPRECATION_AMD: - dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER; - dbgType = GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR; + dbgSource = GL2ES2.GL_DEBUG_SOURCE_OTHER; + dbgType = GL2ES2.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR; break; case GL2GL3.GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD: - dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER; - dbgType = GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR; + dbgSource = GL2ES2.GL_DEBUG_SOURCE_OTHER; + dbgType = GL2ES2.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR; break; case GL2GL3.GL_DEBUG_CATEGORY_PERFORMANCE_AMD: - dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER; - dbgType = GL2GL3.GL_DEBUG_TYPE_PERFORMANCE; + dbgSource = GL2ES2.GL_DEBUG_SOURCE_OTHER; + dbgType = GL2ES2.GL_DEBUG_TYPE_PERFORMANCE; break; case GL2GL3.GL_DEBUG_CATEGORY_OTHER_AMD: default: - dbgSource = GL2GL3.GL_DEBUG_SOURCE_OTHER; - dbgType = GL2GL3.GL_DEBUG_TYPE_OTHER; + dbgSource = GL2ES2.GL_DEBUG_SOURCE_OTHER; + dbgType = GL2ES2.GL_DEBUG_TYPE_OTHER; } return new GLDebugMessage(source, when, dbgSource, dbgType, dbgId, dbgSeverity, dbgMsg); } - public static int translateARB2AMDCategory(int dbgSource, int dbgType) { + public static int translateARB2AMDCategory(final int dbgSource, final int dbgType) { switch (dbgSource) { - case GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM: + case GL2ES2.GL_DEBUG_SOURCE_WINDOW_SYSTEM: return GL2GL3.GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD; - case GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER: + case GL2ES2.GL_DEBUG_SOURCE_SHADER_COMPILER: return GL2GL3.GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD; - case GL2GL3.GL_DEBUG_SOURCE_APPLICATION: + case GL2ES2.GL_DEBUG_SOURCE_APPLICATION: return GL2GL3.GL_DEBUG_CATEGORY_APPLICATION_AMD; } switch(dbgType) { - case GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: + case GL2ES2.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: return GL2GL3.GL_DEBUG_CATEGORY_DEPRECATION_AMD; - case GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: + case GL2ES2.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: return GL2GL3.GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD; - case GL2GL3.GL_DEBUG_TYPE_PERFORMANCE: + case GL2ES2.GL_DEBUG_TYPE_PERFORMANCE: return GL2GL3.GL_DEBUG_CATEGORY_PERFORMANCE_AMD; } @@ -207,46 +207,46 @@ public class GLDebugMessage { return toString(null).toString(); } - public static String getDbgSourceString(int dbgSource) { + public static String getDbgSourceString(final int dbgSource) { switch(dbgSource) { - case GL2GL3.GL_DEBUG_SOURCE_API: return "GL API"; - case GL2GL3.GL_DEBUG_SOURCE_SHADER_COMPILER: return "GLSL or extension compiler"; - case GL2GL3.GL_DEBUG_SOURCE_WINDOW_SYSTEM: return "Native Windowing binding"; - case GL2GL3.GL_DEBUG_SOURCE_THIRD_PARTY: return "Third party"; - case GL2GL3.GL_DEBUG_SOURCE_APPLICATION: return "Application"; - case GL2GL3.GL_DEBUG_SOURCE_OTHER: return "generic"; + case GL2ES2.GL_DEBUG_SOURCE_API: return "GL API"; + case GL2ES2.GL_DEBUG_SOURCE_SHADER_COMPILER: return "GLSL or extension compiler"; + case GL2ES2.GL_DEBUG_SOURCE_WINDOW_SYSTEM: return "Native Windowing binding"; + case GL2ES2.GL_DEBUG_SOURCE_THIRD_PARTY: return "Third party"; + case GL2ES2.GL_DEBUG_SOURCE_APPLICATION: return "Application"; + case GL2ES2.GL_DEBUG_SOURCE_OTHER: return "generic"; default: return "Unknown (" + toHexString(dbgSource) + ")"; } } - public static String getDbgTypeString(int dbgType) { + public static String getDbgTypeString(final int dbgType) { switch(dbgType) { - case GL2GL3.GL_DEBUG_TYPE_ERROR: return "Error"; - case GL2GL3.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: return "Warning: marked for deprecation"; - case GL2GL3.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: return "Warning: undefined behavior"; - case GL2GL3.GL_DEBUG_TYPE_PERFORMANCE: return "Warning: implementation dependent performance"; - case GL2GL3.GL_DEBUG_TYPE_PORTABILITY: return "Warning: vendor-specific extension use"; - case GL2GL3.GL_DEBUG_TYPE_OTHER: return "Warning: generic"; + case GL2ES2.GL_DEBUG_TYPE_ERROR: return "Error"; + case GL2ES2.GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR: return "Warning: marked for deprecation"; + case GL2ES2.GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR: return "Warning: undefined behavior"; + case GL2ES2.GL_DEBUG_TYPE_PERFORMANCE: return "Warning: implementation dependent performance"; + case GL2ES2.GL_DEBUG_TYPE_PORTABILITY: return "Warning: vendor-specific extension use"; + case GL2ES2.GL_DEBUG_TYPE_OTHER: return "Warning: generic"; default: return "Unknown (" + toHexString(dbgType) + ")"; } } - public static String getDbgSeverityString(int dbgSeverity) { + public static String getDbgSeverityString(final int dbgSeverity) { switch(dbgSeverity) { - case GL2GL3.GL_DEBUG_SEVERITY_HIGH: return "High: dangerous undefined behavior"; - case GL2GL3.GL_DEBUG_SEVERITY_MEDIUM: return "Medium: Severe performance/deprecation/other warnings"; - case GL2GL3.GL_DEBUG_SEVERITY_LOW: return "Low: Performance warnings (redundancy/undefined)"; + case GL2ES2.GL_DEBUG_SEVERITY_HIGH: return "High: dangerous undefined behavior"; + case GL2ES2.GL_DEBUG_SEVERITY_MEDIUM: return "Medium: Severe performance/deprecation/other warnings"; + case GL2ES2.GL_DEBUG_SEVERITY_LOW: return "Low: Performance warnings (redundancy/undefined)"; default: return "Unknown (" + toHexString(dbgSeverity) + ")"; } } - public static StringBuilder toHexString(StringBuilder sb, int i) { + public static StringBuilder toHexString(StringBuilder sb, final int i) { if(null==sb) { sb = new StringBuilder(); } return sb.append("0x").append(Integer.toHexString(i)); } - public static String toHexString(int i) { + public static String toHexString(final int i) { return "0x"+Integer.toHexString(i); } diff --git a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java index 077daf6e9..6e7caf8f8 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLDrawableFactory.java @@ -43,6 +43,7 @@ package javax.media.opengl; import java.util.ArrayList; import java.util.List; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; import com.jogamp.opengl.GLAutoDrawableDelegate; import com.jogamp.opengl.GLRendererQuirks; @@ -142,8 +143,8 @@ public abstract class GLDrawableFactory { final String nwt = NativeWindowFactory.getNativeWindowType(true); GLDrawableFactory tmp = null; - String factoryClassName = Debug.getProperty("jogl.gldrawablefactory.class.name", true); - ClassLoader cl = GLDrawableFactory.class.getClassLoader(); + String factoryClassName = PropertyAccess.getProperty("jogl.gldrawablefactory.class.name", true); + final ClassLoader cl = GLDrawableFactory.class.getClassLoader(); if (null == factoryClassName) { if ( nwt == NativeWindowFactory.TYPE_X11 ) { factoryClassName = "jogamp.opengl.x11.glx.X11GLXDrawableFactory"; @@ -164,7 +165,7 @@ public abstract class GLDrawableFactory { } try { tmp = (GLDrawableFactory) ReflectionUtil.createInstance(factoryClassName, cl); - } catch (Exception jre) { + } catch (final Exception jre) { if (DEBUG || GLProfile.DEBUG) { System.err.println("Info: GLDrawableFactory.static - Native Platform: "+nwt+" - not available: "+factoryClassName); jre.printStackTrace(); @@ -179,7 +180,7 @@ public abstract class GLDrawableFactory { if(!disableOpenGLES) { try { tmp = (GLDrawableFactory) ReflectionUtil.createInstance("jogamp.opengl.egl.EGLDrawableFactory", cl); - } catch (Exception jre) { + } catch (final Exception jre) { if (DEBUG || GLProfile.DEBUG) { System.err.println("Info: GLDrawableFactory.static - EGLDrawableFactory - not available"); jre.printStackTrace(); @@ -221,7 +222,7 @@ public abstract class GLDrawableFactory { try { gldf.resetDisplayGamma(); gldf.shutdownImpl(); - } catch (Throwable t) { + } catch (final Throwable t) { System.err.println("GLDrawableFactory.shutdownImpl: Caught "+t.getClass().getName()+" during factory shutdown #"+(i+1)+"/"+gldfCount+" "+gldf.getClass().getName()); if( DEBUG ) { t.printStackTrace(); @@ -322,7 +323,7 @@ public abstract class GLDrawableFactory { * @param device which {@link AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be null for the platform's default device. * @return true if a shared resource could been created, otherwise false. */ - protected final boolean createSharedResource(AbstractGraphicsDevice device) { + protected final boolean createSharedResource(final AbstractGraphicsDevice device) { return createSharedResourceImpl(device); } protected abstract boolean createSharedResourceImpl(AbstractGraphicsDevice device); @@ -343,7 +344,7 @@ public abstract class GLDrawableFactory { * @see #getRendererQuirks(AbstractGraphicsDevice) * @see GLRendererQuirks */ - public final boolean hasRendererQuirk(AbstractGraphicsDevice device, int quirk) { + public final boolean hasRendererQuirk(final AbstractGraphicsDevice device, final int quirk) { final GLRendererQuirks glrq = getRendererQuirks(device); return null != glrq ? glrq.exist(quirk) : false; } @@ -385,11 +386,11 @@ public abstract class GLDrawableFactory { * @param glProfile GLProfile to determine the factory type, ie EGLDrawableFactory, * or one of the native GLDrawableFactory's, ie X11/GLX, Windows/WGL or MacOSX/CGL. */ - public static GLDrawableFactory getFactory(GLProfile glProfile) throws GLException { + public static GLDrawableFactory getFactory(final GLProfile glProfile) throws GLException { return getFactoryImpl(glProfile.getImplName()); } - protected static GLDrawableFactory getFactoryImpl(String glProfileImplName) throws GLException { + protected static GLDrawableFactory getFactoryImpl(final String glProfileImplName) throws GLException { if ( GLProfile.usesNativeGLES(glProfileImplName) ) { if(null!=eglFactory) { return eglFactory; @@ -400,7 +401,7 @@ public abstract class GLDrawableFactory { throw new GLException("No GLDrawableFactory available for profile: "+glProfileImplName); } - protected static GLDrawableFactory getFactoryImpl(AbstractGraphicsDevice device) throws GLException { + protected static GLDrawableFactory getFactoryImpl(final AbstractGraphicsDevice device) throws GLException { if(null != nativeOSFactory && nativeOSFactory.getIsDeviceCompatible(device)) { return nativeOSFactory; } diff --git a/src/jogl/classes/javax/media/opengl/GLException.java b/src/jogl/classes/javax/media/opengl/GLException.java index 460f17be9..6a287c969 100644 --- a/src/jogl/classes/javax/media/opengl/GLException.java +++ b/src/jogl/classes/javax/media/opengl/GLException.java @@ -50,19 +50,19 @@ public class GLException extends RuntimeException { /** Constructs a GLException object with the specified detail message. */ - public GLException(String message) { + public GLException(final String message) { super(message); } /** Constructs a GLException object with the specified detail message and root cause. */ - public GLException(String message, Throwable cause) { + public GLException(final String message, final Throwable cause) { super(message, cause); } /** Constructs a GLException object with the specified root cause. */ - public GLException(Throwable cause) { + public GLException(final Throwable cause) { super(cause); } } diff --git a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java index d947bada2..ab12ba17c 100644 --- a/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java +++ b/src/jogl/classes/javax/media/opengl/GLPipelineFactory.java @@ -88,7 +88,7 @@ public class GLPipelineFactory { * @param downstream is always the 1st argument for the upstream constructor * @param additionalArgs additional arguments for the upstream constructor */ - public static final GL create(String pipelineClazzBaseName, Class reqInterface, GL downstream, Object[] additionalArgs) { + public static final GL create(final String pipelineClazzBaseName, final Class reqInterface, final GL downstream, final Object[] additionalArgs) { Class downstreamClazz = downstream.getClass(); Class upstreamClazz = null; Class interfaceClazz = null; @@ -101,7 +101,7 @@ public class GLPipelineFactory { do { // For all interfaces: right -> left == child -> parent // It is important that this matches with the gluegen cfg file's 'Implements' clause ! - Class[] clazzes = downstreamClazz.getInterfaces(); + final Class[] clazzes = downstreamClazz.getInterfaces(); for(int i=clazzes.length-1; null==upstreamClazz && i>=0; i--) { if(DEBUG) { System.out.println("GLPipelineFactory: Try "+downstreamClazz.getName()+" Interface["+i+"]: "+clazzes[i].getName()); @@ -142,7 +142,7 @@ public class GLPipelineFactory { System.out.println("GLPipelineFactory: Got : "+ upstreamClazz.getName()+", base interface: "+interfaceClazz.getName()); } - Class[] cstrArgTypes = new Class[ 1 + ( ( null==additionalArgs ) ? 0 : additionalArgs.length ) ] ; + final Class[] cstrArgTypes = new Class[ 1 + ( ( null==additionalArgs ) ? 0 : additionalArgs.length ) ] ; { int i = 0; cstrArgTypes[i++] = interfaceClazz; @@ -151,10 +151,10 @@ public class GLPipelineFactory { } } // throws exception if cstr not found! - Constructor cstr = ReflectionUtil.getConstructor(upstreamClazz, cstrArgTypes); + final Constructor cstr = ReflectionUtil.getConstructor(upstreamClazz, cstrArgTypes); Object instance = null; try { - Object[] cstrArgs = new Object[ 1 + ( ( null==additionalArgs ) ? 0 : additionalArgs.length ) ] ; + final Object[] cstrArgs = new Object[ 1 + ( ( null==additionalArgs ) ? 0 : additionalArgs.length ) ] ; { int i = 0; cstrArgs[i++] = downstream; @@ -163,7 +163,7 @@ public class GLPipelineFactory { } } instance = cstr.newInstance( cstrArgs ) ; - } catch (Throwable t) { t.printStackTrace(); } + } catch (final Throwable t) { t.printStackTrace(); } if(null==instance) { throw new GLException("Error: Couldn't create instance of pipeline: "+upstreamClazz.getName()+ " ( "+getArgsClassNameList(downstreamClazz, additionalArgs) +" )"); @@ -174,8 +174,8 @@ public class GLPipelineFactory { return (GL) instance; } - private static final String getArgsClassNameList(Class arg0, Object[] args) { - StringBuilder sb = new StringBuilder(); + private static final String getArgsClassNameList(final Class arg0, final Object[] args) { + final StringBuilder sb = new StringBuilder(); sb.append(arg0.getName()); if(args!=null) { for(int j=0; j getUpstreamClazz(Class downstreamClazz, String pipelineClazzBaseName) { - String downstreamClazzName = downstreamClazz.getName(); + private static final Class getUpstreamClazz(final Class downstreamClazz, final String pipelineClazzBaseName) { + final String downstreamClazzName = downstreamClazz.getName(); - StringTokenizer st = new StringTokenizer(downstreamClazzName, "."); + final StringTokenizer st = new StringTokenizer(downstreamClazzName, "."); String downstreamClazzBaseName = downstreamClazzName; while(st.hasMoreTokens()) { downstreamClazzBaseName = st.nextToken(); } - String upstreamClazzName = pipelineClazzBaseName+downstreamClazzBaseName; + final String upstreamClazzName = pipelineClazzBaseName+downstreamClazzBaseName; Class upstreamClazz = null; try { upstreamClazz = Class.forName(upstreamClazzName, true, GLPipelineFactory.class.getClassLoader()); - } catch (Throwable e) { e.printStackTrace(); } + } catch (final Throwable e) { e.printStackTrace(); } return upstreamClazz; } diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index addc977d8..57367adcc 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -167,7 +167,7 @@ public class GLProfile { * * @throws GLException if no profile for the given device is available. */ - public static void initProfiles(AbstractGraphicsDevice device) throws GLException { + public static void initProfiles(final AbstractGraphicsDevice device) throws GLException { getProfileMap(device, true); } @@ -208,11 +208,11 @@ public class GLProfile { * or [ null, GL ] for the default profile. * @return true if the profile is available for the device, otherwise false. */ - public static boolean isAvailable(AbstractGraphicsDevice device, String profile) { + public static boolean isAvailable(final AbstractGraphicsDevice device, final String profile) { initSingleton(); return isAvailableImpl(getProfileMap(device, false), profile); } - private static boolean isAvailableImpl(HashMap map, String profile) { + private static boolean isAvailableImpl(final HashMap map, final String profile) { return null != map && null != map.get(profile); } @@ -223,7 +223,7 @@ public class GLProfile { * or [ null, GL ] for the default profile. * @return true if the profile is available for the default device, otherwise false. */ - public static boolean isAvailable(String profile) { + public static boolean isAvailable(final String profile) { return isAvailable(null, profile); } @@ -236,21 +236,21 @@ public class GLProfile { return isAvailable(null, null); } - public static String glAvailabilityToString(AbstractGraphicsDevice device) { + public static String glAvailabilityToString(final AbstractGraphicsDevice device) { return glAvailabilityToString(device, null).toString(); } - public static StringBuilder glAvailabilityToString(AbstractGraphicsDevice device, StringBuilder sb) { + public static StringBuilder glAvailabilityToString(final AbstractGraphicsDevice device, final StringBuilder sb) { return glAvailabilityToString(device, sb, null, 0); } - private static StringBuilder doIndent(StringBuilder sb, String indent, int indentCount) { + private static StringBuilder doIndent(final StringBuilder sb, final String indent, int indentCount) { while(indentCount>0) { sb.append(indent); indentCount--; } return sb; } - public static StringBuilder glAvailabilityToString(AbstractGraphicsDevice device, StringBuilder sb, String indent, int indentCount) { + public static StringBuilder glAvailabilityToString(AbstractGraphicsDevice device, StringBuilder sb, final String indent, int indentCount) { boolean avail; if(null == sb) { sb = new StringBuilder(); @@ -425,7 +425,7 @@ public class GLProfile { int profileCount = 0; if(null != map) { - for (Map.Entry entry : map.entrySet()) { + for (final Map.Entry entry : map.entrySet()) { if( !GL_DEFAULT.equals(entry.getKey()) ) { if(useIndent) { doIndent(sb.append(Platform.getNewline()), indent, indentCount); @@ -444,7 +444,7 @@ public class GLProfile { } try { sb.append(getDefault(device)); - } catch (GLException gle) { + } catch (final GLException gle) { sb.append("n/a"); } } @@ -628,8 +628,8 @@ public class GLProfile { * @throws GLException if no profile is available for the device. * @see #GL_PROFILE_LIST_ALL */ - public static GLProfile getDefault(AbstractGraphicsDevice device) { - GLProfile glp = get(device, GL_DEFAULT); + public static GLProfile getDefault(final AbstractGraphicsDevice device) { + final GLProfile glp = get(device, GL_DEFAULT); return glp; } @@ -650,7 +650,7 @@ public class GLProfile { * @throws GLException if no profile is available for the device. * @see #GL_PROFILE_LIST_MAX */ - public static GLProfile getMaximum(AbstractGraphicsDevice device, boolean favorHardwareRasterizer) + public static GLProfile getMaximum(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer) throws GLException { return get(device, GL_PROFILE_LIST_MAX, favorHardwareRasterizer); @@ -660,7 +660,7 @@ public class GLProfile { * @throws GLException if no profile is available for the default device. * @see #GL_PROFILE_LIST_MAX */ - public static GLProfile getMaximum(boolean favorHardwareRasterizer) + public static GLProfile getMaximum(final boolean favorHardwareRasterizer) throws GLException { return get(GL_PROFILE_LIST_MAX, favorHardwareRasterizer); @@ -673,7 +673,7 @@ public class GLProfile { * @throws GLException if no desktop profile is available for the device. * @see #GL_PROFILE_LIST_MIN */ - public static GLProfile getMinimum(AbstractGraphicsDevice device, boolean favorHardwareRasterizer) + public static GLProfile getMinimum(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer) throws GLException { return get(device, GL_PROFILE_LIST_MIN, favorHardwareRasterizer); @@ -683,7 +683,7 @@ public class GLProfile { * @throws GLException if no desktop profile is available for the default device. * @see #GL_PROFILE_LIST_MIN */ - public static GLProfile getMinimum(boolean favorHardwareRasterizer) + public static GLProfile getMinimum(final boolean favorHardwareRasterizer) throws GLException { return get(GL_PROFILE_LIST_MIN, favorHardwareRasterizer); @@ -697,7 +697,7 @@ public class GLProfile { * @throws GLException if no fixed function profile is available for the device. * @see #GL_PROFILE_LIST_MAX_FIXEDFUNC */ - public static GLProfile getMaxFixedFunc(AbstractGraphicsDevice device, boolean favorHardwareRasterizer) + public static GLProfile getMaxFixedFunc(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer) throws GLException { return get(device, GL_PROFILE_LIST_MAX_FIXEDFUNC, favorHardwareRasterizer); @@ -707,7 +707,7 @@ public class GLProfile { * @throws GLException if no fixed function profile is available for the default device. * @see #GL_PROFILE_LIST_MAX_FIXEDFUNC */ - public static GLProfile getMaxFixedFunc(boolean favorHardwareRasterizer) + public static GLProfile getMaxFixedFunc(final boolean favorHardwareRasterizer) throws GLException { return get(GL_PROFILE_LIST_MAX_FIXEDFUNC, favorHardwareRasterizer); @@ -720,7 +720,7 @@ public class GLProfile { * @throws GLException if no programmable profile is available for the device. * @see #GL_PROFILE_LIST_MAX_PROGSHADER */ - public static GLProfile getMaxProgrammable(AbstractGraphicsDevice device, boolean favorHardwareRasterizer) + public static GLProfile getMaxProgrammable(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer) throws GLException { return get(device, GL_PROFILE_LIST_MAX_PROGSHADER, favorHardwareRasterizer); @@ -730,7 +730,7 @@ public class GLProfile { * @throws GLException if no programmable profile is available for the default device. * @see #GL_PROFILE_LIST_MAX_PROGSHADER */ - public static GLProfile getMaxProgrammable(boolean favorHardwareRasterizer) + public static GLProfile getMaxProgrammable(final boolean favorHardwareRasterizer) throws GLException { return get(GL_PROFILE_LIST_MAX_PROGSHADER, favorHardwareRasterizer); @@ -743,7 +743,7 @@ public class GLProfile { * @throws GLException if no programmable core profile is available for the device. * @see #GL_PROFILE_LIST_MAX_PROGSHADER_CORE */ - public static GLProfile getMaxProgrammableCore(AbstractGraphicsDevice device, boolean favorHardwareRasterizer) + public static GLProfile getMaxProgrammableCore(final AbstractGraphicsDevice device, final boolean favorHardwareRasterizer) throws GLException { return get(device, GL_PROFILE_LIST_MAX_PROGSHADER_CORE, favorHardwareRasterizer); @@ -753,7 +753,7 @@ public class GLProfile { * @throws GLException if no programmable core profile is available for the default device. * @see #GL_PROFILE_LIST_MAX_PROGSHADER_CORE */ - public static GLProfile getMaxProgrammableCore(boolean favorHardwareRasterizer) + public static GLProfile getMaxProgrammableCore(final boolean favorHardwareRasterizer) throws GLException { return get(GL_PROFILE_LIST_MAX_PROGSHADER_CORE, favorHardwareRasterizer); @@ -772,7 +772,7 @@ public class GLProfile { * @see #get(AbstractGraphicsDevice, String) * @see #getImpl() */ - public static GLProfile getGL2ES1(AbstractGraphicsDevice device) + public static GLProfile getGL2ES1(final AbstractGraphicsDevice device) throws GLException { return get(device, GL2ES1).getImpl(); @@ -802,7 +802,7 @@ public class GLProfile { * @see #get(AbstractGraphicsDevice, String) * @see #getImpl() */ - public static GLProfile getGL2ES2(AbstractGraphicsDevice device) + public static GLProfile getGL2ES2(final AbstractGraphicsDevice device) throws GLException { return get(device, GL2ES2).getImpl(); @@ -832,7 +832,7 @@ public class GLProfile { * @see #get(AbstractGraphicsDevice, String) * @see #getImpl() */ - public static GLProfile getGL4ES3(AbstractGraphicsDevice device) + public static GLProfile getGL4ES3(final AbstractGraphicsDevice device) throws GLException { return get(device, GL4ES3).getImpl(); @@ -862,7 +862,7 @@ public class GLProfile { * @see #get(AbstractGraphicsDevice, String) * @see #getImpl() */ - public static GLProfile getGL2GL3(AbstractGraphicsDevice device) + public static GLProfile getGL2GL3(final AbstractGraphicsDevice device) throws GLException { return get(device, GL2GL3).getImpl(); @@ -889,7 +889,7 @@ public class GLProfile { * or [ null, GL ] for the default profile. * @throws GLException if the requested profile is not available for the device. */ - public static GLProfile get(AbstractGraphicsDevice device, String profile) + public static GLProfile get(final AbstractGraphicsDevice device, String profile) throws GLException { if(null==profile || profile.equals("GL")) { @@ -908,7 +908,7 @@ public class GLProfile { * or [ null, GL ] for the default profile. * @throws GLException if the requested profile is not available for the default device. */ - public static GLProfile get(String profile) + public static GLProfile get(final String profile) throws GLException { return get(defaultDevice, profile); @@ -923,12 +923,12 @@ public class GLProfile { * @param favorHardwareRasterizer set to true, if hardware rasterizer shall be favored, otherwise false. * @throws GLException if the non of the requested profiles is available for the device. */ - public static GLProfile get(AbstractGraphicsDevice device, String[] profiles, boolean favorHardwareRasterizer) + public static GLProfile get(final AbstractGraphicsDevice device, final String[] profiles, final boolean favorHardwareRasterizer) throws GLException { GLProfile glProfileAny = null; - HashMap map = getProfileMap(device, true); + final HashMap map = getProfileMap(device, true); for(int i=0; i getGLCtor(boolean glObject) { + public final Constructor getGLCtor(final boolean glObject) { return getGLCtor(getImplName(), glObject); } - private static final Constructor getGLCtor(String profileImpl, boolean glObject) { + private static final Constructor getGLCtor(final String profileImpl, final boolean glObject) { if( GLES2 == profileImpl || GLES3 == profileImpl ) { return glObject ? ctorGLES3Impl : ctorGLES3ProcAddr; } else if( GLES1 == profileImpl ) { @@ -1078,7 +1078,7 @@ public class GLProfile { * if both, profile and profileImpl is equal with this. */ @Override - public final boolean equals(Object o) { + public final boolean equals(final Object o) { if(this==o) { return true; } if(o instanceof GLProfile) { final GLProfile glp = (GLProfile)o; @@ -1099,7 +1099,7 @@ public class GLProfile { * @param glp GLProfile to compare with * @throws GLException if given GLProfile and this aren't equal */ - public final void verifyEquality(GLProfile glp) throws GLException { + public final void verifyEquality(final GLProfile glp) throws GLException { if(!this.equals(glp)) { throw new GLException("GLProfiles are not equal: "+this+" != "+glp); } @@ -1235,7 +1235,7 @@ public class GLProfile { * General validation if type is a valid GL data type * for the current profile */ - public boolean isValidDataType(int type, boolean throwException) { + public boolean isValidDataType(final int type, final boolean throwException) { switch(type) { case GL.GL_UNSIGNED_BYTE: case GL.GL_BYTE: @@ -1245,11 +1245,11 @@ public class GLProfile { case GL.GL_FIXED: return true; case javax.media.opengl.GL2ES2.GL_INT: - case javax.media.opengl.GL2ES2.GL_UNSIGNED_INT: + case GL.GL_UNSIGNED_INT: if( isGL2ES2() ) { return true; } - case javax.media.opengl.GL2.GL_DOUBLE: + case javax.media.opengl.GL2GL3.GL_DOUBLE: if( isGL3() ) { return true; } @@ -1266,8 +1266,8 @@ public class GLProfile { return false; } - public boolean isValidArrayDataType(int index, int comps, int type, - boolean isVertexAttribPointer, boolean throwException) { + public boolean isValidArrayDataType(final int index, final int comps, final int type, + final boolean isVertexAttribPointer, final boolean throwException) { final String arrayName = getGLArrayName(index); if( isGLES1() ) { if(isVertexAttribPointer) { @@ -1391,8 +1391,8 @@ public class GLProfile { case GL.GL_SHORT: case GL.GL_FLOAT: case javax.media.opengl.GL2ES2.GL_INT: - case javax.media.opengl.GL2ES2.GL_UNSIGNED_INT: - case javax.media.opengl.GL2.GL_DOUBLE: + case GL.GL_UNSIGNED_INT: + case javax.media.opengl.GL2GL3.GL_DOUBLE: break; default: if(throwException) { @@ -1420,7 +1420,7 @@ public class GLProfile { case GL.GL_SHORT: case GL.GL_FLOAT: case javax.media.opengl.GL2ES2.GL_INT: - case javax.media.opengl.GL2.GL_DOUBLE: + case javax.media.opengl.GL2GL3.GL_DOUBLE: break; default: if(throwException) { @@ -1447,7 +1447,7 @@ public class GLProfile { case GL.GL_SHORT: case GL.GL_FLOAT: case javax.media.opengl.GL2ES2.GL_INT: - case javax.media.opengl.GL2.GL_DOUBLE: + case javax.media.opengl.GL2GL3.GL_DOUBLE: break; default: if(throwException) { @@ -1474,8 +1474,8 @@ public class GLProfile { case GL.GL_SHORT: case GL.GL_FLOAT: case javax.media.opengl.GL2ES2.GL_INT: - case javax.media.opengl.GL2ES2.GL_UNSIGNED_INT: - case javax.media.opengl.GL2.GL_DOUBLE: + case GL.GL_UNSIGNED_INT: + case javax.media.opengl.GL2GL3.GL_DOUBLE: break; default: if(throwException) { @@ -1500,7 +1500,7 @@ public class GLProfile { case GL.GL_SHORT: case GL.GL_FLOAT: case javax.media.opengl.GL2ES2.GL_INT: - case javax.media.opengl.GL2.GL_DOUBLE: + case javax.media.opengl.GL2GL3.GL_DOUBLE: break; default: if(throwException) { @@ -1566,7 +1566,7 @@ public class GLProfile { private static final Constructor getCtor(final String clazzName, final boolean glObject, final ClassLoader cl) { try { return ReflectionUtil.getConstructor(clazzName, glObject ? ctorGLArgs : ctorProcArgs, false, cl); - } catch (Throwable t) { + } catch (final Throwable t) { if( DEBUG ) { System.err.println("Caught: "+t.getMessage()); t.printStackTrace(); @@ -1656,16 +1656,16 @@ public class GLProfile { try { desktopFactory = (GLDrawableFactoryImpl) GLDrawableFactory.getFactoryImpl(GL2); if(null != desktopFactory) { - DesktopGLDynamicLookupHelper glLookupHelper = (DesktopGLDynamicLookupHelper) desktopFactory.getGLDynamicLookupHelper(0); + final DesktopGLDynamicLookupHelper glLookupHelper = (DesktopGLDynamicLookupHelper) desktopFactory.getGLDynamicLookupHelper(0); if(null!=glLookupHelper) { hasDesktopGLFactory = glLookupHelper.isLibComplete() && hasGL234Impl; } } - } catch (LinkageError le) { + } catch (final LinkageError le) { t=le; - } catch (RuntimeException re) { + } catch (final RuntimeException re) { t=re; - } catch (Throwable tt) { + } catch (final Throwable tt) { t=tt; } if(DEBUG) { @@ -1696,13 +1696,13 @@ public class GLProfile { hasGLES3Impl = null!=eglFactory.getGLDynamicLookupHelper(2) && hasGLES3Impl; hasGLES1Impl = null!=eglFactory.getGLDynamicLookupHelper(1) && hasGLES1Impl; } - } catch (LinkageError le) { + } catch (final LinkageError le) { t=le; - } catch (SecurityException se) { + } catch (final SecurityException se) { t=se; - } catch (NullPointerException npe) { + } catch (final NullPointerException npe) { t=npe; - } catch (RuntimeException re) { + } catch (final RuntimeException re) { t=re; } if(DEBUG) { @@ -1765,13 +1765,13 @@ public class GLProfile { * @param device the device for which profiles shall be initialized * @return true if any profile for the device exists, otherwise false */ - private static boolean initProfilesForDevice(AbstractGraphicsDevice device) { + private static boolean initProfilesForDevice(final AbstractGraphicsDevice device) { if(null == device) { return false; } initLock.lock(); try { - GLDrawableFactory factory = GLDrawableFactory.getFactoryImpl(device); + final GLDrawableFactory factory = GLDrawableFactory.getFactoryImpl(device); factory.enterThreadCriticalZone(); try { return initProfilesForDeviceCritical(device); @@ -1782,8 +1782,8 @@ public class GLProfile { initLock.unlock(); } } - private static boolean initProfilesForDeviceCritical(AbstractGraphicsDevice device) { - boolean isSet = GLContext.getAvailableGLVersionsSet(device); + private static boolean initProfilesForDeviceCritical(final AbstractGraphicsDevice device) { + final boolean isSet = GLContext.getAvailableGLVersionsSet(device); if(DEBUG) { System.err.println("Info: GLProfile.initProfilesForDevice: "+device+" ("+device.getClass().getName()+"), isSet "+isSet+", hasDesktopGLFactory "+hasDesktopGLFactory+", hasEGLFactory "+hasEGLFactory); @@ -1791,7 +1791,7 @@ public class GLProfile { if(isSet) { // Avoid recursion and check whether impl. is sane! final String deviceKey = device.getUniqueID(); - HashMap map = deviceConn2ProfileMap.get(deviceKey); + final HashMap map = deviceConn2ProfileMap.get(deviceKey); if( null == map ) { throw new InternalError("GLContext Avail. GLVersion is set - but no profile map for device: "+device); } @@ -1813,7 +1813,7 @@ public class GLProfile { if(null != sharedResourceThread) { initLock.addOwner(sharedResourceThread); } - boolean desktopSharedCtxAvail = desktopFactory.createSharedResource(device); + final boolean desktopSharedCtxAvail = desktopFactory.createSharedResource(device); if(null != sharedResourceThread) { initLock.removeOwner(sharedResourceThread); } @@ -1841,7 +1841,7 @@ public class GLProfile { if(null != sharedResourceThread) { initLock.addOwner(sharedResourceThread); } - boolean eglSharedCtxAvail = eglFactory.createSharedResource(device); + final boolean eglSharedCtxAvail = eglFactory.createSharedResource(device); if(null != sharedResourceThread) { initLock.removeOwner(sharedResourceThread); } @@ -1881,13 +1881,13 @@ public class GLProfile { System.err.println("GLProfile.initProfilesForDevice: "+device.getConnection()+": "+glAvailabilityToString(device)); if(addedDesktopProfile) { dumpGLInfo(desktopFactory, device); - List availCaps = desktopFactory.getAvailableCapabilities(device); + final List availCaps = desktopFactory.getAvailableCapabilities(device); for(int i=0; i availCaps = eglFactory.getAvailableCapabilities(device); + final List availCaps = eglFactory.getAvailableCapabilities(device); for(int i=0; i 0) @@ -1929,8 +1929,8 @@ public class GLProfile { return msg.toString(); } - private static void glAvailabilityToString(AbstractGraphicsDevice device, StringBuilder sb, int major, int profile) { - String str = GLContext.getAvailableGLVersionAsString(device, major, profile); + private static void glAvailabilityToString(final AbstractGraphicsDevice device, final StringBuilder sb, final int major, final int profile) { + final String str = GLContext.getAvailableGLVersionAsString(device, major, profile); if(null==str) { throw new GLException("Internal Error"); } @@ -1939,7 +1939,7 @@ public class GLProfile { sb.append("]"); } - private static boolean computeProfileMap(AbstractGraphicsDevice device, boolean desktopCtxUndef, boolean esCtxUndef) { + private static boolean computeProfileMap(final AbstractGraphicsDevice device, final boolean desktopCtxUndef, final boolean esCtxUndef) { if (DEBUG) { System.err.println("GLProfile.init map "+device.getConnection()+", desktopCtxUndef "+desktopCtxUndef+", esCtxUndef "+esCtxUndef); } @@ -1994,7 +1994,7 @@ public class GLProfile { /** * Returns the profile implementation */ - private static String computeProfileImpl(AbstractGraphicsDevice device, String profile, boolean desktopCtxUndef, boolean esCtxUndef, boolean isHardwareRasterizer[]) { + private static String computeProfileImpl(final AbstractGraphicsDevice device, final String profile, final boolean desktopCtxUndef, final boolean esCtxUndef, final boolean isHardwareRasterizer[]) { if (GL2ES1.equals(profile)) { final boolean es1HardwareRasterizer[] = new boolean[1]; final boolean gles1Available = hasGLES1Impl && ( esCtxUndef || GLContext.isGLES1Available(device, es1HardwareRasterizer) ); @@ -2143,7 +2143,7 @@ public class GLProfile { * @return the GLProfile HashMap if exists, otherwise null * @throws GLException if no profile for the given device is available. */ - private static HashMap getProfileMap(AbstractGraphicsDevice device, boolean throwExceptionOnZeroProfile) + private static HashMap getProfileMap(AbstractGraphicsDevice device, final boolean throwExceptionOnZeroProfile) throws GLException { initSingleton(); @@ -2175,13 +2175,13 @@ public class GLProfile { return map; } - private static void setProfileMap(AbstractGraphicsDevice device, HashMap mappedProfiles) { + private static void setProfileMap(final AbstractGraphicsDevice device, final HashMap mappedProfiles) { synchronized ( deviceConn2ProfileMap ) { deviceConn2ProfileMap.put(device.getUniqueID(), mappedProfiles); } } - private GLProfile(String profile, GLProfile profileImpl, boolean isHardwareRasterizer) { + private GLProfile(final String profile, final GLProfile profileImpl, final boolean isHardwareRasterizer) { this.profile = profile; this.profileImpl = profileImpl; this.isHardwareRasterizer = isHardwareRasterizer; diff --git a/src/jogl/classes/javax/media/opengl/GLUniformData.java b/src/jogl/classes/javax/media/opengl/GLUniformData.java index fac8b7a1f..67cc4c999 100644 --- a/src/jogl/classes/javax/media/opengl/GLUniformData.java +++ b/src/jogl/classes/javax/media/opengl/GLUniformData.java @@ -14,7 +14,7 @@ public class GLUniformData { * Number of objects is 1 * */ - public GLUniformData(String name, int val) { + public GLUniformData(final String name, final int val) { initScalar(name, 1, new Integer(val)); } @@ -24,7 +24,7 @@ public class GLUniformData { * Number of objects is 1 * */ - public GLUniformData(String name, float val) { + public GLUniformData(final String name, final float val) { initScalar(name, 1, new Float(val)); } @@ -35,7 +35,7 @@ public class GLUniformData { * * @param components number of elements of one object, ie 4 for GL_FLOAT_VEC4, */ - public GLUniformData(String name, int components, IntBuffer data) { + public GLUniformData(final String name, final int components, final IntBuffer data) { initBuffer(name, components, data); } @@ -46,19 +46,19 @@ public class GLUniformData { * * @param components number of elements of one object, ie 4 for GL_FLOAT_VEC4, */ - public GLUniformData(String name, int components, FloatBuffer data) { + public GLUniformData(final String name, final int components, final FloatBuffer data) { initBuffer(name, components, data); } - private GLUniformData(int components, String name) { + private GLUniformData(final int components, final String name) { initBuffer(name, components, null); } - public static GLUniformData creatEmptyVector(String name, int components) { + public static GLUniformData creatEmptyVector(final String name, final int components) { return new GLUniformData(components, name); } - public static GLUniformData creatEmptyMatrix(String name, int rows, int columns) { + public static GLUniformData creatEmptyMatrix(final String name, final int rows, final int columns) { return new GLUniformData(name, rows, columns, null); } @@ -70,7 +70,7 @@ public class GLUniformData { * @param rows the matrix rows * @param column the matrix column */ - public GLUniformData(String name, int rows, int columns, FloatBuffer data) { + public GLUniformData(final String name, final int rows, final int columns, final FloatBuffer data) { initBuffer(name, rows, columns, data); } @@ -114,7 +114,7 @@ public class GLUniformData { return toString(null).toString(); } - private void initBuffer(String name, int rows, int columns, Buffer buffer) { + private void initBuffer(final String name, final int rows, final int columns, final Buffer buffer) { if( 2>rows || rows>4 || 2>columns || columns>4 ) { throw new GLException("rowsXcolumns must be within [2..4]X[2..4], is: "+rows+"X"+columns); } @@ -125,7 +125,7 @@ public class GLUniformData { this.location=-1; initBuffer(buffer); } - private void initScalar(String name, int components, Object data) { + private void initScalar(final String name, final int components, final Object data) { if( 1>components || components>4 ) { throw new GLException("components must be within [1..4], is: "+components); } @@ -136,7 +136,7 @@ public class GLUniformData { this.location=-1; initScalar(data); } - private void initBuffer(String name, int components, Buffer buffer) { + private void initBuffer(final String name, final int components, final Buffer buffer) { if( 1>components || components>4 ) { throw new GLException("components must be within [1..4], is: "+components); } @@ -148,7 +148,7 @@ public class GLUniformData { initBuffer(buffer); } - private void initScalar(Object data) { + private void initScalar(final Object data) { if(data instanceof Buffer) { initBuffer((Buffer)data); } else if( null != data ) { @@ -185,7 +185,7 @@ public class GLUniformData { * Sets the given location of the shader uniform. * @return the given location */ - public int setLocation(int location) { this.location=location; return location; } + public int setLocation(final int location) { this.location=location; return location; } /** * Retrieves the location of the shader uniform from the linked shader program. @@ -197,7 +197,7 @@ public class GLUniformData { * @return ≥0 denotes a valid uniform location as found and used in the given shader program. * <0 denotes an invalid location, i.e. not found or used in the given shader program. */ - public int setLocation(GL2ES2 gl, int program) { + public int setLocation(final GL2ES2 gl, final int program) { location = gl.glGetUniformLocation(program, name); return location; } diff --git a/src/jogl/classes/javax/media/opengl/Threading.java b/src/jogl/classes/javax/media/opengl/Threading.java index 7503e9cf7..3ee233303 100644 --- a/src/jogl/classes/javax/media/opengl/Threading.java +++ b/src/jogl/classes/javax/media/opengl/Threading.java @@ -168,7 +168,7 @@ public class Threading { current thread is the OpenGL thread and either execute the Runnable directly or perform the work inside it. **/ - public static final void invokeOnOpenGLThread(boolean wait, Runnable r) throws GLException { + public static final void invokeOnOpenGLThread(final boolean wait, final Runnable r) throws GLException { ThreadingImpl.invokeOnOpenGLThread(wait, r); } @@ -185,7 +185,7 @@ public class Threading { * @param lock optional lock object to be tested * @throws GLException */ - public static final void invoke(boolean wait, Runnable r, Object lock) throws GLException { + public static final void invoke(final boolean wait, final Runnable r, final Object lock) throws GLException { if ( isSingleThreaded() && !isOpenGLThread() && ( null == lock || !Thread.holdsLock(lock) ) ) { invokeOnOpenGLThread(wait, r); diff --git a/src/jogl/classes/javax/media/opengl/TraceGL2.java b/src/jogl/classes/javax/media/opengl/TraceGL2.java index c577332e9..94d391d43 100644 --- a/src/jogl/classes/javax/media/opengl/TraceGL2.java +++ b/src/jogl/classes/javax/media/opengl/TraceGL2.java @@ -17,7 +17,7 @@ import java.io.PrintStream; *

*/ public class TraceGL2 extends TraceGL4bc { - public TraceGL2(GL2 downstream, PrintStream stream) { + public TraceGL2(final GL2 downstream, final PrintStream stream) { super((GL4bc)downstream, stream); } } diff --git a/src/jogl/classes/javax/media/opengl/TraceGL3.java b/src/jogl/classes/javax/media/opengl/TraceGL3.java index 5fccf40c7..96e655902 100644 --- a/src/jogl/classes/javax/media/opengl/TraceGL3.java +++ b/src/jogl/classes/javax/media/opengl/TraceGL3.java @@ -17,7 +17,7 @@ import java.io.PrintStream; *

*/ public class TraceGL3 extends TraceGL4bc { - public TraceGL3(GL3 downstream, PrintStream stream) { + public TraceGL3(final GL3 downstream, final PrintStream stream) { super((GL4bc)downstream, stream); } } diff --git a/src/jogl/classes/javax/media/opengl/TraceGL3bc.java b/src/jogl/classes/javax/media/opengl/TraceGL3bc.java index 84f537f60..2a8590236 100644 --- a/src/jogl/classes/javax/media/opengl/TraceGL3bc.java +++ b/src/jogl/classes/javax/media/opengl/TraceGL3bc.java @@ -17,7 +17,7 @@ import java.io.PrintStream; *

*/ public class TraceGL3bc extends TraceGL4bc { - public TraceGL3bc(GL3bc downstream, PrintStream stream) { + public TraceGL3bc(final GL3bc downstream, final PrintStream stream) { super((GL4bc)downstream, stream); } } diff --git a/src/jogl/classes/javax/media/opengl/TraceGL4.java b/src/jogl/classes/javax/media/opengl/TraceGL4.java index afe2cd9a1..d48f9926a 100644 --- a/src/jogl/classes/javax/media/opengl/TraceGL4.java +++ b/src/jogl/classes/javax/media/opengl/TraceGL4.java @@ -17,7 +17,7 @@ import java.io.PrintStream; *

*/ public class TraceGL4 extends TraceGL4bc { - public TraceGL4(GL4 downstream, PrintStream stream) { + public TraceGL4(final GL4 downstream, final PrintStream stream) { super((GL4bc)downstream, stream); } } diff --git a/src/jogl/classes/javax/media/opengl/TraceGLES2.java b/src/jogl/classes/javax/media/opengl/TraceGLES2.java index 4740e2e72..b58f169a7 100644 --- a/src/jogl/classes/javax/media/opengl/TraceGLES2.java +++ b/src/jogl/classes/javax/media/opengl/TraceGLES2.java @@ -17,7 +17,7 @@ import java.io.PrintStream; *

*/ public class TraceGLES2 extends TraceGLES3 { - public TraceGLES2(GLES2 downstream, PrintStream stream) { + public TraceGLES2(final GLES2 downstream, final PrintStream stream) { super((GLES3)downstream, stream); } } diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index e3a7838e7..9d2d21ce5 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -184,7 +184,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing private volatile boolean isShowing; private final HierarchyListener hierarchyListener = new HierarchyListener() { @Override - public void hierarchyChanged(HierarchyEvent e) { + public void hierarchyChanged(final HierarchyEvent e) { isShowing = GLCanvas.this.isShowing(); } }; @@ -212,7 +212,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device. * @see GLCanvas#GLCanvas(javax.media.opengl.GLCapabilitiesImmutable, javax.media.opengl.GLCapabilitiesChooser, javax.media.opengl.GLContext, java.awt.GraphicsDevice) */ - public GLCanvas(GLCapabilitiesImmutable capsReqUser) throws GLException { + public GLCanvas(final GLCapabilitiesImmutable capsReqUser) throws GLException { this(capsReqUser, null, null, null); } @@ -226,7 +226,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing * @deprecated Use {@link #GLCanvas(GLCapabilitiesImmutable)} * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}. */ - public GLCanvas(GLCapabilitiesImmutable capsReqUser, GLContext shareWith) + public GLCanvas(final GLCapabilitiesImmutable capsReqUser, final GLContext shareWith) throws GLException { this(capsReqUser, null, shareWith, null); @@ -244,9 +244,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing is passed for this argument. * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device. */ - public GLCanvas(GLCapabilitiesImmutable capsReqUser, - GLCapabilitiesChooser chooser, - GraphicsDevice device) + public GLCanvas(final GLCapabilitiesImmutable capsReqUser, + final GLCapabilitiesChooser chooser, + final GraphicsDevice device) throws GLException { this(capsReqUser, chooser, null, device); @@ -272,8 +272,8 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}. */ public GLCanvas(GLCapabilitiesImmutable capsReqUser, - GLCapabilitiesChooser chooser, - GLContext shareWith, + final GLCapabilitiesChooser chooser, + final GLContext shareWith, GraphicsDevice device) throws GLException { @@ -297,7 +297,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } if(null==device) { - GraphicsConfiguration gc = super.getGraphicsConfiguration(); + final GraphicsConfiguration gc = super.getGraphicsConfiguration(); if(null!=gc) { device = gc.getDevice(); } @@ -316,12 +316,12 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public final void setSharedContext(GLContext sharedContext) throws IllegalStateException { + public final void setSharedContext(final GLContext sharedContext) throws IllegalStateException { helper.setSharedContext(this.context, sharedContext); } @Override - public final void setSharedAutoDrawable(GLAutoDrawable sharedAutoDrawable) throws IllegalStateException { + public final void setSharedAutoDrawable(final GLAutoDrawable sharedAutoDrawable) throws IllegalStateException { helper.setSharedAutoDrawable(this, sharedAutoDrawable); } @@ -331,7 +331,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public void setShallUseOffscreenLayer(boolean v) { + public void setShallUseOffscreenLayer(final boolean v) { shallUseOffscreenLayer = v; } @@ -410,11 +410,11 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing * block, both devices should have the same visual list, and the * same configuration should be selected here. */ - AWTGraphicsConfiguration config = chooseGraphicsConfiguration( (GLCapabilitiesImmutable)awtConfig.getChosenCapabilities(), + final AWTGraphicsConfiguration config = chooseGraphicsConfiguration( (GLCapabilitiesImmutable)awtConfig.getChosenCapabilities(), (GLCapabilitiesImmutable)awtConfig.getRequestedCapabilities(), chooser, gc.getDevice()); final GraphicsConfiguration compatible = (null!=config)?config.getAWTGraphicsConfiguration():null; - boolean equalCaps = config.getChosenCapabilities().equals(awtConfig.getChosenCapabilities()); + final boolean equalCaps = config.getChosenCapabilities().equals(awtConfig.getChosenCapabilities()); if(DEBUG) { System.err.println(getThreadName()+": Info:"); System.err.println("Created Config (n): HAVE GC "+chosen); @@ -487,7 +487,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } } - private final void setRealizedImpl(boolean realized) { + private final void setRealizedImpl(final boolean realized) { final RecursiveLock _lock = lock; _lock.lock(); try { @@ -514,7 +514,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing }; @Override - public final void setRealized(boolean realized) { + public final void setRealized(final boolean realized) { // Make sure drawable realization happens on AWT-EDT and only there. Consider the AWTTree lock! AWTEDTExecutor.singleton.invoke(getTreeLock(), false /* allowOnNonEDT */, true /* wait */, realized ? realizeOnEDTAction : unrealizeOnEDTAction); } @@ -531,7 +531,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) { + public WindowClosingMode setDefaultCloseOperation(final WindowClosingMode op) { return awtWindowClosingProtocol.setDefaultCloseOperation(op); } @@ -565,7 +565,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing destroyImpl( false ); } - protected void destroyImpl(boolean destroyJAWTWindowAndAWTDevice) { + protected void destroyImpl(final boolean destroyJAWTWindowAndAWTDevice) { Threading.invoke(true, destroyOnEDTAction, getTreeLock()); if( destroyJAWTWindowAndAWTDevice ) { AWTEDTExecutor.singleton.invoke(getTreeLock(), true /* allowOnNonEDT */, true /* wait */, disposeJAWTWindowAndAWTDeviceOnEDT); @@ -578,21 +578,21 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing properly. */ @Override - public void paint(Graphics g) { + public void paint(final Graphics g) { if( Beans.isDesignTime() ) { // Make GLCanvas behave better in NetBeans GUI builder g.setColor(Color.BLACK); g.fillRect(0, 0, getWidth(), getHeight()); - FontMetrics fm = g.getFontMetrics(); + final FontMetrics fm = g.getFontMetrics(); String name = getName(); if (name == null) { name = getClass().getName(); - int idx = name.lastIndexOf('.'); + final int idx = name.lastIndexOf('.'); if (idx >= 0) { name = name.substring(idx + 1); } } - Rectangle2D bounds = fm.getStringBounds(name, g); + final Rectangle2D bounds = fm.getStringBounds(name, g); g.setColor(Color.WHITE); g.drawString(name, (int) ((getWidth() - bounds.getWidth()) / 2), @@ -801,7 +801,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing
reshape in class java.awt.Component
*/ @SuppressWarnings("deprecation") @Override - public void reshape(int x, int y, int width, int height) { + public void reshape(final int x, final int y, final int width, final int height) { synchronized (getTreeLock()) { // super.reshape(..) claims tree lock, so we do extend it's lock over reshape super.reshape(x, y, width, height); reshapeImpl(width, height); @@ -845,7 +845,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing * canvas from interfering with the OpenGL rendering. */ @Override - public void update(Graphics g) { + public void update(final Graphics g) { paint(g); } @@ -855,7 +855,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing private AWTTilePainter printAWTTiles = null; @Override - public void setupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight) { + public void setupPrint(final double scaleMatX, final double scaleMatY, final int numSamples, final int tileWidth, final int tileHeight) { printActive = true; final int componentCount = isOpaque() ? 3 : 4; final TileRenderer printRenderer = new TileRenderer(); @@ -960,7 +960,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing }; @Override - public void print(Graphics graphics) { + public void print(final Graphics graphics) { if( !printActive || null == printGLAD ) { throw new IllegalStateException("setupPrint() not called"); } @@ -994,7 +994,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing printAWTTiles.resetGraphics2D(); } } - } catch (NoninvertibleTransformException nte) { + } catch (final NoninvertibleTransformException nte) { System.err.println("Caught: Inversion failed of: "+g2d.getTransform()); nte.printStackTrace(); } @@ -1004,12 +1004,12 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public void addGLEventListener(GLEventListener listener) { + public void addGLEventListener(final GLEventListener listener) { helper.addGLEventListener(listener); } @Override - public void addGLEventListener(int index, GLEventListener listener) throws IndexOutOfBoundsException { + public void addGLEventListener(final int index, final GLEventListener listener) throws IndexOutOfBoundsException { helper.addGLEventListener(index, listener); } @@ -1019,7 +1019,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public GLEventListener getGLEventListener(int index) throws IndexOutOfBoundsException { + public GLEventListener getGLEventListener(final int index) throws IndexOutOfBoundsException { return helper.getGLEventListener(index); } @@ -1029,29 +1029,29 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public boolean getGLEventListenerInitState(GLEventListener listener) { + public boolean getGLEventListenerInitState(final GLEventListener listener) { return helper.getGLEventListenerInitState(listener); } @Override - public void setGLEventListenerInitState(GLEventListener listener, boolean initialized) { + public void setGLEventListenerInitState(final GLEventListener listener, final boolean initialized) { helper.setGLEventListenerInitState(listener, initialized); } @Override - public GLEventListener disposeGLEventListener(GLEventListener listener, boolean remove) { + public GLEventListener disposeGLEventListener(final GLEventListener listener, final boolean remove) { final DisposeGLEventListenerAction r = new DisposeGLEventListenerAction(listener, remove); Threading.invoke(true, r, getTreeLock()); return r.listener; } @Override - public GLEventListener removeGLEventListener(GLEventListener listener) { + public GLEventListener removeGLEventListener(final GLEventListener listener) { return helper.removeGLEventListener(listener); } @Override - public void setAnimator(GLAnimatorControl animatorControl) { + public void setAnimator(final GLAnimatorControl animatorControl) { helper.setAnimator(animatorControl); } @@ -1061,7 +1061,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public final Thread setExclusiveContextThread(Thread t) throws GLException { + public final Thread setExclusiveContextThread(final Thread t) throws GLException { return helper.setExclusiveContextThread(t, context); } @@ -1071,7 +1071,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public boolean invoke(boolean wait, GLRunnable glRunnable) { + public boolean invoke(final boolean wait, final GLRunnable glRunnable) { return helper.invoke(this, wait, glRunnable); } @@ -1081,7 +1081,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public GLContext setContext(GLContext newCtx, boolean destroyPrevCtx) { + public GLContext setContext(final GLContext newCtx, final boolean destroyPrevCtx) { final RecursiveLock _lock = lock; _lock.lock(); try { @@ -1114,7 +1114,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public GL setGL(GL gl) { + public GL setGL(final GL gl) { final GLContext _context = context; if (_context != null) { _context.setGL(gl); @@ -1125,7 +1125,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing @Override - public void setAutoSwapBufferMode(boolean onOrOff) { + public void setAutoSwapBufferMode(final boolean onOrOff) { helper.setAutoSwapBufferMode(onOrOff); } @@ -1140,7 +1140,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override - public void setContextCreationFlags(int flags) { + public void setContextCreationFlags(final int flags) { additionalCtxCreationFlags = flags; final GLContext _context = context; if(null != _context) { @@ -1263,7 +1263,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing if(DEBUG) { System.err.println(getThreadName()+": destroyOnEDTAction() - post ctx: "+context); } - } catch (GLException gle) { + } catch (final GLException gle) { gle.printStackTrace(); } } @@ -1327,7 +1327,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } else { adeviceMsg = null; } - boolean closed = adevice.close(); + final boolean closed = adevice.close(); if(DEBUG) { System.err.println(getThreadName()+": GLCanvas.disposeJAWTWindowAndAWTDeviceOnEDT(): post GraphicsDevice: "+adeviceMsg+", result: "+closed); } @@ -1393,7 +1393,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing private class DisposeGLEventListenerAction implements Runnable { GLEventListener listener; private final boolean remove; - private DisposeGLEventListenerAction(GLEventListener listener, boolean remove) { + private DisposeGLEventListenerAction(final GLEventListener listener, final boolean remove) { this.listener = listener; this.remove = remove; } @@ -1431,16 +1431,16 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing clazz.getDeclaredMethod("disableBackgroundErase", new Class[] { Canvas.class }); disableBackgroundEraseMethod.setAccessible(true); - } catch (Exception e) { + } catch (final Exception e) { clazz = clazz.getSuperclass(); } } - } catch (Exception e) { + } catch (final Exception e) { } return null; } }); - } catch (Exception e) { + } catch (final Exception e) { } disableBackgroundEraseInitialized = true; if(DEBUG) { @@ -1452,7 +1452,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing Throwable t=null; try { disableBackgroundEraseMethod.invoke(getToolkit(), new Object[] { this }); - } catch (Exception e) { + } catch (final Exception e) { t = e; } if(DEBUG) { @@ -1498,7 +1498,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing EventQueue.invokeAndWait(new Runnable() { @Override public void run() { - AWTGraphicsConfiguration c = (AWTGraphicsConfiguration) + final AWTGraphicsConfiguration c = (AWTGraphicsConfiguration) GraphicsConfigurationFactory.getFactory(AWTGraphicsDevice.class, GLCapabilitiesImmutable.class).chooseGraphicsConfiguration(capsChosen, capsRequested, chooser, aScreen, VisualIDHolder.VID_UNDEFINED); @@ -1506,9 +1506,9 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } }); config = ( bucket.size() > 0 ) ? bucket.get(0) : null ; - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { throw new GLException(e); } } @@ -1525,7 +1525,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing /** * A most simple JOGL AWT test entry */ - public static void main(String args[]) { + public static void main(final String args[]) { System.err.println(VersionUtil.getPlatformInfo()); System.err.println(GlueGenVersion.getInstance()); // System.err.println(NativeWindowVersion.getInstance()); @@ -1542,16 +1542,16 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing glCanvas.addGLEventListener(new GLEventListener() { @Override - public void init(GLAutoDrawable drawable) { - GL gl = drawable.getGL(); + public void init(final GLAutoDrawable drawable) { + final GL gl = drawable.getGL(); System.err.println(JoglVersion.getGLInfo(gl, null)); } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { } + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } @Override - public void display(GLAutoDrawable drawable) { } + public void display(final GLAutoDrawable drawable) { } @Override - public void dispose(GLAutoDrawable drawable) { } + public void dispose(final GLAutoDrawable drawable) { } }); try { @@ -1560,7 +1560,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing public void run() { frame.setVisible(true); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); } glCanvas.display(); @@ -1570,7 +1570,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing public void run() { frame.dispose(); }}); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); } } diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 558970df6..eca99c6c0 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -96,6 +96,7 @@ import jogamp.opengl.awt.AWTTilePainter; import jogamp.opengl.awt.Java2D; import jogamp.opengl.util.glsl.GLSLTextureRaster; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.awt.AWTEDTExecutor; import com.jogamp.nativewindow.awt.AWTPrintLifecycle; import com.jogamp.nativewindow.awt.AWTWindowClosingProtocol; @@ -190,11 +191,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing static { Debug.initSingleton(); DEBUG = Debug.debug("GLJPanel"); - DEBUG_VIEWPORT = Debug.isPropertyDefined("jogl.debug.GLJPanel.Viewport", true); - USE_GLSL_TEXTURE_RASTERIZER = !Debug.isPropertyDefined("jogl.gljpanel.noglsl", true); - SKIP_VERTICAL_FLIP_DEFAULT = Debug.isPropertyDefined("jogl.gljpanel.noverticalflip", true); - boolean enabled = Debug.getBooleanProperty("sun.java2d.opengl", false); - java2dOGLEnabledByProp = enabled && !Debug.isPropertyDefined("jogl.gljpanel.noogl", true); + DEBUG_VIEWPORT = PropertyAccess.isPropertyDefined("jogl.debug.GLJPanel.Viewport", true); + USE_GLSL_TEXTURE_RASTERIZER = !PropertyAccess.isPropertyDefined("jogl.gljpanel.noglsl", true); + SKIP_VERTICAL_FLIP_DEFAULT = PropertyAccess.isPropertyDefined("jogl.gljpanel.noverticalflip", true); + boolean enabled = PropertyAccess.getBooleanProperty("sun.java2d.opengl", false); + java2dOGLEnabledByProp = enabled && !PropertyAccess.isPropertyDefined("jogl.gljpanel.noogl", true); enabled = false; if( java2dOGLEnabledByProp ) { @@ -281,7 +282,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing private volatile boolean isShowing; private final HierarchyListener hierarchyListener = new HierarchyListener() { @Override - public void hierarchyChanged(HierarchyEvent e) { + public void hierarchyChanged(final HierarchyEvent e) { isShowing = GLJPanel.this.isShowing(); } }; @@ -308,7 +309,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing selection mechanism. * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device. */ - public GLJPanel(GLCapabilitiesImmutable userCapsRequest) throws GLException { + public GLJPanel(final GLCapabilitiesImmutable userCapsRequest) throws GLException { this(userCapsRequest, null, null); } @@ -320,7 +321,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing is used if null is passed for this argument. * @throws GLException if no GLCapabilities are given and no default profile is available for the default desktop device. */ - public GLJPanel(GLCapabilitiesImmutable userCapsRequest, GLCapabilitiesChooser chooser) + public GLJPanel(final GLCapabilitiesImmutable userCapsRequest, final GLCapabilitiesChooser chooser) throws GLException { this(userCapsRequest, chooser, null); @@ -343,7 +344,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing * @deprecated Use {@link #GLJPanel(GLCapabilitiesImmutable, GLCapabilitiesChooser)} * and set shared GLContext via {@link #setSharedContext(GLContext)} or {@link #setSharedAutoDrawable(GLAutoDrawable)}. */ - public GLJPanel(GLCapabilitiesImmutable userCapsRequest, GLCapabilitiesChooser chooser, GLContext shareWith) + public GLJPanel(final GLCapabilitiesImmutable userCapsRequest, final GLCapabilitiesChooser chooser, final GLContext shareWith) throws GLException { super(); @@ -393,7 +394,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing *

* @param offthread */ - public final boolean initializeBackend(boolean offthread) { + public final boolean initializeBackend(final boolean offthread) { if( offthread ) { new Thread(getThreadName()+"-GLJPanel_Init") { public void run() { @@ -412,12 +413,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final void setSharedContext(GLContext sharedContext) throws IllegalStateException { + public final void setSharedContext(final GLContext sharedContext) throws IllegalStateException { helper.setSharedContext(this.getContext(), sharedContext); } @Override - public final void setSharedAutoDrawable(GLAutoDrawable sharedAutoDrawable) throws IllegalStateException { + public final void setSharedAutoDrawable(final GLAutoDrawable sharedAutoDrawable) throws IllegalStateException { helper.setSharedAutoDrawable(this, sharedAutoDrawable); } @@ -428,7 +429,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing * @throws IllegalArgumentException if custom is null * @throws IllegalStateException if backend is already realized, i.e. this instanced already painted once. */ - public void setPixelBufferProvider(AWTGLPixelBufferProvider custom) throws IllegalArgumentException, IllegalStateException { + public void setPixelBufferProvider(final AWTGLPixelBufferProvider custom) throws IllegalArgumentException, IllegalStateException { if( null == custom ) { throw new IllegalArgumentException("Null PixelBufferProvider"); } @@ -454,7 +455,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // so do everything on the event dispatch thread try { EventQueue.invokeAndWait(paintImmediatelyAction); - } catch (Exception e) { + } catch (final Exception e) { throw new GLException(e); } } @@ -469,7 +470,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing if (backend != null && backend.getContext() != null) { boolean animatorPaused = false; - GLAnimatorControl animator = getAnimator(); + final GLAnimatorControl animator = getAnimator(); if(null!=animator) { animatorPaused = animator.pause(); } @@ -517,16 +518,16 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // Make GLJPanel behave better in NetBeans GUI builder g.setColor(Color.BLACK); g.fillRect(0, 0, getWidth(), getHeight()); - FontMetrics fm = g.getFontMetrics(); + final FontMetrics fm = g.getFontMetrics(); String name = getName(); if (name == null) { name = getClass().getName(); - int idx = name.lastIndexOf('.'); + final int idx = name.lastIndexOf('.'); if (idx >= 0) { name = name.substring(idx + 1); } } - Rectangle2D bounds = fm.getStringBounds(name, g); + final Rectangle2D bounds = fm.getStringBounds(name, g); g.setColor(Color.WHITE); g.drawString(name, (int) ((getWidth() - bounds.getWidth()) / 2), @@ -647,7 +648,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing */ @SuppressWarnings("deprecation") @Override - public void reshape(int x, int y, int width, int height) { + public void reshape(final int x, final int y, final int width, final int height) { super.reshape(x, y, width, height); reshapeImpl(width, height); } @@ -675,7 +676,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing private AWTTilePainter printAWTTiles = null; @Override - public void setupPrint(double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight) { + public void setupPrint(final double scaleMatX, final double scaleMatY, final int numSamples, final int tileWidth, final int tileHeight) { printActive = true; final int componentCount = isOpaque() ? 3 : 4; final TileRenderer printRenderer = new TileRenderer(); @@ -802,7 +803,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing }; @Override - public void print(Graphics graphics) { + public void print(final Graphics graphics) { if( !printActive ) { throw new IllegalStateException("setupPrint() not called"); } @@ -837,7 +838,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing printAWTTiles.resetGraphics2D(); } } - } catch (NoninvertibleTransformException nte) { + } catch (final NoninvertibleTransformException nte) { System.err.println("Caught: Inversion failed of: "+g2d.getTransform()); nte.printStackTrace(); } @@ -846,7 +847,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } } @Override - protected void printComponent(Graphics g) { + protected void printComponent(final Graphics g) { if( DEBUG ) { System.err.println("AWT printComponent.X: "+printAWTTiles); } @@ -854,7 +855,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public void setOpaque(boolean opaque) { + public void setOpaque(final boolean opaque) { if (backend != null) { backend.setOpaque(opaque); } @@ -862,12 +863,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public void addGLEventListener(GLEventListener listener) { + public void addGLEventListener(final GLEventListener listener) { helper.addGLEventListener(listener); } @Override - public void addGLEventListener(int index, GLEventListener listener) { + public void addGLEventListener(final int index, final GLEventListener listener) { helper.addGLEventListener(index, listener); } @@ -877,7 +878,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public GLEventListener getGLEventListener(int index) throws IndexOutOfBoundsException { + public GLEventListener getGLEventListener(final int index) throws IndexOutOfBoundsException { return helper.getGLEventListener(index); } @@ -887,17 +888,17 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public boolean getGLEventListenerInitState(GLEventListener listener) { + public boolean getGLEventListenerInitState(final GLEventListener listener) { return helper.getGLEventListenerInitState(listener); } @Override - public void setGLEventListenerInitState(GLEventListener listener, boolean initialized) { + public void setGLEventListenerInitState(final GLEventListener listener, final boolean initialized) { helper.setGLEventListenerInitState(listener, initialized); } @Override - public GLEventListener disposeGLEventListener(GLEventListener listener, boolean remove) { + public GLEventListener disposeGLEventListener(final GLEventListener listener, final boolean remove) { final DisposeGLEventListenerAction r = new DisposeGLEventListenerAction(listener, remove); if (EventQueue.isDispatchThread()) { r.run(); @@ -906,7 +907,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // so do everything on the event dispatch thread try { EventQueue.invokeAndWait(r); - } catch (Exception e) { + } catch (final Exception e) { throw new GLException(e); } } @@ -914,12 +915,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public GLEventListener removeGLEventListener(GLEventListener listener) { + public GLEventListener removeGLEventListener(final GLEventListener listener) { return helper.removeGLEventListener(listener); } @Override - public void setAnimator(GLAnimatorControl animatorControl) { + public void setAnimator(final GLAnimatorControl animatorControl) { helper.setAnimator(animatorControl); } @@ -929,7 +930,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final Thread setExclusiveContextThread(Thread t) throws GLException { + public final Thread setExclusiveContextThread(final Thread t) throws GLException { return helper.setExclusiveContextThread(t, getContext()); } @@ -939,7 +940,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public boolean invoke(boolean wait, GLRunnable glRunnable) { + public boolean invoke(final boolean wait, final GLRunnable glRunnable) { return helper.invoke(this, wait, glRunnable); } @@ -949,7 +950,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { final Backend b = backend; if ( null == b ) { return null; @@ -958,7 +959,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public void setRealized(boolean realized) { + public void setRealized(final boolean realized) { } @Override @@ -967,7 +968,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public GLContext setContext(GLContext newCtx, boolean destroyPrevCtx) { + public GLContext setContext(final GLContext newCtx, final boolean destroyPrevCtx) { final Backend b = backend; if ( null == b ) { return null; @@ -1002,13 +1003,13 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing if (Beans.isDesignTime()) { return null; } - GLContext context = getContext(); + final GLContext context = getContext(); return (context == null) ? null : context.getGL(); } @Override - public GL setGL(GL gl) { - GLContext context = getContext(); + public GL setGL(final GL gl) { + final GLContext context = getContext(); if (context != null) { context.setGL(gl); return gl; @@ -1017,7 +1018,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public void setAutoSwapBufferMode(boolean enable) { + public void setAutoSwapBufferMode(final boolean enable) { this.autoSwapBufferMode = enable; boolean backendHandlesSwapBuffer = false; if( isInitialized ) { @@ -1047,7 +1048,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public void setContextCreationFlags(int flags) { + public void setContextCreationFlags(final int flags) { additionalCtxCreationFlags = flags; } @@ -1111,7 +1112,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing * See constraints of {@link #isGLOriented()}. *

*/ - public final void setSkipGLOrientationVerticalFlip(boolean v) { + public final void setSkipGLOrientationVerticalFlip(final boolean v) { skipGLOrientationVerticalFlip = v; } /** See {@link #setSkipGLOrientationVerticalFlip(boolean)}. */ @@ -1186,7 +1187,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing * @param v requested texture unit * @see #getTextureUnit() */ - public final void setTextureUnit(int v) { + public final void setTextureUnit(final int v) { requestedTextureUnit = v; } @@ -1244,7 +1245,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public WindowClosingMode setDefaultCloseOperation(WindowClosingMode op) { + public WindowClosingMode setDefaultCloseOperation(final WindowClosingMode op) { return awtWindowClosingProtocol.setDefaultCloseOperation(op); } @@ -1265,12 +1266,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing class Updater implements GLEventListener { private Graphics g; - public void setGraphics(Graphics g) { + public void setGraphics(final Graphics g) { this.g = g; } @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { if (!backend.preGL(g)) { return; } @@ -1279,12 +1280,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public void dispose(GLAutoDrawable drawable) { + public void dispose(final GLAutoDrawable drawable) { helper.disposeAllGLEventListener(GLJPanel.this, false); } @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { if (!backend.preGL(g)) { return; } @@ -1300,12 +1301,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing backend.postGL(g, true); } - public void plainPaint(GLAutoDrawable drawable) { + public void plainPaint(final GLAutoDrawable drawable) { helper.display(GLJPanel.this); } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { // This is handled above and dispatched directly to the appropriate context } } @@ -1329,7 +1330,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // so we can continue with the destruction. try { helper.disposeGL(GLJPanel.this, _context, !backendDestroy); - } catch (GLException gle) { + } catch (final GLException gle) { gle.printStackTrace(); } } @@ -1373,7 +1374,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing private class DisposeGLEventListenerAction implements Runnable { GLEventListener listener; private final boolean remove; - private DisposeGLEventListenerAction(GLEventListener listener, boolean remove) { + private DisposeGLEventListenerAction(final GLEventListener listener, final boolean remove) { this.listener = listener; this.remove = remove; } @@ -1387,8 +1388,8 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } }; - private int getGLInteger(GL gl, int which) { - int[] tmp = new int[1]; + private int getGLInteger(final GL gl, final int which) { + final int[] tmp = new int[1]; gl.glGetIntegerv(which, tmp, 0); return tmp[0]; } @@ -1507,7 +1508,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // For saving/restoring of OpenGL state during ReadPixels private final GLPixelStorageModes psm = new GLPixelStorageModes(); - OffscreenBackend(GLProfile glp, AWTGLPixelBufferProvider custom) { + OffscreenBackend(final GLProfile glp, final AWTGLPixelBufferProvider custom) { if(null == custom) { pixelBufferProvider = getSingleAWTGLPixelBufferProvider(); } else { @@ -1543,7 +1544,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing if( DEBUG ) { offscreenDrawable.getNativeSurface().addSurfaceUpdatedListener(new SurfaceUpdatedListener() { @Override - public final void surfaceUpdated(Object updater, NativeSurface ns, long when) { + public final void surfaceUpdated(final Object updater, final NativeSurface ns, final long when) { System.err.println(getThreadName()+": OffscreenBackend.swapBuffers - frameCount "+frameCount); } } ); } @@ -1577,7 +1578,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing glslTextureRaster = new GLSLTextureRaster(fboDrawable.getTextureUnit(), true); glslTextureRaster.init(gl.getGL2ES2()); glslTextureRaster.reshape(gl.getGL2ES2(), 0, 0, fboDrawable.getSurfaceWidth(), fboDrawable.getSurfaceHeight()); - } catch (Exception ex) { + } catch (final Exception ex) { ex.printStackTrace(); if(null != glslTextureRaster) { glslTextureRaster.dispose(gl.getGL2ES2()); @@ -1659,7 +1660,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final void setOpaque(boolean opaque) { + public final void setOpaque(final boolean opaque) { if ( opaque != isOpaque() && !useSingletonBuffer ) { pixelBuffer.dispose(); pixelBuffer = null; @@ -1668,7 +1669,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final boolean preGL(Graphics g) { + public final boolean preGL(final Graphics g) { // Empty in this implementation return true; } @@ -1687,7 +1688,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final void postGL(Graphics g, boolean isDisplay) { + public final void postGL(final Graphics g, final boolean isDisplay) { if (isDisplay) { if(DEBUG) { System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: - frameCount "+frameCount); @@ -1871,7 +1872,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final void doPaintComponent(Graphics g) { + public final void doPaintComponent(final Graphics g) { helper.invokeGL(offscreenDrawable, offscreenContext, updaterDisplayAction, updaterInitAction); if ( null != alignedImage ) { @@ -1922,12 +1923,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final GLContext createContext(GLContext shareWith) { + public final GLContext createContext(final GLContext shareWith) { return (null != offscreenDrawable) ? offscreenDrawable.createContext(shareWith) : null; } @Override - public final void setContext(GLContext ctx) { + public final void setContext(final GLContext ctx) { offscreenContext=(GLContextImpl)ctx; } @@ -2041,12 +2042,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final void setOpaque(boolean opaque) { + public final void setOpaque(final boolean opaque) { // Empty in this implementation } @Override - public final GLContext createContext(GLContext shareWith) { + public final GLContext createContext(final GLContext shareWith) { if(null != shareWith) { throw new GLException("J2DOGLBackend cannot create context w/ additional shared context, since it already needs to share the context w/ J2D."); } @@ -2054,7 +2055,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final void setContext(GLContext ctx) { + public final void setContext(final GLContext ctx) { joglContext=ctx; } @@ -2090,11 +2091,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final boolean preGL(Graphics g) { + public final boolean preGL(final Graphics g) { final GL2 gl = joglContext.getGL().getGL2(); // Set up needed state in JOGL context from Java2D context - gl.glEnable(GL2.GL_SCISSOR_TEST); - Rectangle r = Java2D.getOGLScissorBox(g); + gl.glEnable(GL.GL_SCISSOR_TEST); + final Rectangle r = Java2D.getOGLScissorBox(g); if (r == null) { if (DEBUG) { @@ -2107,7 +2108,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } gl.glScissor(r.x, r.y, r.width, r.height); - Rectangle oglViewport = Java2D.getOGLViewport(g, panelWidth, panelHeight); + final Rectangle oglViewport = Java2D.getOGLViewport(g, panelWidth, panelHeight); // If the viewport X or Y changes, in addition to the panel's // width or height, we need to send a reshape operation to the // client @@ -2132,13 +2133,13 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // The texture target for Java2D's OpenGL pipeline when using FBOs // -- either GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_ARB - int fboTextureTarget = Java2D.getOGLTextureType(g); + final int fboTextureTarget = Java2D.getOGLTextureType(g); if (!checkedForFBObjectWorkarounds) { checkedForFBObjectWorkarounds = true; gl.glBindTexture(fboTextureTarget, 0); - gl.glBindFramebuffer(GL2.GL_FRAMEBUFFER, frameBuffer[0]); - int status = gl.glCheckFramebufferStatus(GL.GL_FRAMEBUFFER); + gl.glBindFramebuffer(GL.GL_FRAMEBUFFER, frameBuffer[0]); + final int status = gl.glCheckFramebufferStatus(GL.GL_FRAMEBUFFER); if (status != GL.GL_FRAMEBUFFER_COMPLETE) { // Need to do workarounds fbObjectWorkarounds = true; @@ -2168,10 +2169,10 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } gl.glBindTexture(fboTextureTarget, frameBufferTexture[0]); - int[] width = new int[1]; - int[] height = new int[1]; - gl.glGetTexLevelParameteriv(fboTextureTarget, 0, GL2.GL_TEXTURE_WIDTH, width, 0); - gl.glGetTexLevelParameteriv(fboTextureTarget, 0, GL2.GL_TEXTURE_HEIGHT, height, 0); + final int[] width = new int[1]; + final int[] height = new int[1]; + gl.glGetTexLevelParameteriv(fboTextureTarget, 0, GL2GL3.GL_TEXTURE_WIDTH, width, 0); + gl.glGetTexLevelParameteriv(fboTextureTarget, 0, GL2GL3.GL_TEXTURE_HEIGHT, height, 0); gl.glGenRenderbuffers(1, frameBufferDepthBuffer, 0); if (DEBUG) { @@ -2181,9 +2182,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, frameBufferDepthBuffer[0]); // FIXME: may need a loop here like in Java2D - gl.glRenderbufferStorage(GL.GL_RENDERBUFFER, GL2GL3.GL_DEPTH_COMPONENT24, width[0], height[0]); + gl.glRenderbufferStorage(GL.GL_RENDERBUFFER, GL.GL_DEPTH_COMPONENT24, width[0], height[0]); - gl.glBindRenderbuffer(GL2.GL_RENDERBUFFER, 0); + gl.glBindRenderbuffer(GL.GL_RENDERBUFFER, 0); createNewDepthBuffer = false; } @@ -2207,7 +2208,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } if (DEBUG) { - int status = gl.glCheckFramebufferStatus(GL.GL_FRAMEBUFFER); + final int status = gl.glCheckFramebufferStatus(GL.GL_FRAMEBUFFER); if (status != GL.GL_FRAMEBUFFER_COMPLETE) { throw new GLException("Error: framebuffer was incomplete: status = 0x" + Integer.toHexString(status)); @@ -2240,11 +2241,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } @Override - public final void postGL(Graphics g, boolean isDisplay) { + public final void postGL(final Graphics g, final boolean isDisplay) { // Cause OpenGL pipeline to flush its results because // otherwise it's possible we will buffer up multiple frames' // rendering results, resulting in apparent mouse lag - GL gl = joglContext.getGL(); + final GL gl = joglContext.getGL(); gl.glFinish(); if (Java2D.isFBOEnabled() && @@ -2308,7 +2309,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing // FIXME: add more checks? j2dContext.makeCurrent(); - GL gl = j2dContext.getGL(); + final GL gl = j2dContext.getGL(); if ((getGLInteger(gl, GL.GL_RED_BITS) < offscreenCaps.getRedBits()) || (getGLInteger(gl, GL.GL_GREEN_BITS) < offscreenCaps.getGreenBits()) || (getGLInteger(gl, GL.GL_BLUE_BITS) < offscreenCaps.getBlueBits()) || @@ -2346,7 +2347,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } try { captureJ2DState(j2dContext.getGL(), g); - Object curSurface = Java2D.getOGLSurfaceIdentifier(g); + final Object curSurface = Java2D.getOGLSurfaceIdentifier(g); if (curSurface != null) { if (j2dSurface != curSurface) { if (joglContext != null) { @@ -2362,7 +2363,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing j2dSurface = curSurface; if (DEBUG) { System.err.print(getThreadName()+": Surface type: "); - int surfaceType = Java2D.getOGLSurfaceType(g); + final int surfaceType = Java2D.getOGLSurfaceType(g); if (surfaceType == Java2D.UNDEFINED) { System.err.println("UNDEFINED"); } else if (surfaceType == Java2D.WINDOW) { @@ -2381,7 +2382,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } } if (joglContext == null) { - AbstractGraphicsDevice device = j2dContext.getGLDrawable().getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); + final AbstractGraphicsDevice device = j2dContext.getGLDrawable().getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); if (factory.canCreateExternalGLDrawable(device)) { joglDrawable = factory.createExternalGLDrawable(); joglContext = joglDrawable.createContext(j2dContext); @@ -2410,9 +2411,9 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing helper.invokeGL(joglDrawable, joglContext, updaterPlainDisplayAction, updaterInitAction); } - private final void captureJ2DState(GL gl, Graphics g) { - gl.glGetIntegerv(GL2.GL_DRAW_BUFFER, drawBuffer, 0); - gl.glGetIntegerv(GL2.GL_READ_BUFFER, readBuffer, 0); + private final void captureJ2DState(final GL gl, final Graphics g) { + gl.glGetIntegerv(GL2GL3.GL_DRAW_BUFFER, drawBuffer, 0); + gl.glGetIntegerv(GL2ES3.GL_READ_BUFFER, readBuffer, 0); if (Java2D.isFBOEnabled() && Java2D.getOGLSurfaceType(g) == Java2D.FBOBJECT) { gl.glGetIntegerv(GL.GL_FRAMEBUFFER_BINDING, frameBuffer, 0); @@ -2446,7 +2447,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing if (!checkedGLVendor) { checkedGLVendor = true; - String vendor = gl.glGetString(GL.GL_VENDOR); + final String vendor = gl.glGetString(GL.GL_VENDOR); if ((vendor != null) && vendor.startsWith("ATI")) { diff --git a/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java b/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java index 9bd644223..3264062e8 100644 --- a/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java +++ b/src/jogl/classes/javax/media/opengl/fixedfunc/GLPointerFuncUtil.java @@ -39,7 +39,7 @@ public class GLPointerFuncUtil { * @param glArrayIndex the fixed function array index * @return default fixed function array name */ - public static String getPredefinedArrayIndexName(int glArrayIndex) { + public static String getPredefinedArrayIndexName(final int glArrayIndex) { return getPredefinedArrayIndexName(glArrayIndex, -1); } @@ -48,7 +48,7 @@ public class GLPointerFuncUtil { * @param multiTexCoordIndex index for multiTexCoordIndex * @return default fixed function array name */ - public static String getPredefinedArrayIndexName(int glArrayIndex, int multiTexCoordIndex) { + public static String getPredefinedArrayIndexName(final int glArrayIndex, final int multiTexCoordIndex) { switch(glArrayIndex) { case GLPointerFunc.GL_VERTEX_ARRAY: return mgl_Vertex; diff --git a/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java b/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java index 15a7bb2a1..c293fbe18 100644 --- a/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java +++ b/src/jogl/classes/javax/media/opengl/glu/GLUtessellatorCallbackAdapter.java @@ -65,32 +65,32 @@ package javax.media.opengl.glu; public class GLUtessellatorCallbackAdapter implements GLUtessellatorCallback { @Override - public void begin(int type) {} + public void begin(final int type) {} @Override - public void edgeFlag(boolean boundaryEdge) {} + public void edgeFlag(final boolean boundaryEdge) {} @Override - public void vertex(Object vertexData) {} + public void vertex(final Object vertexData) {} @Override public void end() {} // public void mesh(jogamp.opengl.tessellator.GLUmesh mesh) {} @Override - public void error(int errnum) {} + public void error(final int errnum) {} @Override - public void combine(double[] coords, Object[] data, - float[] weight, Object[] outData) {} + public void combine(final double[] coords, final Object[] data, + final float[] weight, final Object[] outData) {} @Override - public void beginData(int type, Object polygonData) {} + public void beginData(final int type, final Object polygonData) {} @Override - public void edgeFlagData(boolean boundaryEdge, - Object polygonData) {} + public void edgeFlagData(final boolean boundaryEdge, + final Object polygonData) {} @Override - public void vertexData(Object vertexData, Object polygonData) {} + public void vertexData(final Object vertexData, final Object polygonData) {} @Override - public void endData(Object polygonData) {} + public void endData(final Object polygonData) {} @Override - public void errorData(int errnum, Object polygonData) {} + public void errorData(final int errnum, final Object polygonData) {} @Override - public void combineData(double[] coords, Object[] data, - float[] weight, Object[] outData, - Object polygonData) {} + public void combineData(final double[] coords, final Object[] data, + final float[] weight, final Object[] outData, + final Object polygonData) {} } diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java index b56a69b28..118c9b136 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PMSAAES2.java @@ -142,16 +142,16 @@ public class VBORegion2PMSAAES2 extends GLRegion { final int initialElementCount = 256; // Pass 1: - indicesBuffer = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); + indicesBuffer = GLArrayDataServer.createData(3, GL.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); - gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); - gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); if( hasColorChannel() ) { - gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL2ES2.GL_FLOAT, + gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); } else { gca_ColorsAttr = null; @@ -173,12 +173,12 @@ public class VBORegion2PMSAAES2 extends GLRegion { // Pass 2: gcu_FboTexUnit = new GLUniformData(UniformNames.gcu_FboTexUnit, pass2TexUnit); - indicesFbo = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, 2, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); + indicesFbo = GLArrayDataServer.createData(3, GL.GL_SHORT, 2, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); indicesFbo.puts((short) 0); indicesFbo.puts((short) 1); indicesFbo.puts((short) 3); indicesFbo.puts((short) 1); indicesFbo.puts((short) 2); indicesFbo.puts((short) 3); indicesFbo.seal(true); - gca_FboTexCoordsAttr = GLArrayDataServer.createGLSL(AttributeNames.FBO_TEXCOORDS_ATTR_NAME, 2, GL2ES2.GL_FLOAT, + gca_FboTexCoordsAttr = GLArrayDataServer.createGLSL(AttributeNames.FBO_TEXCOORDS_ATTR_NAME, 2, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); gca_FboTexCoordsAttr.putf(0); gca_FboTexCoordsAttr.putf(0); gca_FboTexCoordsAttr.putf(0); gca_FboTexCoordsAttr.putf(1); @@ -186,7 +186,7 @@ public class VBORegion2PMSAAES2 extends GLRegion { gca_FboTexCoordsAttr.putf(1); gca_FboTexCoordsAttr.putf(0); gca_FboTexCoordsAttr.seal(true); - gca_FboVerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.FBO_VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + gca_FboVerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.FBO_VERTEX_ATTR_NAME, 3, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); } @@ -234,7 +234,7 @@ public class VBORegion2PMSAAES2 extends GLRegion { } @Override - protected final void pushIndex(int idx) { + protected final void pushIndex(final int idx) { indicesBuffer.puts((short)idx); } @@ -432,7 +432,7 @@ public class VBORegion2PMSAAES2 extends GLRegion { gca_FboTexCoordsAttr.enableBuffer(gl, true); indicesFbo.bindBuffer(gl, true); // keeps VBO binding - gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesFbo.getElementCount() * indicesFbo.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); + gl.glDrawElements(GL.GL_TRIANGLES, indicesFbo.getElementCount() * indicesFbo.getComponentCount(), GL.GL_UNSIGNED_SHORT, 0); indicesFbo.bindBuffer(gl, false); gca_FboTexCoordsAttr.enableBuffer(gl, false); @@ -463,7 +463,7 @@ public class VBORegion2PMSAAES2 extends GLRegion { ssink.reset(gl, fboWidth, fboHeight); // FIXME: shall not use bilinear (GL_LINEAR), due to MSAA ??? // ssink.attachTexture2D(gl, 0, true, GL2ES2.GL_LINEAR, GL2ES2.GL_LINEAR, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); - ssink.attachTexture2D(gl, 0, true, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); + ssink.attachTexture2D(gl, 0, true, GL.GL_NEAREST, GL.GL_NEAREST, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE); if( !blendingEnabled ) { // no depth-buffer w/ blending ssink.attachRenderbuffer(gl, Attachment.Type.DEPTH, 24); @@ -489,7 +489,7 @@ public class VBORegion2PMSAAES2 extends GLRegion { gl.glViewport(0, 0, fboWidth, fboHeight); if( blendingEnabled ) { gl.glClearColor(0f, 0f, 0f, 0.0f); - gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT); // no depth-buffer w/ blending + gl.glClear(GL.GL_COLOR_BUFFER_BIT); // no depth-buffer w/ blending // For already pre-multiplied alpha values, use: // gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE_MINUS_SRC_ALPHA); @@ -500,7 +500,7 @@ public class VBORegion2PMSAAES2 extends GLRegion { gl.glDisable(GL.GL_DEPTH_TEST); } } else { - gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT); + gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); } renderRegion(gl); @@ -526,10 +526,10 @@ public class VBORegion2PMSAAES2 extends GLRegion { gcu_ColorTexUnit.setData(colorTexSeq.getTextureUnit()); gl.glUniform(gcu_ColorTexUnit); // Always update, since program maybe used by multiple regions gl.glUniform(gcu_ColorTexBBox); // Always update, since program maybe used by multiple regions - gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); + gl.glDrawElements(GL.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL.GL_UNSIGNED_SHORT, 0); tex.disable(gl); // nop on core } else { - gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); + gl.glDrawElements(GL.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL.GL_UNSIGNED_SHORT, 0); } indicesBuffer.bindBuffer(gl, false); diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java index 861d889c1..8f75e7115 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegion2PVBAAES2.java @@ -37,6 +37,7 @@ import jogamp.graph.curve.opengl.shader.AttributeNames; import jogamp.graph.curve.opengl.shader.UniformNames; import jogamp.opengl.Debug; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.graph.curve.Region; import com.jogamp.graph.curve.opengl.GLRegion; import com.jogamp.graph.curve.opengl.RegionRenderer; @@ -79,7 +80,7 @@ public class VBORegion2PVBAAES2 extends GLRegion { static { Debug.initSingleton(); final String key = "jogl.debug.graph.curve.vbaa.resizeLowerBoundary"; - RESIZE_BOUNDARY = Math.max(0, Debug.getIntProperty(key, true, 0)); + RESIZE_BOUNDARY = Math.max(0, PropertyAccess.getIntProperty(key, true, 0)); if( RESIZE_BOUNDARY > 0 ) { System.err.println("key: "+RESIZE_BOUNDARY); } @@ -178,15 +179,15 @@ public class VBORegion2PVBAAES2 extends GLRegion { final int initialElementCount = 256; // Pass 1: - indicesBuffer = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); + indicesBuffer = GLArrayDataServer.createData(3, GL.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); - gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); - gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); if( hasColorChannel() ) { - gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL2ES2.GL_FLOAT, + gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); } else { gca_ColorsAttr = null; @@ -209,12 +210,12 @@ public class VBORegion2PVBAAES2 extends GLRegion { gcu_FboTexUnit = new GLUniformData(UniformNames.gcu_FboTexUnit, pass2TexUnit); gcu_FboTexSize = new GLUniformData(UniformNames.gcu_FboTexSize, 2, FloatBuffer.wrap(new float[2])); - indicesFbo = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, 2, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); + indicesFbo = GLArrayDataServer.createData(3, GL.GL_SHORT, 2, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); indicesFbo.puts((short) 0); indicesFbo.puts((short) 1); indicesFbo.puts((short) 3); indicesFbo.puts((short) 1); indicesFbo.puts((short) 2); indicesFbo.puts((short) 3); indicesFbo.seal(true); - gca_FboTexCoordsAttr = GLArrayDataServer.createGLSL(AttributeNames.FBO_TEXCOORDS_ATTR_NAME, 2, GL2ES2.GL_FLOAT, + gca_FboTexCoordsAttr = GLArrayDataServer.createGLSL(AttributeNames.FBO_TEXCOORDS_ATTR_NAME, 2, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); gca_FboTexCoordsAttr.putf(0); gca_FboTexCoordsAttr.putf(0); gca_FboTexCoordsAttr.putf(0); gca_FboTexCoordsAttr.putf(1); @@ -222,7 +223,7 @@ public class VBORegion2PVBAAES2 extends GLRegion { gca_FboTexCoordsAttr.putf(1); gca_FboTexCoordsAttr.putf(0); gca_FboTexCoordsAttr.seal(true); - gca_FboVerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.FBO_VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + gca_FboVerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.FBO_VERTEX_ATTR_NAME, 3, GL.GL_FLOAT, false, 4, GL.GL_STATIC_DRAW); } @@ -274,7 +275,7 @@ public class VBORegion2PVBAAES2 extends GLRegion { } @Override - protected final void pushIndex(int idx) { + protected final void pushIndex(final int idx) { indicesBuffer.puts((short)idx); } @@ -549,7 +550,7 @@ public class VBORegion2PVBAAES2 extends GLRegion { gca_FboTexCoordsAttr.enableBuffer(gl, true); indicesFbo.bindBuffer(gl, true); // keeps VBO binding - gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesFbo.getElementCount() * indicesFbo.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); + gl.glDrawElements(GL.GL_TRIANGLES, indicesFbo.getElementCount() * indicesFbo.getComponentCount(), GL.GL_UNSIGNED_SHORT, 0); indicesFbo.bindBuffer(gl, false); gca_FboTexCoordsAttr.enableBuffer(gl, false); @@ -581,7 +582,7 @@ public class VBORegion2PVBAAES2 extends GLRegion { // Shall not use bilinear (GL_LINEAR), due to own VBAA. Result is smooth w/o it now! // FIXME: FXAA requires bilinear filtering! // texA = fbo.attachTexture2D(gl, 0, true, GL2ES2.GL_LINEAR, GL2ES2.GL_LINEAR, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); - texA = fbo.attachTexture2D(gl, 0, true, GL2ES2.GL_NEAREST, GL2ES2.GL_NEAREST, GL2ES2.GL_CLAMP_TO_EDGE, GL2ES2.GL_CLAMP_TO_EDGE); + texA = fbo.attachTexture2D(gl, 0, true, GL.GL_NEAREST, GL.GL_NEAREST, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE); if( !blendingEnabled ) { // no depth-buffer w/ blending fbo.attachRenderbuffer(gl, Attachment.Type.DEPTH, 24); @@ -610,14 +611,14 @@ public class VBORegion2PVBAAES2 extends GLRegion { gl.glViewport(0, 0, fboWidth, fboHeight); if( blendingEnabled ) { gl.glClearColor(0f, 0f, 0f, 0.0f); - gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT); // no depth-buffer w/ blending + gl.glClear(GL.GL_COLOR_BUFFER_BIT); // no depth-buffer w/ blending // For already pre-multiplied alpha values, use: // gl.glBlendFunc(GL.GL_ONE, GL.GL_ONE_MINUS_SRC_ALPHA); // Multiply RGB w/ Alpha, preserve alpha for renderFBO(..) gl.glBlendFuncSeparate(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA, GL.GL_ONE, GL.GL_ONE_MINUS_SRC_ALPHA); } else { - gl.glClear(GL2ES2.GL_COLOR_BUFFER_BIT | GL2ES2.GL_DEPTH_BUFFER_BIT); + gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); } renderRegion(gl); @@ -644,10 +645,10 @@ public class VBORegion2PVBAAES2 extends GLRegion { gcu_ColorTexUnit.setData(colorTexSeq.getTextureUnit()); gl.glUniform(gcu_ColorTexUnit); // Always update, since program maybe used by multiple regions gl.glUniform(gcu_ColorTexBBox); // Always update, since program maybe used by multiple regions - gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); + gl.glDrawElements(GL.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL.GL_UNSIGNED_SHORT, 0); tex.disable(gl); // nop on core } else { - gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); + gl.glDrawElements(GL.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL.GL_UNSIGNED_SHORT, 0); } indicesBuffer.bindBuffer(gl, false); diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java index 8265b014a..46e991866 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java +++ b/src/jogl/classes/jogamp/graph/curve/opengl/VBORegionSPES2.java @@ -64,16 +64,16 @@ public class VBORegionSPES2 extends GLRegion { rsLocal = new RenderState.ProgramLocal(); final int initialElementCount = 256; - indicesBuffer = GLArrayDataServer.createData(3, GL2ES2.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); + indicesBuffer = GLArrayDataServer.createData(3, GL.GL_SHORT, initialElementCount, GL.GL_STATIC_DRAW, GL.GL_ELEMENT_ARRAY_BUFFER); - gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + gca_VerticesAttr = GLArrayDataServer.createGLSL(AttributeNames.VERTEX_ATTR_NAME, 3, GL.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); - gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL2ES2.GL_FLOAT, + gca_CurveParamsAttr = GLArrayDataServer.createGLSL(AttributeNames.CURVEPARAMS_ATTR_NAME, 3, GL.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); if( hasColorChannel() ) { - gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL2ES2.GL_FLOAT, + gca_ColorsAttr = GLArrayDataServer.createGLSL(AttributeNames.COLOR_ATTR_NAME, 4, GL.GL_FLOAT, false, initialElementCount, GL.GL_STATIC_DRAW); } else { gca_ColorsAttr = null; @@ -135,7 +135,7 @@ public class VBORegionSPES2 extends GLRegion { } @Override - protected final void pushIndex(int idx) { + protected final void pushIndex(final int idx) { indicesBuffer.puts((short)idx); } @@ -244,10 +244,10 @@ public class VBORegionSPES2 extends GLRegion { gcu_ColorTexUnit.setData(colorTexSeq.getTextureUnit()); gl.glUniform(gcu_ColorTexUnit); // Always update, since program maybe used by multiple regions gl.glUniform(gcu_ColorTexBBox); // Always update, since program maybe used by multiple regions - gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); + gl.glDrawElements(GL.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL.GL_UNSIGNED_SHORT, 0); tex.disable(gl); // nop on core } else { - gl.glDrawElements(GL2ES2.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL2ES2.GL_UNSIGNED_SHORT, 0); + gl.glDrawElements(GL.GL_TRIANGLES, indicesBuffer.getElementCount() * indicesBuffer.getComponentCount(), GL.GL_UNSIGNED_SHORT, 0); } indicesBuffer.bindBuffer(gl, false); diff --git a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java index d2cfa42a1..4473d040f 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/CDTriangulator2D.java @@ -100,7 +100,7 @@ public class CDTriangulator2D implements Triangulator { } @Override - public final void generate(List sink) { + public final void generate(final List sink) { final int loopsSize = loops.size(); for(int i=0;i vertices = polyline.getVertices(); for(int i=0; i < loops.size(); i++) { final Loop loop = loops.get(i); diff --git a/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java b/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java index 2e8d4f58f..81e6efdad 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphOutline.java @@ -44,9 +44,9 @@ public class GraphOutline { * the curve pieces can be identified by onCurve flag * of each cp the control polyline is open by default */ - public GraphOutline(Outline ol){ + public GraphOutline(final Outline ol){ this.outline = ol; - ArrayList vertices = this.outline.getVertices(); + final ArrayList vertices = this.outline.getVertices(); for(int i = 0; i< vertices.size(); i++){ this.controlpoints.add(new GraphVertex(vertices.get(i))); } @@ -64,7 +64,7 @@ public class GraphOutline { return outline.getVertices(); } - public void addVertex(GraphVertex v) { + public void addVertex(final GraphVertex v) { controlpoints.add(v); outline.addVertex(v.getPoint()); } diff --git a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java index 89ad3edf1..391e71011 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/GraphVertex.java @@ -36,7 +36,7 @@ public class GraphVertex { private ArrayList edges = null; private boolean boundaryContained = false; - public GraphVertex(Vertex point) { + public GraphVertex(final Vertex point) { this.point = point; } @@ -59,7 +59,7 @@ public class GraphVertex { return point.getCoord(); } - public void setPoint(Vertex point) { + public void setPoint(final Vertex point) { this.point = point; } @@ -67,17 +67,17 @@ public class GraphVertex { return edges; } - public void setEdges(ArrayList edges) { + public void setEdges(final ArrayList edges) { this.edges = edges; } - public void addEdge(HEdge edge){ + public void addEdge(final HEdge edge){ if(edges == null){ edges = new ArrayList(); } edges.add(edge); } - public void removeEdge(HEdge edge){ + public void removeEdge(final HEdge edge){ if(edges == null) return; edges.remove(edge); @@ -85,9 +85,9 @@ public class GraphVertex { edges = null; } } - public HEdge findNextEdge(GraphVertex nextVert){ + public HEdge findNextEdge(final GraphVertex nextVert){ for(int i=0; i void connect(HEdge first, HEdge next){ + public static void connect(final HEdge first, final HEdge next){ first.setNext(next); next.setPrev(first); } - public static void makeSiblings(HEdge first, HEdge second){ + public static void makeSiblings(final HEdge first, final HEdge second){ first.setSibling(second); second.setSibling(first); } diff --git a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java index 1f038a930..6563219cc 100644 --- a/src/jogl/classes/jogamp/graph/curve/tess/Loop.java +++ b/src/jogl/classes/jogamp/graph/curve/tess/Loop.java @@ -40,7 +40,7 @@ public class Loop { private final AABBox box = new AABBox(); private GraphOutline initialOutline = null; - public Loop(GraphOutline polyline, VectorUtil.Winding winding){ + public Loop(final GraphOutline polyline, final VectorUtil.Winding winding){ initialOutline = polyline; this.root = initFromPolyline(initialOutline, winding); } @@ -67,7 +67,7 @@ public class Loop { final GraphVertex v2 = next1.getGraphPoint(); final GraphVertex v3 = next2.getGraphPoint(); - HEdge v3Edge = new HEdge(v3, HEdge.INNER); + final HEdge v3Edge = new HEdge(v3, HEdge.INNER); HEdge.connect(v3Edge, root); HEdge.connect(next1, v3Edge); @@ -94,8 +94,8 @@ public class Loop { * from the boundary profile * @param reqWinding requested winding of edges (CCW or CW) */ - private HEdge initFromPolyline(GraphOutline outline, VectorUtil.Winding reqWinding){ - ArrayList vertices = outline.getGraphPoint(); + private HEdge initFromPolyline(final GraphOutline outline, final VectorUtil.Winding reqWinding){ + final ArrayList vertices = outline.getGraphPoint(); if(vertices.size()<3) { throw new IllegalArgumentException("outline's vertices < 3: " + vertices.size()); @@ -124,10 +124,10 @@ public class Loop { } while(index != max){ - GraphVertex v1 = vertices.get(index); + final GraphVertex v1 = vertices.get(index); box.resize(v1.getX(), v1.getY(), v1.getZ()); - HEdge edge = new HEdge(v1, edgeType); + final HEdge edge = new HEdge(v1, edgeType); v1.addEdge(edge); if(lastEdge != null) { @@ -155,15 +155,15 @@ public class Loop { return firstEdge; } - public void addConstraintCurve(GraphOutline polyline) { + public void addConstraintCurve(final GraphOutline polyline) { // GraphOutline outline = new GraphOutline(polyline); /**needed to generate vertex references.*/ initFromPolyline(polyline, VectorUtil.Winding.CW); - GraphVertex v3 = locateClosestVertex(polyline); - HEdge v3Edge = v3.findBoundEdge(); - HEdge v3EdgeP = v3Edge.getPrev(); - HEdge crossEdge = new HEdge(root.getGraphPoint(), HEdge.INNER); + final GraphVertex v3 = locateClosestVertex(polyline); + final HEdge v3Edge = v3.findBoundEdge(); + final HEdge v3EdgeP = v3Edge.getPrev(); + final HEdge crossEdge = new HEdge(root.getGraphPoint(), HEdge.INNER); HEdge.connect(root.getPrev(), crossEdge); HEdge.connect(crossEdge, v3Edge); @@ -184,7 +184,7 @@ public class Loop { * to search for closestvertices * @return the vertex that is closest to the newly set root Hedge. */ - private GraphVertex locateClosestVertex(GraphOutline polyline) { + private GraphVertex locateClosestVertex(final GraphOutline polyline) { HEdge closestE = null; GraphVertex closestV = null; @@ -200,7 +200,7 @@ public class Loop { final GraphVertex cand = vertices.get(pos); final float distance = VectorUtil.distVec3(v.getCoord(), cand.getCoord()); if(distance < minDistance){ - for (GraphVertex vert:vertices){ + for (final GraphVertex vert:vertices){ if(vert == v || vert == nextV || vert == cand) continue; inValid = VectorUtil.isInCircleVec2(v.getPoint(), nextV.getPoint(), @@ -226,19 +226,19 @@ public class Loop { return closestV; } - private HEdge findClosestValidNeighbor(HEdge edge, boolean delaunay) { - HEdge next = root.getNext(); + private HEdge findClosestValidNeighbor(final HEdge edge, final boolean delaunay) { + final HEdge next = root.getNext(); if(!VectorUtil.ccw(root.getGraphPoint().getPoint(), next.getGraphPoint().getPoint(), edge.getGraphPoint().getPoint())){ return null; } - HEdge candEdge = edge; + final HEdge candEdge = edge; boolean inValid = false; if(delaunay){ - Vertex cand = candEdge.getGraphPoint().getPoint(); + final Vertex cand = candEdge.getGraphPoint().getPoint(); HEdge e = candEdge.getNext(); while (e != candEdge){ if(e.getGraphPoint() == root.getGraphPoint() @@ -269,7 +269,7 @@ public class Loop { * @param root and edge of this triangle * @return the triangle iff it satisfies, null otherwise */ - private Triangle createTriangle(Vertex v1, Vertex v2, Vertex v3, HEdge rootT){ + private Triangle createTriangle(final Vertex v1, final Vertex v2, final Vertex v3, final HEdge rootT){ return new Triangle(v1, v2, v3, checkVerticesBoundary(rootT)); } @@ -287,7 +287,7 @@ public class Loop { return boundary; } - public boolean checkInside(Vertex v) { + public boolean checkInside(final Vertex v) { if(!box.contains(v.getX(), v.getY(), v.getZ())){ return false; } @@ -296,8 +296,8 @@ public class Loop { HEdge current = root; HEdge next = root.getNext(); do { - Vertex v2 = current.getGraphPoint().getPoint(); - Vertex v1 = next.getGraphPoint().getPoint(); + final Vertex v2 = current.getGraphPoint().getPoint(); + final Vertex v1 = next.getGraphPoint().getPoint(); if ( ((v1.getY() > v.getY()) != (v2.getY() > v.getY())) && (v.getX() < (v2.getX() - v1.getX()) * (v.getY() - v1.getY()) / (v2.getY() - v1.getY()) + v1.getX()) ){ diff --git a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java index e3df0af1d..1bb2bb5f3 100644 --- a/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java +++ b/src/jogl/classes/jogamp/graph/font/JavaFontLoader.java @@ -78,7 +78,7 @@ public class JavaFontLoader implements FontSet { } } - static boolean is(int bits, int bit) { + static boolean is(final int bits, final int bit) { return 0 != ( bits & bit ) ; } @@ -88,7 +88,7 @@ public class JavaFontLoader implements FontSet { } @Override - public Font get(int family, int style) throws IOException { + public Font get(final int family, final int style) throws IOException { Font font = (Font)fontMap.get( ( family << 8 ) | style ); if (font != null) { return font; @@ -138,7 +138,7 @@ public class JavaFontLoader implements FontSet { return font; } - Font abspath(String fname, int family, int style) throws IOException { + Font abspath(final String fname, final int family, final int style) throws IOException { if(null == javaFontPath) { throw new GLException("java font path undefined"); } @@ -151,7 +151,7 @@ public class JavaFontLoader implements FontSet { return f; } throw new IOException (err); - } catch (IOException ioe) { + } catch (final IOException ioe) { throw new IOException(err, ioe); } } diff --git a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java index c7efe143b..76947873e 100644 --- a/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java +++ b/src/jogl/classes/jogamp/graph/font/UbuntuFontLoader.java @@ -76,7 +76,7 @@ public class UbuntuFontLoader implements FontSet { private UbuntuFontLoader() { } - static boolean is(int bits, int bit) { + static boolean is(final int bits, final int bit) { return 0 != ( bits & bit ) ; } @@ -86,7 +86,7 @@ public class UbuntuFontLoader implements FontSet { } @Override - public Font get(int family, int style) throws IOException { + public Font get(final int family, final int style) throws IOException { Font font = (Font)fontMap.get( ( family << 8 ) | style ); if (font != null) { return font; @@ -132,7 +132,7 @@ public class UbuntuFontLoader implements FontSet { private static boolean attemptedJARLoading = false; private static boolean useTempJarCache = false; - private synchronized Font abspath(String fname, int family, int style) throws IOException { + private synchronized Font abspath(final String fname, final int family, final int style) throws IOException { final String err = "Problem loading font "+fname+", stream "+relFontPath+fname; final Exception[] privErr = { null }; try { @@ -150,7 +150,7 @@ public class UbuntuFontLoader implements FontSet { public Object run() { try { TempJarCache.addResources(UbuntuFontLoader.class, uri); - } catch (Exception e) { privErr[0] = e; } + } catch (final Exception e) { privErr[0] = e; } return null; } } ); if( null == privErr[0] ) { @@ -162,7 +162,7 @@ public class UbuntuFontLoader implements FontSet { } } } - } catch(Exception e) { + } catch(final Exception e) { throw new IOException(err, e); } if( null != privErr[0] ) { @@ -182,7 +182,7 @@ public class UbuntuFontLoader implements FontSet { try { final URI uri = TempJarCache.getResource(absFontPath+fname); privConn[0] = null != uri ? uri.toURL().openConnection() : null; - } catch (Exception e) { privErr[0] = e; } + } catch (final Exception e) { privErr[0] = e; } return null; } } ); if( null != privErr[0] ) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java index 5fb61387a..c48ef99ca 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFont.java @@ -63,15 +63,15 @@ class TypecastFont implements Font { // FIXME: Generic attempt to find the best CmapTable, // which is assumed to be the one with the most entries (stupid 'eh?) - CmapTable cmapTable = font.getCmapTable(); - CmapFormat[] _cmapFormatP = { null, null, null, null }; + final CmapTable cmapTable = font.getCmapTable(); + final CmapFormat[] _cmapFormatP = { null, null, null, null }; int platform = -1; int platformLength = -1; int encoding = -1; for(int i=0; i 0) { @@ -350,7 +350,7 @@ class TypecastFont implements Font { } @Override - public boolean isPrintableChar( char c ) { + public boolean isPrintableChar( final char c ) { return FontFactory.isPrintableChar(c); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java index d7db981b0..6154484d5 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastFontConstructor.java @@ -45,14 +45,14 @@ public class TypecastFontConstructor implements FontConstructor { @Override public Font create(final File ffile) throws IOException { - Object o = AccessController.doPrivileged(new PrivilegedAction() { + final Object o = AccessController.doPrivileged(new PrivilegedAction() { @Override public Object run() { OTFontCollection fontset; try { fontset = OTFontCollection.create(ffile); return new TypecastFont(fontset); - } catch (IOException e) { + } catch (final IOException e) { return e; } } @@ -83,7 +83,7 @@ public class TypecastFontConstructor implements FontConstructor { } f = create(tf); tf.delete(); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } return f; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java index 2246b4a3c..7a3962f7c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastGlyph.java @@ -211,7 +211,7 @@ public class TypecastGlyph implements Font.Glyph { @Override public final int hashCode() { // 31 * x == (x << 5) - x - int hash = 31 + font.getName(Font.NAME_UNIQUNAME).hashCode(); + final int hash = 31 + font.getName(Font.NAME_UNIQUNAME).hashCode(); return ((hash << 5) - hash) + id; } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java index be8ab8f69..d5e30a500 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastHMetrics.java @@ -52,12 +52,12 @@ class TypecastHMetrics implements Metrics { // vheaTable = this.fontImpl.font.getVheaTable(); unitsPerEM_Inv = 1.0f / ( headTable.getUnitsPerEm() ); - int maxWidth = headTable.getXMax() - headTable.getXMin(); - int maxHeight = headTable.getYMax() - headTable.getYMin(); - float lowx= headTable.getXMin(); - float lowy = -(headTable.getYMin()+maxHeight); - float highx = lowx + maxWidth; - float highy = lowy + maxHeight; + final int maxWidth = headTable.getXMax() - headTable.getXMin(); + final int maxHeight = headTable.getYMax() - headTable.getYMin(); + final float lowx= headTable.getXMin(); + final float lowy = -(headTable.getYMin()+maxHeight); + final float highx = lowx + maxWidth; + final float highy = lowy + maxHeight; bbox = new AABBox(lowx, lowy, 0, highx, highy, 0); // invert } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java index b6e9925d4..f78656b52 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/TypecastRenderer.java @@ -45,23 +45,23 @@ import com.jogamp.graph.geom.Vertex.Factory; public class TypecastRenderer { private static final boolean DEBUG = Debug.debug("graph.font.Renderer"); - private static void addShapeMoveTo(final OutlineShape shape, Factory vertexFactory, Point p1) { + private static void addShapeMoveTo(final OutlineShape shape, final Factory vertexFactory, final Point p1) { if( DEBUG ) { System.err.println("Shape.MoveTo: "+p1); } shape.closeLastOutline(false); shape.addEmptyOutline(); shape.addVertex(0, vertexFactory.create(p1.x, p1.y, 0, p1.onCurve)); } - private static void addShapeLineTo(final OutlineShape shape, Factory vertexFactory, Point p1) { + private static void addShapeLineTo(final OutlineShape shape, final Factory vertexFactory, final Point p1) { if( DEBUG ) { System.err.println("Shape.LineTo: "+p1); } shape.addVertex(0, vertexFactory.create(p1.x, p1.y, 0, p1.onCurve)); } - private static void addShapeQuadTo(final OutlineShape shape, Factory vertexFactory, Point p1, Point p2) { + private static void addShapeQuadTo(final OutlineShape shape, final Factory vertexFactory, final Point p1, final Point p2) { if( DEBUG ) { System.err.println("Shape.QuadTo: "+p1+", "+p2); } shape.addVertex(0, vertexFactory.create(p1.x, p1.y, 0, p1.onCurve)); shape.addVertex(0, vertexFactory.create(p2.x, p2.y, 0, p2.onCurve)); } - private static void addShapeQuadTo(final OutlineShape shape, Factory vertexFactory, Point p1, - float p2x, float p2y, boolean p2OnCurve) { + private static void addShapeQuadTo(final OutlineShape shape, final Factory vertexFactory, final Point p1, + final float p2x, final float p2y, final boolean p2OnCurve) { if( DEBUG ) { System.err.println("Shape.QuadTo: "+p1+", p2 "+p2x+", "+p2y+", onCurve "+p2OnCurve); } shape.addVertex(0, vertexFactory.create(p1.x, p1.y, 0, p1.onCurve)); shape.addVertex(0, vertexFactory.create(p2x, p2y, 0, p2OnCurve)); @@ -73,7 +73,7 @@ public class TypecastRenderer { shape.addVertex(0, vertexFactory.create(p3.x, p3.y, 0, p3.onCurve)); } */ - public static OutlineShape buildShape(char symbol, OTGlyph glyph, Factory vertexFactory) { + public static OutlineShape buildShape(final char symbol, final OTGlyph glyph, final Factory vertexFactory) { // // See Typecast: GlyphPathFactory.addContourToPath(..) // @@ -108,7 +108,7 @@ public class TypecastRenderer { } } */ - private static void buildShapeImpl(final OutlineShape shape, char symbol, OTGlyph glyph, Factory vertexFactory) { + private static void buildShapeImpl(final OutlineShape shape, final char symbol, final OTGlyph glyph, final Factory vertexFactory) { // Iterate through all of the points in the glyph. Each time we find a // contour end point, add the point range to the path. int startIndex = 0; @@ -217,7 +217,7 @@ public class TypecastRenderer { } } - private static float midValue(float a, float b) { + private static float midValue(final float a, final float b) { return a + (b - a)/2f; } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java index 8b685659e..181f77ee4 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Disassembler.java @@ -22,7 +22,7 @@ public class Disassembler { * @param ip The current instruction pointer * @return The new instruction pointer */ - public static int advanceIP(short[] instructions, int ip) { + public static int advanceIP(final short[] instructions, int ip) { // The high word specifies font, cvt, or glyph program int i = ip & 0xffff; @@ -46,8 +46,8 @@ public class Disassembler { return ip; } - public static short getPushCount(short[] instructions, int ip) { - short instr = instructions[ip & 0xffff]; + public static short getPushCount(final short[] instructions, final int ip) { + final short instr = instructions[ip & 0xffff]; if ((Mnemonic.NPUSHB == instr) || (Mnemonic.NPUSHW == instr)) { return instructions[(ip & 0xffff) + 1]; } else if ((Mnemonic.PUSHB == (instr & 0xf8)) || (Mnemonic.PUSHW == (instr & 0xf8))) { @@ -56,11 +56,11 @@ public class Disassembler { return 0; } - public static int[] getPushData(short[] instructions, int ip) { - int count = getPushCount(instructions, ip); - int[] data = new int[count]; - int i = ip & 0xffff; - short instr = instructions[i]; + public static int[] getPushData(final short[] instructions, final int ip) { + final int count = getPushCount(instructions, ip); + final int[] data = new int[count]; + final int i = ip & 0xffff; + final short instr = instructions[i]; if (Mnemonic.NPUSHB == instr) { for (int j = 0; j < count; j++) { data[j] = instructions[i + j + 2]; @@ -81,8 +81,8 @@ public class Disassembler { return data; } - public static String disassemble(short[] instructions, int leadingSpaces) { - StringBuilder sb = new StringBuilder(); + public static String disassemble(final short[] instructions, final int leadingSpaces) { + final StringBuilder sb = new StringBuilder(); int ip = 0; while (ip < instructions.length) { for (int i = 0; i < leadingSpaces; i++) { @@ -91,7 +91,7 @@ public class Disassembler { sb.append(ip).append(": "); sb.append(Mnemonic.getMnemonic(instructions[ip])); if (getPushCount(instructions, ip) > 0) { - int[] data = getPushData(instructions, ip); + final int[] data = getPushData(instructions, ip); for(int j = 0; j < data.length; j++) { if ((instructions[ip] == Mnemonic.PUSHW) || (instructions[ip] == Mnemonic.NPUSHW)) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java index 0a4786f82..14e83814c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Fixed.java @@ -812,7 +812,7 @@ public class Fixed { * @param num Input * @return Output */ - public static int arctan( int num ) { + public static int arctan( final int num ) { return 0; } @@ -822,7 +822,7 @@ public class Fixed { * @param num The 26.6 fixed number in question * @return The resulting square root */ - public static int squareRoot(int num) { + public static int squareRoot(final int num) { int n = num; int divisor = num; int nSquared; @@ -841,12 +841,12 @@ public class Fixed { return n; } - public static float floatValue(long fixed) { + public static float floatValue(final long fixed) { return (fixed >> 16) + (float)(fixed & 0xffff) / 0x10000; } - public static float roundedFloatValue(long fixed, int decimalPlaces) { - int factor = 10 * decimalPlaces; + public static float roundedFloatValue(final long fixed, final int decimalPlaces) { + final int factor = 10 * decimalPlaces; return (float)((int)(floatValue(fixed) * factor)) / factor; } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java index d6c9da268..6df892d4d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Mnemonic.java @@ -143,7 +143,7 @@ public class Mnemonic { * @param opcode The opcode for which the mnemonic is required * @return The mnemonic, with a description */ - public static String getMnemonic(short opcode) { + public static String getMnemonic(final short opcode) { if (opcode >= MIRP) return "MIRP["+((opcode&16)==0?"nrp0,":"srp0,")+((opcode&8)==0?"nmd,":"md,")+((opcode&4)==0?"nrd,":"rd,")+(opcode&3)+"]"; else if (opcode >= MDRP) return "MDRP["+((opcode&16)==0?"nrp0,":"srp0,")+((opcode&8)==0?"nmd,":"md,")+((opcode&4)==0?"nrd,":"rd,")+(opcode&3)+"]"; else if (opcode >= PUSHW) return "PUSHW["+((opcode&7)+1)+"]"; @@ -269,7 +269,7 @@ public class Mnemonic { else return "????"; } - public static String getComment(short opcode) { + public static String getComment(final short opcode) { if (opcode >= MIRP) return "MIRP["+((opcode&16)==0?"nrp0,":"srp0,")+((opcode&8)==0?"nmd,":"md,")+((opcode&4)==0?"nrd,":"rd,")+(opcode&3)+"]\t\tMove Indirect Relative Point"; else if (opcode >= MDRP) return "MDRP["+((opcode&16)==0?"nrp0,":"srp0,")+((opcode&8)==0?"nmd,":"md,")+((opcode&4)==0?"nrd,":"rd,")+(opcode&3)+"]\t\tMove Direct Relative Point"; else if (opcode >= PUSHW) return "PUSHW["+((opcode&7)+1)+"]"; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java index 7c3b32e2c..e83a428ed 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFont.java @@ -79,7 +79,7 @@ import jogamp.graph.font.typecast.ot.table.VheaTable; */ public class OTFont { - private OTFontCollection _fc; + private final OTFontCollection _fc; private TableDirectory _tableDirectory = null; private Table[] _tables; private Os2Table _os2; @@ -98,17 +98,17 @@ public class OTFont { /** * Constructor */ - public OTFont(OTFontCollection fc) { + public OTFont(final OTFontCollection fc) { _fc = fc; } - public StringBuilder getName(int nameIndex, StringBuilder sb) { + public StringBuilder getName(final int nameIndex, StringBuilder sb) { if(null == sb) { sb = new StringBuilder(); } return _name.getRecordsRecordString(sb, nameIndex); } - public StringBuilder getAllNames(StringBuilder sb, String separator) { + public StringBuilder getAllNames(StringBuilder sb, final String separator) { if(null != _name) { if(null == sb) { sb = new StringBuilder(); @@ -120,7 +120,7 @@ public class OTFont { return sb; } - public Table getTable(int tableType) { + public Table getTable(final int tableType) { for (int i = 0; i < _tables.length; i++) { if ((_tables[i] != null) && (_tables[i].getType() == tableType)) { return _tables[i]; @@ -185,7 +185,7 @@ public class OTFont { return _maxp.getNumGlyphs(); } - public OTGlyph getGlyph(int i) { + public OTGlyph getGlyph(final int i) { final GlyfDescript _glyfDescr = _glyf.getDescription(i); return (null != _glyfDescr) @@ -201,11 +201,11 @@ public class OTFont { } private Table readTable( - DataInputStream dis, - int tablesOrigin, - int tag) throws IOException { + final DataInputStream dis, + final int tablesOrigin, + final int tag) throws IOException { dis.reset(); - DirectoryEntry entry = _tableDirectory.getEntryByTag(tag); + final DirectoryEntry entry = _tableDirectory.getEntryByTag(tag); if (entry == null) { return null; } @@ -225,9 +225,9 @@ public class OTFont { * individual font resource data. */ protected void read( - DataInputStream dis, - int directoryOffset, - int tablesOrigin) throws IOException { + final DataInputStream dis, + final int directoryOffset, + final int tablesOrigin) throws IOException { // Load the table directory dis.reset(); @@ -255,7 +255,7 @@ public class OTFont { // Load all other tables for (int i = 0; i < _tableDirectory.getNumTables(); i++) { - DirectoryEntry entry = _tableDirectory.getEntry(i); + final DirectoryEntry entry = _tableDirectory.getEntry(i); if (entry.getTag() == Table.head || entry.getTag() == Table.hhea || entry.getTag() == Table.maxp diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFontCollection.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFontCollection.java index c79380f16..e5ad2900a 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFontCollection.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTFontCollection.java @@ -48,7 +48,7 @@ public class OTFontCollection { private String _fileName; private TTCHeader _ttcHeader; private OTFont[] _fonts; - private ArrayList _tables = new ArrayList
(); + private final ArrayList
_tables = new ArrayList
(); private boolean _resourceFork = false; /** Creates new FontCollection */ @@ -58,8 +58,8 @@ public class OTFontCollection { /** * @param file The OpenType font file */ - public static OTFontCollection create(File file) throws IOException { - OTFontCollection fc = new OTFontCollection(); + public static OTFontCollection create(final File file) throws IOException { + final OTFontCollection fc = new OTFontCollection(); fc.read(file); return fc; } @@ -72,7 +72,7 @@ public class OTFontCollection { return _fileName; } - public OTFont getFont(int i) { + public OTFont getFont(final int i) { return _fonts[i]; } @@ -84,9 +84,9 @@ public class OTFontCollection { return _ttcHeader; } - public Table getTable(DirectoryEntry de) { + public Table getTable(final DirectoryEntry de) { for (int i = 0; i < _tables.size(); i++) { - Table table = _tables.get(i); + final Table table = _tables.get(i); if ((table.getDirectoryEntry().getTag() == de.getTag()) && (table.getDirectoryEntry().getOffset() == de.getOffset())) { return table; @@ -95,7 +95,7 @@ public class OTFontCollection { return null; } - public void addTable(Table table) { + public void addTable(final Table table) { _tables.add(table); } @@ -120,7 +120,7 @@ public class OTFontCollection { _resourceFork = true; } - DataInputStream dis = new DataInputStream( + final DataInputStream dis = new DataInputStream( new BufferedInputStream( new FileInputStream(file), (int) file.length())); dis.mark((int) file.length()); @@ -128,22 +128,22 @@ public class OTFontCollection { if (_resourceFork || _pathName.endsWith(".dfont")) { // This is a Macintosh font suitcase resource - ResourceHeader resourceHeader = new ResourceHeader(dis); + final ResourceHeader resourceHeader = new ResourceHeader(dis); // Seek to the map offset and read the map dis.reset(); dis.skip(resourceHeader.getMapOffset()); - ResourceMap map = new ResourceMap(dis); + final ResourceMap map = new ResourceMap(dis); // Get the 'sfnt' resources - ResourceType resourceType = map.getResourceType("sfnt"); + final ResourceType resourceType = map.getResourceType("sfnt"); // Load the font data _fonts = new OTFont[resourceType.getCount()]; for (int i = 0; i < resourceType.getCount(); i++) { - ResourceReference resourceReference = resourceType.getReference(i); + final ResourceReference resourceReference = resourceType.getReference(i); _fonts[i] = new OTFont(this); - int offset = resourceHeader.getDataOffset() + + final int offset = resourceHeader.getDataOffset() + resourceReference.getDataOffset() + 4; _fonts[i].read(dis, offset, offset); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java index 270507fec..7bfffd58c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/OTGlyph.java @@ -79,7 +79,7 @@ public class OTGlyph { * @param lsb The Left Side Bearing. * @param advance The advance width. */ - public OTGlyph(GlyphDescription gd, short lsb, int advance) { + public OTGlyph(final GlyphDescription gd, final short lsb, final int advance) { _leftSideBearing = lsb; _advanceWidth = advance; describe(gd); @@ -91,11 +91,11 @@ public class OTGlyph { * @param lsb The Left Side Bearing. * @param advance The advance width. */ - public OTGlyph(Charstring cs, short lsb, int advance) { + public OTGlyph(final Charstring cs, final short lsb, final int advance) { _leftSideBearing = lsb; _advanceWidth = advance; if (cs instanceof CharstringType2) { - T2Interpreter t2i = new T2Interpreter(); + final T2Interpreter t2i = new T2Interpreter(); _points = t2i.execute((CharstringType2) cs); } else { //throw unsupported charstring type @@ -118,7 +118,7 @@ public class OTGlyph { return _leftSideBearing; } - public Point getPoint(int i) { + public Point getPoint(final int i) { return _points[i]; } @@ -129,7 +129,7 @@ public class OTGlyph { /** * @param factor a 16.16 fixed value */ - public void scale(int factor) { + public void scale(final int factor) { for (int i = 0; i < _points.length; i++) { //points[i].x = ( points[i].x * factor ) >> 6; //points[i].y = ( points[i].y * factor ) >> 6; @@ -143,11 +143,11 @@ public class OTGlyph { /** * Set the points of a glyph from the GlyphDescription */ - private void describe(GlyphDescription gd) { + private void describe(final GlyphDescription gd) { int endPtIndex = 0; _points = new Point[gd.getPointCount() /* + 2 */ ]; for (int i = 0; i < gd.getPointCount(); i++) { - boolean endPt = gd.getEndPtOfContours(endPtIndex) == i; + final boolean endPt = gd.getEndPtOfContours(endPtIndex) == i; if (endPt) { endPtIndex++; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/Point.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/Point.java index 0cac8ab44..76b0f90f3 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/Point.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/Point.java @@ -19,7 +19,7 @@ public class Point { public boolean onCurve = true; public boolean endOfContour = false; - public Point(int x, int y, boolean onCurve, boolean endOfContour) { + public Point(final int x, final int y, final boolean onCurve, final boolean endOfContour) { this.x = x; this.y = y; this.onCurve = onCurve; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceData.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceData.java index 7a5b0c4d2..709ff9e91 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceData.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceData.java @@ -30,11 +30,11 @@ import java.io.IOException; */ public class ResourceData { - private byte[] data; + private final byte[] data; /** Creates new ResourceData */ - public ResourceData(DataInput di) throws IOException { - int dataLen = di.readInt(); + public ResourceData(final DataInput di) throws IOException { + final int dataLen = di.readInt(); data = new byte[dataLen]; di.readFully(data); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceFile.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceFile.java index 468ab2e1c..767eafb6b 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceFile.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceFile.java @@ -31,11 +31,11 @@ import java.io.RandomAccessFile; */ public class ResourceFile { - private ResourceHeader header; - private ResourceMap map; + private final ResourceHeader header; + private final ResourceMap map; /** Creates new Resource */ - public ResourceFile(RandomAccessFile raf) throws IOException { + public ResourceFile(final RandomAccessFile raf) throws IOException { // Read header at the beginning of the file raf.seek(0); @@ -50,13 +50,13 @@ public class ResourceFile { return map; } - public static void main(String[] args) { + public static void main(final String[] args) { try { //RandomAccessFile raf = new RandomAccessFile("/Library/Fonts/GillSans.dfont", "r"); // Tests loading a font from a resource fork on Mac OS X - RandomAccessFile raf = new RandomAccessFile("/Library/Fonts/Georgia/..namedfork/rsrc", "r"); - ResourceFile resource = new ResourceFile(raf); + final RandomAccessFile raf = new RandomAccessFile("/Library/Fonts/Georgia/..namedfork/rsrc", "r"); + final ResourceFile resource = new ResourceFile(raf); for (int i = 0; i < resource.getResourceMap().getResourceTypeCount(); i++) { System.out.println(resource.getResourceMap().getResourceType(i).getTypeAsString()); } @@ -70,7 +70,7 @@ public class ResourceFile { reference = type.getReference(i); System.out.println(reference.getName()); } - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceHeader.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceHeader.java index de13b116f..dea0b9843 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceHeader.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceHeader.java @@ -30,13 +30,13 @@ import java.io.IOException; */ public class ResourceHeader { - private int dataOffset; - private int mapOffset; - private int dataLen; - private int mapLen; + private final int dataOffset; + private final int mapOffset; + private final int dataLen; + private final int mapLen; /** Creates new ResourceHeader */ - public ResourceHeader(DataInput di) throws IOException { + public ResourceHeader(final DataInput di) throws IOException { dataOffset = di.readInt(); mapOffset = di.readInt(); dataLen = di.readInt(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceMap.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceMap.java index d348c645e..b22a06325 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceMap.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceMap.java @@ -30,21 +30,21 @@ import java.io.IOException; */ public class ResourceMap { - private byte[] headerCopy = new byte[16]; - private int nextResourceMap; - private int fileReferenceNumber; - private int attributes; - private ResourceType[] types; + private final byte[] headerCopy = new byte[16]; + private final int nextResourceMap; + private final int fileReferenceNumber; + private final int attributes; + private final ResourceType[] types; /** Creates new ResourceMap */ - public ResourceMap(DataInput di) throws IOException { + public ResourceMap(final DataInput di) throws IOException { di.readFully(headerCopy); nextResourceMap = di.readInt(); fileReferenceNumber = di.readUnsignedShort(); attributes = di.readUnsignedShort(); - int typeOffset = di.readUnsignedShort(); - int nameOffset = di.readUnsignedShort(); - int typeCount = di.readUnsignedShort() + 1; + final int typeOffset = di.readUnsignedShort(); + final int nameOffset = di.readUnsignedShort(); + final int typeCount = di.readUnsignedShort() + 1; // Read types types = new ResourceType[typeCount]; @@ -63,9 +63,9 @@ public class ResourceMap { } } - public ResourceType getResourceType(String typeName) { + public ResourceType getResourceType(final String typeName) { for (int i = 0; i < types.length; i++) { - String s = types[i].getTypeAsString(); + final String s = types[i].getTypeAsString(); if (types[i].getTypeAsString().equals(typeName)) { return types[i]; } @@ -73,7 +73,7 @@ public class ResourceMap { return null; } - public ResourceType getResourceType(int i) { + public ResourceType getResourceType(final int i) { return types[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceReference.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceReference.java index 9d1534821..f76b85cf4 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceReference.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceReference.java @@ -30,15 +30,15 @@ import java.io.IOException; */ public class ResourceReference { - private int id; - private short nameOffset; - private short attributes; - private int dataOffset; - private int handle; + private final int id; + private final short nameOffset; + private final short attributes; + private final int dataOffset; + private final int handle; private String name; /** Creates new ResourceReference */ - protected ResourceReference(DataInput di) throws IOException { + protected ResourceReference(final DataInput di) throws IOException { id = di.readUnsignedShort(); nameOffset = di.readShort(); attributes = (short) di.readUnsignedByte(); @@ -46,10 +46,10 @@ public class ResourceReference { handle = di.readInt(); } - protected void readName(DataInput di) throws IOException { + protected void readName(final DataInput di) throws IOException { if (nameOffset > -1) { - int len = di.readUnsignedByte(); - byte[] buf = new byte[len]; + final int len = di.readUnsignedByte(); + final byte[] buf = new byte[len]; di.readFully(buf); name = new String(buf); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceType.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceType.java index 2ad002e6a..903fe1a48 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceType.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/mac/ResourceType.java @@ -30,26 +30,26 @@ import java.io.IOException; */ public class ResourceType { - private int type; - private int count; - private int offset; - private ResourceReference[] references; + private final int type; + private final int count; + private final int offset; + private final ResourceReference[] references; /** Creates new ResourceType */ - protected ResourceType(DataInput di) throws IOException { + protected ResourceType(final DataInput di) throws IOException { type = di.readInt(); count = di.readUnsignedShort() + 1; offset = di.readUnsignedShort(); references = new ResourceReference[count]; } - protected void readRefs(DataInput di) throws IOException { + protected void readRefs(final DataInput di) throws IOException { for (int i = 0; i < count; i++) { references[i] = new ResourceReference(di); } } - protected void readNames(DataInput di) throws IOException { + protected void readNames(final DataInput di) throws IOException { for (int i = 0; i < count; i++) { references[i].readName(di); } @@ -76,7 +76,7 @@ public class ResourceType { return offset; } - public ResourceReference getReference(int i) { + public ResourceReference getReference(final int i) { return references[i]; } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java index 60975dd52..49ab1d474 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/BaseTable.java @@ -41,9 +41,9 @@ public class BaseTable implements Table { private class BaseCoordFormat1 extends BaseCoord { - private short _coordinate; + private final short _coordinate; - protected BaseCoordFormat1(DataInput di) throws IOException { + protected BaseCoordFormat1(final DataInput di) throws IOException { _coordinate = di.readShort(); } @@ -61,11 +61,11 @@ public class BaseTable implements Table { private class BaseCoordFormat2 extends BaseCoord { - private short _coordinate; - private int _referenceGlyph; - private int _baseCoordPoint; + private final short _coordinate; + private final int _referenceGlyph; + private final int _baseCoordPoint; - protected BaseCoordFormat2(DataInput di) throws IOException { + protected BaseCoordFormat2(final DataInput di) throws IOException { _coordinate = di.readShort(); _referenceGlyph = di.readUnsignedShort(); _baseCoordPoint = di.readUnsignedShort(); @@ -85,10 +85,10 @@ public class BaseTable implements Table { private class BaseCoordFormat3 extends BaseCoord { - private short _coordinate; - private int _deviceTableOffset; + private final short _coordinate; + private final int _deviceTableOffset; - protected BaseCoordFormat3(DataInput di) throws IOException { + protected BaseCoordFormat3(final DataInput di) throws IOException { _coordinate = di.readShort(); _deviceTableOffset = di.readUnsignedShort(); } @@ -107,11 +107,11 @@ public class BaseTable implements Table { private class FeatMinMaxRecord { - private int _tag; - private int _minCoordOffset; - private int _maxCoordOffset; + private final int _tag; + private final int _minCoordOffset; + private final int _maxCoordOffset; - protected FeatMinMaxRecord(DataInput di) throws IOException { + protected FeatMinMaxRecord(final DataInput di) throws IOException { _tag = di.readInt(); _minCoordOffset = di.readUnsignedShort(); _maxCoordOffset = di.readUnsignedShort(); @@ -120,13 +120,13 @@ public class BaseTable implements Table { private class MinMax { - private int _minCoordOffset; - private int _maxCoordOffset; - private int _featMinMaxCount; - private FeatMinMaxRecord[] _featMinMaxRecord; + private final int _minCoordOffset; + private final int _maxCoordOffset; + private final int _featMinMaxCount; + private final FeatMinMaxRecord[] _featMinMaxRecord; - protected MinMax(int minMaxOffset) throws IOException { - DataInput di = getDataInputForOffset(minMaxOffset); + protected MinMax(final int minMaxOffset) throws IOException { + final DataInput di = getDataInputForOffset(minMaxOffset); _minCoordOffset = di.readUnsignedShort(); _maxCoordOffset = di.readUnsignedShort(); _featMinMaxCount = di.readUnsignedShort(); @@ -139,13 +139,13 @@ public class BaseTable implements Table { private class BaseValues { - private int _defaultIndex; - private int _baseCoordCount; - private int[] _baseCoordOffset; - private BaseCoord[] _baseCoords; + private final int _defaultIndex; + private final int _baseCoordCount; + private final int[] _baseCoordOffset; + private final BaseCoord[] _baseCoords; - protected BaseValues(int baseValuesOffset) throws IOException { - DataInput di = getDataInputForOffset(baseValuesOffset); + protected BaseValues(final int baseValuesOffset) throws IOException { + final DataInput di = getDataInputForOffset(baseValuesOffset); _defaultIndex = di.readUnsignedShort(); _baseCoordCount = di.readUnsignedShort(); _baseCoordOffset = new int[_baseCoordCount]; @@ -154,7 +154,7 @@ public class BaseTable implements Table { } _baseCoords = new BaseCoord[_baseCoordCount]; for (int i = 0; i < _baseCoordCount; ++i) { - int format = di.readUnsignedShort(); + final int format = di.readUnsignedShort(); switch (format) { case 1: _baseCoords[i] = new BaseCoordFormat1(di); @@ -172,10 +172,10 @@ public class BaseTable implements Table { private class BaseLangSysRecord { - private int _baseLangSysTag; - private int _minMaxOffset; + private final int _baseLangSysTag; + private final int _minMaxOffset; - protected BaseLangSysRecord(DataInput di) throws IOException { + protected BaseLangSysRecord(final DataInput di) throws IOException { _baseLangSysTag = di.readInt(); _minMaxOffset = di.readUnsignedShort(); } @@ -191,17 +191,17 @@ public class BaseTable implements Table { private class BaseScript { - private int _thisOffset; - private int _baseValuesOffset; - private int _defaultMinMaxOffset; - private int _baseLangSysCount; - private BaseLangSysRecord[] _baseLangSysRecord; + private final int _thisOffset; + private final int _baseValuesOffset; + private final int _defaultMinMaxOffset; + private final int _baseLangSysCount; + private final BaseLangSysRecord[] _baseLangSysRecord; private BaseValues _baseValues; private MinMax[] _minMax; - protected BaseScript(int baseScriptOffset) throws IOException { + protected BaseScript(final int baseScriptOffset) throws IOException { _thisOffset = baseScriptOffset; - DataInput di = getDataInputForOffset(baseScriptOffset); + final DataInput di = getDataInputForOffset(baseScriptOffset); _baseValuesOffset = di.readUnsignedShort(); _defaultMinMaxOffset = di.readUnsignedShort(); _baseLangSysCount = di.readUnsignedShort(); @@ -219,7 +219,7 @@ public class BaseTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder() + final StringBuilder sb = new StringBuilder() .append("\nBaseScript BaseScriptT").append(Integer.toHexString(_thisOffset)) .append("\nBaseValuesT").append(Integer.toHexString(_thisOffset + _baseValuesOffset)) .append("\nMinMaxT").append(Integer.toHexString(_thisOffset + _defaultMinMaxOffset)) @@ -241,10 +241,10 @@ public class BaseTable implements Table { private class BaseScriptRecord { - private int _baseScriptTag; - private int _baseScriptOffset; + private final int _baseScriptTag; + private final int _baseScriptOffset; - protected BaseScriptRecord(DataInput di) throws IOException { + protected BaseScriptRecord(final DataInput di) throws IOException { _baseScriptTag = di.readInt(); _baseScriptOffset = di.readUnsignedShort(); } @@ -260,14 +260,14 @@ public class BaseTable implements Table { private class BaseScriptList { - private int _thisOffset; - private int _baseScriptCount; - private BaseScriptRecord[] _baseScriptRecord; - private BaseScript[] _baseScripts; + private final int _thisOffset; + private final int _baseScriptCount; + private final BaseScriptRecord[] _baseScriptRecord; + private final BaseScript[] _baseScripts; - protected BaseScriptList(int baseScriptListOffset) throws IOException { + protected BaseScriptList(final int baseScriptListOffset) throws IOException { _thisOffset = baseScriptListOffset; - DataInput di = getDataInputForOffset(baseScriptListOffset); + final DataInput di = getDataInputForOffset(baseScriptListOffset); _baseScriptCount = di.readUnsignedShort(); _baseScriptRecord = new BaseScriptRecord[_baseScriptCount]; for (int i = 0; i < _baseScriptCount; ++i) { @@ -282,7 +282,7 @@ public class BaseTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder() + final StringBuilder sb = new StringBuilder() .append("\nBaseScriptList BaseScriptListT").append(Integer.toHexString(_thisOffset)) .append("\n").append(Integer.toHexString(_baseScriptCount)); for (int i = 0; i < _baseScriptCount; ++i) { @@ -299,13 +299,13 @@ public class BaseTable implements Table { private class BaseTagList { - private int _thisOffset; - private int _baseTagCount; - private int[] _baselineTag; + private final int _thisOffset; + private final int _baseTagCount; + private final int[] _baselineTag; - protected BaseTagList(int baseTagListOffset) throws IOException { + protected BaseTagList(final int baseTagListOffset) throws IOException { _thisOffset = baseTagListOffset; - DataInput di = getDataInputForOffset(baseTagListOffset); + final DataInput di = getDataInputForOffset(baseTagListOffset); _baseTagCount = di.readUnsignedShort(); _baselineTag = new int[_baseTagCount]; for (int i = 0; i < _baseTagCount; ++i) { @@ -315,7 +315,7 @@ public class BaseTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder() + final StringBuilder sb = new StringBuilder() .append("\nBaseTagList BaseTagListT").append(Integer.toHexString(_thisOffset)) .append("\n").append(Integer.toHexString(_baseTagCount)); for (int i = 0; i < _baseTagCount; ++i) { @@ -327,15 +327,15 @@ public class BaseTable implements Table { private class Axis { - private int _thisOffset; - private int _baseTagListOffset; - private int _baseScriptListOffset; + private final int _thisOffset; + private final int _baseTagListOffset; + private final int _baseScriptListOffset; private BaseTagList _baseTagList; private BaseScriptList _baseScriptList; - protected Axis(int axisOffset) throws IOException { + protected Axis(final int axisOffset) throws IOException { _thisOffset = axisOffset; - DataInput di = getDataInputForOffset(axisOffset); + final DataInput di = getDataInputForOffset(axisOffset); _baseTagListOffset = di.readUnsignedShort(); _baseScriptListOffset = di.readUnsignedShort(); if (_baseTagListOffset != 0) { @@ -359,22 +359,22 @@ public class BaseTable implements Table { } } - private DirectoryEntry _de; - private int _version; - private int _horizAxisOffset; - private int _vertAxisOffset; + private final DirectoryEntry _de; + private final int _version; + private final int _horizAxisOffset; + private final int _vertAxisOffset; private Axis _horizAxis; private Axis _vertAxis; private byte[] _buf; /** Creates a new instance of BaseTable */ - protected BaseTable(DirectoryEntry de, DataInput di) throws IOException { + protected BaseTable(final DirectoryEntry de, final DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); // Load entire table into a buffer, and create another input stream _buf = new byte[de.getLength()]; di.readFully(_buf); - DataInput di2 = getDataInputForOffset(0); + final DataInput di2 = getDataInputForOffset(0); _version = di2.readInt(); _horizAxisOffset = di2.readUnsignedShort(); @@ -390,7 +390,7 @@ public class BaseTable implements Table { _buf = null; } - private DataInput getDataInputForOffset(int offset) { + private DataInput getDataInputForOffset(final int offset) { return new DataInputStream(new ByteArrayInputStream( _buf, offset, _de.getLength() - offset)); @@ -404,8 +404,8 @@ public class BaseTable implements Table { // return String.format("%1$8x", value); // } - static protected String tagAsString(int tag) { - char[] c = new char[4]; + static protected String tagAsString(final int tag) { + final char[] c = new char[4]; c[0] = (char)((tag >> 24) & 0xff); c[1] = (char)((tag >> 16) & 0xff); c[2] = (char)((tag >> 8) & 0xff); @@ -420,7 +420,7 @@ public class BaseTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder() + final StringBuilder sb = new StringBuilder() .append("; 'BASE' Table - Baseline\n;-------------------------------------\n\n") .append("BASEHeader BASEHeaderT").append(Integer.toHexString(0)) .append("\n").append(Integer.toHexString(_version)) diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java index a36a49923..b0acff575 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CffTable.java @@ -39,11 +39,11 @@ public class CffTable implements Table { public class Dict { - private Dictionary _entries = new Hashtable(); - private int[] _data; + private final Dictionary _entries = new Hashtable(); + private final int[] _data; private int _index; - protected Dict(int[] data, int offset, int length) { + protected Dict(final int[] data, final int offset, final int length) { _data = data; _index = offset; while (_index < offset + length) { @@ -51,12 +51,12 @@ public class CffTable implements Table { } } - public Object getValue(int key) { + public Object getValue(final int key) { return _entries.get(key); } private boolean addKeyAndValueEntry() { - ArrayList operands = new ArrayList(); + final ArrayList operands = new ArrayList(); Object operand = null; while (isOperandAtIndex()) { operand = nextOperand(); @@ -76,7 +76,7 @@ public class CffTable implements Table { } private boolean isOperandAtIndex() { - int b0 = _data[_index]; + final int b0 = _data[_index]; if ((32 <= b0 && b0 <= 254) || b0 == 28 || b0 == 29 @@ -87,7 +87,7 @@ public class CffTable implements Table { } private boolean isOperatorAtIndex() { - int b0 = _data[_index]; + final int b0 = _data[_index]; if (0 <= b0 && b0 <= 21) { return true; } @@ -95,7 +95,7 @@ public class CffTable implements Table { } private Object nextOperand() { - int b0 = _data[_index]; + final int b0 = _data[_index]; if (32 <= b0 && b0 <= 246) { // 1 byte integer @@ -104,35 +104,35 @@ public class CffTable implements Table { } else if (247 <= b0 && b0 <= 250) { // 2 byte integer - int b1 = _data[_index + 1]; + final int b1 = _data[_index + 1]; _index += 2; return new Integer((b0 - 247) * 256 + b1 + 108); } else if (251 <= b0 && b0 <= 254) { // 2 byte integer - int b1 = _data[_index + 1]; + final int b1 = _data[_index + 1]; _index += 2; return new Integer(-(b0 - 251) * 256 - b1 - 108); } else if (b0 == 28) { // 3 byte integer - int b1 = _data[_index + 1]; - int b2 = _data[_index + 2]; + final int b1 = _data[_index + 1]; + final int b2 = _data[_index + 2]; _index += 3; return new Integer(b1 << 8 | b2); } else if (b0 == 29) { // 5 byte integer - int b1 = _data[_index + 1]; - int b2 = _data[_index + 2]; - int b3 = _data[_index + 3]; - int b4 = _data[_index + 4]; + final int b1 = _data[_index + 1]; + final int b2 = _data[_index + 2]; + final int b3 = _data[_index + 3]; + final int b4 = _data[_index + 4]; _index += 5; return new Integer(b1 << 24 | b2 << 16 | b3 << 8 | b4); } else if (b0 == 30) { // Real number - StringBuilder fString = new StringBuilder(); + final StringBuilder fString = new StringBuilder(); int nibble1 = 0; int nibble2 = 0; ++_index; @@ -149,7 +149,7 @@ public class CffTable implements Table { } } - private String decodeRealNibble(int nibble) { + private String decodeRealNibble(final int nibble) { if (nibble < 0xa) { return Integer.toString(nibble); } else if (nibble == 0xa) { @@ -166,10 +166,10 @@ public class CffTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); - Enumeration keys = _entries.keys(); + final StringBuilder sb = new StringBuilder(); + final Enumeration keys = _entries.keys(); while (keys.hasMoreElements()) { - Integer key = keys.nextElement(); + final Integer key = keys.nextElement(); if ((key.intValue() & 0xc00) == 0xc00) { sb.append("12 ").append(key.intValue() & 0xff).append(": "); } else { @@ -183,12 +183,12 @@ public class CffTable implements Table { public class Index { - private int _count; - private int _offSize; - private int[] _offset; - private int[] _data; + private final int _count; + private final int _offSize; + private final int[] _offset; + private final int[] _data; - protected Index(DataInput di) throws IOException { + protected Index(final DataInput di) throws IOException { _count = di.readUnsignedShort(); _offset = new int[_count + 1]; _offSize = di.readUnsignedByte(); @@ -209,7 +209,7 @@ public class CffTable implements Table { return _count; } - public int getOffset(int index) { + public int getOffset(final int index) { return _offset[index]; } @@ -223,7 +223,7 @@ public class CffTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("DICT\n"); sb.append("count: ").append(_count).append("\n"); sb.append("offSize: ").append(_offSize).append("\n"); @@ -246,19 +246,19 @@ public class CffTable implements Table { public class TopDictIndex extends Index { - protected TopDictIndex(DataInput di) throws IOException { + protected TopDictIndex(final DataInput di) throws IOException { super(di); } - public Dict getTopDict(int index) { - int offset = getOffset(index) - 1; - int len = getOffset(index + 1) - offset - 1; + public Dict getTopDict(final int index) { + final int offset = getOffset(index) - 1; + final int len = getOffset(index + 1) - offset - 1; return new Dict(getData(), offset, len); } @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); for (int i = 0; i < getCount(); ++i) { sb.append(getTopDict(i).toString()).append("\n"); } @@ -268,18 +268,18 @@ public class CffTable implements Table { public class NameIndex extends Index { - protected NameIndex(DataInput di) throws IOException { + protected NameIndex(final DataInput di) throws IOException { super(di); } - public String getName(int index) { + public String getName(final int index) { String name = null; - int offset = getOffset(index) - 1; - int len = getOffset(index + 1) - offset - 1; + final int offset = getOffset(index) - 1; + final int len = getOffset(index + 1) - offset - 1; // Ensure the name hasn't been deleted if (getData()[offset] != 0) { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); for (int i = offset; i < offset + len; ++i) { sb.append((char) getData()[i]); } @@ -292,7 +292,7 @@ public class CffTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); for (int i = 0; i < getCount(); ++i) { sb.append(getName(i)).append("\n"); } @@ -302,7 +302,7 @@ public class CffTable implements Table { public class StringIndex extends Index { - protected StringIndex(DataInput di) throws IOException { + protected StringIndex(final DataInput di) throws IOException { super(di); } @@ -314,10 +314,10 @@ public class CffTable implements Table { if (index >= getCount()) { return null; } - int offset = getOffset(index) - 1; - int len = getOffset(index + 1) - offset - 1; + final int offset = getOffset(index) - 1; + final int len = getOffset(index + 1) - offset - 1; - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); for (int i = offset; i < offset + len; ++i) { sb.append((char) getData()[i]); } @@ -327,8 +327,8 @@ public class CffTable implements Table { @Override public String toString() { - int nonStandardBase = CffStandardStrings.standardStrings.length; - StringBuilder sb = new StringBuilder(); + final int nonStandardBase = CffStandardStrings.standardStrings.length; + final StringBuilder sb = new StringBuilder(); for (int i = 0; i < getCount(); ++i) { sb.append(nonStandardBase + i).append(": "); sb.append(getString(nonStandardBase + i)).append("\n"); @@ -346,7 +346,7 @@ public class CffTable implements Table { return _first; } - protected void setFirst(int first) { + protected void setFirst(final int first) { _first = first; } @@ -354,14 +354,14 @@ public class CffTable implements Table { return _left; } - protected void setLeft(int left) { + protected void setLeft(final int left) { _left = left; } } private class CharsetRange1 extends CharsetRange { - protected CharsetRange1(DataInput di) throws IOException { + protected CharsetRange1(final DataInput di) throws IOException { setFirst(di.readUnsignedShort()); setLeft(di.readUnsignedByte()); } @@ -369,7 +369,7 @@ public class CffTable implements Table { private class CharsetRange2 extends CharsetRange { - protected CharsetRange2(DataInput di) throws IOException { + protected CharsetRange2(final DataInput di) throws IOException { setFirst(di.readUnsignedShort()); setLeft(di.readUnsignedShort()); } @@ -384,9 +384,9 @@ public class CffTable implements Table { private class CharsetFormat0 extends Charset { - private int[] _glyph; + private final int[] _glyph; - protected CharsetFormat0(DataInput di, int glyphCount) throws IOException { + protected CharsetFormat0(final DataInput di, final int glyphCount) throws IOException { _glyph = new int[glyphCount - 1]; // minus 1 because .notdef is omitted for (int i = 0; i < glyphCount - 1; ++i) { _glyph[i] = di.readUnsignedShort(); @@ -399,7 +399,7 @@ public class CffTable implements Table { } @Override - public int getSID(int gid) { + public int getSID(final int gid) { if (gid == 0) { return 0; } @@ -409,12 +409,12 @@ public class CffTable implements Table { private class CharsetFormat1 extends Charset { - private ArrayList _charsetRanges = new ArrayList(); + private final ArrayList _charsetRanges = new ArrayList(); - protected CharsetFormat1(DataInput di, int glyphCount) throws IOException { + protected CharsetFormat1(final DataInput di, final int glyphCount) throws IOException { int glyphsCovered = glyphCount - 1; // minus 1 because .notdef is omitted while (glyphsCovered > 0) { - CharsetRange range = new CharsetRange1(di); + final CharsetRange range = new CharsetRange1(di); _charsetRanges.add(range); glyphsCovered -= range.getLeft() + 1; } @@ -426,17 +426,17 @@ public class CffTable implements Table { } @Override - public int getSID(int gid) { + public int getSID(final int gid) { if (gid == 0) { return 0; } // Count through the ranges to find the one of interest int count = 0; - for (CharsetRange range : _charsetRanges) { + for (final CharsetRange range : _charsetRanges) { count += range.getLeft(); if (gid < count) { - int sid = gid - count + range.getFirst(); + final int sid = gid - count + range.getFirst(); return sid; } } @@ -446,12 +446,12 @@ public class CffTable implements Table { private class CharsetFormat2 extends Charset { - private ArrayList _charsetRanges = new ArrayList(); + private final ArrayList _charsetRanges = new ArrayList(); - protected CharsetFormat2(DataInput di, int glyphCount) throws IOException { + protected CharsetFormat2(final DataInput di, final int glyphCount) throws IOException { int glyphsCovered = glyphCount - 1; // minus 1 because .notdef is omitted while (glyphsCovered > 0) { - CharsetRange range = new CharsetRange2(di); + final CharsetRange range = new CharsetRange2(di); _charsetRanges.add(range); glyphsCovered -= range.getLeft() + 1; } @@ -463,16 +463,16 @@ public class CffTable implements Table { } @Override - public int getSID(int gid) { + public int getSID(final int gid) { if (gid == 0) { return 0; } // Count through the ranges to find the one of interest int count = 0; - for (CharsetRange range : _charsetRanges) { + for (final CharsetRange range : _charsetRanges) { if (gid < range.getLeft() + count) { - int sid = gid - count + range.getFirst() - 1; + final int sid = gid - count + range.getFirst() - 1; return sid; } count += range.getLeft(); @@ -481,23 +481,23 @@ public class CffTable implements Table { } } - private DirectoryEntry _de; - private int _major; - private int _minor; - private int _hdrSize; - private int _offSize; - private NameIndex _nameIndex; - private TopDictIndex _topDictIndex; - private StringIndex _stringIndex; - private Index _globalSubrIndex; - private Index _charStringsIndexArray[]; - private Charset[] _charsets; - private Charstring[][] _charstringsArray; - - private byte[] _buf; + private final DirectoryEntry _de; + private final int _major; + private final int _minor; + private final int _hdrSize; + private final int _offSize; + private final NameIndex _nameIndex; + private final TopDictIndex _topDictIndex; + private final StringIndex _stringIndex; + private final Index _globalSubrIndex; + private final Index _charStringsIndexArray[]; + private final Charset[] _charsets; + private final Charstring[][] _charstringsArray; + + private final byte[] _buf; /** Creates a new instance of CffTable */ - protected CffTable(DirectoryEntry de, DataInput di) throws IOException { + protected CffTable(final DirectoryEntry de, final DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); // Load entire table into a buffer, and create another input stream @@ -537,15 +537,15 @@ public class CffTable implements Table { // Charstrings INDEX // We load this before Charsets because we may need to know the number // of glyphs - Integer charStringsOffset = (Integer) _topDictIndex.getTopDict(i).getValue(17); + final Integer charStringsOffset = (Integer) _topDictIndex.getTopDict(i).getValue(17); di2 = getDataInputForOffset(charStringsOffset); _charStringsIndexArray[i] = new Index(di2); - int glyphCount = _charStringsIndexArray[i].getCount(); + final int glyphCount = _charStringsIndexArray[i].getCount(); // Charsets - Integer charsetOffset = (Integer) _topDictIndex.getTopDict(i).getValue(15); + final Integer charsetOffset = (Integer) _topDictIndex.getTopDict(i).getValue(15); di2 = getDataInputForOffset(charsetOffset); - int format = di2.readUnsignedByte(); + final int format = di2.readUnsignedByte(); switch (format) { case 0: _charsets[i] = new CharsetFormat0(di2, glyphCount); @@ -561,8 +561,8 @@ public class CffTable implements Table { // Create the charstrings _charstringsArray[i] = new Charstring[glyphCount]; for (int j = 0; j < glyphCount; ++j) { - int offset = _charStringsIndexArray[i].getOffset(j) - 1; - int len = _charStringsIndexArray[i].getOffset(j + 1) - offset - 1; + final int offset = _charStringsIndexArray[i].getOffset(j) - 1; + final int len = _charStringsIndexArray[i].getOffset(j + 1) - offset - 1; _charstringsArray[i][j] = new CharstringType2( i, _stringIndex.getString(_charsets[i].getSID(j)), @@ -575,7 +575,7 @@ public class CffTable implements Table { } } - private DataInput getDataInputForOffset(int offset) { + private DataInput getDataInputForOffset(final int offset) { return new DataInputStream(new ByteArrayInputStream( _buf, offset, _de.getLength() - offset)); @@ -585,15 +585,15 @@ public class CffTable implements Table { return _nameIndex; } - public Charset getCharset(int fontIndex) { + public Charset getCharset(final int fontIndex) { return _charsets[fontIndex]; } - public Charstring getCharstring(int fontIndex, int gid) { + public Charstring getCharstring(final int fontIndex, final int gid) { return _charstringsArray[fontIndex][gid]; } - public int getCharstringCount(int fontIndex) { + public int getCharstringCount(final int fontIndex) { return _charstringsArray[fontIndex].length; } @@ -604,7 +604,7 @@ public class CffTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'CFF' Table - Compact Font Format\n---------------------------------\n"); sb.append("\nName INDEX\n"); sb.append(_nameIndex.toString()); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java index 7a7b51890..211499357 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CharstringType2.java @@ -106,24 +106,24 @@ public class CharstringType2 extends Charstring { "-Reserved-" }; - private int _index; - private String _name; - private int[] _data; - private int _offset; - private int _length; - private CffTable.Index _localSubrIndex; - private CffTable.Index _globalSubrIndex; + private final int _index; + private final String _name; + private final int[] _data; + private final int _offset; + private final int _length; + private final CffTable.Index _localSubrIndex; + private final CffTable.Index _globalSubrIndex; private int _ip; /** Creates a new instance of CharstringType2 */ protected CharstringType2( - int index, - String name, - int[] data, - int offset, - int length, - CffTable.Index localSubrIndex, - CffTable.Index globalSubrIndex) { + final int index, + final String name, + final int[] data, + final int offset, + final int length, + final CffTable.Index localSubrIndex, + final CffTable.Index globalSubrIndex) { _index = index; _name = name; _data = data; @@ -143,7 +143,7 @@ public class CharstringType2 extends Charstring { return _name; } - private void disassemble(StringBuilder sb) { + private void disassemble(final StringBuilder sb) { Number operand = null; while (isOperandAtIndex()) { operand = nextOperand(); @@ -170,7 +170,7 @@ public class CharstringType2 extends Charstring { } public boolean isOperandAtIndex() { - int b0 = _data[_ip]; + final int b0 = _data[_ip]; if ((32 <= b0 && b0 <= 255) || b0 == 28) { return true; } @@ -178,7 +178,7 @@ public class CharstringType2 extends Charstring { } public Number nextOperand() { - int b0 = _data[_ip]; + final int b0 = _data[_ip]; if (32 <= b0 && b0 <= 246) { // 1 byte integer @@ -187,29 +187,29 @@ public class CharstringType2 extends Charstring { } else if (247 <= b0 && b0 <= 250) { // 2 byte integer - int b1 = _data[_ip + 1]; + final int b1 = _data[_ip + 1]; _ip += 2; return new Integer((b0 - 247) * 256 + b1 + 108); } else if (251 <= b0 && b0 <= 254) { // 2 byte integer - int b1 = _data[_ip + 1]; + final int b1 = _data[_ip + 1]; _ip += 2; return new Integer(-(b0 - 251) * 256 - b1 - 108); } else if (b0 == 28) { // 3 byte integer - int b1 = _data[_ip + 1]; - int b2 = _data[_ip + 2]; + final int b1 = _data[_ip + 1]; + final int b2 = _data[_ip + 2]; _ip += 3; return new Integer(b1 << 8 | b2); } else if (b0 == 255) { // 16-bit signed integer with 16 bits of fraction - int b1 = (byte) _data[_ip + 1]; - int b2 = _data[_ip + 2]; - int b3 = _data[_ip + 3]; - int b4 = _data[_ip + 4]; + final int b1 = (byte) _data[_ip + 1]; + final int b2 = _data[_ip + 2]; + final int b3 = _data[_ip + 3]; + final int b4 = _data[_ip + 4]; _ip += 5; return new Float((b1 << 8 | b2) + ((b3 << 8 | b4) / 65536.0)); } else { @@ -227,7 +227,7 @@ public class CharstringType2 extends Charstring { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); resetIP(); while (moreBytes()) { disassemble(sb); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDef.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDef.java index 21698c76b..a65bcd525 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDef.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDef.java @@ -20,9 +20,9 @@ public abstract class ClassDef { public abstract int getFormat(); - protected static ClassDef read(RandomAccessFile raf) throws IOException { + protected static ClassDef read(final RandomAccessFile raf) throws IOException { ClassDef c = null; - int format = raf.readUnsignedShort(); + final int format = raf.readUnsignedShort(); if (format == 1) { c = new ClassDefFormat1(raf); } else if (format == 2) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat1.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat1.java index 94910e4f6..cbc05393f 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat1.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat1.java @@ -18,12 +18,12 @@ import java.io.RandomAccessFile; */ public class ClassDefFormat1 extends ClassDef { - private int startGlyph; - private int glyphCount; - private int[] classValues; + private final int startGlyph; + private final int glyphCount; + private final int[] classValues; /** Creates new ClassDefFormat1 */ - public ClassDefFormat1(RandomAccessFile raf) throws IOException { + public ClassDefFormat1(final RandomAccessFile raf) throws IOException { startGlyph = raf.readUnsignedShort(); glyphCount = raf.readUnsignedShort(); classValues = new int[glyphCount]; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat2.java index 9906ecfb1..99283f026 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ClassDefFormat2.java @@ -18,11 +18,11 @@ import java.io.RandomAccessFile; */ public class ClassDefFormat2 extends ClassDef { - private int classRangeCount; - private RangeRecord[] classRangeRecords; + private final int classRangeCount; + private final RangeRecord[] classRangeRecords; /** Creates new ClassDefFormat2 */ - public ClassDefFormat2(RandomAccessFile raf) throws IOException { + public ClassDefFormat2(final RandomAccessFile raf) throws IOException { classRangeCount = raf.readUnsignedShort(); classRangeRecords = new RangeRecord[classRangeCount]; for (int i = 0; i < classRangeCount; i++) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat.java index f7054852a..f29583ec4 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat.java @@ -61,10 +61,10 @@ public abstract class CmapFormat { public class Range { - private int _startCode; - private int _endCode; + private final int _startCode; + private final int _endCode; - protected Range(int startCode, int endCode) { + protected Range(final int startCode, final int endCode) { _startCode = startCode; _endCode = endCode; } @@ -82,12 +82,12 @@ public abstract class CmapFormat { protected int _length; protected int _language; - protected CmapFormat(DataInput di) throws IOException { + protected CmapFormat(final DataInput di) throws IOException { _length = di.readUnsignedShort(); _language = di.readUnsignedShort(); } - protected static CmapFormat create(int format, DataInput di) + protected static CmapFormat create(final int format, final DataInput di) throws IOException { switch(format) { case 0: diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat0.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat0.java index dd1ede232..505e8c942 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat0.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat0.java @@ -61,9 +61,9 @@ import java.io.IOException; */ public class CmapFormat0 extends CmapFormat { - private int[] _glyphIdArray = new int[256]; + private final int[] _glyphIdArray = new int[256]; - protected CmapFormat0(DataInput di) throws IOException { + protected CmapFormat0(final DataInput di) throws IOException { super(di); _format = 0; for (int i = 0; i < 256; i++) { @@ -77,7 +77,7 @@ public class CmapFormat0 extends CmapFormat { } @Override - public Range getRange(int index) throws ArrayIndexOutOfBoundsException { + public Range getRange(final int index) throws ArrayIndexOutOfBoundsException { if (index != 0) { throw new ArrayIndexOutOfBoundsException(); } @@ -85,7 +85,7 @@ public class CmapFormat0 extends CmapFormat { } @Override - public int mapCharCode(int charCode) { + public int mapCharCode(final int charCode) { if (0 <= charCode && charCode < 256) { return _glyphIdArray[charCode]; } else { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java index d071e9421..e57e509b4 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat2.java @@ -68,11 +68,11 @@ public class CmapFormat2 extends CmapFormat { int _arrayIndex; } - private int[] _subHeaderKeys = new int[256]; - private SubHeader[] _subHeaders; - private int[] _glyphIndexArray; + private final int[] _subHeaderKeys = new int[256]; + private final SubHeader[] _subHeaders; + private final int[] _glyphIndexArray; - protected CmapFormat2(DataInput di) throws IOException { + protected CmapFormat2(final DataInput di) throws IOException { super(di); _format = 2; @@ -86,15 +86,15 @@ public class CmapFormat2 extends CmapFormat { highest = Math.max(highest, _subHeaderKeys[i]); pos += 2; } - int subHeaderCount = highest / 8 + 1; + final int subHeaderCount = highest / 8 + 1; _subHeaders = new SubHeader[subHeaderCount]; // Read the subheaders, once again noting the highest glyphIndexArray // index range. - int indexArrayOffset = 8 * subHeaderCount + 518; + final int indexArrayOffset = 8 * subHeaderCount + 518; highest = 0; for (int i = 0; i < _subHeaders.length; ++i) { - SubHeader sh = new SubHeader(); + final SubHeader sh = new SubHeader(); sh._firstCode = di.readUnsignedShort(); sh._entryCount = di.readUnsignedShort(); sh._idDelta = di.readShort(); @@ -124,7 +124,7 @@ public class CmapFormat2 extends CmapFormat { } @Override - public Range getRange(int index) throws ArrayIndexOutOfBoundsException { + public Range getRange(final int index) throws ArrayIndexOutOfBoundsException { if (index < 0 || index >= _subHeaders.length) { throw new ArrayIndexOutOfBoundsException(); } @@ -147,18 +147,18 @@ public class CmapFormat2 extends CmapFormat { } @Override - public int mapCharCode(int charCode) { + public int mapCharCode(final int charCode) { // Get the appropriate subheader int index = 0; - int highByte = charCode >> 8; + final int highByte = charCode >> 8; if (highByte != 0) { index = _subHeaderKeys[highByte] / 8; } - SubHeader sh = _subHeaders[index]; + final SubHeader sh = _subHeaders[index]; // Is the charCode out-of-range? - int lowByte = charCode & 0xff; + final int lowByte = charCode & 0xff; if (lowByte < sh._firstCode || lowByte >= (sh._firstCode + sh._entryCount)) { return 0; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat4.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat4.java index 2ae23d031..f84a4eab3 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat4.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat4.java @@ -59,18 +59,18 @@ import java.io.IOException; */ public class CmapFormat4 extends CmapFormat { - private int _segCountX2; - private int _searchRange; - private int _entrySelector; - private int _rangeShift; - private int[] _endCode; - private int[] _startCode; - private int[] _idDelta; - private int[] _idRangeOffset; - private int[] _glyphIdArray; - private int _segCount; - - protected CmapFormat4(DataInput di) throws IOException { + private final int _segCountX2; + private final int _searchRange; + private final int _entrySelector; + private final int _rangeShift; + private final int[] _endCode; + private final int[] _startCode; + private final int[] _idDelta; + private final int[] _idRangeOffset; + private final int[] _glyphIdArray; + private final int _segCount; + + protected CmapFormat4(final DataInput di) throws IOException { super(di); // 6 _format = 4; _segCountX2 = di.readUnsignedShort(); // +2 (8) @@ -97,7 +97,7 @@ public class CmapFormat4 extends CmapFormat { } // + 2*segCount (8*segCount + 16) // Whatever remains of this header belongs in glyphIdArray - int count = (_length - (8*_segCount + 16)) / 2; + final int count = (_length - (8*_segCount + 16)) / 2; _glyphIdArray = new int[count]; for (int i = 0; i < count; i++) { _glyphIdArray[i] = di.readUnsignedShort(); @@ -116,7 +116,7 @@ public class CmapFormat4 extends CmapFormat { } @Override - public Range getRange(int index) throws ArrayIndexOutOfBoundsException { + public Range getRange(final int index) throws ArrayIndexOutOfBoundsException { if (index < 0 || index >= _segCount) { throw new ArrayIndexOutOfBoundsException(); } @@ -124,7 +124,7 @@ public class CmapFormat4 extends CmapFormat { } @Override - public int mapCharCode(int charCode) { + public int mapCharCode(final int charCode) { try { for (int i = 0; i < _segCount; i++) { if (_endCode[i] >= charCode) { @@ -139,7 +139,7 @@ public class CmapFormat4 extends CmapFormat { } } } - } catch (ArrayIndexOutOfBoundsException e) { + } catch (final ArrayIndexOutOfBoundsException e) { System.err.println("error: Array out of bounds - " + e.getMessage()); } return 0; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat6.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat6.java index 2a33d8d40..eff3d2fb1 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat6.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormat6.java @@ -64,7 +64,7 @@ public class CmapFormat6 extends CmapFormat { private short _entryCount; private short[] _glyphIdArray; - protected CmapFormat6(DataInput di) throws IOException { + protected CmapFormat6(final DataInput di) throws IOException { super(di); _format = 6; @@ -79,12 +79,12 @@ public class CmapFormat6 extends CmapFormat { } @Override - public Range getRange(int index) throws ArrayIndexOutOfBoundsException { + public Range getRange(final int index) throws ArrayIndexOutOfBoundsException { throw new ArrayIndexOutOfBoundsException(); } @Override - public int mapCharCode(int charCode) { + public int mapCharCode(final int charCode) { return 0; } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormatUnknown.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormatUnknown.java index 392683bcd..e9aa1d4e0 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormatUnknown.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapFormatUnknown.java @@ -32,7 +32,7 @@ import java.io.IOException; public class CmapFormatUnknown extends CmapFormat { /** Creates a new instance of CmapFormatUnknown */ - protected CmapFormatUnknown(int format, DataInput di) throws IOException { + protected CmapFormatUnknown(final int format, final DataInput di) throws IOException { super(di); _format = format; @@ -46,12 +46,12 @@ public class CmapFormatUnknown extends CmapFormat { } @Override - public Range getRange(int index) throws ArrayIndexOutOfBoundsException { + public Range getRange(final int index) throws ArrayIndexOutOfBoundsException { throw new ArrayIndexOutOfBoundsException(); } @Override - public int mapCharCode(int charCode) { + public int mapCharCode(final int charCode) { return 0; } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapIndexEntry.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapIndexEntry.java index 4833318d5..1f2c80286 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapIndexEntry.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapIndexEntry.java @@ -59,12 +59,12 @@ import java.io.IOException; */ public class CmapIndexEntry implements Comparable { - private int _platformId; - private int _encodingId; - private int _offset; + private final int _platformId; + private final int _encodingId; + private final int _offset; private CmapFormat _format; - protected CmapIndexEntry(DataInput di) throws IOException { + protected CmapIndexEntry(final DataInput di) throws IOException { _platformId = di.readUnsignedShort(); _encodingId = di.readUnsignedShort(); _offset = di.readInt(); @@ -86,7 +86,7 @@ public class CmapIndexEntry implements Comparable { return _format; } - public void setFormat(CmapFormat format) { + public void setFormat(final CmapFormat format) { _format = format; } @@ -106,8 +106,8 @@ public class CmapIndexEntry implements Comparable { } @Override - public int compareTo(java.lang.Object obj) { - CmapIndexEntry entry = (CmapIndexEntry) obj; + public int compareTo(final java.lang.Object obj) { + final CmapIndexEntry entry = (CmapIndexEntry) obj; if (getOffset() < entry.getOffset()) { return -1; } else if (getOffset() > entry.getOffset()) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java index 2cdddb3ef..4623eb5cf 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CmapTable.java @@ -61,12 +61,12 @@ import java.util.Arrays; */ public class CmapTable implements Table { - private DirectoryEntry _de; - private int _version; - private int _numTables; - private CmapIndexEntry[] _entries; + private final DirectoryEntry _de; + private final int _version; + private final int _numTables; + private final CmapIndexEntry[] _entries; - protected CmapTable(DirectoryEntry de, DataInput di) throws IOException { + protected CmapTable(final DirectoryEntry de, final DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); _version = di.readUnsignedShort(); _numTables = di.readUnsignedShort(); @@ -98,7 +98,7 @@ public class CmapTable implements Table { // Something is amiss throw new IOException(); } - int formatType = di.readUnsignedShort(); + final int formatType = di.readUnsignedShort(); lastFormat = CmapFormat.create(formatType, di); lastOffset = _entries[i].getOffset(); _entries[i].setFormat(lastFormat); @@ -114,11 +114,11 @@ public class CmapTable implements Table { return _numTables; } - public CmapIndexEntry getCmapIndexEntry(int i) { + public CmapIndexEntry getCmapIndexEntry(final int i) { return _entries[i]; } - public CmapFormat getCmapFormat(short platformId, short encodingId) { + public CmapFormat getCmapFormat(final short platformId, final short encodingId) { // Find the requested format for (int i = 0; i < _numTables; i++) { @@ -137,7 +137,7 @@ public class CmapTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder().append("cmap\n"); + final StringBuilder sb = new StringBuilder().append("cmap\n"); // Get each of the index entries for (int i = 0; i < _numTables; i++) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Coverage.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Coverage.java index 4f526f51d..a6f994f95 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Coverage.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Coverage.java @@ -69,9 +69,9 @@ public abstract class Coverage { */ public abstract int findGlyph(int glyphId); - protected static Coverage read(DataInput di) throws IOException { + protected static Coverage read(final DataInput di) throws IOException { Coverage c = null; - int format = di.readUnsignedShort(); + final int format = di.readUnsignedShort(); if (format == 1) { c = new CoverageFormat1(di); } else if (format == 2) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat1.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat1.java index 715bf11ec..3deb60202 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat1.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat1.java @@ -60,11 +60,11 @@ import java.io.IOException; */ public class CoverageFormat1 extends Coverage { - private int _glyphCount; - private int[] _glyphIds; + private final int _glyphCount; + private final int[] _glyphIds; /** Creates new CoverageFormat1 */ - protected CoverageFormat1(DataInput di) throws IOException { + protected CoverageFormat1(final DataInput di) throws IOException { _glyphCount = di.readUnsignedShort(); _glyphIds = new int[_glyphCount]; for (int i = 0; i < _glyphCount; i++) { @@ -78,7 +78,7 @@ public class CoverageFormat1 extends Coverage { } @Override - public int findGlyph(int glyphId) { + public int findGlyph(final int glyphId) { for (int i = 0; i < _glyphCount; i++) { if (_glyphIds[i] == glyphId) { return i; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat2.java index bd2a28f79..9397f376d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CoverageFormat2.java @@ -60,11 +60,11 @@ import java.io.IOException; */ public class CoverageFormat2 extends Coverage { - private int _rangeCount; - private RangeRecord[] _rangeRecords; + private final int _rangeCount; + private final RangeRecord[] _rangeRecords; /** Creates new CoverageFormat2 */ - protected CoverageFormat2(DataInput di) throws IOException { + protected CoverageFormat2(final DataInput di) throws IOException { _rangeCount = di.readUnsignedShort(); _rangeRecords = new RangeRecord[_rangeCount]; for (int i = 0; i < _rangeCount; i++) { @@ -78,9 +78,9 @@ public class CoverageFormat2 extends Coverage { } @Override - public int findGlyph(int glyphId) { + public int findGlyph(final int glyphId) { for (int i = 0; i < _rangeCount; i++) { - int n = _rangeRecords[i].getCoverageIndex(glyphId); + final int n = _rangeRecords[i].getCoverageIndex(glyphId); if (n > -1) { return n; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java index 9e1c47de9..7f62d26ab 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/CvtTable.java @@ -17,12 +17,12 @@ import java.io.IOException; */ public class CvtTable implements Table { - private DirectoryEntry de; - private short[] values; + private final DirectoryEntry de; + private final short[] values; - protected CvtTable(DirectoryEntry de, DataInput di) throws IOException { + protected CvtTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); - int len = de.getLength() / 2; + final int len = de.getLength() / 2; values = new short[len]; for (int i = 0; i < len; i++) { values[i] = di.readShort(); @@ -40,7 +40,7 @@ public class CvtTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'cvt ' Table - Control Value Table\n----------------------------------\n"); sb.append("Size = ").append(0).append(" bytes, ").append(values.length).append(" entries\n"); sb.append(" Values\n ------\n"); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Device.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Device.java index 5451f4502..a0b10e187 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Device.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Device.java @@ -18,13 +18,13 @@ import java.io.RandomAccessFile; */ public class Device extends Object { - private int startSize; - private int endSize; - private int deltaFormat; - private int[] deltaValues; + private final int startSize; + private final int endSize; + private final int deltaFormat; + private final int[] deltaValues; /** Creates new Device */ - public Device(RandomAccessFile raf) throws IOException { + public Device(final RandomAccessFile raf) throws IOException { startSize = raf.readUnsignedShort(); endSize = raf.readUnsignedShort(); deltaFormat = raf.readUnsignedShort(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DirectoryEntry.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DirectoryEntry.java index e34fa32e8..54684b8e9 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DirectoryEntry.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DirectoryEntry.java @@ -59,12 +59,12 @@ import java.io.IOException; */ public class DirectoryEntry implements Cloneable { - private int _tag; - private int _checksum; - private int _offset; - private int _length; + private final int _tag; + private final int _checksum; + private final int _offset; + private final int _length; - protected DirectoryEntry(DataInput di) throws IOException { + protected DirectoryEntry(final DataInput di) throws IOException { _tag = di.readInt(); _checksum = di.readInt(); _offset = di.readInt(); @@ -75,7 +75,7 @@ public class DirectoryEntry implements Cloneable { public Object clone() { try { return super.clone(); - } catch (CloneNotSupportedException e) { + } catch (final CloneNotSupportedException e) { return null; } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigEntry.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigEntry.java index 4a09a4c34..ec7b503f1 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigEntry.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigEntry.java @@ -18,12 +18,12 @@ import java.io.DataInput; */ public class DsigEntry { - private int format; - private int length; - private int offset; + private final int format; + private final int length; + private final int offset; /** Creates new DsigEntry */ - protected DsigEntry(DataInput di) throws IOException { + protected DsigEntry(final DataInput di) throws IOException { format = di.readInt(); length = di.readInt(); offset = di.readInt(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java index 2b85f52d8..f2b1322c0 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/DsigTable.java @@ -18,15 +18,15 @@ import java.io.DataInput; */ public class DsigTable implements Table { - private DirectoryEntry de; - private int version; - private int numSigs; - private int flag; - private DsigEntry[] dsigEntry; - private SignatureBlock[] sigBlocks; + private final DirectoryEntry de; + private final int version; + private final int numSigs; + private final int flag; + private final DsigEntry[] dsigEntry; + private final SignatureBlock[] sigBlocks; /** Creates new DsigTable */ - protected DsigTable(DirectoryEntry de, DataInput di) throws IOException { + protected DsigTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); version = di.readInt(); numSigs = di.readUnsignedShort(); @@ -63,7 +63,7 @@ public class DsigTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder().append("DSIG\n"); + final StringBuilder sb = new StringBuilder().append("DSIG\n"); for (int i = 0; i < numSigs; i++) { sb.append(sigBlocks[i].toString()); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Feature.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Feature.java index ee27896a4..c6f912569 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Feature.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Feature.java @@ -60,12 +60,12 @@ import java.io.IOException; */ public class Feature { - private int _featureParams; - private int _lookupCount; - private int[] _lookupListIndex; + private final int _featureParams; + private final int _lookupCount; + private final int[] _lookupListIndex; /** Creates new Feature */ - protected Feature(DataInput di) throws IOException { + protected Feature(final DataInput di) throws IOException { _featureParams = di.readUnsignedShort(); _lookupCount = di.readUnsignedShort(); _lookupListIndex = new int[_lookupCount]; @@ -78,7 +78,7 @@ public class Feature { return _lookupCount; } - public int getLookupListIndex(int i) { + public int getLookupListIndex(final int i) { return _lookupListIndex[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureList.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureList.java index fdedca94a..933378068 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureList.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureList.java @@ -60,12 +60,12 @@ import java.io.IOException; */ public class FeatureList { - private int _featureCount; - private FeatureRecord[] _featureRecords; - private Feature[] _features; + private final int _featureCount; + private final FeatureRecord[] _featureRecords; + private final Feature[] _features; /** Creates new FeatureList */ - public FeatureList(DataInputStream dis, int offset) throws IOException { + public FeatureList(final DataInputStream dis, final int offset) throws IOException { // Ensure we're in the right place dis.reset(); @@ -89,19 +89,19 @@ public class FeatureList { return _featureCount; } - public FeatureRecord getFeatureRecord(int i) { + public FeatureRecord getFeatureRecord(final int i) { return _featureRecords[i]; } - public Feature getFeature(int i) { + public Feature getFeature(final int i) { return _features[i]; } - public Feature findFeature(LangSys langSys, String tag) { + public Feature findFeature(final LangSys langSys, final String tag) { if (tag.length() != 4) { return null; } - int tagVal = ((tag.charAt(0)<<24) + final int tagVal = ((tag.charAt(0)<<24) | (tag.charAt(1)<<16) | (tag.charAt(2)<<8) | tag.charAt(3)); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureRecord.java index 1da74f4d5..06506904f 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureRecord.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FeatureRecord.java @@ -60,11 +60,11 @@ import java.io.IOException; */ public class FeatureRecord { - private int _tag; - private int _offset; + private final int _tag; + private final int _offset; /** Creates new FeatureRecord */ - protected FeatureRecord(DataInput di) throws IOException { + protected FeatureRecord(final DataInput di) throws IOException { _tag = di.readInt(); _offset = di.readUnsignedShort(); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java index 467a4f360..e44acfa02 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/FpgmTable.java @@ -19,9 +19,9 @@ import jogamp.graph.font.typecast.ot.Disassembler; */ public class FpgmTable extends Program implements Table { - private DirectoryEntry de; + private final DirectoryEntry de; - protected FpgmTable(DirectoryEntry de, DataInput di) throws IOException { + protected FpgmTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); readInstructions(di, de.getLength()); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspRange.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspRange.java index cc87b19a4..cebc51646 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspRange.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspRange.java @@ -21,18 +21,18 @@ public class GaspRange { public static final int GASP_GRIDFIT = 1; public static final int GASP_DOGRAY = 2; - private int rangeMaxPPEM; - private int rangeGaspBehavior; + private final int rangeMaxPPEM; + private final int rangeGaspBehavior; /** Creates new GaspRange */ - protected GaspRange(DataInput di) throws IOException { + protected GaspRange(final DataInput di) throws IOException { rangeMaxPPEM = di.readUnsignedShort(); rangeGaspBehavior = di.readUnsignedShort(); } @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(" rangeMaxPPEM: ").append(rangeMaxPPEM) .append("\n rangeGaspBehavior: 0x").append(rangeGaspBehavior); if ((rangeGaspBehavior & GASP_GRIDFIT) != 0) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java index 8f91e6d00..7bf7f96cc 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GaspTable.java @@ -18,13 +18,13 @@ import java.io.IOException; */ public class GaspTable implements Table { - private DirectoryEntry de; - private int version; - private int numRanges; - private GaspRange[] gaspRange; + private final DirectoryEntry de; + private final int version; + private final int numRanges; + private final GaspRange[] gaspRange; /** Creates new GaspTable */ - protected GaspTable(DirectoryEntry de, DataInput di) throws IOException { + protected GaspTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); version = di.readUnsignedShort(); numRanges = di.readUnsignedShort(); @@ -41,7 +41,7 @@ public class GaspTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'gasp' Table - Grid-fitting And Scan-conversion Procedure\n---------------------------------------------------------"); sb.append("\n 'gasp' version: ").append(version); sb.append("\n numRanges: ").append(numRanges); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeComp.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeComp.java index e5c86873e..4db4ddcc2 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeComp.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeComp.java @@ -69,12 +69,12 @@ public class GlyfCompositeComp { public static final short WE_HAVE_INSTRUCTIONS = 0x0100; public static final short USE_MY_METRICS = 0x0200; - private int _firstIndex; - private int _firstContour; + private final int _firstIndex; + private final int _firstContour; private short _argument1; private short _argument2; - private int _flags; - private int _glyphIndex; + private final int _flags; + private final int _glyphIndex; private double _xscale = 1.0; private double _yscale = 1.0; private double _scale01 = 0.0; @@ -84,7 +84,7 @@ public class GlyfCompositeComp { private int _point1 = 0; private int _point2 = 0; - protected GlyfCompositeComp(int firstIndex, int firstContour, DataInput di) + protected GlyfCompositeComp(final int firstIndex, final int firstContour, final DataInput di) throws IOException { _firstIndex = firstIndex; _firstContour = firstContour; @@ -96,8 +96,8 @@ public class GlyfCompositeComp { _argument1 = di.readShort(); _argument2 = di.readShort(); } else { - _argument1 = (short) di.readByte(); - _argument2 = (short) di.readByte(); + _argument1 = di.readByte(); + _argument2 = di.readByte(); } // Assign the arguments according to the flags @@ -111,7 +111,7 @@ public class GlyfCompositeComp { // Get the scale values (if any) if ((_flags & WE_HAVE_A_SCALE) != 0) { - int i = di.readShort(); + final int i = di.readShort(); _xscale = _yscale = (double) i / (double) 0x4000; } else if ((_flags & WE_HAVE_AN_X_AND_Y_SCALE) != 0) { short i = di.readShort(); @@ -184,8 +184,8 @@ public class GlyfCompositeComp { * @param y The y-coordinate of the point to transform * @return The transformed x-coordinate */ - public int scaleX(int x, int y) { - return (int)((double) x * _xscale + (double) y * _scale10); + public int scaleX(final int x, final int y) { + return (int)(x * _xscale + y * _scale10); } /** @@ -194,7 +194,7 @@ public class GlyfCompositeComp { * @param y The y-coordinate of the point to transform * @return The transformed y-coordinate */ - public int scaleY(int x, int y) { - return (int)((double) x * _scale01 + (double) y * _yscale); + public int scaleY(final int x, final int y) { + return (int)(x * _scale01 + y * _yscale); } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java index fabc71a77..3879da02a 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfCompositeDescript.java @@ -69,9 +69,9 @@ public class GlyfCompositeDescript extends GlyfDescript { new ArrayList(); public GlyfCompositeDescript( - GlyfTable parentTable, - int glyphIndex, - DataInput di) throws IOException { + final GlyfTable parentTable, + final int glyphIndex, + final DataInput di) throws IOException { super(parentTable, glyphIndex, (short) -1, di); // Get all of the composite components @@ -81,7 +81,7 @@ public class GlyfCompositeDescript extends GlyfDescript { try { do { _components.add(comp = new GlyfCompositeComp(firstIndex, firstContour, di)); - GlyfDescript desc = parentTable.getDescription(comp.getGlyphIndex()); + final GlyfDescript desc = parentTable.getDescription(comp.getGlyphIndex()); if (desc != null) { firstIndex += desc.getPointCount(); firstContour += desc.getContourCount(); @@ -92,7 +92,7 @@ public class GlyfCompositeDescript extends GlyfDescript { if ((comp.getFlags() & GlyfCompositeComp.WE_HAVE_INSTRUCTIONS) != 0) { readInstructions(di, di.readShort()); } - } catch (IOException e) { + } catch (final IOException e) { throw e; // } catch (Exception e) { // int foo = 0; @@ -100,33 +100,33 @@ public class GlyfCompositeDescript extends GlyfDescript { } @Override - public int getEndPtOfContours(int i) { - GlyfCompositeComp c = getCompositeCompEndPt(i); + public int getEndPtOfContours(final int i) { + final GlyfCompositeComp c = getCompositeCompEndPt(i); if (c != null) { - GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); + final GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); return gd.getEndPtOfContours(i - c.getFirstContour()) + c.getFirstIndex(); } return 0; } @Override - public byte getFlags(int i) { - GlyfCompositeComp c = getCompositeComp(i); + public byte getFlags(final int i) { + final GlyfCompositeComp c = getCompositeComp(i); if (c != null) { - GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); + final GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); return gd.getFlags(i - c.getFirstIndex()); } return 0; } @Override - public short getXCoordinate(int i) { - GlyfCompositeComp c = getCompositeComp(i); + public short getXCoordinate(final int i) { + final GlyfCompositeComp c = getCompositeComp(i); if (c != null) { - GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); - int n = i - c.getFirstIndex(); - int x = gd.getXCoordinate(n); - int y = gd.getYCoordinate(n); + final GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); + final int n = i - c.getFirstIndex(); + final int x = gd.getXCoordinate(n); + final int y = gd.getYCoordinate(n); short x1 = (short) c.scaleX(x, y); x1 += c.getXTranslate(); return x1; @@ -135,13 +135,13 @@ public class GlyfCompositeDescript extends GlyfDescript { } @Override - public short getYCoordinate(int i) { - GlyfCompositeComp c = getCompositeComp(i); + public short getYCoordinate(final int i) { + final GlyfCompositeComp c = getCompositeComp(i); if (c != null) { - GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); - int n = i - c.getFirstIndex(); - int x = gd.getXCoordinate(n); - int y = gd.getYCoordinate(n); + final GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); + final int n = i - c.getFirstIndex(); + final int x = gd.getXCoordinate(n); + final int y = gd.getYCoordinate(n); short y1 = (short) c.scaleY(x, y); y1 += c.getYTranslate(); return y1; @@ -156,8 +156,8 @@ public class GlyfCompositeDescript extends GlyfDescript { @Override public int getPointCount() { - GlyfCompositeComp c = _components.get(_components.size()-1); - GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); + final GlyfCompositeComp c = _components.get(_components.size()-1); + final GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); if (gd != null) { return c.getFirstIndex() + gd.getPointCount(); } else { @@ -172,7 +172,7 @@ public class GlyfCompositeDescript extends GlyfDescript { return c.getFirstContour() + ( null != d ? d.getContourCount() : 0 ); } - public int getComponentIndex(int i) { + public int getComponentIndex(final int i) { return _components.get(i).getFirstIndex(); } @@ -180,15 +180,15 @@ public class GlyfCompositeDescript extends GlyfDescript { return _components.size(); } - public GlyfCompositeComp getComponent(int i) { + public GlyfCompositeComp getComponent(final int i) { return _components.get(i); } - protected GlyfCompositeComp getCompositeComp(int i) { + protected GlyfCompositeComp getCompositeComp(final int i) { GlyfCompositeComp c; for (int n = 0; n < _components.size(); n++) { c = _components.get(n); - GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); + final GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); if (c.getFirstIndex() <= i && i < (c.getFirstIndex() + gd.getPointCount())) { return c; } @@ -196,11 +196,11 @@ public class GlyfCompositeDescript extends GlyfDescript { return null; } - protected GlyfCompositeComp getCompositeCompEndPt(int i) { + protected GlyfCompositeComp getCompositeCompEndPt(final int i) { GlyfCompositeComp c; for (int j = 0; j < _components.size(); j++) { c = _components.get(j); - GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); + final GlyphDescription gd = _parentTable.getDescription(c.getGlyphIndex()); if (c.getFirstContour() <= i && i < (c.getFirstContour() + gd.getContourCount())) { return c; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java index 6b06eb3de..3d2154d5a 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfDescript.java @@ -69,17 +69,17 @@ public abstract class GlyfDescript extends Program implements GlyphDescription { protected GlyfTable _parentTable; private int _glyphIndex; - private int _numberOfContours; - private short _xMin; - private short _yMin; - private short _xMax; - private short _yMax; + private final int _numberOfContours; + private final short _xMin; + private final short _yMin; + private final short _xMax; + private final short _yMax; protected GlyfDescript( - GlyfTable parentTable, - int glyphIndex, - short numberOfContours, - DataInput di) throws IOException { + final GlyfTable parentTable, + final int glyphIndex, + final short numberOfContours, + final DataInput di) throws IOException { _parentTable = parentTable; _numberOfContours = numberOfContours; _xMin = di.readShort(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfSimpleDescript.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfSimpleDescript.java index c06ceaa13..041c0f04c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfSimpleDescript.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfSimpleDescript.java @@ -61,17 +61,17 @@ import jogamp.graph.font.typecast.ot.Disassembler; */ public class GlyfSimpleDescript extends GlyfDescript { - private int[] _endPtsOfContours; - private byte[] _flags; - private short[] _xCoordinates; - private short[] _yCoordinates; - private int _count; + private final int[] _endPtsOfContours; + private final byte[] _flags; + private final short[] _xCoordinates; + private final short[] _yCoordinates; + private final int _count; public GlyfSimpleDescript( - GlyfTable parentTable, - int glyphIndex, - short numberOfContours, - DataInput di) throws IOException { + final GlyfTable parentTable, + final int glyphIndex, + final short numberOfContours, + final DataInput di) throws IOException { super(parentTable, glyphIndex, numberOfContours, di); // Simple glyph description @@ -86,29 +86,29 @@ public class GlyfSimpleDescript extends GlyfDescript { _xCoordinates = new short[_count]; _yCoordinates = new short[_count]; - int instructionCount = di.readShort(); + final int instructionCount = di.readShort(); readInstructions(di, instructionCount); readFlags(_count, di); readCoords(_count, di); } @Override - public int getEndPtOfContours(int i) { + public int getEndPtOfContours(final int i) { return _endPtsOfContours[i]; } @Override - public byte getFlags(int i) { + public byte getFlags(final int i) { return _flags[i]; } @Override - public short getXCoordinate(int i) { + public short getXCoordinate(final int i) { return _xCoordinates[i]; } @Override - public short getYCoordinate(int i) { + public short getYCoordinate(final int i) { return _yCoordinates[i]; } @@ -138,7 +138,7 @@ public class GlyfSimpleDescript extends GlyfDescript { /** * The table is stored as relative values, but we'll store them as absolutes */ - private void readCoords(int count, DataInput di) throws IOException { + private void readCoords(final int count, final DataInput di) throws IOException { short x = 0; short y = 0; for (int i = 0; i < count; i++) { @@ -175,26 +175,26 @@ public class GlyfSimpleDescript extends GlyfDescript { /** * The flags are run-length encoded */ - private void readFlags(int flagCount, DataInput di) throws IOException { + private void readFlags(final int flagCount, final DataInput di) throws IOException { try { for (int index = 0; index < flagCount; index++) { _flags[index] = di.readByte(); if ((_flags[index] & repeat) != 0) { - int repeats = di.readByte(); + final int repeats = di.readByte(); for (int i = 1; i <= repeats; i++) { _flags[index + i] = _flags[index]; } index += repeats; } } - } catch (ArrayIndexOutOfBoundsException e) { + } catch (final ArrayIndexOutOfBoundsException e) { System.out.println("error: array index out of bounds"); } } @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append("\n\n EndPoints\n ---------"); for (int i = 0; i < _endPtsOfContours.length; i++) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java index 4b196c9e2..6750e9394 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GlyfTable.java @@ -61,30 +61,30 @@ import java.io.IOException; */ public class GlyfTable implements Table { - private DirectoryEntry _de; - private GlyfDescript[] _descript; + private final DirectoryEntry _de; + private final GlyfDescript[] _descript; protected GlyfTable( - DirectoryEntry de, - DataInput di, - MaxpTable maxp, - LocaTable loca) throws IOException { + final DirectoryEntry de, + final DataInput di, + final MaxpTable maxp, + final LocaTable loca) throws IOException { _de = (DirectoryEntry) de.clone(); _descript = new GlyfDescript[maxp.getNumGlyphs()]; // Buffer the whole table so we can randomly access it - byte[] buf = new byte[de.getLength()]; + final byte[] buf = new byte[de.getLength()]; di.readFully(buf); - ByteArrayInputStream bais = new ByteArrayInputStream(buf); + final ByteArrayInputStream bais = new ByteArrayInputStream(buf); // Process all the simple glyphs for (int i = 0; i < maxp.getNumGlyphs(); i++) { - int len = loca.getOffset(i + 1) - loca.getOffset(i); + final int len = loca.getOffset(i + 1) - loca.getOffset(i); if (len > 0) { bais.reset(); bais.skip(loca.getOffset(i)); - DataInputStream dis = new DataInputStream(bais); - short numberOfContours = dis.readShort(); + final DataInputStream dis = new DataInputStream(bais); + final short numberOfContours = dis.readShort(); if (numberOfContours >= 0) { _descript[i] = new GlyfSimpleDescript(this, i, numberOfContours, dis); } @@ -95,12 +95,12 @@ public class GlyfTable implements Table { // Now do all the composite glyphs for (int i = 0; i < maxp.getNumGlyphs(); i++) { - int len = loca.getOffset(i + 1) - loca.getOffset(i); + final int len = loca.getOffset(i + 1) - loca.getOffset(i); if (len > 0) { bais.reset(); bais.skip(loca.getOffset(i)); - DataInputStream dis = new DataInputStream(bais); - short numberOfContours = dis.readShort(); + final DataInputStream dis = new DataInputStream(bais); + final short numberOfContours = dis.readShort(); if (numberOfContours < 0) { _descript[i] = new GlyfCompositeDescript(this, i, dis); } @@ -108,7 +108,7 @@ public class GlyfTable implements Table { } } - public GlyfDescript getDescription(int i) { + public GlyfDescript getDescription(final int i) { if (i < _descript.length) { return _descript[i]; } else { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java index 30ecdd051..f10d4e299 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GposTable.java @@ -30,16 +30,16 @@ import java.io.IOException; */ public class GposTable implements Table { - private DirectoryEntry _de; + private final DirectoryEntry _de; - protected GposTable(DirectoryEntry de, DataInput di) throws IOException { + protected GposTable(final DirectoryEntry de, final DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); // GPOS Header - int version = di.readInt(); - int scriptList = di.readInt(); - int featureList = di.readInt(); - int lookupList = di.readInt(); + final int version = di.readInt(); + final int scriptList = di.readInt(); + final int featureList = di.readInt(); + final int lookupList = di.readInt(); } /** Get the table type, as a table directory value. diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java index c23d420a8..f09973f99 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/GsubTable.java @@ -62,24 +62,24 @@ import java.io.IOException; */ public class GsubTable implements Table, LookupSubtableFactory { - private DirectoryEntry _de; - private ScriptList _scriptList; - private FeatureList _featureList; - private LookupList _lookupList; + private final DirectoryEntry _de; + private final ScriptList _scriptList; + private final FeatureList _featureList; + private final LookupList _lookupList; - protected GsubTable(DirectoryEntry de, DataInput di) throws IOException { + protected GsubTable(final DirectoryEntry de, final DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); // Load into a temporary buffer, and create another input stream - byte[] buf = new byte[de.getLength()]; + final byte[] buf = new byte[de.getLength()]; di.readFully(buf); - DataInputStream dis = new DataInputStream(new ByteArrayInputStream(buf)); + final DataInputStream dis = new DataInputStream(new ByteArrayInputStream(buf)); // GSUB Header - int version = dis.readInt(); - int scriptListOffset = dis.readUnsignedShort(); - int featureListOffset = dis.readUnsignedShort(); - int lookupListOffset = dis.readUnsignedShort(); + final int version = dis.readInt(); + final int scriptListOffset = dis.readUnsignedShort(); + final int featureListOffset = dis.readUnsignedShort(); + final int lookupListOffset = dis.readUnsignedShort(); // Script List _scriptList = new ScriptList(dis, scriptListOffset); @@ -101,9 +101,9 @@ public class GsubTable implements Table, LookupSubtableFactory { */ @Override public LookupSubtable read( - int type, - DataInputStream dis, - int offset) throws IOException { + final int type, + final DataInputStream dis, + final int offset) throws IOException { LookupSubtable s = null; switch (type) { case 1: @@ -153,7 +153,7 @@ public class GsubTable implements Table, LookupSubtableFactory { return "GSUB"; } - public static String lookupTypeAsString(int type) { + public static String lookupTypeAsString(final int type) { switch (type) { case 1: return "Single"; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java index 64f5e6415..c3b875a2c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HdmxTable.java @@ -33,11 +33,11 @@ public class HdmxTable implements Table { public class DeviceRecord { - private short _pixelSize; - private short _maxWidth; - private short[] _widths; + private final short _pixelSize; + private final short _maxWidth; + private final short[] _widths; - protected DeviceRecord(int numGlyphs, DataInput di) throws IOException { + protected DeviceRecord(final int numGlyphs, final DataInput di) throws IOException { _pixelSize = di.readByte(); _maxWidth = di.readByte(); _widths = new short[numGlyphs]; @@ -58,20 +58,20 @@ public class HdmxTable implements Table { return _widths; } - public short getWidth(int glyphidx) { + public short getWidth(final int glyphidx) { return _widths[glyphidx]; } } - private DirectoryEntry _de; - private int _version; - private short _numRecords; - private int _sizeDeviceRecords; - private DeviceRecord[] _records; + private final DirectoryEntry _de; + private final int _version; + private final short _numRecords; + private final int _sizeDeviceRecords; + private final DeviceRecord[] _records; /** Creates a new instance of HdmxTable */ - protected HdmxTable(DirectoryEntry de, DataInput di, MaxpTable maxp) + protected HdmxTable(final DirectoryEntry de, final DataInput di, final MaxpTable maxp) throws IOException { _de = (DirectoryEntry) de.clone(); _version = di.readUnsignedShort(); @@ -89,7 +89,7 @@ public class HdmxTable implements Table { return _numRecords; } - public DeviceRecord getRecord(int i) { + public DeviceRecord getRecord(final int i) { return _records[i]; } @@ -100,7 +100,7 @@ public class HdmxTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'hdmx' Table - Horizontal Device Metrics\n----------------------------------------\n"); sb.append("Size = ").append(_de.getLength()).append(" bytes\n") .append("\t'hdmx' version: ").append(_version).append("\n") diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java index 47e60f900..85158ea3e 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HeadTable.java @@ -62,26 +62,26 @@ import jogamp.graph.font.typecast.ot.Fixed; */ public class HeadTable implements Table { - private DirectoryEntry _de; - private int _versionNumber; - private int _fontRevision; - private int _checkSumAdjustment; - private int _magicNumber; - private short _flags; - private short _unitsPerEm; - private long _created; - private long _modified; - private short _xMin; - private short _yMin; - private short _xMax; - private short _yMax; - private short _macStyle; - private short _lowestRecPPEM; - private short _fontDirectionHint; - private short _indexToLocFormat; - private short _glyphDataFormat; - - protected HeadTable(DirectoryEntry de, DataInput di) throws IOException { + private final DirectoryEntry _de; + private final int _versionNumber; + private final int _fontRevision; + private final int _checkSumAdjustment; + private final int _magicNumber; + private final short _flags; + private final short _unitsPerEm; + private final long _created; + private final long _modified; + private final short _xMin; + private final short _yMin; + private final short _xMax; + private final short _yMax; + private final short _macStyle; + private final short _lowestRecPPEM; + private final short _fontDirectionHint; + private final short _indexToLocFormat; + private final short _glyphDataFormat; + + protected HeadTable(final DirectoryEntry de, final DataInput di) throws IOException { this._de = (DirectoryEntry) de.clone(); _versionNumber = di.readInt(); _fontRevision = di.readInt(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java index 242c9b139..e67a03777 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HheaTable.java @@ -19,21 +19,21 @@ import jogamp.graph.font.typecast.ot.Fixed; */ public class HheaTable implements Table { - private DirectoryEntry de; - private int version; - private short ascender; - private short descender; - private short lineGap; - private short advanceWidthMax; - private short minLeftSideBearing; - private short minRightSideBearing; - private short xMaxExtent; - private short caretSlopeRise; - private short caretSlopeRun; - private short metricDataFormat; - private int numberOfHMetrics; - - protected HheaTable(DirectoryEntry de, DataInput di) throws IOException { + private final DirectoryEntry de; + private final int version; + private final short ascender; + private final short descender; + private final short lineGap; + private final short advanceWidthMax; + private final short minLeftSideBearing; + private final short minRightSideBearing; + private final short xMaxExtent; + private final short caretSlopeRise; + private final short caretSlopeRun; + private final short metricDataFormat; + private final int numberOfHMetrics; + + protected HheaTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); version = di.readInt(); ascender = di.readShort(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HmtxTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HmtxTable.java index 122a0a826..3a9672a92 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HmtxTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/HmtxTable.java @@ -59,15 +59,15 @@ import java.io.IOException; */ public class HmtxTable implements Table { - private DirectoryEntry _de; + private final DirectoryEntry _de; private int[] _hMetrics = null; private short[] _leftSideBearing = null; protected HmtxTable( - DirectoryEntry de, - DataInput di, - HheaTable hhea, - MaxpTable maxp) throws IOException { + final DirectoryEntry de, + final DataInput di, + final HheaTable hhea, + final MaxpTable maxp) throws IOException { _de = (DirectoryEntry) de.clone(); _hMetrics = new int[hhea.getNumberOfHMetrics()]; for (int i = 0; i < hhea.getNumberOfHMetrics(); ++i) { @@ -77,14 +77,14 @@ public class HmtxTable implements Table { | di.readUnsignedByte()<<8 | di.readUnsignedByte(); } - int lsbCount = maxp.getNumGlyphs() - hhea.getNumberOfHMetrics(); + final int lsbCount = maxp.getNumGlyphs() - hhea.getNumberOfHMetrics(); _leftSideBearing = new short[lsbCount]; for (int i = 0; i < lsbCount; ++i) { _leftSideBearing[i] = di.readShort(); } } - public int getAdvanceWidth(int i) { + public int getAdvanceWidth(final int i) { if (_hMetrics == null) { return 0; } @@ -95,7 +95,7 @@ public class HmtxTable implements Table { } } - public short getLeftSideBearing(int i) { + public short getLeftSideBearing(final int i) { if (_hMetrics == null) { return 0; } @@ -113,7 +113,7 @@ public class HmtxTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'hmtx' Table - Horizontal Metrics\n---------------------------------\n"); sb.append("Size = ").append(_de.getLength()).append(" bytes, ") .append(_hMetrics.length).append(" entries\n"); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java index eed8c1841..ad7e4e376 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ID.java @@ -190,7 +190,7 @@ public abstract class ID { public static final short nameSampleText = 19; public static final short namePostScriptCIDFindfontName = 20; - public static String getPlatformName(short platformId) { + public static String getPlatformName(final short platformId) { switch (platformId) { case platformUnicode: return "Unicode"; case platformMacintosh: return "Macintosh"; @@ -200,7 +200,7 @@ public abstract class ID { } } - public static String getEncodingName(short platformId, short encodingId) { + public static String getEncodingName(final short platformId, final short encodingId) { if (platformId == platformUnicode) { @@ -284,7 +284,7 @@ public abstract class ID { return ""; } - public static String getLanguageName(short platformId, short languageId) { + public static String getLanguageName(final short platformId, final short languageId) { if (platformId == platformMacintosh) { switch (languageId) { @@ -371,7 +371,7 @@ public abstract class ID { return ""; } - public static String getNameName(short nameId) { + public static String getNameName(final short nameId) { switch (nameId) { case nameCopyrightNotice: return "Copyright notice"; case nameFontFamilyName: return "Font Family name"; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtable.java index 04fd646a7..df5d0394f 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtable.java @@ -26,12 +26,12 @@ public abstract class KernSubtable { public abstract KerningPair getKerningPair(int i); - public static KernSubtable read(DataInput di) throws IOException { + public static KernSubtable read(final DataInput di) throws IOException { KernSubtable table = null; - int version = di.readUnsignedShort(); - int length = di.readUnsignedShort(); - int coverage = di.readUnsignedShort(); - int format = coverage >> 8; + final int version = di.readUnsignedShort(); + final int length = di.readUnsignedShort(); + final int coverage = di.readUnsignedShort(); + final int format = coverage >> 8; switch (format) { case 0: diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat0.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat0.java index 1e7ff8c2d..2d1acddd5 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat0.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat0.java @@ -18,14 +18,14 @@ import java.io.IOException; */ public class KernSubtableFormat0 extends KernSubtable { - private int nPairs; - private int searchRange; - private int entrySelector; - private int rangeShift; - private KerningPair[] kerningPairs; + private final int nPairs; + private final int searchRange; + private final int entrySelector; + private final int rangeShift; + private final KerningPair[] kerningPairs; /** Creates new KernSubtableFormat0 */ - protected KernSubtableFormat0(DataInput di) throws IOException { + protected KernSubtableFormat0(final DataInput di) throws IOException { nPairs = di.readUnsignedShort(); searchRange = di.readUnsignedShort(); entrySelector = di.readUnsignedShort(); @@ -42,7 +42,7 @@ public class KernSubtableFormat0 extends KernSubtable { } @Override - public KerningPair getKerningPair(int i) { + public KerningPair getKerningPair(final int i) { return kerningPairs[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat2.java index 9c7fc81f9..deb56c96d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernSubtableFormat2.java @@ -18,13 +18,13 @@ import java.io.IOException; */ public class KernSubtableFormat2 extends KernSubtable { - private int rowWidth; - private int leftClassTable; - private int rightClassTable; - private int array; + private final int rowWidth; + private final int leftClassTable; + private final int rightClassTable; + private final int array; /** Creates new KernSubtableFormat2 */ - protected KernSubtableFormat2(DataInput di) throws IOException { + protected KernSubtableFormat2(final DataInput di) throws IOException { rowWidth = di.readUnsignedShort(); leftClassTable = di.readUnsignedShort(); rightClassTable = di.readUnsignedShort(); @@ -37,7 +37,7 @@ public class KernSubtableFormat2 extends KernSubtable { } @Override - public KerningPair getKerningPair(int i) { + public KerningPair getKerningPair(final int i) { return null; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java index 006a86895..6f1d682e1 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KernTable.java @@ -18,13 +18,13 @@ import java.io.IOException; */ public class KernTable implements Table { - private DirectoryEntry de; - private int version; - private int nTables; - private KernSubtable[] tables; + private final DirectoryEntry de; + private final int version; + private final int nTables; + private final KernSubtable[] tables; /** Creates new KernTable */ - protected KernTable(DirectoryEntry de, DataInput di) throws IOException { + protected KernTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); version = di.readUnsignedShort(); nTables = di.readUnsignedShort(); @@ -38,7 +38,7 @@ public class KernTable implements Table { return nTables; } - public KernSubtable getSubtable(int i) { + public KernSubtable getSubtable(final int i) { return tables[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KerningPair.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KerningPair.java index 52f82cc85..dd5d0ba06 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KerningPair.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/KerningPair.java @@ -18,12 +18,12 @@ import java.io.IOException; */ public class KerningPair { - private int left; - private int right; - private short value; + private final int left; + private final int right; + private final short value; /** Creates new KerningPair */ - protected KerningPair(DataInput di) throws IOException { + protected KerningPair(final DataInput di) throws IOException { left = di.readUnsignedShort(); right = di.readUnsignedShort(); value = di.readShort(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSys.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSys.java index 1ab112a78..e12d2e2e7 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSys.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSys.java @@ -60,13 +60,13 @@ import java.io.IOException; */ public class LangSys { - private int _lookupOrder; - private int _reqFeatureIndex; - private int _featureCount; - private int[] _featureIndex; + private final int _lookupOrder; + private final int _reqFeatureIndex; + private final int _featureCount; + private final int[] _featureIndex; /** Creates new LangSys */ - protected LangSys(DataInput di) throws IOException { + protected LangSys(final DataInput di) throws IOException { _lookupOrder = di.readUnsignedShort(); _reqFeatureIndex = di.readUnsignedShort(); _featureCount = di.readUnsignedShort(); @@ -88,11 +88,11 @@ public class LangSys { return _featureCount; } - public int getFeatureIndex(int i) { + public int getFeatureIndex(final int i) { return _featureIndex[i]; } - protected boolean isFeatureIndexed(int n) { + protected boolean isFeatureIndexed(final int n) { for (int i = 0; i < _featureCount; i++) { if (_featureIndex[i] == n) { return true; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSysRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSysRecord.java index f3befe3b6..08ea719f3 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSysRecord.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LangSysRecord.java @@ -60,11 +60,11 @@ import java.io.IOException; */ public class LangSysRecord { - private int _tag; - private int _offset; + private final int _tag; + private final int _offset; /** Creates new LangSysRecord */ - public LangSysRecord(DataInput di) throws IOException { + public LangSysRecord(final DataInput di) throws IOException { _tag = di.readInt(); _offset = di.readUnsignedShort(); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Ligature.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Ligature.java index de862a983..dfd19e7ac 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Ligature.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Ligature.java @@ -60,12 +60,12 @@ import java.io.IOException; */ public class Ligature { - private int _ligGlyph; - private int _compCount; - private int[] _components; + private final int _ligGlyph; + private final int _compCount; + private final int[] _components; /** Creates new Ligature */ - public Ligature(DataInput di) throws IOException { + public Ligature(final DataInput di) throws IOException { _ligGlyph = di.readUnsignedShort(); _compCount = di.readUnsignedShort(); _components = new int[_compCount - 1]; @@ -78,7 +78,7 @@ public class Ligature { return _compCount; } - public int getGlyphId(int i) { + public int getGlyphId(final int i) { return (i == 0) ? _ligGlyph : _components[i-1]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSet.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSet.java index e261f3a88..8b7738992 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSet.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSet.java @@ -60,12 +60,12 @@ import java.io.IOException; */ public class LigatureSet { - private int _ligatureCount; - private int[] _ligatureOffsets; - private Ligature[] _ligatures; + private final int _ligatureCount; + private final int[] _ligatureOffsets; + private final Ligature[] _ligatures; /** Creates new LigatureSet */ - public LigatureSet(DataInputStream dis, int offset) throws IOException { + public LigatureSet(final DataInputStream dis, final int offset) throws IOException { dis.reset(); dis.skipBytes(offset); _ligatureCount = dis.readUnsignedShort(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubst.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubst.java index c0570cde9..36a44a11e 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubst.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubst.java @@ -60,10 +60,10 @@ import java.io.IOException; */ public abstract class LigatureSubst extends LookupSubtable { - public static LigatureSubst read(DataInputStream dis, int offset) throws IOException { + public static LigatureSubst read(final DataInputStream dis, final int offset) throws IOException { dis.reset(); dis.skipBytes(offset); - int format = dis.readUnsignedShort(); + final int format = dis.readUnsignedShort(); if (format == 1) { return new LigatureSubstFormat1(dis, offset); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubstFormat1.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubstFormat1.java index 1979ea586..02d4479b3 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubstFormat1.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LigatureSubstFormat1.java @@ -60,16 +60,16 @@ import java.io.IOException; */ public class LigatureSubstFormat1 extends LigatureSubst { - private int _coverageOffset; - private int _ligSetCount; - private int[] _ligatureSetOffsets; - private Coverage _coverage; - private LigatureSet[] _ligatureSets; + private final int _coverageOffset; + private final int _ligSetCount; + private final int[] _ligatureSetOffsets; + private final Coverage _coverage; + private final LigatureSet[] _ligatureSets; /** Creates new LigatureSubstFormat1 */ protected LigatureSubstFormat1( - DataInputStream dis, - int offset) throws IOException { + final DataInputStream dis, + final int offset) throws IOException { _coverageOffset = dis.readUnsignedShort(); _ligSetCount = dis.readUnsignedShort(); _ligatureSetOffsets = new int[_ligSetCount]; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java index 2c7079fec..a955ad3e5 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LocaTable.java @@ -17,18 +17,18 @@ import java.io.IOException; */ public class LocaTable implements Table { - private DirectoryEntry _de; + private final DirectoryEntry _de; private int[] _offsets = null; private short _factor = 0; protected LocaTable( - DirectoryEntry de, - DataInput di, - HeadTable head, - MaxpTable maxp) throws IOException { + final DirectoryEntry de, + final DataInput di, + final HeadTable head, + final MaxpTable maxp) throws IOException { _de = (DirectoryEntry) de.clone(); _offsets = new int[maxp.getNumGlyphs() + 1]; - boolean shortEntries = head.getIndexToLocFormat() == 0; + final boolean shortEntries = head.getIndexToLocFormat() == 0; if (shortEntries) { _factor = 2; for (int i = 0; i <= maxp.getNumGlyphs(); i++) { @@ -42,7 +42,7 @@ public class LocaTable implements Table { } } - public int getOffset(int i) { + public int getOffset(final int i) { if (_offsets == null) { return 0; } @@ -56,7 +56,7 @@ public class LocaTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'loca' Table - Index To Location Table\n--------------------------------------\n") .append("Size = ").append(_de.getLength()).append(" bytes, ") .append(_offsets.length).append(" entries\n"); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Lookup.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Lookup.java index 6496c3791..b80ebbee4 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Lookup.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Lookup.java @@ -66,14 +66,14 @@ public class Lookup { public static final int IGNORE_BASE_MARKS = 0x0008; public static final int MARK_ATTACHMENT_TYPE = 0xFF00; - private int _type; - private int _flag; - private int _subTableCount; - private int[] _subTableOffsets; - private LookupSubtable[] _subTables; + private final int _type; + private final int _flag; + private final int _subTableCount; + private final int[] _subTableOffsets; + private final LookupSubtable[] _subTables; /** Creates new Lookup */ - public Lookup(LookupSubtableFactory factory, DataInputStream dis, int offset) + public Lookup(final LookupSubtableFactory factory, final DataInputStream dis, final int offset) throws IOException { // Ensure we're in the right place @@ -102,7 +102,7 @@ public class Lookup { return _subTableCount; } - public LookupSubtable getSubtable(int i) { + public LookupSubtable getSubtable(final int i) { return _subTables[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupList.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupList.java index e70a932e4..6d8ca2a6c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupList.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LookupList.java @@ -60,12 +60,12 @@ import java.io.IOException; */ public class LookupList { - private int _lookupCount; - private int[] _lookupOffsets; - private Lookup[] _lookups; + private final int _lookupCount; + private final int[] _lookupOffsets; + private final Lookup[] _lookups; /** Creates new LookupList */ - public LookupList(DataInputStream dis, int offset, LookupSubtableFactory factory) + public LookupList(final DataInputStream dis, final int offset, final LookupSubtableFactory factory) throws IOException { // Ensure we're in the right place @@ -88,17 +88,17 @@ public class LookupList { return _lookupCount; } - public int getLookupOffset(int i) { + public int getLookupOffset(final int i) { return _lookupOffsets[i]; } - public Lookup getLookup(int i) { + public Lookup getLookup(final int i) { return _lookups[i]; } - public Lookup getLookup(Feature feature, int index) { + public Lookup getLookup(final Feature feature, final int index) { if (feature.getLookupCount() > index) { - int i = feature.getLookupListIndex(index); + final int i = feature.getLookupListIndex(index); return _lookups[i]; } return null; diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java index 47874cc56..efafe7bb6 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/LtshTable.java @@ -18,13 +18,13 @@ import java.io.IOException; */ public class LtshTable implements Table { - private DirectoryEntry de; - private int version; - private int numGlyphs; - private int[] yPels; + private final DirectoryEntry de; + private final int version; + private final int numGlyphs; + private final int[] yPels; /** Creates new LtshTable */ - protected LtshTable(DirectoryEntry de, DataInput di) throws IOException { + protected LtshTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); version = di.readUnsignedShort(); numGlyphs = di.readUnsignedShort(); @@ -45,7 +45,7 @@ public class LtshTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'LTSH' Table - Linear Threshold Table\n-------------------------------------") .append("\n 'LTSH' Version: ").append(version) .append("\n Number of Glyphs: ").append(numGlyphs) diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java index abb6047fc..0e9a6177f 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/MaxpTable.java @@ -19,8 +19,8 @@ import jogamp.graph.font.typecast.ot.Fixed; */ public class MaxpTable implements Table { - private DirectoryEntry de; - private int versionNumber; + private final DirectoryEntry de; + private final int versionNumber; private int numGlyphs; private int maxPoints; private int maxContours; @@ -36,7 +36,7 @@ public class MaxpTable implements Table { private int maxComponentElements; private int maxComponentDepth; - protected MaxpTable(DirectoryEntry de, DataInput di) throws IOException { + protected MaxpTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); versionNumber = di.readInt(); @@ -128,7 +128,7 @@ public class MaxpTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'maxp' Table - Maximum Profile\n------------------------------") .append("\n 'maxp' version: ").append(Fixed.floatValue(versionNumber)) .append("\n numGlyphs: ").append(numGlyphs); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java index a1787e3e7..5ac9ada29 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameRecord.java @@ -59,15 +59,15 @@ import java.io.IOException; */ public class NameRecord { - private short _platformId; - private short _encodingId; - private short _languageId; - private short _nameId; - private short _stringLength; - private short _stringOffset; + private final short _platformId; + private final short _encodingId; + private final short _languageId; + private final short _nameId; + private final short _stringLength; + private final short _stringOffset; private String _record; - protected NameRecord(DataInput di) throws IOException { + protected NameRecord(final DataInput di) throws IOException { _platformId = di.readShort(); _encodingId = di.readShort(); _languageId = di.readShort(); @@ -92,13 +92,13 @@ public class NameRecord { return _platformId; } - public StringBuilder getRecordString(StringBuilder sb) { + public StringBuilder getRecordString(final StringBuilder sb) { sb.append(_record); return sb; } - protected void loadString(DataInput di) throws IOException { - StringBuilder sb = new StringBuilder(); + protected void loadString(final DataInput di) throws IOException { + final StringBuilder sb = new StringBuilder(); di.skipBytes(_stringOffset); if (_platformId == ID.platformUnicode) { @@ -132,7 +132,7 @@ public class NameRecord { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(" Platform ID: ").append(_platformId) .append("\n Specific ID: ").append(_encodingId) diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java index ad8198b7f..ba9292a4b 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/NameTable.java @@ -63,13 +63,13 @@ import java.io.IOException; * @author David Schweinsberg */ public class NameTable implements Table { - private DirectoryEntry _de; - private short _formatSelector; - private short _numberOfNameRecords; - private short _stringStorageOffset; - private NameRecord[] _records; + private final DirectoryEntry _de; + private final short _formatSelector; + private final short _numberOfNameRecords; + private final short _stringStorageOffset; + private final NameRecord[] _records; - protected NameTable(DirectoryEntry de, DataInput di) throws IOException { + protected NameTable(final DirectoryEntry de, final DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); _formatSelector = di.readShort(); _numberOfNameRecords = di.readShort(); @@ -84,7 +84,7 @@ public class NameTable implements Table { // Load the string data into a buffer so the records can copy out the // bits they are interested in - byte[] buffer = new byte[_de.getLength() - _stringStorageOffset]; + final byte[] buffer = new byte[_de.getLength() - _stringStorageOffset]; di.readFully(buffer); // Now let the records get their hands on them @@ -99,14 +99,14 @@ public class NameTable implements Table { } - public NameRecord getRecord(int i) { + public NameRecord getRecord(final int i) { if(_numberOfNameRecords > i) { return _records[i]; } return null; } - public StringBuilder getRecordsRecordString(StringBuilder sb, int i) { + public StringBuilder getRecordsRecordString(final StringBuilder sb, final int i) { if(_numberOfNameRecords > i) { _records[i].getRecordString(sb); } else { @@ -115,7 +115,7 @@ public class NameTable implements Table { return sb; } - public StringBuilder getNamedRecordString(StringBuilder sb, short nameId) { + public StringBuilder getNamedRecordString(final StringBuilder sb, final short nameId) { // Search for the first instance of this name ID boolean done = false; for (int i = 0; !done && i < _numberOfNameRecords; i++) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java index 5340b297c..c91127303 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Os2Table.java @@ -59,46 +59,46 @@ import java.io.IOException; */ public class Os2Table implements Table { - private DirectoryEntry _de; - private int _version; - private short _xAvgCharWidth; - private int _usWeightClass; - private int _usWidthClass; - private short _fsType; - private short _ySubscriptXSize; - private short _ySubscriptYSize; - private short _ySubscriptXOffset; - private short _ySubscriptYOffset; - private short _ySuperscriptXSize; - private short _ySuperscriptYSize; - private short _ySuperscriptXOffset; - private short _ySuperscriptYOffset; - private short _yStrikeoutSize; - private short _yStrikeoutPosition; - private short _sFamilyClass; - private Panose _panose; - private int _ulUnicodeRange1; - private int _ulUnicodeRange2; - private int _ulUnicodeRange3; - private int _ulUnicodeRange4; - private int _achVendorID; - private short _fsSelection; - private int _usFirstCharIndex; - private int _usLastCharIndex; - private short _sTypoAscender; - private short _sTypoDescender; - private short _sTypoLineGap; - private int _usWinAscent; - private int _usWinDescent; - private int _ulCodePageRange1; - private int _ulCodePageRange2; + private final DirectoryEntry _de; + private final int _version; + private final short _xAvgCharWidth; + private final int _usWeightClass; + private final int _usWidthClass; + private final short _fsType; + private final short _ySubscriptXSize; + private final short _ySubscriptYSize; + private final short _ySubscriptXOffset; + private final short _ySubscriptYOffset; + private final short _ySuperscriptXSize; + private final short _ySuperscriptYSize; + private final short _ySuperscriptXOffset; + private final short _ySuperscriptYOffset; + private final short _yStrikeoutSize; + private final short _yStrikeoutPosition; + private final short _sFamilyClass; + private final Panose _panose; + private final int _ulUnicodeRange1; + private final int _ulUnicodeRange2; + private final int _ulUnicodeRange3; + private final int _ulUnicodeRange4; + private final int _achVendorID; + private final short _fsSelection; + private final int _usFirstCharIndex; + private final int _usLastCharIndex; + private final short _sTypoAscender; + private final short _sTypoDescender; + private final short _sTypoLineGap; + private final int _usWinAscent; + private final int _usWinDescent; + private final int _ulCodePageRange1; + private final int _ulCodePageRange2; private short _sxHeight; private short _sCapHeight; private int _usDefaultChar; private int _usBreakChar; private int _usMaxContext; - protected Os2Table(DirectoryEntry de, DataInput di) throws IOException { + protected Os2Table(final DirectoryEntry de, final DataInput di) throws IOException { this._de = (DirectoryEntry) de.clone(); _version = di.readUnsignedShort(); _xAvgCharWidth = di.readShort(); @@ -116,7 +116,7 @@ public class Os2Table implements Table { _yStrikeoutSize = di.readShort(); _yStrikeoutPosition = di.readShort(); _sFamilyClass = di.readShort(); - byte[] buf = new byte[10]; + final byte[] buf = new byte[10]; di.readFully(buf); _panose = new Panose(buf); _ulUnicodeRange1 = di.readInt(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Panose.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Panose.java index 771318108..493f43baa 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Panose.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Panose.java @@ -26,7 +26,7 @@ public class Panose { byte bXHeight = 0; /** Creates new Panose */ - public Panose(byte[] panose) { + public Panose(final byte[] panose) { bFamilyType = panose[0]; bSerifStyle = panose[1]; bWeight = panose[2]; @@ -81,7 +81,7 @@ public class Panose { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(String.valueOf(bFamilyType)).append(" ") .append(String.valueOf(bSerifStyle)).append(" ") .append(String.valueOf(bWeight)).append(" ") diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java index a1f603d8f..63399cf0e 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PcltTable.java @@ -18,25 +18,25 @@ import java.io.IOException; */ public class PcltTable implements Table { - private DirectoryEntry de; - private int version; - private long fontNumber; - private int pitch; - private int xHeight; - private int style; - private int typeFamily; - private int capHeight; - private int symbolSet; - private char[] typeface = new char[16]; - private short[] characterComplement = new short[8]; - private char[] fileName = new char[6]; - private short strokeWeight; - private short widthType; - private byte serifStyle; - private byte reserved; + private final DirectoryEntry de; + private final int version; + private final long fontNumber; + private final int pitch; + private final int xHeight; + private final int style; + private final int typeFamily; + private final int capHeight; + private final int symbolSet; + private final char[] typeface = new char[16]; + private final short[] characterComplement = new short[8]; + private final char[] fileName = new char[6]; + private final short strokeWeight; + private final short widthType; + private final byte serifStyle; + private final byte reserved; /** Creates new PcltTable */ - protected PcltTable(DirectoryEntry de, DataInput di) throws IOException { + protected PcltTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); version = di.readInt(); fontNumber = di.readInt(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java index 188b441ac..faeecf909 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PostTable.java @@ -284,16 +284,16 @@ public class PostTable implements Table { "" // 257 }; - private DirectoryEntry de; - private int version; - private int italicAngle; - private short underlinePosition; - private short underlineThickness; - private int isFixedPitch; - private int minMemType42; - private int maxMemType42; - private int minMemType1; - private int maxMemType1; + private final DirectoryEntry de; + private final int version; + private final int italicAngle; + private final short underlinePosition; + private final short underlineThickness; + private final int isFixedPitch; + private final int minMemType42; + private final int maxMemType42; + private final int minMemType1; + private final int maxMemType1; // v2 private int numGlyphs; @@ -301,7 +301,7 @@ public class PostTable implements Table { private String[] psGlyphName; /** Creates new PostTable */ - protected PostTable(DirectoryEntry de, DataInput di) throws IOException { + protected PostTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); version = di.readInt(); italicAngle = di.readInt(); @@ -324,8 +324,8 @@ public class PostTable implements Table { h -= 257; psGlyphName = new String[h]; for (int i = 0; i < h; i++) { - int len = di.readUnsignedByte(); - byte[] buf = new byte[len]; + final int len = di.readUnsignedByte(); + final byte[] buf = new byte[len]; di.readFully(buf); psGlyphName[i] = new String(buf); } @@ -349,7 +349,7 @@ public class PostTable implements Table { return high; } - public String getGlyphName(int i) { + public String getGlyphName(final int i) { if (version == 0x00020000) { return (glyphNameIndex[i] > 257) ? psGlyphName[glyphNameIndex[i] - 258] @@ -359,7 +359,7 @@ public class PostTable implements Table { } } - private boolean isMacGlyphName(int i) { + private boolean isMacGlyphName(final int i) { if (version == 0x00020000) { return glyphNameIndex[i] <= 257; } else { @@ -377,7 +377,7 @@ public class PostTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'post' Table - PostScript Metrics\n---------------------------------\n") .append("\n 'post' version: ").append(Fixed.floatValue(version)) .append("\n italicAngle: ").append(Fixed.floatValue(italicAngle)) diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java index 4c64673b7..039789d62 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/PrepTable.java @@ -19,9 +19,9 @@ import jogamp.graph.font.typecast.ot.Disassembler; */ public class PrepTable extends Program implements Table { - private DirectoryEntry de; + private final DirectoryEntry de; - public PrepTable(DirectoryEntry de, DataInput di) throws IOException { + public PrepTable(final DirectoryEntry de, final DataInput di) throws IOException { this.de = (DirectoryEntry) de.clone(); readInstructions(di, de.getLength()); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Program.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Program.java index e3beabef8..c0d2c1b9d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Program.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Program.java @@ -23,7 +23,7 @@ public abstract class Program { return instructions; } - protected void readInstructions(DataInput di, int count) throws IOException { + protected void readInstructions(final DataInput di, final int count) throws IOException { instructions = new short[count]; for (int i = 0; i < count; i++) { instructions[i] = (short) di.readUnsignedByte(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/RangeRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/RangeRecord.java index 40ddf4215..417779703 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/RangeRecord.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/RangeRecord.java @@ -61,22 +61,22 @@ import java.io.IOException; */ public class RangeRecord { - private int _start; - private int _end; - private int _startCoverageIndex; + private final int _start; + private final int _end; + private final int _startCoverageIndex; /** Creates new RangeRecord */ - public RangeRecord(DataInput di) throws IOException { + public RangeRecord(final DataInput di) throws IOException { _start = di.readUnsignedShort(); _end = di.readUnsignedShort(); _startCoverageIndex = di.readUnsignedShort(); } - public boolean isInRange(int glyphId) { + public boolean isInRange(final int glyphId) { return (_start <= glyphId && glyphId <= _end); } - public int getCoverageIndex(int glyphId) { + public int getCoverageIndex(final int glyphId) { if (isInRange(glyphId)) { return _startCoverageIndex + glyphId - _start; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Script.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Script.java index 04781a8f9..8846de5f0 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Script.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/Script.java @@ -60,14 +60,14 @@ import java.io.IOException; */ public class Script { - private int _defaultLangSysOffset; - private int _langSysCount; + private final int _defaultLangSysOffset; + private final int _langSysCount; private LangSysRecord[] _langSysRecords; private LangSys _defaultLangSys; private LangSys[] _langSys; /** Creates new ScriptTable */ - protected Script(DataInputStream dis, int offset) throws IOException { + protected Script(final DataInputStream dis, final int offset) throws IOException { // Ensure we're in the right place dis.reset(); @@ -103,7 +103,7 @@ public class Script { return _langSysCount; } - public LangSysRecord getLangSysRecord(int i) { + public LangSysRecord getLangSysRecord(final int i) { return _langSysRecords[i]; } @@ -111,7 +111,7 @@ public class Script { return _defaultLangSys; } - public LangSys getLangSys(int i) { + public LangSys getLangSys(final int i) { return _langSys[i]; } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptList.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptList.java index 18589b712..1c1be0d2b 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptList.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptList.java @@ -61,11 +61,11 @@ import java.io.IOException; public class ScriptList { private int _scriptCount = 0; - private ScriptRecord[] _scriptRecords; - private Script[] _scripts; + private final ScriptRecord[] _scriptRecords; + private final Script[] _scripts; /** Creates new ScriptList */ - protected ScriptList(DataInputStream dis, int offset) throws IOException { + protected ScriptList(final DataInputStream dis, final int offset) throws IOException { // Ensure we're in the right place dis.reset(); @@ -87,19 +87,19 @@ public class ScriptList { return _scriptCount; } - public ScriptRecord getScriptRecord(int i) { + public ScriptRecord getScriptRecord(final int i) { return _scriptRecords[i]; } - public Script getScript(int i) { + public Script getScript(final int i) { return _scripts[i]; } - public Script findScript(String tag) { + public Script findScript(final String tag) { if (tag.length() != 4) { return null; } - int tagVal = ((tag.charAt(0)<<24) + final int tagVal = ((tag.charAt(0)<<24) | (tag.charAt(1)<<16) | (tag.charAt(2)<<8) | tag.charAt(3)); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptRecord.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptRecord.java index 183ca2ffd..18eefe5a7 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptRecord.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/ScriptRecord.java @@ -60,11 +60,11 @@ import java.io.IOException; */ public class ScriptRecord { - private int _tag; - private int _offset; + private final int _tag; + private final int _offset; /** Creates new ScriptRecord */ - protected ScriptRecord(DataInput di) throws IOException { + protected ScriptRecord(final DataInput di) throws IOException { _tag = di.readInt(); _offset = di.readUnsignedShort(); } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SignatureBlock.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SignatureBlock.java index 31a2d17c9..e6841b94c 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SignatureBlock.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SignatureBlock.java @@ -18,13 +18,13 @@ import java.io.DataInput; */ public class SignatureBlock { - private int reserved1; - private int reserved2; - private int signatureLen; - private byte[] signature; + private final int reserved1; + private final int reserved2; + private final int signatureLen; + private final byte[] signature; /** Creates new SignatureBlock */ - protected SignatureBlock(DataInput di) throws IOException { + protected SignatureBlock(final DataInput di) throws IOException { reserved1 = di.readUnsignedShort(); reserved2 = di.readUnsignedShort(); signatureLen = di.readInt(); @@ -34,7 +34,7 @@ public class SignatureBlock { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); for (int i = 0; i < signatureLen; i += 16) { if (signatureLen - i >= 16) { sb.append(new String(signature, i, 16)).append("\n"); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubst.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubst.java index e31281f2e..c398b4fbb 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubst.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubst.java @@ -64,11 +64,11 @@ public abstract class SingleSubst extends LookupSubtable { public abstract int substitute(int glyphId); - public static SingleSubst read(DataInputStream dis, int offset) throws IOException { + public static SingleSubst read(final DataInputStream dis, final int offset) throws IOException { SingleSubst s = null; dis.reset(); dis.skipBytes(offset); - int format = dis.readUnsignedShort(); + final int format = dis.readUnsignedShort(); if (format == 1) { s = new SingleSubstFormat1(dis, offset); } else if (format == 2) { diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat1.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat1.java index e97e62a58..b2e65dded 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat1.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat1.java @@ -60,12 +60,12 @@ import java.io.IOException; */ public class SingleSubstFormat1 extends SingleSubst { - private int _coverageOffset; - private short _deltaGlyphID; - private Coverage _coverage; + private final int _coverageOffset; + private final short _deltaGlyphID; + private final Coverage _coverage; /** Creates new SingleSubstFormat1 */ - protected SingleSubstFormat1(DataInputStream dis, int offset) throws IOException { + protected SingleSubstFormat1(final DataInputStream dis, final int offset) throws IOException { _coverageOffset = dis.readUnsignedShort(); _deltaGlyphID = dis.readShort(); dis.reset(); @@ -79,8 +79,8 @@ public class SingleSubstFormat1 extends SingleSubst { } @Override - public int substitute(int glyphId) { - int i = _coverage.findGlyph(glyphId); + public int substitute(final int glyphId) { + final int i = _coverage.findGlyph(glyphId); if (i > -1) { return glyphId + _deltaGlyphID; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat2.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat2.java index 4d46b07b4..449c14c7a 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat2.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/SingleSubstFormat2.java @@ -60,13 +60,13 @@ import java.io.IOException; */ public class SingleSubstFormat2 extends SingleSubst { - private int _coverageOffset; - private int _glyphCount; - private int[] _substitutes; - private Coverage _coverage; + private final int _coverageOffset; + private final int _glyphCount; + private final int[] _substitutes; + private final Coverage _coverage; /** Creates new SingleSubstFormat2 */ - protected SingleSubstFormat2(DataInputStream dis, int offset) throws IOException { + protected SingleSubstFormat2(final DataInputStream dis, final int offset) throws IOException { _coverageOffset = dis.readUnsignedShort(); _glyphCount = dis.readUnsignedShort(); _substitutes = new int[_glyphCount]; @@ -84,8 +84,8 @@ public class SingleSubstFormat2 extends SingleSubst { } @Override - public int substitute(int glyphId) { - int i = _coverage.findGlyph(glyphId); + public int substitute(final int glyphId) { + final int i = _coverage.findGlyph(glyphId); if (i > -1) { return _substitutes[i]; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TTCHeader.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TTCHeader.java index f7c7d99b5..a6ec61887 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TTCHeader.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TTCHeader.java @@ -20,16 +20,16 @@ public class TTCHeader { public static final int ttcf = 0x74746366; - private int ttcTag; - private int version; - private int directoryCount; - private int[] tableDirectory; + private final int ttcTag; + private final int version; + private final int directoryCount; + private final int[] tableDirectory; private int dsigTag; - private int dsigLength; - private int dsigOffset; + private final int dsigLength; + private final int dsigOffset; /** Creates new TTCHeader */ - public TTCHeader(DataInput di) throws IOException { + public TTCHeader(final DataInput di) throws IOException { ttcTag = di.readInt(); version = di.readInt(); directoryCount = di.readInt(); @@ -48,12 +48,12 @@ public class TTCHeader { return directoryCount; } - public int getTableDirectory(int i) { + public int getTableDirectory(final int i) { return tableDirectory[i]; } - public static boolean isTTC(DataInput di) throws IOException { - int ttcTag = di.readInt(); + public static boolean isTTC(final DataInput di) throws IOException { + final int ttcTag = di.readInt(); return ttcTag == ttcf; } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableDirectory.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableDirectory.java index 23ecba804..b9448cc72 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableDirectory.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableDirectory.java @@ -66,9 +66,9 @@ public class TableDirectory { private short _searchRange = 0; private short _entrySelector = 0; private short _rangeShift = 0; - private DirectoryEntry[] _entries; + private final DirectoryEntry[] _entries; - public TableDirectory(DataInput di) throws IOException { + public TableDirectory(final DataInput di) throws IOException { _version = di.readInt(); _numTables = di.readShort(); _searchRange = di.readShort(); @@ -80,11 +80,11 @@ public class TableDirectory { } } - public DirectoryEntry getEntry(int index) { + public DirectoryEntry getEntry(final int index) { return _entries[index]; } - public DirectoryEntry getEntryByTag(int tag) { + public DirectoryEntry getEntryByTag(final int tag) { for (int i = 0; i < _numTables; i++) { if (_entries[i].getTag() == tag) { return _entries[i]; @@ -115,7 +115,7 @@ public class TableDirectory { @Override public String toString() { - StringBuilder sb = new StringBuilder() + final StringBuilder sb = new StringBuilder() .append("Offset Table\n------ -----") .append("\n sfnt version: ").append(Fixed.floatValue(_version)) .append("\n numTables = ").append(_numTables) diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableException.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableException.java index 65aa84bff..e0433f098 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableException.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableException.java @@ -40,7 +40,7 @@ public class TableException extends java.lang.Exception { * Constructs an instance of TableException with the specified detail message. * @param msg the detail message. */ - public TableException(String msg) { + public TableException(final String msg) { super(msg); } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableFactory.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableFactory.java index 956d1aecd..d24f3b3ae 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableFactory.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/TableFactory.java @@ -64,10 +64,10 @@ import jogamp.graph.font.typecast.ot.OTFontCollection; public class TableFactory { public static Table create( - OTFontCollection fc, - OTFont font, - DirectoryEntry de, - DataInputStream dis) throws IOException { + final OTFontCollection fc, + final OTFont font, + final DirectoryEntry de, + final DataInputStream dis) throws IOException { Table t = null; // First, if we have a font collection, look for the table there diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java index bebd7f946..1a390f86d 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VdmxTable.java @@ -32,12 +32,12 @@ public class VdmxTable implements Table { private class Ratio { - private byte _bCharSet; - private byte _xRatio; - private byte _yStartRatio; - private byte _yEndRatio; + private final byte _bCharSet; + private final byte _xRatio; + private final byte _yStartRatio; + private final byte _yEndRatio; - protected Ratio(DataInput di) throws IOException { + protected Ratio(final DataInput di) throws IOException { _bCharSet = di.readByte(); _xRatio = di.readByte(); _yStartRatio = di.readByte(); @@ -63,11 +63,11 @@ public class VdmxTable implements Table { private class VTableRecord { - private int _yPelHeight; - private short _yMax; - private short _yMin; + private final int _yPelHeight; + private final short _yMax; + private final short _yMin; - protected VTableRecord(DataInput di) throws IOException { + protected VTableRecord(final DataInput di) throws IOException { _yPelHeight = di.readUnsignedShort(); _yMax = di.readShort(); _yMin = di.readShort(); @@ -88,12 +88,12 @@ public class VdmxTable implements Table { private class Group { - private int _recs; - private int _startsz; - private int _endsz; - private VTableRecord[] _entry; + private final int _recs; + private final int _startsz; + private final int _endsz; + private final VTableRecord[] _entry; - protected Group(DataInput di) throws IOException { + protected Group(final DataInput di) throws IOException { _recs = di.readUnsignedShort(); _startsz = di.readUnsignedByte(); _endsz = di.readUnsignedByte(); @@ -120,16 +120,16 @@ public class VdmxTable implements Table { } } - private DirectoryEntry _de; - private int _version; - private int _numRecs; - private int _numRatios; - private Ratio[] _ratRange; - private int _offset[]; - private Group[] _groups; + private final DirectoryEntry _de; + private final int _version; + private final int _numRecs; + private final int _numRatios; + private final Ratio[] _ratRange; + private final int _offset[]; + private final Group[] _groups; /** Creates a new instance of VdmxTable */ - protected VdmxTable(DirectoryEntry de, DataInput di) throws IOException { + protected VdmxTable(final DirectoryEntry de, final DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); _version = di.readUnsignedShort(); _numRecs = di.readUnsignedShort(); @@ -155,7 +155,7 @@ public class VdmxTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'VDMX' Table - Precomputed Vertical Device Metrics\n") .append("--------------------------------------------------\n") .append(" Version: ").append(_version).append("\n") @@ -172,7 +172,7 @@ public class VdmxTable implements Table { sb.append("\n VDMX Height Record Groups\n") .append(" -------------------------\n"); for (int i = 0; i < _numRecs; ++i) { - Group group = _groups[i]; + final Group group = _groups[i]; sb.append(" ").append(i + 1) .append(". Number of Hgt Records ").append(group.getRecs()).append("\n") .append(" Starting Y Pel Height ").append(group.getStartSZ()).append("\n") diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java index 521b87cc8..cef7b5297 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VheaTable.java @@ -32,21 +32,21 @@ import jogamp.graph.font.typecast.ot.Fixed; */ public class VheaTable implements Table { - private DirectoryEntry _de; - private int _version; - private short _ascent; - private short _descent; - private short _lineGap; - private short _advanceHeightMax; - private short _minTopSideBearing; - private short _minBottomSideBearing; - private short _yMaxExtent; - private short _caretSlopeRise; - private short _caretSlopeRun; - private short _metricDataFormat; - private int _numberOfLongVerMetrics; - - protected VheaTable(DirectoryEntry de, DataInput di) throws IOException { + private final DirectoryEntry _de; + private final int _version; + private final short _ascent; + private final short _descent; + private final short _lineGap; + private final short _advanceHeightMax; + private final short _minTopSideBearing; + private final short _minBottomSideBearing; + private final short _yMaxExtent; + private final short _caretSlopeRise; + private final short _caretSlopeRun; + private final short _metricDataFormat; + private final int _numberOfLongVerMetrics; + + protected VheaTable(final DirectoryEntry de, final DataInput di) throws IOException { _de = (DirectoryEntry) de.clone(); _version = di.readInt(); _ascent = di.readShort(); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VmtxTable.java b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VmtxTable.java index 1b77a6fdc..b76ed7e15 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VmtxTable.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/ot/table/VmtxTable.java @@ -30,15 +30,15 @@ import java.io.IOException; */ public class VmtxTable implements Table { - private DirectoryEntry _de; + private final DirectoryEntry _de; private int[] _vMetrics = null; private short[] _topSideBearing = null; protected VmtxTable( - DirectoryEntry de, - DataInput di, - VheaTable vhea, - MaxpTable maxp) throws IOException { + final DirectoryEntry de, + final DataInput di, + final VheaTable vhea, + final MaxpTable maxp) throws IOException { _de = (DirectoryEntry) de.clone(); _vMetrics = new int[vhea.getNumberOfLongVerMetrics()]; for (int i = 0; i < vhea.getNumberOfLongVerMetrics(); ++i) { @@ -48,14 +48,14 @@ public class VmtxTable implements Table { | di.readUnsignedByte()<<8 | di.readUnsignedByte(); } - int tsbCount = maxp.getNumGlyphs() - vhea.getNumberOfLongVerMetrics(); + final int tsbCount = maxp.getNumGlyphs() - vhea.getNumberOfLongVerMetrics(); _topSideBearing = new short[tsbCount]; for (int i = 0; i < tsbCount; ++i) { _topSideBearing[i] = di.readShort(); } } - public int getAdvanceHeight(int i) { + public int getAdvanceHeight(final int i) { if (_vMetrics == null) { return 0; } @@ -66,7 +66,7 @@ public class VmtxTable implements Table { } } - public short getTopSideBearing(int i) { + public short getTopSideBearing(final int i) { if (_vMetrics == null) { return 0; } @@ -84,7 +84,7 @@ public class VmtxTable implements Table { @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("'vmtx' Table - Vertical Metrics\n-------------------------------\n"); sb.append("Size = ").append(_de.getLength()).append(" bytes, ") .append(_vMetrics.length).append(" entries\n"); diff --git a/src/jogl/classes/jogamp/graph/font/typecast/t2/T2Interpreter.java b/src/jogl/classes/jogamp/graph/font/typecast/t2/T2Interpreter.java index 73f26b27c..7bfb8cbd5 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/t2/T2Interpreter.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/t2/T2Interpreter.java @@ -56,10 +56,10 @@ public class T2Interpreter { * (dx1, dy1). */ private void _rmoveto() { - int dy1 = popArg().intValue(); - int dx1 = popArg().intValue(); + final int dy1 = popArg().intValue(); + final int dx1 = popArg().intValue(); clearArg(); - Point lastPoint = getLastPoint(); + final Point lastPoint = getLastPoint(); moveTo(lastPoint.x + dx1, lastPoint.y + dy1); } @@ -67,9 +67,9 @@ public class T2Interpreter { * Moves the current point dx1 units in the horizontal direction. */ private void _hmoveto() { - int dx1 = popArg().intValue(); + final int dx1 = popArg().intValue(); clearArg(); - Point lastPoint = getLastPoint(); + final Point lastPoint = getLastPoint(); moveTo(lastPoint.x + dx1, lastPoint.y); } @@ -77,9 +77,9 @@ public class T2Interpreter { * Moves the current point dy1 units in the vertical direction. */ private void _vmoveto() { - int dy1 = popArg().intValue(); + final int dy1 = popArg().intValue(); clearArg(); - Point lastPoint = getLastPoint(); + final Point lastPoint = getLastPoint(); moveTo(lastPoint.x, lastPoint.y + dy1); } @@ -90,15 +90,15 @@ public class T2Interpreter { * lines is determined from the number of arguments on the stack. */ private void _rlineto() { - int count = getArgCount() / 2; - int[] dx = new int[count]; - int[] dy = new int[count]; + final int count = getArgCount() / 2; + final int[] dx = new int[count]; + final int[] dy = new int[count]; for (int i = 0; i < count; ++i) { dy[count - i - 1] = popArg().intValue(); dx[count - i - 1] = popArg().intValue(); } for (int i = 0; i < count; ++i) { - Point lastPoint = getLastPoint(); + final Point lastPoint = getLastPoint(); lineTo(lastPoint.x + dx[i], lastPoint.y + dy[i]); } clearArg(); @@ -115,13 +115,13 @@ public class T2Interpreter { * number of arguments on the stack. */ private void _hlineto() { - int count = getArgCount(); - Number[] nums = new Number[count]; + final int count = getArgCount(); + final Number[] nums = new Number[count]; for (int i = 0; i < count; ++i) { nums[count - i - 1] = popArg(); } for (int i = 0; i < count; ++i) { - Point lastPoint = getLastPoint(); + final Point lastPoint = getLastPoint(); if (i % 2 == 0) { lineTo(lastPoint.x + nums[i].intValue(), lastPoint.y); } else { @@ -142,13 +142,13 @@ public class T2Interpreter { * number of arguments on the stack. */ private void _vlineto() { - int count = getArgCount(); - Number[] nums = new Number[count]; + final int count = getArgCount(); + final Number[] nums = new Number[count]; for (int i = 0; i < count; ++i) { nums[count - i - 1] = popArg(); } for (int i = 0; i < count; ++i) { - Point lastPoint = getLastPoint(); + final Point lastPoint = getLastPoint(); if (i % 2 == 0) { lineTo(lastPoint.x, lastPoint.y + nums[i].intValue()); } else { @@ -167,13 +167,13 @@ public class T2Interpreter { * stack. */ private void _rrcurveto() { - int count = getArgCount() / 6; - int[] dxa = new int[count]; - int[] dya = new int[count]; - int[] dxb = new int[count]; - int[] dyb = new int[count]; - int[] dxc = new int[count]; - int[] dyc = new int[count]; + final int count = getArgCount() / 6; + final int[] dxa = new int[count]; + final int[] dya = new int[count]; + final int[] dxb = new int[count]; + final int[] dyb = new int[count]; + final int[] dxc = new int[count]; + final int[] dyc = new int[count]; for (int i = 0; i < count; ++i) { dyc[count - i - 1] = popArg().intValue(); dxc[count - i - 1] = popArg().intValue(); @@ -183,13 +183,13 @@ public class T2Interpreter { dxa[count - i - 1] = popArg().intValue(); } for (int i = 0; i < count; ++i) { - Point lastPoint = getLastPoint(); - int xa = lastPoint.x + dxa[i]; - int ya = lastPoint.y + dya[i]; - int xb = xa + dxb[i]; - int yb = ya + dyb[i]; - int xc = xb + dxc[i]; - int yc = yb + dyc[i]; + final Point lastPoint = getLastPoint(); + final int xa = lastPoint.x + dxa[i]; + final int ya = lastPoint.y + dya[i]; + final int xb = xa + dxb[i]; + final int yb = ya + dyb[i]; + final int xc = xb + dxc[i]; + final int yc = yb + dyc[i]; curveTo(xa, ya, xb, yb, xc, yc); } clearArg(); @@ -203,12 +203,12 @@ public class T2Interpreter { * case). Note the argument order for the odd argument case. */ private void _hhcurveto() { - int count = getArgCount() / 4; + final int count = getArgCount() / 4; int dy1 = 0; - int[] dxa = new int[count]; - int[] dxb = new int[count]; - int[] dyb = new int[count]; - int[] dxc = new int[count]; + final int[] dxa = new int[count]; + final int[] dxb = new int[count]; + final int[] dyb = new int[count]; + final int[] dxc = new int[count]; for (int i = 0; i < count; ++i) { dxc[count - i - 1] = popArg().intValue(); dyb[count - i - 1] = popArg().intValue(); @@ -219,13 +219,13 @@ public class T2Interpreter { dy1 = popArg().intValue(); } for (int i = 0; i < count; ++i) { - Point lastPoint = getLastPoint(); - int xa = lastPoint.x + dxa[i]; - int ya = lastPoint.y + (i == 0 ? dy1 : 0); - int xb = xa + dxb[i]; - int yb = ya + dyb[i]; - int xc = xb + dxc[i]; - int yc = yb; + final Point lastPoint = getLastPoint(); + final int xa = lastPoint.x + dxa[i]; + final int ya = lastPoint.y + (i == 0 ? dy1 : 0); + final int xb = xa + dxb[i]; + final int yb = ya + dyb[i]; + final int xc = xb + dxc[i]; + final int yc = yb; curveTo(xa, ya, xb, yb, xc, yc); } clearArg(); @@ -243,15 +243,15 @@ public class T2Interpreter { */ private void _hvcurveto() { if (getArgCount() % 8 <= 1) { - int count = getArgCount() / 8; - int[] dxa = new int[count]; - int[] dxb = new int[count]; - int[] dyb = new int[count]; - int[] dyc = new int[count]; - int[] dyd = new int[count]; - int[] dxe = new int[count]; - int[] dye = new int[count]; - int[] dxf = new int[count]; + final int count = getArgCount() / 8; + final int[] dxa = new int[count]; + final int[] dxb = new int[count]; + final int[] dyb = new int[count]; + final int[] dyc = new int[count]; + final int[] dyd = new int[count]; + final int[] dxe = new int[count]; + final int[] dye = new int[count]; + final int[] dxf = new int[count]; int dyf = 0; if (getArgCount() % 8 == 1) { dyf = popArg().intValue(); @@ -267,32 +267,32 @@ public class T2Interpreter { dxa[count - i - 1] = popArg().intValue(); } for (int i = 0; i < count; ++i) { - Point lastPoint = getLastPoint(); - int xa = lastPoint.x + dxa[i]; - int ya = lastPoint.y; - int xb = xa + dxb[i]; - int yb = ya + dyb[i]; - int xc = xb; - int yc = yb + dyc[i]; - int xd = xc; - int yd = yc + dyd[i]; - int xe = xd + dxe[i]; - int ye = yd + dye[i]; - int xf = xe + dxf[i]; - int yf = ye + dyf; + final Point lastPoint = getLastPoint(); + final int xa = lastPoint.x + dxa[i]; + final int ya = lastPoint.y; + final int xb = xa + dxb[i]; + final int yb = ya + dyb[i]; + final int xc = xb; + final int yc = yb + dyc[i]; + final int xd = xc; + final int yd = yc + dyd[i]; + final int xe = xd + dxe[i]; + final int ye = yd + dye[i]; + final int xf = xe + dxf[i]; + final int yf = ye + dyf; curveTo(xa, ya, xb, yb, xc, yc); curveTo(xd, yd, xe, ye, xf, yf); } } else { - int count = getArgCount() / 8; - int[] dya = new int[count]; - int[] dxb = new int[count]; - int[] dyb = new int[count]; - int[] dxc = new int[count]; - int[] dxd = new int[count]; - int[] dxe = new int[count]; - int[] dye = new int[count]; - int[] dyf = new int[count]; + final int count = getArgCount() / 8; + final int[] dya = new int[count]; + final int[] dxb = new int[count]; + final int[] dyb = new int[count]; + final int[] dxc = new int[count]; + final int[] dxd = new int[count]; + final int[] dxe = new int[count]; + final int[] dye = new int[count]; + final int[] dyf = new int[count]; int dxf = 0; if (getArgCount() % 8 == 1) { dxf = popArg().intValue(); @@ -307,24 +307,24 @@ public class T2Interpreter { dxb[count - i - 1] = popArg().intValue(); dya[count - i - 1] = popArg().intValue(); } - int dy3 = popArg().intValue(); - int dy2 = popArg().intValue(); - int dx2 = popArg().intValue(); - int dx1 = popArg().intValue(); + final int dy3 = popArg().intValue(); + final int dy2 = popArg().intValue(); + final int dx2 = popArg().intValue(); + final int dx1 = popArg().intValue(); for (int i = 0; i < count; ++i) { - Point lastPoint = getLastPoint(); - int xa = lastPoint.x; - int ya = lastPoint.y + dya[i]; - int xb = xa + dxb[i]; - int yb = ya + dyb[i]; - int xc = xb + dxc[i]; - int yc = yb; - int xd = xc + dxd[i]; - int yd = yc; - int xe = xd + dxe[i]; - int ye = yd + dye[i]; - int xf = xe + dxf; - int yf = ye + dyf[i]; + final Point lastPoint = getLastPoint(); + final int xa = lastPoint.x; + final int ya = lastPoint.y + dya[i]; + final int xb = xa + dxb[i]; + final int yb = ya + dyb[i]; + final int xc = xb + dxc[i]; + final int yc = yb; + final int xd = xc + dxd[i]; + final int yd = yc; + final int xe = xd + dxe[i]; + final int ye = yd + dye[i]; + final int xf = xe + dxf; + final int yf = ye + dyf[i]; curveTo(xa, ya, xb, yb, xc, yc); curveTo(xd, yd, xe, ye, xf, yf); @@ -341,15 +341,15 @@ public class T2Interpreter { * on the argument stack. */ private void _rcurveline() { - int count = (getArgCount() - 2) / 6; - int[] dxa = new int[count]; - int[] dya = new int[count]; - int[] dxb = new int[count]; - int[] dyb = new int[count]; - int[] dxc = new int[count]; - int[] dyc = new int[count]; - int dyd = popArg().intValue(); - int dxd = popArg().intValue(); + final int count = (getArgCount() - 2) / 6; + final int[] dxa = new int[count]; + final int[] dya = new int[count]; + final int[] dxb = new int[count]; + final int[] dyb = new int[count]; + final int[] dxc = new int[count]; + final int[] dyc = new int[count]; + final int dyd = popArg().intValue(); + final int dxd = popArg().intValue(); for (int i = 0; i < count; ++i) { dyc[count - i - 1] = popArg().intValue(); dxc[count - i - 1] = popArg().intValue(); @@ -361,11 +361,11 @@ public class T2Interpreter { int xc = 0; int yc = 0; for (int i = 0; i < count; ++i) { - Point lastPoint = getLastPoint(); - int xa = lastPoint.x + dxa[i]; - int ya = lastPoint.y + dya[i]; - int xb = xa + dxb[i]; - int yb = ya + dyb[i]; + final Point lastPoint = getLastPoint(); + final int xa = lastPoint.x + dxa[i]; + final int ya = lastPoint.y + dya[i]; + final int xb = xa + dxb[i]; + final int yb = ya + dyb[i]; xc = xb + dxc[i]; yc = yb + dyc[i]; curveTo(xa, ya, xb, yb, xc, yc); @@ -381,15 +381,15 @@ public class T2Interpreter { * items on the argument stack. */ private void _rlinecurve() { - int count = (getArgCount() - 6) / 2; - int[] dxa = new int[count]; - int[] dya = new int[count]; - int dyd = popArg().intValue(); - int dxd = popArg().intValue(); - int dyc = popArg().intValue(); - int dxc = popArg().intValue(); - int dyb = popArg().intValue(); - int dxb = popArg().intValue(); + final int count = (getArgCount() - 6) / 2; + final int[] dxa = new int[count]; + final int[] dya = new int[count]; + final int dyd = popArg().intValue(); + final int dxd = popArg().intValue(); + final int dyc = popArg().intValue(); + final int dxc = popArg().intValue(); + final int dyb = popArg().intValue(); + final int dxb = popArg().intValue(); for (int i = 0; i < count; ++i) { dya[count - i - 1] = popArg().intValue(); dxa[count - i - 1] = popArg().intValue(); @@ -397,17 +397,17 @@ public class T2Interpreter { int xa = 0; int ya = 0; for (int i = 0; i < count; ++i) { - Point lastPoint = getLastPoint(); + final Point lastPoint = getLastPoint(); xa = lastPoint.x + dxa[i]; ya = lastPoint.y + dya[i]; lineTo(xa, ya); } - int xb = xa + dxb; - int yb = ya + dyb; - int xc = xb + dxc; - int yc = yb + dyc; - int xd = xc + dxd; - int yd = yc + dyd; + final int xb = xa + dxb; + final int yb = ya + dyb; + final int xc = xb + dxc; + final int yc = yb + dyc; + final int xd = xc + dxd; + final int yd = yc + dyd; curveTo(xb, yb, xc, yc, xd, yd); clearArg(); } @@ -420,15 +420,15 @@ public class T2Interpreter { */ private void _vhcurveto() { if (getArgCount() % 8 <= 1) { - int count = getArgCount() / 8; - int[] dya = new int[count]; - int[] dxb = new int[count]; - int[] dyb = new int[count]; - int[] dxc = new int[count]; - int[] dxd = new int[count]; - int[] dxe = new int[count]; - int[] dye = new int[count]; - int[] dyf = new int[count]; + final int count = getArgCount() / 8; + final int[] dya = new int[count]; + final int[] dxb = new int[count]; + final int[] dyb = new int[count]; + final int[] dxc = new int[count]; + final int[] dxd = new int[count]; + final int[] dxe = new int[count]; + final int[] dye = new int[count]; + final int[] dyf = new int[count]; int dxf = 0; if (getArgCount() % 8 == 1) { dxf = popArg().intValue(); @@ -444,24 +444,24 @@ public class T2Interpreter { dya[count - i - 1] = popArg().intValue(); } for (int i = 0; i < count; ++i) { - Point lastPoint = getLastPoint(); - int xa = lastPoint.x; - int ya = lastPoint.y + dya[i]; - int xb = xa + dxb[i]; - int yb = ya + dyb[i]; - int xc = xb + dxc[i]; - int yc = yb; - int xd = xc + dxd[i]; - int yd = yc; - int xe = xd + dxe[i]; - int ye = yd + dye[i]; - int xf = xe + dxf; - int yf = ye + dyf[i]; + final Point lastPoint = getLastPoint(); + final int xa = lastPoint.x; + final int ya = lastPoint.y + dya[i]; + final int xb = xa + dxb[i]; + final int yb = ya + dyb[i]; + final int xc = xb + dxc[i]; + final int yc = yb; + final int xd = xc + dxd[i]; + final int yd = yc; + final int xe = xd + dxe[i]; + final int ye = yd + dye[i]; + final int xf = xe + dxf; + final int yf = ye + dyf[i]; curveTo(xa, ya, xb, yb, xc, yc); curveTo(xd, yd, xe, ye, xf, yf); } } else { - int foo = 0; + final int foo = 0; } clearArg(); } @@ -565,7 +565,7 @@ public class T2Interpreter { * Returns the absolute value of num. */ private void _abs() { - double num = popArg().doubleValue(); + final double num = popArg().doubleValue(); pushArg(Math.abs(num)); } @@ -573,8 +573,8 @@ public class T2Interpreter { * Returns the sum of the two numbers num1 and num2. */ private void _add() { - double num2 = popArg().doubleValue(); - double num1 = popArg().doubleValue(); + final double num2 = popArg().doubleValue(); + final double num1 = popArg().doubleValue(); pushArg(num1 + num2); } @@ -582,8 +582,8 @@ public class T2Interpreter { * Returns the result of subtracting num2 from num1. */ private void _sub() { - double num2 = popArg().doubleValue(); - double num1 = popArg().doubleValue(); + final double num2 = popArg().doubleValue(); + final double num1 = popArg().doubleValue(); pushArg(num1 - num2); } @@ -592,8 +592,8 @@ public class T2Interpreter { * undefined if overflow occurs and is zero for underflow. */ private void _div() { - double num2 = popArg().doubleValue(); - double num1 = popArg().doubleValue(); + final double num2 = popArg().doubleValue(); + final double num1 = popArg().doubleValue(); pushArg(num1 / num2); } @@ -601,7 +601,7 @@ public class T2Interpreter { * Returns the negative of num. */ private void _neg() { - double num = popArg().doubleValue(); + final double num = popArg().doubleValue(); pushArg(-num); } @@ -618,8 +618,8 @@ public class T2Interpreter { * result is undefined, and zero is returned for underflow. */ private void _mul() { - double num2 = popArg().doubleValue(); - double num1 = popArg().doubleValue(); + final double num2 = popArg().doubleValue(); + final double num1 = popArg().doubleValue(); pushArg(num1 * num2); } @@ -628,7 +628,7 @@ public class T2Interpreter { * undefined. */ private void _sqrt() { - double num = popArg().doubleValue(); + final double num = popArg().doubleValue(); pushArg(Math.sqrt(num)); } @@ -643,8 +643,8 @@ public class T2Interpreter { * Exchanges the top two elements on the argument stack. */ private void _exch() { - Number num2 = popArg(); - Number num1 = popArg(); + final Number num2 = popArg(); + final Number num1 = popArg(); pushArg(num2); pushArg(num1); } @@ -656,8 +656,8 @@ public class T2Interpreter { * undefined. */ private void _index() { - int i = popArg().intValue(); - Number[] nums = new Number[i]; + final int i = popArg().intValue(); + final Number[] nums = new Number[i]; for (int j = 0; j < i; ++j) { nums[j] = popArg(); } @@ -675,9 +675,9 @@ public class T2Interpreter { * operation is undefined. */ private void _roll() { - int j = popArg().intValue(); - int n = popArg().intValue(); - Number[] nums = new Number[n]; + final int j = popArg().intValue(); + final int n = popArg().intValue(); + final Number[] nums = new Number[n]; for (int i = 0; i < n; ++i) { nums[i] = popArg(); } @@ -690,7 +690,7 @@ public class T2Interpreter { * Duplicates the top element on the argument stack. */ private void _dup() { - Number any = popArg(); + final Number any = popArg(); pushArg(any); pushArg(any); } @@ -699,8 +699,8 @@ public class T2Interpreter { * Stores val into the transient array at the location given by i. */ private void _put() { - int i = popArg().intValue(); - Number val = popArg(); + final int i = popArg().intValue(); + final Number val = popArg(); _transientArray[i] = val; } @@ -711,7 +711,7 @@ public class T2Interpreter { * charstring, the value returned is undefined. */ private void _get() { - int i = popArg().intValue(); + final int i = popArg().intValue(); pushArg(_transientArray[i]); } @@ -720,8 +720,8 @@ public class T2Interpreter { * puts a 0 on the stack if either argument is zero. */ private void _and() { - double num2 = popArg().doubleValue(); - double num1 = popArg().doubleValue(); + final double num2 = popArg().doubleValue(); + final double num1 = popArg().doubleValue(); pushArg((num1!=0.0) && (num2!=0.0) ? 1 : 0); } @@ -730,8 +730,8 @@ public class T2Interpreter { * puts a 0 on the stack if both arguments are zero. */ private void _or() { - double num2 = popArg().doubleValue(); - double num1 = popArg().doubleValue(); + final double num2 = popArg().doubleValue(); + final double num1 = popArg().doubleValue(); pushArg((num1!=0.0) || (num2!=0.0) ? 1 : 0); } @@ -739,7 +739,7 @@ public class T2Interpreter { * Returns a 0 if num1 is non-zero; returns a 1 if num1 is zero. */ private void _not() { - double num1 = popArg().doubleValue(); + final double num1 = popArg().doubleValue(); pushArg((num1!=0.0) ? 0 : 1); } @@ -748,8 +748,8 @@ public class T2Interpreter { * is put on the stack. */ private void _eq() { - double num2 = popArg().doubleValue(); - double num1 = popArg().doubleValue(); + final double num2 = popArg().doubleValue(); + final double num1 = popArg().doubleValue(); pushArg(num1 == num2 ? 1 : 0); } @@ -759,10 +759,10 @@ public class T2Interpreter { * number of a subroutine. */ private void _ifelse() { - double v2 = popArg().doubleValue(); - double v1 = popArg().doubleValue(); - Number s2 = popArg(); - Number s1 = popArg(); + final double v2 = popArg().doubleValue(); + final double v1 = popArg().doubleValue(); + final Number s2 = popArg(); + final Number s1 = popArg(); pushArg(v1 <= v2 ? s1 : s2); } @@ -796,7 +796,7 @@ public class T2Interpreter { } - public Point[] execute(CharstringType2 cs) { + public Point[] execute(final CharstringType2 cs) { _points = new ArrayList(); cs.resetIP(); while (cs.moreBytes()) { @@ -964,7 +964,7 @@ public class T2Interpreter { } } } - Point[] pointArray = new Point[_points.size()]; + final Point[] pointArray = new Point[_points.size()]; _points.toArray(pointArray); return pointArray; } @@ -986,7 +986,7 @@ public class T2Interpreter { /** * Push a value on to the argument stack */ - private void pushArg(Number n) { + private void pushArg(final Number n) { _argStack[_argStackIndex++] = n; } @@ -1000,7 +1000,7 @@ public class T2Interpreter { /** * Push a value on to the subroutine stack */ - private void pushSubr(int n) { + private void pushSubr(final int n) { _subrStack[_subrStackIndex++] = n; } @@ -1012,7 +1012,7 @@ public class T2Interpreter { } private Point getLastPoint() { - int size = _points.size(); + final int size = _points.size(); if (size > 0) { return _points.get(size - 1); } else { @@ -1020,23 +1020,23 @@ public class T2Interpreter { } } - private void moveTo(int x, int y) { + private void moveTo(final int x, final int y) { endContour(); _points.add(new Point(x, y, true, false)); } - private void lineTo(int x, int y) { + private void lineTo(final int x, final int y) { _points.add(new Point(x, y, true, false)); } - private void curveTo(int cx1, int cy1, int cx2, int cy2, int x, int y) { + private void curveTo(final int cx1, final int cy1, final int cx2, final int cy2, final int x, final int y) { _points.add(new Point(cx1, cy1, false, false)); _points.add(new Point(cx2, cy2, false, false)); _points.add(new Point(x, y, true, false)); } private void endContour() { - Point lastPoint = getLastPoint(); + final Point lastPoint = getLastPoint(); if (lastPoint != null) { lastPoint.endOfContour = true; } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java index 2bb5cec0c..b296886cc 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Interpreter.java @@ -33,16 +33,16 @@ import jogamp.graph.font.typecast.ot.Point; public class Interpreter { private Parser parser = null; - private GraphicsState gs = new GraphicsState(); - private Point[][] zone = new Point[2][]; + private final GraphicsState gs = new GraphicsState(); + private final Point[][] zone = new Point[2][]; private int[] stack = null; private int[] store = null; - private int[] cvt = new int[256]; + private final int[] cvt = new int[256]; private int[] functionMap = null; private int stackIndex = 0; private boolean inFuncDef = false; - public Interpreter(int stackMax, int storeMax, int funcMax) { + public Interpreter(final int stackMax, final int storeMax, final int funcMax) { zone[0] = new Point[256]; zone[1] = new Point[256]; stack = new int[stackMax]; @@ -54,7 +54,7 @@ public class Interpreter { * ABSolute value */ private void _abs() { - int n = pop(); + final int n = pop(); if (n >= 0) { push(n); } else { @@ -66,8 +66,8 @@ public class Interpreter { * ADD */ private void _add() { - int n1 = pop(); - int n2 = pop(); + final int n1 = pop(); + final int n2 = pop(); push(n2 + n1); } @@ -92,8 +92,8 @@ public class Interpreter { * logical AND */ private void _and() { - int e2 = pop(); - int e1 = pop(); + final int e2 = pop(); + final int e1 = pop(); push(((e1 != 0) && (e2 != 0)) ? 1 : 0); } @@ -108,7 +108,7 @@ public class Interpreter { * CEILING */ private void _ceiling() { - int n = pop(); + final int n = pop(); if (n >= 0) { push((n & 0xffc0) + (((n & 0x3f) != 0) ? 0x40 : 0)); } else { @@ -138,7 +138,7 @@ public class Interpreter { * DELTA exception C1 */ private void _deltac1() { - int n = pop(); + final int n = pop(); for (int i = 0; i < n; i++) { pop(); // pn pop(); // argn @@ -149,7 +149,7 @@ public class Interpreter { * DELTA exception C2 */ private void _deltac2() { - int n = pop(); + final int n = pop(); for (int i = 0; i < n; i++) { pop(); // pn pop(); // argn @@ -160,7 +160,7 @@ public class Interpreter { * DELTA exception C3 */ private void _deltac3() { - int n = pop(); + final int n = pop(); for (int i = 0; i < n; i++) { pop(); // pn pop(); // argn @@ -171,7 +171,7 @@ public class Interpreter { * DELTA exception P1 */ private void _deltap1() { - int n = pop(); + final int n = pop(); for (int i = 0; i < n; i++) { pop(); // pn pop(); // argn @@ -182,7 +182,7 @@ public class Interpreter { * DELTA exception P2 */ private void _deltap2() { - int n = pop(); + final int n = pop(); for (int i = 0; i < n; i++) { pop(); // pn pop(); // argn @@ -193,7 +193,7 @@ public class Interpreter { * DELTA exception P3 */ private void _deltap3() { - int n = pop(); + final int n = pop(); for (int i = 0; i < n; i++) { pop(); // pn pop(); // argn @@ -211,8 +211,8 @@ public class Interpreter { * DIVide */ private void _div() { - int n1 = pop(); - int n2 = pop(); + final int n1 = pop(); + final int n2 = pop(); push((n2 / n1) >> 6); } @@ -220,7 +220,7 @@ public class Interpreter { * DUPlicate top stack element */ private void _dup() { - int n = pop(); + final int n = pop(); push(n); push(n); } @@ -228,7 +228,7 @@ public class Interpreter { /** * ELSE */ - private int _else(int instructionIndex) { + private int _else(final int instructionIndex) { return parser.handleElse(instructionIndex); } @@ -236,8 +236,8 @@ public class Interpreter { * EQual */ private void _eq() { - int e2 = pop(); - int e1 = pop(); + final int e2 = pop(); + final int e1 = pop(); push((e1 == e2) ? 1 : 0); } @@ -249,7 +249,7 @@ public class Interpreter { /** * Function DEFinition */ - private void _fdef(int instructionIndex) { + private void _fdef(final int instructionIndex) { functionMap[pop()] = instructionIndex; inFuncDef = true; } @@ -275,7 +275,7 @@ public class Interpreter { */ private void _flippt() { while(gs.loop-- > 0) { - int index = pop(); + final int index = pop(); zone[gs.zp0][index].onCurve = !zone[gs.zp0][index].onCurve; } gs.loop = 1; @@ -285,8 +285,8 @@ public class Interpreter { * FLIP RanGe OFF */ private void _fliprgoff() { - int end = pop(); - int start = pop(); + final int end = pop(); + final int start = pop(); for (int i = start; i <= end; i++) { zone[1][i].onCurve = false; } @@ -296,8 +296,8 @@ public class Interpreter { * FLIP RanGe ON */ private void _fliprgon() { - int end = pop(); - int start = pop(); + final int end = pop(); + final int start = pop(); for (int i = start; i <= end; i++) { zone[1][i].onCurve = true; } @@ -307,7 +307,7 @@ public class Interpreter { * FLOOR */ private void _floor() { - int n = pop(); + final int n = pop(); if (n >= 0) { push(n & 0xffc0); } else { @@ -315,7 +315,7 @@ public class Interpreter { } } - private void _gc(short param) { + private void _gc(final short param) { pop(); push(0); } @@ -345,8 +345,8 @@ public class Interpreter { * Greater Than */ private void _gt() { - int e2 = pop(); - int e1 = pop(); + final int e2 = pop(); + final int e1 = pop(); push((e1 > e2) ? 1 : 0); } @@ -354,8 +354,8 @@ public class Interpreter { * Greater Than or EQual */ private void _gteq() { - int e2 = pop(); - int e1 = pop(); + final int e2 = pop(); + final int e1 = pop(); push((e1 >= e2) ? 1 : 0); } @@ -370,7 +370,7 @@ public class Interpreter { /** * IF test */ - private int _if(int instructionIndex) { + private int _if(final int instructionIndex) { return parser.handleIf(pop() != 0, instructionIndex); } @@ -425,8 +425,8 @@ public class Interpreter { * will be used in glyph instructions. */ private void _instctrl() { - int s = pop(); - int v = pop(); + final int s = pop(); + final int v = pop(); if (s == 1) { gs.instruction_control |= v; } else if (s == 2) { @@ -446,7 +446,7 @@ public class Interpreter { pop(); } - private void _iup(short param) { + private void _iup(final short param) { } /** @@ -460,8 +460,8 @@ public class Interpreter { * Jump Relative On False */ private int _jrof(int instructionIndex) { - boolean test = pop() != 0; - int offset = pop(); + final boolean test = pop() != 0; + final int offset = pop(); if (!test) { instructionIndex += offset - 1; } @@ -472,8 +472,8 @@ public class Interpreter { * Jump Relative On True */ private int _jrot(int instructionIndex) { - boolean test = pop() != 0; - int offset = pop(); + final boolean test = pop() != 0; + final int offset = pop(); if (test) { instructionIndex += offset - 1; } @@ -484,8 +484,8 @@ public class Interpreter { * LOOP and CALL function */ private void _loopcall() { - int index = pop(); - int count = pop(); + final int index = pop(); + final int count = pop(); for (int i = 0; i < count; i++) { execute(functionMap[i]); } @@ -495,8 +495,8 @@ public class Interpreter { * Less Than */ private void _lt() { - int e2 = pop(); - int e1 = pop(); + final int e2 = pop(); + final int e1 = pop(); push((e1 < e2) ? 1 : 0); } @@ -504,8 +504,8 @@ public class Interpreter { * Less Than or EQual */ private void _lteq() { - int e2 = pop(); - int e1 = pop(); + final int e2 = pop(); + final int e1 = pop(); push((e1 <= e2) ? 1 : 0); } @@ -513,26 +513,26 @@ public class Interpreter { * MAXimum of top two stack elements */ private void _max() { - int n1 = pop(); - int n2 = pop(); + final int n1 = pop(); + final int n2 = pop(); push((n1 > n2) ? n1 : n2); } - private void _md(short param) { + private void _md(final short param) { pop(); pop(); push(0); } - private void _mdap(short param) { + private void _mdap(final short param) { pop(); } - private void _mdrp(short param) { + private void _mdrp(final short param) { pop(); } - private void _miap(short param) { + private void _miap(final short param) { pop(); pop(); } @@ -540,8 +540,8 @@ public class Interpreter { * MINimum of top two stack elements */ private void _min() { - int n1 = pop(); - int n2 = pop(); + final int n1 = pop(); + final int n2 = pop(); push((n1 < n2) ? n1 : n2); } @@ -550,15 +550,15 @@ public class Interpreter { */ private void _mindex() { // Move the indexed element to stackIndex, and shift the others down - int k = pop(); - int e = stack[stackIndex - k]; + final int k = pop(); + final int e = stack[stackIndex - k]; for (int i = stackIndex - k; i < stackIndex - 1; i++) { stack[i] = stack[i+1]; } stack[stackIndex - 1] = e; } - private void _mirp(short param) { + private void _mirp(final short param) { pop(); pop(); } @@ -571,7 +571,7 @@ public class Interpreter { push(0); } - private void _msirp(short param) { + private void _msirp(final short param) { pop(); pop(); } @@ -580,8 +580,8 @@ public class Interpreter { * MULtiply */ private void _mul() { - int n1 = pop(); - int n2 = pop(); + final int n1 = pop(); + final int n2 = pop(); push((n1 * n2) >> 6); } @@ -596,8 +596,8 @@ public class Interpreter { * Not EQual */ private void _neq() { - int e2 = pop(); - int e1 = pop(); + final int e2 = pop(); + final int e1 = pop(); push((e1 != e2) ? 1 : 0); } @@ -608,7 +608,7 @@ public class Interpreter { push((pop() != 0) ? 0 : 1); } - private void _nround(short param) { + private void _nround(final short param) { pop(); push(0); } @@ -622,8 +622,8 @@ public class Interpreter { * logical OR */ private void _or() { - int e2 = pop(); - int e1 = pop(); + final int e2 = pop(); + final int e1 = pop(); push(((e1 != 0) || (e2 != 0)) ? 1 : 0); } @@ -633,7 +633,7 @@ public class Interpreter { * PUSH Bytes * PUSH Words */ - private void _push(int[] data) { + private void _push(final int[] data) { for (int j = 0; j < data.length; j++) { push(data[j]); } @@ -664,15 +664,15 @@ public class Interpreter { * ROLL the top three stack elements */ private void _roll() { - int a = pop(); - int b = pop(); - int c = pop(); + final int a = pop(); + final int b = pop(); + final int c = pop(); push(b); push(a); push(c); } - private void _round(short param) { + private void _round(final short param) { pop(); push(0); } @@ -907,7 +907,7 @@ public class Interpreter { /** * Set Dual Projection_Vector To Line */ - private void _sdpvtl(short param) { + private void _sdpvtl(final short param) { pop(); pop(); } @@ -930,7 +930,7 @@ public class Interpreter { /* * Set Freedom_Vector to Coordinate Axis */ - private void _sfvtca(short param) { + private void _sfvtca(final short param) { if (param == 1) { gs.freedom_vector[0] = 0x4000; gs.freedom_vector[1] = 0x0000; @@ -943,7 +943,7 @@ public class Interpreter { /* * Set Freedom_Vector To Line */ - private void _sfvtl(short param) { + private void _sfvtl(final short param) { pop(); pop(); if (param == 1) { @@ -963,7 +963,7 @@ public class Interpreter { gs.freedom_vector[1] = gs.projection_vector[1]; } - private void _shc(short param) { + private void _shc(final short param) { pop(); } @@ -972,7 +972,7 @@ public class Interpreter { * * USES: loop */ - private void _shp(short param) { + private void _shp(final short param) { while(gs.loop-- > 0) { pop(); if(param == 0) { @@ -995,7 +995,7 @@ public class Interpreter { gs.loop = 1; } - private void _shz(short param) { + private void _shz(final short param) { pop(); } @@ -1024,7 +1024,7 @@ public class Interpreter { /* * Set Projection_Vector To Coordinate Axis */ - private void _spvtca(short param) { + private void _spvtca(final short param) { if (param == 1) { gs.projection_vector[0] = 0x4000; gs.projection_vector[1] = 0x0000; @@ -1037,14 +1037,14 @@ public class Interpreter { /** * Set Projection_Vector To Line */ - private void _spvtl(short param) { + private void _spvtl(final short param) { // We'll get a copy of the line and normalize it - // divide the x- and y-coords by the vector's dot product. - Point p1 = zone[gs.zp2][pop()]; - Point p2 = zone[gs.zp1][pop()]; - int x = p2.x - p1.x; - int y = p2.y - p1.y; + final Point p1 = zone[gs.zp2][pop()]; + final Point p2 = zone[gs.zp1][pop()]; + final int x = p2.x - p1.x; + final int y = p2.y - p1.y; if(param == 1) { gs.projection_vector[0] = 0x0000; gs.projection_vector[1] = 0x0000; @@ -1097,15 +1097,15 @@ public class Interpreter { * SUBtract */ private void _sub() { - int n1 = pop(); - int n2 = pop(); + final int n1 = pop(); + final int n2 = pop(); push(n2 - n1); } /** * Set freedom and projection Vectors To Coordinate Axis */ - private void _svtca(short param) { + private void _svtca(final short param) { if (param == 1) { gs.projection_vector[0] = 0x4000; gs.projection_vector[1] = 0x0000; @@ -1123,8 +1123,8 @@ public class Interpreter { * SWAP the top two elements on the stack */ private void _swap() { - int n1 = pop(); - int n2 = pop(); + final int n1 = pop(); + final int n2 = pop(); push(n1); push(n2); } @@ -1165,7 +1165,7 @@ public class Interpreter { * Write Control Value Table in FUnits */ private void _wcvtf() { - int value = pop(); + final int value = pop(); // Conversion of value goes here cvt[pop()] = value; } @@ -1174,7 +1174,7 @@ public class Interpreter { * Write Control Value Table in Pixel units */ private void _wcvtp() { - int value = pop(); + final int value = pop(); // Conversion of value goes here cvt[pop()] = value; } @@ -1188,7 +1188,7 @@ public class Interpreter { public void execute(int ip) { while (ip < ((ip & 0xffff0000) | parser.getISLength(ip >> 16))) { - short opcode = parser.getOpcode(ip); + final short opcode = parser.getOpcode(ip); if (inFuncDef) { // We're within a function definition, so don't execute the code @@ -1332,7 +1332,7 @@ public class Interpreter { return stack[--stackIndex]; } - private void push(int i) { + private void push(final int i) { stack[stackIndex++] = i; } @@ -1351,7 +1351,7 @@ public class Interpreter { } } - public void setParser(Parser p) { + public void setParser(final Parser p) { parser = p; } } diff --git a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Parser.java b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Parser.java index 1159b2c17..ff1795a28 100644 --- a/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Parser.java +++ b/src/jogl/classes/jogamp/graph/font/typecast/tt/engine/Parser.java @@ -28,7 +28,7 @@ import jogamp.graph.font.typecast.ot.Mnemonic; */ public class Parser { - private short[][] instructions = new short[3][]; + private final short[][] instructions = new short[3][]; /** * Advance the instruction pointer to the next executable opcode. @@ -41,7 +41,7 @@ public class Parser { public int advanceIP(int ip) { // The high word specifies font, cvt, or glyph program - int prog = ip >> 16; + final int prog = ip >> 16; int i = ip & 0xffff; int dataCount; ip++; @@ -63,16 +63,16 @@ public class Parser { return ip; } - public int getISLength(int prog) { + public int getISLength(final int prog) { return instructions[prog].length; } - public short getOpcode(int ip) { + public short getOpcode(final int ip) { return instructions[ip >> 16][ip & 0xffff]; } - public short getPushCount(int ip) { - short instr = instructions[ip >> 16][ip & 0xffff]; + public short getPushCount(final int ip) { + final short instr = instructions[ip >> 16][ip & 0xffff]; if ((Mnemonic.NPUSHB == instr) || (Mnemonic.NPUSHW == instr)) { return instructions[ip >> 16][(ip & 0xffff) + 1]; } else if ((Mnemonic.PUSHB == (instr & 0xf8)) || (Mnemonic.PUSHW == (instr & 0xf8))) { @@ -81,12 +81,12 @@ public class Parser { return 0; } - public int[] getPushData(int ip) { - int count = getPushCount(ip); - int[] data = new int[count]; - int prog = ip >> 16; - int i = ip & 0xffff; - short instr = instructions[prog][i]; + public int[] getPushData(final int ip) { + final int count = getPushCount(ip); + final int[] data = new int[count]; + final int prog = ip >> 16; + final int i = ip & 0xffff; + final short instr = instructions[prog][i]; if (Mnemonic.NPUSHB == instr) { for (int j = 0; j < count; j++) { data[j] = instructions[prog][i + j + 2]; @@ -114,7 +114,7 @@ public class Parser { return ip; } - public int handleIf(boolean test, int ip) { + public int handleIf(final boolean test, int ip) { if (test == false) { // The TrueType spec says that we merely jump to the *next* ELSE or EIF // instruction in the instruction stream. So therefore no nesting! @@ -130,32 +130,32 @@ public class Parser { /** * This program is run everytime we scale the font */ - public void setCvtProgram(short[] program) { + public void setCvtProgram(final short[] program) { instructions[1] = program; } /** * This program is only run once */ - public void setFontProgram(short[] program) { + public void setFontProgram(final short[] program) { instructions[0] = program; } /** * This program is run everytime we scale the glyph */ - public void setGlyphProgram(short[] program) { + public void setGlyphProgram(final short[] program) { instructions[2] = program; } @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); int ip = 0; while (ip < instructions[0].length) { sb.append(Mnemonic.getMnemonic(getOpcode(ip))); if (getPushCount(ip) > 0) { - int[] data = getPushData(ip); + final int[] data = getPushData(ip); for(int j = 0; j < data.length; j++) sb.append(" ").append(data[j]); } @@ -167,7 +167,7 @@ public class Parser { while (ip < (0x10000 | instructions[1].length)) { sb.append(Mnemonic.getMnemonic(getOpcode(ip))); if(getPushCount(ip) > 0) { - int[] data = getPushData(ip); + final int[] data = getPushData(ip); for (int j = 0; j < data.length; j++) { sb.append(" ").append(data[j]); } @@ -180,7 +180,7 @@ public class Parser { while (ip < (0x20000 | instructions[2].length)) { sb.append(Mnemonic.getMnemonic(getOpcode(ip))); if (getPushCount(ip) > 0) { - int[] data = getPushData(ip); + final int[] data = getPushData(ip); for (int j = 0; j < data.length; j++) { sb.append(" ").append(data[j]); } diff --git a/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java b/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java index 2a30fa6ec..909240c76 100644 --- a/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java +++ b/src/jogl/classes/jogamp/graph/geom/plane/AffineTransform.java @@ -69,7 +69,7 @@ public class AffineTransform implements Cloneable { setToIdentity(); } - public AffineTransform(AffineTransform t) { + public AffineTransform(final AffineTransform t) { this.type = t.type; this.m00 = t.m00; this.m10 = t.m10; @@ -79,7 +79,7 @@ public class AffineTransform implements Cloneable { this.m12 = t.m12; } - public AffineTransform(float m00, float m10, float m01, float m11, float m02, float m12) { + public AffineTransform(final float m00, final float m10, final float m01, final float m11, final float m02, final float m12) { this.type = TYPE_UNKNOWN; this.m00 = m00; this.m10 = m10; @@ -89,7 +89,7 @@ public class AffineTransform implements Cloneable { this.m12 = m12; } - public AffineTransform(float[] matrix) { + public AffineTransform(final float[] matrix) { this.type = TYPE_UNKNOWN; m00 = matrix[0]; m10 = matrix[1]; @@ -144,8 +144,8 @@ public class AffineTransform implements Cloneable { type |= TYPE_FLIP; } - float dx = m00 * m00 + m10 * m10; - float dy = m01 * m01 + m11 * m11; + final float dx = m00 * m00 + m10 * m10; + final float dy = m01 * m01 + m11 * m11; if (dx != dy) { type |= TYPE_GENERAL_SCALE; } else @@ -193,7 +193,7 @@ public class AffineTransform implements Cloneable { return getType() == TYPE_IDENTITY; } - public final void getMatrix(float[] matrix) { + public final void getMatrix(final float[] matrix) { matrix[0] = m00; matrix[1] = m10; matrix[2] = m01; @@ -208,7 +208,7 @@ public class AffineTransform implements Cloneable { return m00 * m11 - m01 * m10; } - public final AffineTransform setTransform(float m00, float m10, float m01, float m11, float m02, float m12) { + public final AffineTransform setTransform(final float m00, final float m10, final float m01, final float m11, final float m02, final float m12) { this.type = TYPE_UNKNOWN; this.m00 = m00; this.m10 = m10; @@ -219,7 +219,7 @@ public class AffineTransform implements Cloneable { return this; } - public final AffineTransform setTransform(AffineTransform t) { + public final AffineTransform setTransform(final AffineTransform t) { type = t.type; setTransform(t.m00, t.m10, t.m01, t.m11, t.m02, t.m12); return this; @@ -232,7 +232,7 @@ public class AffineTransform implements Cloneable { return this; } - public final AffineTransform setToTranslation(float mx, float my) { + public final AffineTransform setToTranslation(final float mx, final float my) { m00 = m11 = 1.0f; m01 = m10 = 0.0f; m02 = mx; @@ -245,7 +245,7 @@ public class AffineTransform implements Cloneable { return this; } - public final AffineTransform setToScale(float scx, float scy) { + public final AffineTransform setToScale(final float scx, final float scy) { m00 = scx; m11 = scy; m10 = m01 = m02 = m12 = 0.0f; @@ -257,7 +257,7 @@ public class AffineTransform implements Cloneable { return this; } - public final AffineTransform setToShear(float shx, float shy) { + public final AffineTransform setToShear(final float shx, final float shy) { m00 = m11 = 1.0f; m02 = m12 = 0.0f; m01 = shx; @@ -270,7 +270,7 @@ public class AffineTransform implements Cloneable { return this; } - public final AffineTransform setToRotation(float angle) { + public final AffineTransform setToRotation(final float angle) { float sin = FloatUtil.sin(angle); float cos = FloatUtil.cos(angle); if (FloatUtil.abs(cos) < ZERO) { @@ -289,7 +289,7 @@ public class AffineTransform implements Cloneable { return this; } - public final AffineTransform setToRotation(float angle, float px, float py) { + public final AffineTransform setToRotation(final float angle, final float px, final float py) { setToRotation(angle); m02 = px * (1.0f - m00) + py * m10; m12 = py * (1.0f - m00) - px * m10; @@ -297,23 +297,23 @@ public class AffineTransform implements Cloneable { return this; } - public final AffineTransform translate(float mx, float my, AffineTransform tmp) { + public final AffineTransform translate(final float mx, final float my, final AffineTransform tmp) { return concatenate(tmp.setToTranslation(mx, my)); } - public final AffineTransform scale(float scx, float scy, AffineTransform tmp) { + public final AffineTransform scale(final float scx, final float scy, final AffineTransform tmp) { return concatenate(tmp.setToScale(scx, scy)); } - public final AffineTransform shear(float shx, float shy, AffineTransform tmp) { + public final AffineTransform shear(final float shx, final float shy, final AffineTransform tmp) { return concatenate(tmp.setToShear(shx, shy)); } - public final AffineTransform rotate(float angle, AffineTransform tmp) { + public final AffineTransform rotate(final float angle, final AffineTransform tmp) { return concatenate(tmp.setToRotation(angle)); } - public final AffineTransform rotate(float angle, float px, float py, AffineTransform tmp) { + public final AffineTransform rotate(final float angle, final float px, final float py, final AffineTransform tmp) { return concatenate(tmp.setToRotation(angle, px, py)); } @@ -345,7 +345,7 @@ public class AffineTransform implements Cloneable { * @param tR the right-argument of the matrix multiplication * @return this transform for chaining */ - public final AffineTransform concatenate(AffineTransform tR) { + public final AffineTransform concatenate(final AffineTransform tR) { // setTransform(multiply(this, tR)); type = TYPE_UNKNOWN; setTransform( @@ -369,7 +369,7 @@ public class AffineTransform implements Cloneable { * @param tL the left-argument of the matrix multiplication * @return this transform for chaining */ - public final AffineTransform preConcatenate(AffineTransform tL) { + public final AffineTransform preConcatenate(final AffineTransform tL) { // setTransform(multiply(tL, this)); type = TYPE_UNKNOWN; setTransform( @@ -383,7 +383,7 @@ public class AffineTransform implements Cloneable { } public final AffineTransform createInverse() throws NoninvertibleTransformException { - float det = getDeterminant(); + final float det = getDeterminant(); if (FloatUtil.abs(det) < ZERO) { throw new NoninvertibleTransformException(determinantIsZero); } @@ -425,8 +425,8 @@ public class AffineTransform implements Cloneable { public final void transform(final Vertex[] src, int srcOff, final Vertex[] dst, int dstOff, int length) { while (--length >= 0) { - Vertex srcPoint = src[srcOff++]; - Vertex dstPoint = dst[dstOff]; + final Vertex srcPoint = src[srcOff++]; + final Vertex dstPoint = dst[dstOff]; if (dstPoint == null) { throw new IllegalArgumentException("dst["+dstOff+"] is null"); } @@ -489,8 +489,8 @@ public class AffineTransform implements Cloneable { public final void deltaTransform(final float[] src, int srcOff, final float[] dst, int dstOff, int length) { while (--length >= 0) { - float x = src[srcOff++]; - float y = src[srcOff++]; + final float x = src[srcOff++]; + final float y = src[srcOff++]; dst[dstOff++] = x * m00 + y * m01; dst[dstOff++] = x * m10 + y * m11; } @@ -504,7 +504,7 @@ public class AffineTransform implements Cloneable { * @throws NoninvertibleTransformException */ public final Vertex inverseTransform(final Vertex src, final Vertex dst) throws NoninvertibleTransformException { - float det = getDeterminant(); + final float det = getDeterminant(); if (FloatUtil.abs(det) < ZERO) { throw new NoninvertibleTransformException(determinantIsZero); } @@ -517,28 +517,28 @@ public class AffineTransform implements Cloneable { public final void inverseTransform(final float[] src, int srcOff, final float[] dst, int dstOff, int length) throws NoninvertibleTransformException { - float det = getDeterminant(); + final float det = getDeterminant(); if (FloatUtil.abs(det) < ZERO) { throw new NoninvertibleTransformException(determinantIsZero); } while (--length >= 0) { - float x = src[srcOff++] - m02; - float y = src[srcOff++] - m12; + final float x = src[srcOff++] - m02; + final float y = src[srcOff++] - m12; dst[dstOff++] = (x * m11 - y * m01) / det; dst[dstOff++] = (y * m00 - x * m10) / det; } } - public final Path2D createTransformedShape(Path2D src) { + public final Path2D createTransformedShape(final Path2D src) { if (src == null) { return null; } if (src instanceof Path2D) { return src.createTransformedShape(this); } - PathIterator path = src.iterator(this); - Path2D dst = new Path2D(path.getWindingRule()); + final PathIterator path = src.iterator(this); + final Path2D dst = new Path2D(path.getWindingRule()); dst.append(path, false); return dst; } @@ -555,7 +555,7 @@ public class AffineTransform implements Cloneable { public final AffineTransform clone() { try { return (AffineTransform) super.clone(); - } catch (CloneNotSupportedException e) { + } catch (final CloneNotSupportedException e) { throw new InternalError(); } } @@ -573,12 +573,12 @@ public class AffineTransform implements Cloneable { } */ @Override - public final boolean equals(Object obj) { + public final boolean equals(final Object obj) { if (obj == this) { return true; } if (obj instanceof AffineTransform) { - AffineTransform t = (AffineTransform)obj; + final AffineTransform t = (AffineTransform)obj; return m00 == t.m00 && m01 == t.m01 && m02 == t.m02 && m10 == t.m10 && diff --git a/src/jogl/classes/jogamp/graph/geom/plane/Crossing.java b/src/jogl/classes/jogamp/graph/geom/plane/Crossing.java index 982575b53..f46dd3c94 100644 --- a/src/jogl/classes/jogamp/graph/geom/plane/Crossing.java +++ b/src/jogl/classes/jogamp/graph/geom/plane/Crossing.java @@ -51,10 +51,10 @@ public class Crossing { * @param res - the roots of the equation * @return a number of roots */ - public static int solveQuad(float eqn[], float res[]) { - float a = eqn[2]; - float b = eqn[1]; - float c = eqn[0]; + public static int solveQuad(final float eqn[], final float res[]) { + final float a = eqn[2]; + final float b = eqn[1]; + final float c = eqn[0]; int rc = 0; if (a == 0.0) { if (b == 0.0) { @@ -83,26 +83,26 @@ public class Crossing { * @param res - the roots of the equation * @return a number of roots */ - public static int solveCubic(float eqn[], float res[]) { - float d = eqn[3]; + public static int solveCubic(final float eqn[], final float res[]) { + final float d = eqn[3]; if (d == 0) { return solveQuad(eqn, res); } - float a = eqn[2] / d; - float b = eqn[1] / d; - float c = eqn[0] / d; + final float a = eqn[2] / d; + final float b = eqn[1] / d; + final float c = eqn[0] / d; int rc = 0; - float Q = (a * a - 3.0f * b) / 9.0f; - float R = (2.0f * a * a * a - 9.0f * a * b + 27.0f * c) / 54.0f; - float Q3 = Q * Q * Q; - float R2 = R * R; - float n = - a / 3.0f; + final float Q = (a * a - 3.0f * b) / 9.0f; + final float R = (2.0f * a * a * a - 9.0f * a * b + 27.0f * c) / 54.0f; + final float Q3 = Q * Q * Q; + final float R2 = R * R; + final float n = - a / 3.0f; if (R2 < Q3) { - float t = FloatUtil.acos(R / FloatUtil.sqrt(Q3)) / 3.0f; - float p = 2.0f * FloatUtil.PI / 3.0f; - float m = -2.0f * FloatUtil.sqrt(Q); + final float t = FloatUtil.acos(R / FloatUtil.sqrt(Q3)) / 3.0f; + final float p = 2.0f * FloatUtil.PI / 3.0f; + final float m = -2.0f * FloatUtil.sqrt(Q); res[rc++] = m * FloatUtil.cos(t) + n; res[rc++] = m * FloatUtil.cos(t + p) + n; res[rc++] = m * FloatUtil.cos(t - p) + n; @@ -116,10 +116,10 @@ public class Crossing { if (-ROOT_DELTA < A && A < ROOT_DELTA) { res[rc++] = n; } else { - float B = Q / A; + final float B = Q / A; res[rc++] = A + B + n; // if (R2 == Q3) { - float delta = R2 - Q3; + final float delta = R2 - Q3; if (-ROOT_DELTA < delta && delta < ROOT_DELTA) { res[rc++] = - (A + B) / 2.0f + n; } @@ -135,7 +135,7 @@ public class Crossing { * @param rc - the roots count * @return new roots count */ - static int fixRoots(float res[], int rc) { + static int fixRoots(final float res[], final int rc) { int tc = 0; for(int i = 0; i < rc; i++) { out: { @@ -158,7 +158,7 @@ public class Crossing { float ax, ay, bx, by; float Ax, Ay, Bx, By; - public QuadCurve(float x1, float y1, float cx, float cy, float x2, float y2) { + public QuadCurve(final float x1, final float y1, final float cx, final float cy, final float x2, final float y2) { ax = x2 - x1; ay = y2 - y1; bx = cx - x1; @@ -171,11 +171,11 @@ public class Crossing { Ay = ay - By; // Ay = ay - 2.0 * by } - int cross(float res[], int rc, float py1, float py2) { + int cross(final float res[], final int rc, final float py1, final float py2) { int cross = 0; for (int i = 0; i < rc; i++) { - float t = res[i]; + final float t = res[i]; // CURVE-OUTSIDE if (t < -DELTA || t > 1 + DELTA) { @@ -196,10 +196,10 @@ public class Crossing { continue; } // CURVE-INSIDE - float ry = t * (t * Ay + By); + final float ry = t * (t * Ay + By); // ry = t * t * Ay + t * By if (ry > py2) { - float rxt = t * Ax + bx; + final float rxt = t * Ax + bx; // rxt = 2.0 * t * Ax + Bx = 2.0 * t * Ax + 2.0 * bx if (rxt > -DELTA && rxt < DELTA) { continue; @@ -211,12 +211,12 @@ public class Crossing { return cross; } - int solvePoint(float res[], float px) { - float eqn[] = {-px, Bx, Ax}; + int solvePoint(final float res[], final float px) { + final float eqn[] = {-px, Bx, Ax}; return solveQuad(eqn, res); } - int solveExtrem(float res[]) { + int solveExtrem(final float res[]) { int rc = 0; if (Ax != 0.0) { res[rc++] = - Bx / (Ax + Ax); @@ -227,11 +227,11 @@ public class Crossing { return rc; } - int addBound(float bound[], int bc, float res[], int rc, float minX, float maxX, boolean changeId, int id) { + int addBound(final float bound[], int bc, final float res[], final int rc, final float minX, final float maxX, final boolean changeId, int id) { for(int i = 0; i < rc; i++) { - float t = res[i]; + final float t = res[i]; if (t > -DELTA && t < 1 + DELTA) { - float rx = t * (t * Ax + Bx); + final float rx = t * (t * Ax + Bx); if (minX <= rx && rx <= maxX) { bound[bc++] = t; bound[bc++] = rx; @@ -257,7 +257,7 @@ public class Crossing { float Ax, Ay, Bx, By, Cx, Cy; float Ax3, Bx2; - public CubicCurve(float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2) { + public CubicCurve(final float x1, final float y1, final float cx1, final float cy1, final float cx2, final float cy2, final float x2, final float y2) { ax = x2 - x1; ay = y2 - y1; bx = cx1 - x1; @@ -277,10 +277,10 @@ public class Crossing { Bx2 = Bx + Bx; } - int cross(float res[], int rc, float py1, float py2) { + int cross(final float res[], final int rc, final float py1, final float py2) { int cross = 0; for (int i = 0; i < rc; i++) { - float t = res[i]; + final float t = res[i]; // CURVE-OUTSIDE if (t < -DELTA || t > 1 + DELTA) { @@ -301,7 +301,7 @@ public class Crossing { continue; } // CURVE-INSIDE - float ry = t * (t * (t * Ay + By) + Cy); + final float ry = t * (t * (t * Ay + By) + Cy); // ry = t * t * t * Ay + t * t * By + t * Cy if (ry > py2) { float rxt = t * (t * Ax3 + Bx2) + Cx; @@ -322,26 +322,26 @@ public class Crossing { return cross; } - int solvePoint(float res[], float px) { - float eqn[] = {-px, Cx, Bx, Ax}; + int solvePoint(final float res[], final float px) { + final float eqn[] = {-px, Cx, Bx, Ax}; return solveCubic(eqn, res); } - int solveExtremX(float res[]) { - float eqn[] = {Cx, Bx2, Ax3}; + int solveExtremX(final float res[]) { + final float eqn[] = {Cx, Bx2, Ax3}; return solveQuad(eqn, res); } - int solveExtremY(float res[]) { - float eqn[] = {Cy, By + By, Ay + Ay + Ay}; + int solveExtremY(final float res[]) { + final float eqn[] = {Cy, By + By, Ay + Ay + Ay}; return solveQuad(eqn, res); } - int addBound(float bound[], int bc, float res[], int rc, float minX, float maxX, boolean changeId, int id) { + int addBound(final float bound[], int bc, final float res[], final int rc, final float minX, final float maxX, final boolean changeId, int id) { for(int i = 0; i < rc; i++) { - float t = res[i]; + final float t = res[i]; if (t > -DELTA && t < 1 + DELTA) { - float rx = t * (t * (t * Ax + Bx) + Cx); + final float rx = t * (t * (t * Ax + Bx) + Cx); if (minX <= rx && rx <= maxX) { bound[bc++] = t; bound[bc++] = rx; @@ -361,7 +361,7 @@ public class Crossing { /** * Returns how many times ray from point (x,y) cross line. */ - public static int crossLine(float x1, float y1, float x2, float y2, float x, float y) { + public static int crossLine(final float x1, final float y1, final float x2, final float y2, final float x, final float y) { // LEFT/RIGHT/UP/EMPTY if ((x < x1 && x < x2) || @@ -399,7 +399,7 @@ public class Crossing { /** * Returns how many times ray from point (x,y) cross quard curve */ - public static int crossQuad(float x1, float y1, float cx, float cy, float x2, float y2, float x, float y) { + public static int crossQuad(final float x1, final float y1, final float cx, final float cy, final float x2, final float y2, final float x, final float y) { // LEFT/RIGHT/UP/EMPTY if ((x < x1 && x < cx && x < x2) || @@ -419,11 +419,11 @@ public class Crossing { } // INSIDE - QuadCurve c = new QuadCurve(x1, y1, cx, cy, x2, y2); - float px = x - x1; - float py = y - y1; - float res[] = new float[3]; - int rc = c.solvePoint(res, px); + final QuadCurve c = new QuadCurve(x1, y1, cx, cy, x2, y2); + final float px = x - x1; + final float py = y - y1; + final float res[] = new float[3]; + final int rc = c.solvePoint(res, px); return c.cross(res, rc, py, py); } @@ -431,7 +431,7 @@ public class Crossing { /** * Returns how many times ray from point (x,y) cross cubic curve */ - public static int crossCubic(float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2, float x, float y) { + public static int crossCubic(final float x1, final float y1, final float cx1, final float cy1, final float cx2, final float cy2, final float x2, final float y2, final float x, final float y) { // LEFT/RIGHT/UP/EMPTY if ((x < x1 && x < cx1 && x < cx2 && x < x2) || @@ -451,18 +451,18 @@ public class Crossing { } // INSIDE - CubicCurve c = new CubicCurve(x1, y1, cx1, cy1, cx2, cy2, x2, y2); - float px = x - x1; - float py = y - y1; - float res[] = new float[3]; - int rc = c.solvePoint(res, px); + final CubicCurve c = new CubicCurve(x1, y1, cx1, cy1, cx2, cy2, x2, y2); + final float px = x - x1; + final float py = y - y1; + final float res[] = new float[3]; + final int rc = c.solvePoint(res, px); return c.cross(res, rc, py, py); } /** * Returns how many times ray from point (x,y) cross path */ - public static int crossPath(PathIterator p, float x, float y) { + public static int crossPath(final PathIterator p, final float x, final float y) { int cross = 0; float mx, my, cx, cy; mx = my = cx = cy = 0.0f; @@ -513,7 +513,7 @@ public class Crossing { /** * Returns how many times ray from point (x,y) cross shape */ - public static int crossShape(Path2D s, float x, float y) { + public static int crossShape(final Path2D s, final float x, final float y) { if (!s.getBounds2D().contains(x, y)) { return 0; } @@ -523,14 +523,14 @@ public class Crossing { /** * Returns true if value enough small */ - public static boolean isZero(float val) { + public static boolean isZero(final float val) { return -DELTA < val && val < DELTA; } /** * Sort bound array */ - static void sortBound(float bound[], int bc) { + static void sortBound(final float bound[], final int bc) { for(int i = 0; i < bc - 4; i += 4) { int k = i; for(int j = i + 4; j < bc; j += 4) { @@ -558,7 +558,7 @@ public class Crossing { /** * Returns are bounds intersect or not intersect rectangle */ - static int crossBound(float bound[], int bc, float py1, float py2) { + static int crossBound(final float bound[], final int bc, final float py1, final float py2) { // LEFT/RIGHT if (bc == 0) { @@ -590,7 +590,7 @@ public class Crossing { sortBound(bound, bc); boolean sign = bound[2] > py2; for(int i = 6; i < bc; i += 4) { - boolean sign2 = bound[i] > py2; + final boolean sign2 = bound[i] > py2; if (sign != sign2 && bound[i + 1] != bound[i - 3]) { return CROSSING; } @@ -603,7 +603,7 @@ public class Crossing { /** * Returns how many times rectangle stripe cross line or the are intersect */ - public static int intersectLine(float x1, float y1, float x2, float y2, float rx1, float ry1, float rx2, float ry2) { + public static int intersectLine(final float x1, final float y1, final float x2, final float y2, final float rx1, final float ry1, final float rx2, final float ry2) { // LEFT/RIGHT/UP if ((rx2 < x1 && rx2 < x2) || @@ -631,9 +631,9 @@ public class Crossing { bx1 = x2 < rx1 ? rx1 : x2; bx2 = x1 < rx2 ? x1 : rx2; } - float k = (y2 - y1) / (x2 - x1); - float by1 = k * (bx1 - x1) + y1; - float by2 = k * (bx2 - x1) + y1; + final float k = (y2 - y1) / (x2 - x1); + final float by1 = k * (bx1 - x1) + y1; + final float by2 = k * (bx2 - x1) + y1; // BOUND-UP if (by1 < ry1 && by2 < ry1) { @@ -672,7 +672,7 @@ public class Crossing { /** * Returns how many times rectangle stripe cross quad curve or the are intersect */ - public static int intersectQuad(float x1, float y1, float cx, float cy, float x2, float y2, float rx1, float ry1, float rx2, float ry2) { + public static int intersectQuad(final float x1, final float y1, final float cx, final float cy, final float x2, final float y2, final float rx1, final float ry1, final float rx2, final float ry2) { // LEFT/RIGHT/UP ------------------------------------------------------ if ((rx2 < x1 && rx2 < cx && rx2 < x2) || @@ -691,15 +691,15 @@ public class Crossing { } // INSIDE ------------------------------------------------------------- - QuadCurve c = new QuadCurve(x1, y1, cx, cy, x2, y2); - float px1 = rx1 - x1; - float py1 = ry1 - y1; - float px2 = rx2 - x1; - float py2 = ry2 - y1; - - float res1[] = new float[3]; - float res2[] = new float[3]; - int rc1 = c.solvePoint(res1, px1); + final QuadCurve c = new QuadCurve(x1, y1, cx, cy, x2, y2); + final float px1 = rx1 - x1; + final float py1 = ry1 - y1; + final float px2 = rx2 - x1; + final float py2 = ry2 - y1; + + final float res1[] = new float[3]; + final float res2[] = new float[3]; + final int rc1 = c.solvePoint(res1, px1); int rc2 = c.solvePoint(res2, px2); // INSIDE-LEFT/RIGHT @@ -708,9 +708,9 @@ public class Crossing { } // Build bound -------------------------------------------------------- - float minX = px1 - DELTA; - float maxX = px2 + DELTA; - float bound[] = new float[28]; + final float minX = px1 - DELTA; + final float maxX = px2 + DELTA; + final float bound[] = new float[28]; int bc = 0; // Add roots bc = c.addBound(bound, bc, res1, rc1, minX, maxX, false, 0); @@ -733,7 +733,7 @@ public class Crossing { } // End build bound ---------------------------------------------------- - int cross = crossBound(bound, bc, py1, py2); + final int cross = crossBound(bound, bc, py1, py2); if (cross != UNKNOWN) { return cross; } @@ -743,7 +743,7 @@ public class Crossing { /** * Returns how many times rectangle stripe cross cubic curve or the are intersect */ - public static int intersectCubic(float x1, float y1, float cx1, float cy1, float cx2, float cy2, float x2, float y2, float rx1, float ry1, float rx2, float ry2) { + public static int intersectCubic(final float x1, final float y1, final float cx1, final float cy1, final float cx2, final float cy2, final float x2, final float y2, final float rx1, final float ry1, final float rx2, final float ry2) { // LEFT/RIGHT/UP if ((rx2 < x1 && rx2 < cx1 && rx2 < cx2 && rx2 < x2) || @@ -762,15 +762,15 @@ public class Crossing { } // INSIDE - CubicCurve c = new CubicCurve(x1, y1, cx1, cy1, cx2, cy2, x2, y2); - float px1 = rx1 - x1; - float py1 = ry1 - y1; - float px2 = rx2 - x1; - float py2 = ry2 - y1; - - float res1[] = new float[3]; - float res2[] = new float[3]; - int rc1 = c.solvePoint(res1, px1); + final CubicCurve c = new CubicCurve(x1, y1, cx1, cy1, cx2, cy2, x2, y2); + final float px1 = rx1 - x1; + final float py1 = ry1 - y1; + final float px2 = rx2 - x1; + final float py2 = ry2 - y1; + + final float res1[] = new float[3]; + final float res2[] = new float[3]; + final int rc1 = c.solvePoint(res1, px1); int rc2 = c.solvePoint(res2, px2); // LEFT/RIGHT @@ -778,11 +778,11 @@ public class Crossing { return 0; } - float minX = px1 - DELTA; - float maxX = px2 + DELTA; + final float minX = px1 - DELTA; + final float maxX = px2 + DELTA; // Build bound -------------------------------------------------------- - float bound[] = new float[40]; + final float bound[] = new float[40]; int bc = 0; // Add roots bc = c.addBound(bound, bc, res1, rc1, minX, maxX, false, 0); @@ -807,7 +807,7 @@ public class Crossing { } // End build bound ---------------------------------------------------- - int cross = crossBound(bound, bc, py1, py2); + final int cross = crossBound(bound, bc, py1, py2); if (cross != UNKNOWN) { return cross; } @@ -817,7 +817,7 @@ public class Crossing { /** * Returns how many times rectangle stripe cross path or the are intersect */ - public static int intersectPath(PathIterator p, float x, float y, float w, float h) { + public static int intersectPath(final PathIterator p, final float x, final float y, final float w, final float h) { int cross = 0; int count; @@ -825,10 +825,10 @@ public class Crossing { mx = my = cx = cy = 0.0f; final float coords[] = new float[6]; - float rx1 = x; - float ry1 = y; - float rx2 = x + w; - float ry2 = y + h; + final float rx1 = x; + final float ry1 = y; + final float rx2 = x + w; + final float ry2 = y + h; while (!p.isDone()) { count = 0; @@ -879,7 +879,7 @@ public class Crossing { /** * Returns how many times rectangle stripe cross shape or the are intersect */ - public static int intersectShape(Path2D s, float x, float y, float w, float h) { + public static int intersectShape(final Path2D s, final float x, final float y, final float w, final float h) { if (!s.getBounds2D().intersects2DRegion(x, y, w, h)) { return 0; } @@ -889,14 +889,14 @@ public class Crossing { /** * Returns true if cross count correspond inside location for non zero path rule */ - public static boolean isInsideNonZero(int cross) { + public static boolean isInsideNonZero(final int cross) { return cross != 0; } /** * Returns true if cross count correspond inside location for even-odd path rule */ - public static boolean isInsideEvenOdd(int cross) { + public static boolean isInsideEvenOdd(final int cross) { return (cross & 1) != 0; } } diff --git a/src/jogl/classes/jogamp/graph/geom/plane/IllegalPathStateException.java b/src/jogl/classes/jogamp/graph/geom/plane/IllegalPathStateException.java index 55211b3f9..2c18e0834 100644 --- a/src/jogl/classes/jogamp/graph/geom/plane/IllegalPathStateException.java +++ b/src/jogl/classes/jogamp/graph/geom/plane/IllegalPathStateException.java @@ -26,7 +26,7 @@ public class IllegalPathStateException extends RuntimeException { public IllegalPathStateException() { } - public IllegalPathStateException(String s) { + public IllegalPathStateException(final String s) { super(s); } diff --git a/src/jogl/classes/jogamp/graph/geom/plane/NoninvertibleTransformException.java b/src/jogl/classes/jogamp/graph/geom/plane/NoninvertibleTransformException.java index 398a03fca..6e49607b7 100644 --- a/src/jogl/classes/jogamp/graph/geom/plane/NoninvertibleTransformException.java +++ b/src/jogl/classes/jogamp/graph/geom/plane/NoninvertibleTransformException.java @@ -23,7 +23,7 @@ public class NoninvertibleTransformException extends java.lang.Exception { private static final long serialVersionUID = 6137225240503990466L; - public NoninvertibleTransformException(String s) { + public NoninvertibleTransformException(final String s) { super(s); } diff --git a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java index a87c0a0a1..3b79c28b6 100644 --- a/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java +++ b/src/jogl/classes/jogamp/graph/geom/plane/Path2D.java @@ -108,7 +108,7 @@ public final class Path2D implements Cloneable { * Constructs a new GeneralPath.Iterator for given general path * @param path - the source GeneralPath object */ - Iterator(Path2D path) { + Iterator(final Path2D path) { this(path, null); } @@ -117,7 +117,7 @@ public final class Path2D implements Cloneable { * @param path - the source GeneralPath object * @param at - the AffineTransform object to apply rectangle path */ - Iterator(Path2D path, AffineTransform at) { + Iterator(final Path2D path, final AffineTransform at) { this.p = path; this.t = at; } @@ -138,12 +138,12 @@ public final class Path2D implements Cloneable { } @Override - public int currentSegment(float[] coords) { + public int currentSegment(final float[] coords) { if (isDone()) { throw new NoSuchElementException(iteratorOutOfBounds); } - int type = p.types[typeIndex]; - int count = Path2D.pointShift[type]; + final int type = p.types[typeIndex]; + final int count = Path2D.pointShift[type]; System.arraycopy(p.points, pointIndex, coords, 0, count); if (t != null) { t.transform(coords, 0, coords, 0, count / 2); @@ -158,24 +158,24 @@ public final class Path2D implements Cloneable { this(WIND_NON_ZERO, BUFFER_SIZE); } - public Path2D(int rule) { + public Path2D(final int rule) { this(rule, BUFFER_SIZE); } - public Path2D(int rule, int initialCapacity) { + public Path2D(final int rule, final int initialCapacity) { setWindingRule(rule); types = new byte[initialCapacity]; points = new float[initialCapacity * 2]; } - public Path2D(Path2D path) { + public Path2D(final Path2D path) { this(WIND_NON_ZERO, BUFFER_SIZE); - PathIterator p = path.iterator(null); + final PathIterator p = path.iterator(null); setWindingRule(p.getWindingRule()); append(p, false); } - public void setWindingRule(int rule) { + public void setWindingRule(final int rule) { if (rule != WIND_EVEN_ODD && rule != WIND_NON_ZERO) { throw new NoSuchElementException(invalidWindingRuleValue); } @@ -190,23 +190,23 @@ public final class Path2D implements Cloneable { * Checks points and types buffer size to add pointCount points. If necessary realloc buffers to enlarge size. * @param pointCount - the point count to be added in buffer */ - void checkBuf(int pointCount, boolean checkMove) { + void checkBuf(final int pointCount, final boolean checkMove) { if (checkMove && typeSize == 0) { throw new IllegalPathStateException("First segment should be SEG_MOVETO type"); } if (typeSize == types.length) { - byte tmp[] = new byte[typeSize + BUFFER_CAPACITY]; + final byte tmp[] = new byte[typeSize + BUFFER_CAPACITY]; System.arraycopy(types, 0, tmp, 0, typeSize); types = tmp; } if (pointSize + pointCount > points.length) { - float tmp[] = new float[pointSize + Math.max(BUFFER_CAPACITY * 2, pointCount)]; + final float tmp[] = new float[pointSize + Math.max(BUFFER_CAPACITY * 2, pointCount)]; System.arraycopy(points, 0, tmp, 0, pointSize); points = tmp; } } - public void moveTo(float x, float y) { + public void moveTo(final float x, final float y) { if (typeSize > 0 && types[typeSize - 1] == PathIterator.SEG_MOVETO) { points[pointSize - 2] = x; points[pointSize - 1] = y; @@ -218,14 +218,14 @@ public final class Path2D implements Cloneable { } } - public void lineTo(float x, float y) { + public void lineTo(final float x, final float y) { checkBuf(2, true); types[typeSize++] = PathIterator.SEG_LINETO; points[pointSize++] = x; points[pointSize++] = y; } - public void quadTo(float x1, float y1, float x2, float y2) { + public void quadTo(final float x1, final float y1, final float x2, final float y2) { checkBuf(4, true); types[typeSize++] = PathIterator.SEG_QUADTO; points[pointSize++] = x1; @@ -234,7 +234,7 @@ public final class Path2D implements Cloneable { points[pointSize++] = y2; } - public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3) { + public void curveTo(final float x1, final float y1, final float x2, final float y2, final float x3, final float y3) { checkBuf(6, true); types[typeSize++] = PathIterator.SEG_CUBICTO; points[pointSize++] = x1; @@ -265,12 +265,12 @@ public final class Path2D implements Cloneable { return "[size "+size()+", closed "+isClosed()+"]"; } - public void append(Path2D path, boolean connect) { - PathIterator p = path.iterator(null); + public void append(final Path2D path, final boolean connect) { + final PathIterator p = path.iterator(null); append(p, connect); } - public void append(PathIterator path, boolean connect) { + public void append(final PathIterator path, boolean connect) { while (!path.isDone()) { final float coords[] = new float[6]; final int segmentType = path.currentSegment(coords); @@ -315,7 +315,7 @@ public final class Path2D implements Cloneable { if (types[typeSize - 1] == PathIterator.SEG_CLOSE) { for (int i = typeSize - 2; i > 0; i--) { - int type = types[i]; + final int type = types[i]; if (type == PathIterator.SEG_MOVETO) { break; } @@ -330,12 +330,12 @@ public final class Path2D implements Cloneable { pointSize = 0; } - public void transform(AffineTransform t) { + public void transform(final AffineTransform t) { t.transform(points, 0, points, 0, pointSize / 2); } - public Path2D createTransformedShape(AffineTransform t) { - Path2D p = (Path2D)clone(); + public Path2D createTransformedShape(final AffineTransform t) { + final Path2D p = (Path2D)clone(); if (t != null) { p.transform(t); } @@ -351,8 +351,8 @@ public final class Path2D implements Cloneable { ry1 = ry2 = points[i--]; rx1 = rx2 = points[i--]; while (i > 0) { - float y = points[i--]; - float x = points[i--]; + final float y = points[i--]; + final float x = points[i--]; if (x < rx1) { rx1 = x; } else @@ -375,36 +375,36 @@ public final class Path2D implements Cloneable { * @param cross - the point cross count * @return true if point is inside path, or false otherwise */ - boolean isInside(int cross) { + boolean isInside(final int cross) { if (rule == WIND_NON_ZERO) { return Crossing.isInsideNonZero(cross); } return Crossing.isInsideEvenOdd(cross); } - public boolean contains(float px, float py) { + public boolean contains(final float px, final float py) { return isInside(Crossing.crossShape(this, px, py)); } - public boolean contains(float rx, float ry, float rw, float rh) { - int cross = Crossing.intersectShape(this, rx, ry, rw, rh); + public boolean contains(final float rx, final float ry, final float rw, final float rh) { + final int cross = Crossing.intersectShape(this, rx, ry, rw, rh); return cross != Crossing.CROSSING && isInside(cross); } - public boolean intersects(float rx, float ry, float rw, float rh) { - int cross = Crossing.intersectShape(this, rx, ry, rw, rh); + public boolean intersects(final float rx, final float ry, final float rw, final float rh) { + final int cross = Crossing.intersectShape(this, rx, ry, rw, rh); return cross == Crossing.CROSSING || isInside(cross); } - public boolean contains(Vertex p) { + public boolean contains(final Vertex p) { return contains(p.getX(), p.getY()); } - public boolean contains(AABBox r) { + public boolean contains(final AABBox r) { return contains(r.getMinX(), r.getMinY(), r.getWidth(), r.getHeight()); } - public boolean intersects(AABBox r) { + public boolean intersects(final AABBox r) { return intersects(r.getMinX(), r.getMinY(), r.getWidth(), r.getHeight()); } @@ -412,7 +412,7 @@ public final class Path2D implements Cloneable { return new Iterator(this); } - public PathIterator iterator(AffineTransform t) { + public PathIterator iterator(final AffineTransform t) { return new Iterator(this, t); } @@ -423,11 +423,11 @@ public final class Path2D implements Cloneable { @Override public Object clone() { try { - Path2D p = (Path2D) super.clone(); + final Path2D p = (Path2D) super.clone(); p.types = types.clone(); p.points = points.clone(); return p; - } catch (CloneNotSupportedException e) { + } catch (final CloneNotSupportedException e) { throw new InternalError(); } } diff --git a/src/jogl/classes/jogamp/opengl/Debug.java b/src/jogl/classes/jogamp/opengl/Debug.java index 9332b670a..8fa450f51 100644 --- a/src/jogl/classes/jogamp/opengl/Debug.java +++ b/src/jogl/classes/jogamp/opengl/Debug.java @@ -63,7 +63,7 @@ public class Debug extends PropertyAccess { verbose = isPropertyDefined("jogl.verbose", true); debugAll = isPropertyDefined("jogl.debug", true); if (verbose) { - Package p = Package.getPackage("javax.media.opengl"); + final Package p = Package.getPackage("javax.media.opengl"); System.err.println("JOGL specification version " + p.getSpecificationVersion()); System.err.println("JOGL implementation version " + p.getImplementationVersion()); System.err.println("JOGL implementation vendor " + p.getImplementationVendor()); @@ -81,7 +81,7 @@ public class Debug extends PropertyAccess { return debugAll; } - public static final boolean debug(String subcomponent) { + public static final boolean debug(final String subcomponent) { return debugAll() || isPropertyDefined("jogl.debug." + subcomponent, true); } } diff --git a/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java index 578f416b7..270a65882 100644 --- a/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLibraryBundleInfo.java @@ -49,7 +49,7 @@ public abstract class DesktopGLDynamicLibraryBundleInfo extends GLDynamicLibrary } @Override - public final boolean useToolGetProcAdressFirst(String funcName) { + public final boolean useToolGetProcAdressFirst(final String funcName) { return true; } diff --git a/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java b/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java index c1e1d1821..6025b45ff 100644 --- a/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java +++ b/src/jogl/classes/jogamp/opengl/DesktopGLDynamicLookupHelper.java @@ -33,7 +33,7 @@ import java.util.*; public class DesktopGLDynamicLookupHelper extends GLDynamicLookupHelper { - public DesktopGLDynamicLookupHelper(DesktopGLDynamicLibraryBundleInfo info) { + public DesktopGLDynamicLookupHelper(final DesktopGLDynamicLibraryBundleInfo info) { super(info); } @@ -43,7 +43,7 @@ public class DesktopGLDynamicLookupHelper extends GLDynamicLookupHelper { public final synchronized boolean loadGLULibrary() { /** hacky code .. where all platform GLU libs are tried ..*/ if(null==gluLib) { - List gluLibNames = new ArrayList(); + final List gluLibNames = new ArrayList(); gluLibNames.add("/System/Library/Frameworks/OpenGL.framework/Libraries/libGLU.dylib"); // osx gluLibNames.add("libGLU.so"); // unix gluLibNames.add("GLU32"); // windows diff --git a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java index fd59ecfd4..1b33e1a8b 100644 --- a/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java +++ b/src/jogl/classes/jogamp/opengl/ExtensionAvailabilityCache.java @@ -44,6 +44,7 @@ import java.util.HashMap; import java.util.StringTokenizer; import javax.media.opengl.GL; +import javax.media.opengl.GL2ES3; import javax.media.opengl.GL2GL3; import javax.media.opengl.GLContext; @@ -77,7 +78,7 @@ final class ExtensionAvailabilityCache { /** * Flush and rebuild the cache. */ - final void reset(GLContextImpl context) { + final void reset(final GLContextImpl context) { flush(); initAvailableExtensions(context); } @@ -91,7 +92,7 @@ final class ExtensionAvailabilityCache { return availableExtensionCache.size(); } - final boolean isExtensionAvailable(String glExtensionName) { + final boolean isExtensionAvailable(final String glExtensionName) { validateInitialization(); return null != availableExtensionCache.get(glExtensionName); } @@ -124,8 +125,8 @@ final class ExtensionAvailabilityCache { throw new InternalError("ExtensionAvailabilityCache not initialized!"); } } - private final void initAvailableExtensions(GLContextImpl context) { - GL gl = context.getGL(); + private final void initAvailableExtensions(final GLContextImpl context) { + final GL gl = context.getGL(); // if hash is empty (meaning it was flushed), pre-cache it with the list // of extensions that are in the GL_EXTENSIONS string if (isInitialized()) { @@ -155,14 +156,14 @@ final class ExtensionAvailabilityCache { } if(useGetStringi) { - GL2GL3 gl2gl3 = gl.getGL2GL3(); + final GL2GL3 gl2gl3 = gl.getGL2GL3(); final int count; { - int[] val = { 0 } ; - gl2gl3.glGetIntegerv(GL2GL3.GL_NUM_EXTENSIONS, val, 0); + final int[] val = { 0 } ; + gl2gl3.glGetIntegerv(GL2ES3.GL_NUM_EXTENSIONS, val, 0); count = val[0]; } - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); for (int i = 0; i < count; i++) { final String ext = gl2gl3.glGetStringi(GL.GL_EXTENSIONS, i); if( null == availableExtensionCache.put(ext, ext) ) { @@ -229,8 +230,8 @@ final class ExtensionAvailabilityCache { final int ctxOptions = context.getCtxOptions(); final VersionNumber version = context.getGLVersionNumber(); - int major[] = new int[] { version.getMajor() }; - int minor[] = new int[] { version.getMinor() }; + final int major[] = new int[] { version.getMajor() }; + final int minor[] = new int[] { version.getMinor() }; do{ final String GL_XX_VERSION = ( context.isGLES() ? "GL_ES_VERSION_" : "GL_VERSION_" ) + major[0] + "_" + minor[0]; availableExtensionCache.put(GL_XX_VERSION, GL_XX_VERSION); diff --git a/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java b/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java index 08a1fe882..d7ac6eb1e 100644 --- a/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java +++ b/src/jogl/classes/jogamp/opengl/FPSCounterImpl.java @@ -60,11 +60,11 @@ public class FPSCounterImpl implements FPSCounter { final long now = TimeUnit.NANOSECONDS.toMillis(System.nanoTime()); fpsLastPeriod = now - fpsLastUpdateTime; fpsLastPeriod = Math.max(fpsLastPeriod, 1); // div 0 - fpsLast = ( (float)fpsUpdateFramesInterval * 1000f ) / ( (float) fpsLastPeriod ) ; + fpsLast = ( fpsUpdateFramesInterval * 1000f ) / ( fpsLastPeriod ) ; fpsTotalDuration = now - fpsStartTime; fpsTotalDuration = Math.max(fpsTotalDuration, 1); // div 0 - fpsTotal= ( (float)fpsTotalFrames * 1000f ) / ( (float) fpsTotalDuration ) ; + fpsTotal= ( fpsTotalFrames * 1000f ) / ( fpsTotalDuration ) ; if(null != fpsOutputStream) { fpsOutputStream.println(toString()); @@ -93,7 +93,7 @@ public class FPSCounterImpl implements FPSCounter { } @Override - public final synchronized void setUpdateFPSFrames(int frames, PrintStream out) { + public final synchronized void setUpdateFPSFrames(final int frames, final PrintStream out) { fpsUpdateFramesInterval = frames; fpsOutputStream = out; resetFPSCounter(); diff --git a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java index 493926f25..fce5c1fcc 100644 --- a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java +++ b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java @@ -100,7 +100,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe * the drawable is created w/ it's own new instance, e.g. offscreen drawables, * and no further lifecycle handling is applied. */ - public GLAutoDrawableBase(GLDrawableImpl drawable, GLContextImpl context, boolean ownsDevice) { + public GLAutoDrawableBase(final GLDrawableImpl drawable, final GLContextImpl context, final boolean ownsDevice) { this.drawable = drawable; this.context = context; this.preserveGLELSAtDestroy = false; @@ -114,12 +114,12 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public final void setSharedContext(GLContext sharedContext) throws IllegalStateException { + public final void setSharedContext(final GLContext sharedContext) throws IllegalStateException { helper.setSharedContext(this.context, sharedContext); } @Override - public final void setSharedAutoDrawable(GLAutoDrawable sharedAutoDrawable) throws IllegalStateException { + public final void setSharedAutoDrawable(final GLAutoDrawable sharedAutoDrawable) throws IllegalStateException { helper.setSharedAutoDrawable(this, sharedAutoDrawable); } @@ -127,14 +127,14 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe protected abstract RecursiveLock getLock(); @Override - public final GLStateKeeper.Listener setGLStateKeeperListener(Listener l) { + public final GLStateKeeper.Listener setGLStateKeeperListener(final Listener l) { final GLStateKeeper.Listener pre = glStateKeeperListener; glStateKeeperListener = l; return pre; } @Override - public final boolean preserveGLStateAtDestroy(boolean value) { + public final boolean preserveGLStateAtDestroy(final boolean value) { final boolean res = isGLStatePreservationSupported() ? true : false; if( res ) { if( DEBUG ) { @@ -363,7 +363,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe // so we can continue with the destruction. try { helper.disposeGL(this, context, true); - } catch (GLException gle) { + } catch (final GLException gle) { gle.printStackTrace(); } } @@ -451,7 +451,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } } - protected final GLEventListener defaultDisposeGLEventListener(GLEventListener listener, boolean remove) { + protected final GLEventListener defaultDisposeGLEventListener(final GLEventListener listener, final boolean remove) { final RecursiveLock _lock = getLock(); _lock.lock(); try { @@ -472,7 +472,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public final GLContext setContext(GLContext newCtx, boolean destroyPrevCtx) { + public final GLContext setContext(final GLContext newCtx, final boolean destroyPrevCtx) { final RecursiveLock lock = getLock(); lock.lock(); try { @@ -495,7 +495,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public final GL setGL(GL gl) { + public final GL setGL(final GL gl) { final GLContext _context = context; if (_context != null) { _context.setGL(gl); @@ -505,12 +505,12 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public final void addGLEventListener(GLEventListener listener) { + public final void addGLEventListener(final GLEventListener listener) { helper.addGLEventListener(listener); } @Override - public final void addGLEventListener(int index, GLEventListener listener) throws IndexOutOfBoundsException { + public final void addGLEventListener(final int index, final GLEventListener listener) throws IndexOutOfBoundsException { helper.addGLEventListener(index, listener); } @@ -520,7 +520,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public GLEventListener getGLEventListener(int index) throws IndexOutOfBoundsException { + public GLEventListener getGLEventListener(final int index) throws IndexOutOfBoundsException { return helper.getGLEventListener(index); } @@ -530,27 +530,27 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public boolean getGLEventListenerInitState(GLEventListener listener) { + public boolean getGLEventListenerInitState(final GLEventListener listener) { return helper.getGLEventListenerInitState(listener); } @Override - public void setGLEventListenerInitState(GLEventListener listener, boolean initialized) { + public void setGLEventListenerInitState(final GLEventListener listener, final boolean initialized) { helper.setGLEventListenerInitState(listener, initialized); } @Override - public GLEventListener disposeGLEventListener(GLEventListener listener, boolean remove) { + public GLEventListener disposeGLEventListener(final GLEventListener listener, final boolean remove) { return defaultDisposeGLEventListener(listener, remove); } @Override - public final GLEventListener removeGLEventListener(GLEventListener listener) { + public final GLEventListener removeGLEventListener(final GLEventListener listener) { return helper.removeGLEventListener(listener); } @Override - public final void setAnimator(GLAnimatorControl animatorControl) + public final void setAnimator(final GLAnimatorControl animatorControl) throws GLException { helper.setAnimator(animatorControl); } @@ -561,7 +561,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public final Thread setExclusiveContextThread(Thread t) throws GLException { + public final Thread setExclusiveContextThread(final Thread t) throws GLException { return helper.setExclusiveContextThread(t, context); } @@ -571,7 +571,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public final boolean invoke(boolean wait, GLRunnable glRunnable) { + public final boolean invoke(final boolean wait, final GLRunnable glRunnable) { return helper.invoke(this, wait, glRunnable); } @@ -581,7 +581,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public final void setAutoSwapBufferMode(boolean enable) { + public final void setAutoSwapBufferMode(final boolean enable) { helper.setAutoSwapBufferMode(enable); } @@ -591,7 +591,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public final void setContextCreationFlags(int flags) { + public final void setContextCreationFlags(final int flags) { additionalCtxCreationFlags = flags; final GLContext _context = context; if(null != _context) { @@ -609,7 +609,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe // @Override - public final void setUpdateFPSFrames(int frames, PrintStream out) { + public final void setUpdateFPSFrames(final int frames, final PrintStream out) { fpsCounter.setUpdateFPSFrames(frames, out); } @@ -679,7 +679,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public final void setRealized(boolean realized) { + public final void setRealized(final boolean realized) { final RecursiveLock _lock = getLock(); _lock.lock(); try { diff --git a/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java index 483b9b526..34857586d 100644 --- a/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java +++ b/src/jogl/classes/jogamp/opengl/GLBufferObjectTracker.java @@ -36,6 +36,7 @@ import javax.media.opengl.*; import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.IntObjectHashMap; +import com.jogamp.common.util.PropertyAccess; /** * Tracking of {@link GLBufferStorage} instances via GL API callbacks. @@ -102,7 +103,7 @@ public class GLBufferObjectTracker { static { Debug.initSingleton(); - DEBUG = Debug.isPropertyDefined("jogl.debug.GLBufferObjectTracker", true); + DEBUG = PropertyAccess.isPropertyDefined("jogl.debug.GLBufferObjectTracker", true); } static final class GLBufferStorageImpl extends GLBufferStorage { @@ -146,7 +147,7 @@ public class GLBufferObjectTracker { * @throws GLException if a native GL-Error occurs */ public synchronized final void createBufferStorage(final GLBufferStateTracker bufferStateTracker, final GL caller, - final int target, final long size, final Buffer data, int mutableUsage, int immutableFlags, + final int target, final long size, final Buffer data, final int mutableUsage, final int immutableFlags, final CreateStorageDispatch dispatch, final long glProcAddress) throws GLException { final int glerrPre = caller.glGetError(); // clear if (DEBUG && GL.GL_NO_ERROR != glerrPre) { @@ -195,7 +196,7 @@ public class GLBufferObjectTracker { * @throws GLException if a native GL-Error occurs */ public synchronized final void createBufferStorage(final GL caller, - final int bufferName, final long size, final Buffer data, final int mutableUsage, int immutableFlags, + final int bufferName, final long size, final Buffer data, final int mutableUsage, final int immutableFlags, final CreateStorageDispatch dispatch, final long glProcAddress) throws GLException { final int glerrPre = caller.glGetError(); // clear if (DEBUG && GL.GL_NO_ERROR != glerrPre) { @@ -340,7 +341,7 @@ public class GLBufferObjectTracker { */ private synchronized final GLBufferStorage mapBufferImpl(final GLBufferStateTracker bufferStateTracker, final GL caller, final int target, final boolean useRange, - long offset, long length, final int access, + final long offset, final long length, final int access, final MapBufferDispatch dispatch, final long glProcAddress) throws GLException { final int bufferName = bufferStateTracker.getBoundBufferObject(target, caller); if( 0 == bufferName ) { diff --git a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java index 511c1b9b9..9231804be 100644 --- a/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java +++ b/src/jogl/classes/jogamp/opengl/GLBufferStateTracker.java @@ -43,6 +43,7 @@ package jogamp.opengl; import javax.media.opengl.*; import com.jogamp.common.util.IntIntHashMap; +import com.jogamp.common.util.PropertyAccess; /** * Tracks as closely as possible which OpenGL buffer object is bound @@ -82,7 +83,7 @@ public class GLBufferStateTracker { static { Debug.initSingleton(); - DEBUG = Debug.isPropertyDefined("jogl.debug.GLBufferStateTracker", true); + DEBUG = PropertyAccess.isPropertyDefined("jogl.debug.GLBufferStateTracker", true); } // Maps binding targets to buffer objects. A null value indicates @@ -104,8 +105,8 @@ public class GLBufferStateTracker { setBoundBufferObject(GL.GL_ARRAY_BUFFER, 0); setBoundBufferObject(GL4.GL_DRAW_INDIRECT_BUFFER, 0); setBoundBufferObject(GL.GL_ELEMENT_ARRAY_BUFFER, 0); - setBoundBufferObject(GL2.GL_PIXEL_PACK_BUFFER, 0); - setBoundBufferObject(GL2.GL_PIXEL_UNPACK_BUFFER, 0); + setBoundBufferObject(GL2ES3.GL_PIXEL_PACK_BUFFER, 0); + setBoundBufferObject(GL2ES3.GL_PIXEL_UNPACK_BUFFER, 0); } @@ -136,8 +137,8 @@ public class GLBufferStateTracker { case GL4.GL_DRAW_INDIRECT_BUFFER: return GL4.GL_DRAW_INDIRECT_BUFFER_BINDING; case GL4.GL_DISPATCH_INDIRECT_BUFFER: return GL4.GL_DISPATCH_INDIRECT_BUFFER_BINDING; case GL.GL_ELEMENT_ARRAY_BUFFER: return GL.GL_ELEMENT_ARRAY_BUFFER_BINDING; - case GL2.GL_PIXEL_PACK_BUFFER: return GL2.GL_PIXEL_PACK_BUFFER_BINDING; - case GL2.GL_PIXEL_UNPACK_BUFFER: return GL2.GL_PIXEL_UNPACK_BUFFER_BINDING; + case GL2ES3.GL_PIXEL_PACK_BUFFER: return GL2ES3.GL_PIXEL_PACK_BUFFER_BINDING; + case GL2ES3.GL_PIXEL_UNPACK_BUFFER: return GL2ES3.GL_PIXEL_UNPACK_BUFFER_BINDING; // FIXME case GL4.GL_QUERY_BUFFER: return GL4.GL_QUERY_BUFFER_BINDING; case GL4.GL_SHADER_STORAGE_BUFFER: return GL4.GL_SHADER_STORAGE_BUFFER_BINDING; case GL2GL3.GL_TEXTURE_BUFFER: return GL2GL3.GL_TEXTURE_BINDING_BUFFER; @@ -159,8 +160,8 @@ public class GLBufferStateTracker { case GL4.GL_DRAW_INDIRECT_BUFFER: case GL4.GL_DISPATCH_INDIRECT_BUFFER: case GL.GL_ELEMENT_ARRAY_BUFFER: - case GL2.GL_PIXEL_PACK_BUFFER: - case GL2.GL_PIXEL_UNPACK_BUFFER: + case GL2ES3.GL_PIXEL_PACK_BUFFER: + case GL2ES3.GL_PIXEL_UNPACK_BUFFER: // FIXME case GL4.GL_QUERY_BUFFER: case GL4.GL_SHADER_STORAGE_BUFFER: case GL2GL3.GL_TEXTURE_BUFFER: @@ -185,7 +186,7 @@ public class GLBufferStateTracker { * @param target * @param bufferName */ - public final void setBoundBufferObject(int target, int bufferName) { + public final void setBoundBufferObject(final int target, final int bufferName) { checkTargetName(target); final int oldBufferName = bindingMap.put(target, bufferName); /*** @@ -215,7 +216,7 @@ public class GLBufferStateTracker { specified target (e.g. GL_ARRAY_BUFFER) is currently unknown. You must use isBoundBufferObjectKnown() to see whether the return value is valid. */ - public final int getBoundBufferObject(int target, GL caller) { + public final int getBoundBufferObject(final int target, final GL caller) { int value = bindingMap.get(target); if (bindingNotFound == value) { // User probably either called glPushClientAttrib / @@ -263,5 +264,5 @@ public class GLBufferStateTracker { } bindingMap.clear(); } - private final String toHexString(int i) { return Integer.toHexString(i); } + private final String toHexString(final int i) { return Integer.toHexString(i); } } diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index b88bdcdae..5671334bd 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -134,7 +134,7 @@ public abstract class GLContextImpl extends GLContext { mappedGLXProcAddress.clear(); } - public GLContextImpl(GLDrawableImpl drawable, GLContext shareWith) { + public GLContextImpl(final GLDrawableImpl drawable, final GLContext shareWith) { super(); bufferStateTracker = new GLBufferStateTracker(); @@ -162,7 +162,7 @@ public abstract class GLContextImpl extends GLContext { } @Override - protected void resetStates(boolean isInit) { + protected void resetStates(final boolean isInit) { if( !isInit ) { clearStates(); } @@ -188,7 +188,7 @@ public abstract class GLContextImpl extends GLContext { } @Override - public final GLDrawable setGLReadDrawable(GLDrawable read) { + public final GLDrawable setGLReadDrawable(final GLDrawable read) { if(!isGLReadDrawableAvailable()) { throw new GLException("Setting read drawable feature not available"); } @@ -212,7 +212,7 @@ public abstract class GLContextImpl extends GLContext { } @Override - public final GLDrawable setGLDrawable(GLDrawable readWrite, boolean setWriteOnly) { + public final GLDrawable setGLDrawable(final GLDrawable readWrite, final boolean setWriteOnly) { if( drawable == readWrite && ( setWriteOnly || drawableRead == readWrite ) ) { return drawable; // no change. } @@ -278,7 +278,7 @@ public abstract class GLContextImpl extends GLContext { } @Override - public GL setGL(GL gl) { + public GL setGL(final GL gl) { if( DEBUG ) { final String sgl1 = (null!=this.gl)?this.gl.getClass().getSimpleName()+", "+this.gl.toString():""; final String sgl2 = (null!=gl)?gl.getClass().getSimpleName()+", "+gl.toString():""; @@ -314,7 +314,7 @@ public abstract class GLContextImpl extends GLContext { public void release() throws GLException { release(false); } - private void release(boolean inDestruction) throws GLException { + private void release(final boolean inDestruction) throws GLException { if( TRACE_SWITCH ) { System.err.println(getThreadName() +": GLContext.ContextSwitch[release.0]: obj " + toHexString(hashCode()) + ", ctx "+toHexString(contextHandle)+", surf "+toHexString(drawable.getHandle())+", inDestruction: "+inDestruction+", "+lock); } @@ -339,7 +339,7 @@ public abstract class GLContextImpl extends GLContext { if( !inDestruction ) { try { contextMadeCurrent(false); - } catch (Throwable t) { + } catch (final Throwable t) { drawableContextMadeCurrentException = t; } } @@ -409,7 +409,7 @@ public abstract class GLContextImpl extends GLContext { } try { associateDrawable(false); - } catch (Throwable t) { + } catch (final Throwable t) { associateDrawableException = t; } if ( 0 != defaultVAO ) { @@ -452,7 +452,7 @@ public abstract class GLContextImpl extends GLContext { protected abstract void destroyImpl() throws GLException; @Override - public final void copy(GLContext source, int mask) throws GLException { + public final void copy(final GLContext source, final int mask) throws GLException { if (source.getHandle() == 0) { throw new GLException("Source OpenGL context has not been created"); } @@ -568,7 +568,7 @@ public abstract class GLContextImpl extends GLContext { tracker.ref(); } */ - } catch (RuntimeException e) { + } catch (final RuntimeException e) { unlockResources = true; throw e; } finally { @@ -580,7 +580,7 @@ public abstract class GLContextImpl extends GLContext { } } } /* if ( drawable.isRealized() ) */ - } catch (RuntimeException e) { + } catch (final RuntimeException e) { unlockResources = true; throw e; } finally { @@ -632,7 +632,7 @@ public abstract class GLContextImpl extends GLContext { return res; } - private final int makeCurrentWithinLock(int surfaceLockRes) throws GLException { + private final int makeCurrentWithinLock(final int surfaceLockRes) throws GLException { if (!isCreated()) { if( 0 >= drawable.getSurfaceWidth() || 0 >= drawable.getSurfaceHeight() ) { if ( DEBUG_TRACE_SWITCH ) { @@ -728,14 +728,14 @@ public abstract class GLContextImpl extends GLContext { /** * Calls {@link GLDrawableImpl#associateContext(GLContext, boolean)} */ - protected void associateDrawable(boolean bound) { + protected void associateDrawable(final boolean bound) { drawable.associateContext(this, bound); } /** * Calls {@link GLDrawableImpl#contextMadeCurrent(GLContext, boolean)} */ - protected void contextMadeCurrent(boolean current) { + protected void contextMadeCurrent(final boolean current) { drawable.contextMadeCurrent(this, current); } @@ -840,9 +840,9 @@ public abstract class GLContextImpl extends GLContext { if(DEBUG) { System.err.println(getThreadName() + ": createContextARB: Requested "+GLContext.getGLVersion(reqMajorCTP[0], 0, reqMajorCTP[0], null)); } - int _major[] = { 0 }; - int _minor[] = { 0 }; - int _ctp[] = { 0 }; + final int _major[] = { 0 }; + final int _minor[] = { 0 }; + final int _ctp[] = { 0 }; long _ctx = 0; if( GLContext.getAvailableGLVersion(device, reqMajorCTP[0], reqMajorCTP[1], _major, _minor, _ctp)) { @@ -860,7 +860,7 @@ public abstract class GLContextImpl extends GLContext { return _ctx; } - private final boolean mapGLVersions(AbstractGraphicsDevice device) { + private final boolean mapGLVersions(final AbstractGraphicsDevice device) { synchronized (GLContext.deviceVersionAvailable) { final long t0 = ( DEBUG ) ? System.nanoTime() : 0; boolean success = false; @@ -985,7 +985,7 @@ public abstract class GLContextImpl extends GLContext { * Note: Since context creation is temporary, caller need to issue {@link #resetStates(boolean)}, if creation was successful, i.e. returns true. * This method does not reset the states, allowing the caller to utilize the state variables. **/ - private final boolean createContextARBMapVersionsAvailable(int reqMajor, int reqProfile) { + private final boolean createContextARBMapVersionsAvailable(final int reqMajor, final int reqProfile) { long _context; int ctp = CTX_IS_ARB_CREATED | reqProfile; @@ -994,8 +994,8 @@ public abstract class GLContextImpl extends GLContext { // so the user can always cast to the highest available one. int majorMax, minorMax; int majorMin, minorMin; - int major[] = new int[1]; - int minor[] = new int[1]; + final int major[] = new int[1]; + final int minor[] = new int[1]; if( 4 == reqMajor ) { majorMax=4; minorMax=GLContext.getMaxMinor(ctp, majorMax); majorMin=4; minorMin=0; @@ -1034,7 +1034,7 @@ public abstract class GLContextImpl extends GLContext { } final boolean res; if( 0 != _context ) { - AbstractGraphicsDevice device = drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); + final AbstractGraphicsDevice device = drawable.getNativeSurface().getGraphicsConfiguration().getScreen().getDevice(); // ctxMajorVersion, ctxMinorVersion, ctxOptions is being set by // createContextARBVersions(..) -> setGLFunctionAvailbility(..) -> setContextVersion(..) GLContext.mapAvailableGLVersion(device, reqMajor, reqProfile, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions); @@ -1052,10 +1052,10 @@ public abstract class GLContextImpl extends GLContext { return res; } - private final long createContextARBVersions(long share, boolean direct, int ctxOptionFlags, - int majorMax, int minorMax, - int majorMin, int minorMin, - int major[], int minor[]) { + private final long createContextARBVersions(final long share, final boolean direct, final int ctxOptionFlags, + final int majorMax, final int minorMax, + final int majorMin, final int minorMin, + final int major[], final int minor[]) { major[0]=majorMax; minor[0]=minorMax; long _context=0; @@ -1097,7 +1097,7 @@ public abstract class GLContextImpl extends GLContext { * If major > 0 || minor > 0 : Use passed values, determined at creation time * Otherwise .. don't touch .. */ - private final void setContextVersion(int major, int minor, int ctp, VersionNumberString glVendorVersion, boolean useGL) { + private final void setContextVersion(final int major, final int minor, final int ctp, final VersionNumberString glVendorVersion, final boolean useGL) { if ( 0 == ctp ) { throw new GLException("Invalid GL Version "+major+"."+minor+", ctp "+toHexString(ctp)); } @@ -1126,16 +1126,16 @@ public abstract class GLContextImpl extends GLContext { // Helpers for various context implementations // - private Object createInstance(GLProfile glp, boolean glObject, Object[] cstrArgs) { + private Object createInstance(final GLProfile glp, final boolean glObject, final Object[] cstrArgs) { return ReflectionUtil.createInstance(glp.getGLCtor(glObject), cstrArgs); } - private boolean verifyInstance(GLProfile glp, String suffix, Object instance) { + private boolean verifyInstance(final GLProfile glp, final String suffix, final Object instance) { return ReflectionUtil.instanceOf(instance, glp.getGLImplBaseClassName()+suffix); } /** Create the GL for this context. */ - protected GL createGL(GLProfile glp) { + protected GL createGL(final GLProfile glp) { final GL gl = (GL) createInstance(glp, true, new Object[] { glp, this } ); /* FIXME: refactor dependence on Java 2D / JOGL bridge @@ -1152,11 +1152,11 @@ public abstract class GLContextImpl extends GLContext { * Method calls 'void finalizeInit()' of instance 'gl' as retrieved by reflection, if exist. *

*/ - private void finalizeInit(GL gl) { + private void finalizeInit(final GL gl) { Method finalizeInit = null; try { finalizeInit = ReflectionUtil.getMethod(gl.getClass(), "finalizeInit", new Class[]{ }); - } catch ( Throwable t ) { + } catch ( final Throwable t ) { if(DEBUG) { System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); @@ -1198,9 +1198,9 @@ public abstract class GLContextImpl extends GLContext { /** Maps the given "platform-independent" function name to a real function name. Currently this is only used to map "glAllocateMemoryNV" and associated routines to wglAllocateMemoryNV / glXAllocateMemoryNV. */ - protected final String mapToRealGLFunctionName(String glFunctionName) { - Map map = getFunctionNameMap(); - String lookup = ( null != map ) ? map.get(glFunctionName) : null; + protected final String mapToRealGLFunctionName(final String glFunctionName) { + final Map map = getFunctionNameMap(); + final String lookup = ( null != map ) ? map.get(glFunctionName) : null; if (lookup != null) { return lookup; } @@ -1213,9 +1213,9 @@ public abstract class GLContextImpl extends GLContext { "GL_ARB_pbuffer" to "WGL_ARB_pbuffer/GLX_SGIX_pbuffer" and "GL_ARB_pixel_format" to "WGL_ARB_pixel_format/n.a." */ - protected final String mapToRealGLExtensionName(String glExtensionName) { - Map map = getExtensionNameMap(); - String lookup = ( null != map ) ? map.get(glExtensionName) : null; + protected final String mapToRealGLExtensionName(final String glExtensionName) { + final Map map = getExtensionNameMap(); + final String lookup = ( null != map ) ? map.get(glExtensionName) : null; if (lookup != null) { return lookup; } @@ -1287,12 +1287,12 @@ public abstract class GLContextImpl extends GLContext { * Note: Non ARB ctx is limited to GL 3.0. *

*/ - private static final VersionNumber getGLVersionNumber(int ctp, String glVersionStr) { + private static final VersionNumber getGLVersionNumber(final int ctp, final String glVersionStr) { if( null != glVersionStr ) { final GLVersionNumber version = GLVersionNumber.create(glVersionStr); if ( version.isValid() ) { - int[] major = new int[] { version.getMajor() }; - int[] minor = new int[] { version.getMinor() }; + final int[] major = new int[] { version.getMajor() }; + final int[] minor = new int[] { version.getMinor() }; if ( GLContext.isValidGLVersion(ctp, major[0], minor[0]) ) { return new VersionNumber(major[0], minor[0], 0); } @@ -1308,7 +1308,7 @@ public abstract class GLContextImpl extends GLContext { * If the GL query fails, major will be zero. *

*/ - private final boolean getGLIntVersion(int[] glIntMajor, int[] glIntMinor) { + private final boolean getGLIntVersion(final int[] glIntMajor, final int[] glIntMinor) { glIntMajor[0] = 0; // clear final GLDynamicLookupHelper glDynLookupHelper = getDrawableImpl().getGLDynamicLookupHelper(); final long _glGetIntegerv = glDynLookupHelper.dynamicLookupFunction("glGetIntegerv"); @@ -1319,8 +1319,8 @@ public abstract class GLContextImpl extends GLContext { } return false; } else { - glGetIntegervInt(GL2GL3.GL_MAJOR_VERSION, glIntMajor, 0, _glGetIntegerv); - glGetIntegervInt(GL2GL3.GL_MINOR_VERSION, glIntMinor, 0, _glGetIntegerv); + glGetIntegervInt(GL2ES3.GL_MAJOR_VERSION, glIntMajor, 0, _glGetIntegerv); + glGetIntegervInt(GL2ES3.GL_MINOR_VERSION, glIntMinor, 0, _glGetIntegerv); return true; } } @@ -1361,8 +1361,8 @@ public abstract class GLContextImpl extends GLContext { * @see javax.media.opengl.GLContext#CTX_PROFILE_COMPAT * @see javax.media.opengl.GLContext#CTX_IMPL_ES2_COMPAT */ - protected final boolean setGLFunctionAvailability(boolean force, int major, int minor, int ctxProfileBits, - boolean strictMatch, boolean withinGLVersionsMapping) { + protected final boolean setGLFunctionAvailability(final boolean force, int major, int minor, int ctxProfileBits, + final boolean strictMatch, final boolean withinGLVersionsMapping) { if(null!=this.gl && null!=glProcAddressTable && !force) { return true; // already done and not forced } @@ -1666,10 +1666,10 @@ public abstract class GLContextImpl extends GLContext { } private final void setRendererQuirks(final AbstractGraphicsDevice adevice, final GLDrawableFactoryImpl factory, - int reqMajor, int reqMinor, int reqCTP, - int major, int minor, int ctp, final VersionNumberString vendorVersion, - boolean withinGLVersionsMapping) { - int[] quirks = new int[GLRendererQuirks.COUNT + 1]; // + 1 ( NoFullFBOSupport ) + final int reqMajor, final int reqMinor, final int reqCTP, + final int major, final int minor, final int ctp, final VersionNumberString vendorVersion, + final boolean withinGLVersionsMapping) { + final int[] quirks = new int[GLRendererQuirks.COUNT + 1]; // + 1 ( NoFullFBOSupport ) int i = 0; final String MesaSP = "Mesa "; @@ -1938,7 +1938,7 @@ public abstract class GLContextImpl extends GLContext { } } - private static final boolean hasFBOImpl(int major, int ctp, ExtensionAvailabilityCache extCache) { + private static final boolean hasFBOImpl(final int major, final int ctp, final ExtensionAvailabilityCache extCache) { return ( 0 != (ctp & CTX_PROFILE_ES) && major >= 2 ) || // ES >= 2.0 major >= 3 || // any >= 3.0 GL ctx (core, compat and ES) @@ -1954,7 +1954,7 @@ public abstract class GLContextImpl extends GLContext { extCache.isExtensionAvailable(GLExtensions.OES_framebuffer_object) ) ; // OES_framebuffer_object excluded } - private final void removeCachedVersion(int major, int minor, int ctxProfileBits) { + private final void removeCachedVersion(final int major, final int minor, int ctxProfileBits) { if(!isCurrentContextHardwareRasterizer()) { ctxProfileBits |= GLContext.CTX_IMPL_ACCEL_SOFT; } @@ -2006,14 +2006,14 @@ public abstract class GLContextImpl extends GLContext { protected abstract StringBuilder getPlatformExtensionsStringImpl(); @Override - public final boolean isFunctionAvailable(String glFunctionName) { + public final boolean isFunctionAvailable(final String glFunctionName) { // Check GL 1st (cached) if(null!=glProcAddressTable) { // null if this context wasn't not created try { if( glProcAddressTable.isFunctionAvailable( glFunctionName ) ) { return true; } - } catch (Exception e) {} + } catch (final Exception e) {} } // Check platform extensions 2nd (cached) - context had to be enabled once @@ -2023,25 +2023,25 @@ public abstract class GLContextImpl extends GLContext { if( pTable.isFunctionAvailable( glFunctionName ) ) { return true; } - } catch (Exception e) {} + } catch (final Exception e) {} } // dynamic function lookup at last incl name aliasing (not cached) final DynamicLookupHelper dynLookup = getDrawableImpl().getGLDynamicLookupHelper(); final String tmpBase = GLNameResolver.normalizeVEN(GLNameResolver.normalizeARB(glFunctionName, true), true); boolean res = false; - int variants = GLNameResolver.getFuncNamePermutationNumber(tmpBase); + final int variants = GLNameResolver.getFuncNamePermutationNumber(tmpBase); for(int i = 0; !res && i < variants; i++) { final String tmp = GLNameResolver.getFuncNamePermutation(tmpBase, i); try { res = dynLookup.isFunctionAvailable(tmp); - } catch (Exception e) { } + } catch (final Exception e) { } } return res; } @Override - public final boolean isExtensionAvailable(String glExtensionName) { + public final boolean isExtensionAvailable(final String glExtensionName) { if(null!=extensionAvailability) { return extensionAvailability.isExtensionAvailable(mapToRealGLExtensionName(glExtensionName)); } @@ -2081,7 +2081,7 @@ public abstract class GLContextImpl extends GLContext { return false; } - protected static String getContextFQN(AbstractGraphicsDevice device, int major, int minor, int ctxProfileBits) { + protected static String getContextFQN(final AbstractGraphicsDevice device, final int major, final int minor, int ctxProfileBits) { // remove non-key values ctxProfileBits &= CTX_IMPL_CACHE_MASK; @@ -2170,7 +2170,7 @@ public abstract class GLContextImpl extends GLContext { * Method exists merely for code validation of {@link #isCurrent()}. *

*/ - public final boolean isOwner(Thread thread) { + public final boolean isOwner(final Thread thread) { return lock.isOwner(thread); } @@ -2208,7 +2208,7 @@ public abstract class GLContextImpl extends GLContext { * *

Does not throw an exception if target is unknown or framebufferName invalid.

*/ - public final void setBoundFramebuffer(int target, int framebufferName) { + public final void setBoundFramebuffer(final int target, final int framebufferName) { if(0 > framebufferName) { return; // ignore invalid name } @@ -2217,22 +2217,22 @@ public abstract class GLContextImpl extends GLContext { boundFBOTarget[0] = framebufferName; // draw boundFBOTarget[1] = framebufferName; // read break; - case GL2GL3.GL_DRAW_FRAMEBUFFER: + case GL2ES3.GL_DRAW_FRAMEBUFFER: boundFBOTarget[0] = framebufferName; // draw break; - case GL2GL3.GL_READ_FRAMEBUFFER: + case GL2ES3.GL_READ_FRAMEBUFFER: boundFBOTarget[1] = framebufferName; // read break; default: // ignore untracked target } } @Override - public final int getBoundFramebuffer(int target) { + public final int getBoundFramebuffer(final int target) { switch(target) { case GL.GL_FRAMEBUFFER: - case GL2GL3.GL_DRAW_FRAMEBUFFER: + case GL2ES3.GL_DRAW_FRAMEBUFFER: return boundFBOTarget[0]; // draw - case GL2GL3.GL_READ_FRAMEBUFFER: + case GL2ES3.GL_READ_FRAMEBUFFER: return boundFBOTarget[1]; // read default: throw new InternalError("Invalid FBO target name: "+toHexString(target)); @@ -2266,7 +2266,7 @@ public abstract class GLContextImpl extends GLContext { } @Override - public final void setContextCreationFlags(int flags) { + public final void setContextCreationFlags(final int flags) { if(!isCreated()) { additionalCtxCreationFlags = flags & GLContext.CTX_OPTION_DEBUG; } @@ -2276,12 +2276,12 @@ public abstract class GLContextImpl extends GLContext { public final boolean isGLDebugSynchronous() { return glDebugHandler.isSynchronous(); } @Override - public final void setGLDebugSynchronous(boolean synchronous) { + public final void setGLDebugSynchronous(final boolean synchronous) { glDebugHandler.setSynchronous(synchronous); } @Override - public final void enableGLDebugMessage(boolean enable) throws GLException { + public final void enableGLDebugMessage(final boolean enable) throws GLException { if(!isCreated()) { if(enable) { additionalCtxCreationFlags |= GLContext.CTX_OPTION_DEBUG; @@ -2295,17 +2295,17 @@ public abstract class GLContextImpl extends GLContext { } @Override - public final void addGLDebugListener(GLDebugListener listener) { + public final void addGLDebugListener(final GLDebugListener listener) { glDebugHandler.addListener(listener); } @Override - public final void removeGLDebugListener(GLDebugListener listener) { + public final void removeGLDebugListener(final GLDebugListener listener) { glDebugHandler.removeListener(listener); } @Override - public final void glDebugMessageControl(int source, int type, int severity, int count, IntBuffer ids, boolean enabled) { + public final void glDebugMessageControl(final int source, final int type, final int severity, final int count, final IntBuffer ids, final boolean enabled) { if(glDebugHandler.isExtensionARB()) { gl.getGL2GL3().glDebugMessageControl(source, type, severity, count, ids, enabled); } else if(glDebugHandler.isExtensionAMD()) { @@ -2314,7 +2314,7 @@ public abstract class GLContextImpl extends GLContext { } @Override - public final void glDebugMessageControl(int source, int type, int severity, int count, int[] ids, int ids_offset, boolean enabled) { + public final void glDebugMessageControl(final int source, final int type, final int severity, final int count, final int[] ids, final int ids_offset, final boolean enabled) { if(glDebugHandler.isExtensionARB()) { gl.getGL2GL3().glDebugMessageControl(source, type, severity, count, ids, ids_offset, enabled); } else if(glDebugHandler.isExtensionAMD()) { @@ -2323,7 +2323,7 @@ public abstract class GLContextImpl extends GLContext { } @Override - public final void glDebugMessageInsert(int source, int type, int id, int severity, String buf) { + public final void glDebugMessageInsert(final int source, final int type, final int id, final int severity, final String buf) { final int len = (null != buf) ? buf.length() : 0; if(glDebugHandler.isExtensionARB()) { gl.getGL2GL3().glDebugMessageInsert(source, type, id, severity, len, buf); diff --git a/src/jogl/classes/jogamp/opengl/GLContextShareSet.java b/src/jogl/classes/jogamp/opengl/GLContextShareSet.java index c057c904c..209707f33 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextShareSet.java +++ b/src/jogl/classes/jogamp/opengl/GLContextShareSet.java @@ -143,7 +143,7 @@ public class GLContextShareSet { if (lastContext == null) { throw new IllegalArgumentException("Last context is null"); } - ShareSet share = entryFor(lastContext); + final ShareSet share = entryFor(lastContext); if (share == null) { throw new GLException("Last context is unknown: "+lastContext); } @@ -159,8 +159,8 @@ public class GLContextShareSet { System.err.println("GLContextShareSet: unregisterSharing: " + toHexString(lastContext.getHandle())+", entries: "+s.size()); } - for(Iterator iter = s.iterator() ; iter.hasNext() ; ) { - GLContext ctx = iter.next(); + for(final Iterator iter = s.iterator() ; iter.hasNext() ; ) { + final GLContext ctx = iter.next(); if(null == removeEntry(ctx)) { throw new GLException("Removal of shareSet for context failed"); } @@ -207,7 +207,7 @@ public class GLContextShareSet { } /** Returns true if the given GLContext has shared and created GLContext left including itself, otherwise false. */ - public static synchronized boolean hasCreatedSharedLeft(GLContext context) { + public static synchronized boolean hasCreatedSharedLeft(final GLContext context) { final Set s = getCreatedSharesImpl(context); return null != s && s.size() > 0; } @@ -279,7 +279,7 @@ public class GLContextShareSet { return shareMap.remove(context); } - private static String toHexString(long hex) { + private static String toHexString(final long hex) { return "0x" + Long.toHexString(hex); } } diff --git a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java index 2c947693c..7519d568b 100644 --- a/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java +++ b/src/jogl/classes/jogamp/opengl/GLDebugMessageHandler.java @@ -32,11 +32,14 @@ import java.security.PrivilegedAction; import java.util.ArrayList; import javax.media.nativewindow.NativeWindowException; +import javax.media.opengl.GL2ES2; import javax.media.opengl.GL2GL3; import javax.media.opengl.GLDebugListener; import javax.media.opengl.GLDebugMessage; import javax.media.opengl.GLException; +import jogamp.common.os.PlatformPropsImpl; + import com.jogamp.common.os.Platform; import com.jogamp.gluegen.runtime.ProcAddressTable; import com.jogamp.opengl.GLExtensions; @@ -84,7 +87,7 @@ public class GLDebugMessageHandler { * @param ctx the associated GLContext * @param glDebugExtension chosen extension to use */ - public GLDebugMessageHandler(GLContextImpl ctx) { + public GLDebugMessageHandler(final GLContextImpl ctx) { this.ctx = ctx; this.listenerImpl = new ListenerSyncedImplStub(); this.glDebugMessageCallbackProcAddress = 0; @@ -95,7 +98,7 @@ public class GLDebugMessageHandler { this.synchronous = true; } - public void init(boolean enable) { + public void init(final boolean enable) { if(DEBUG) { System.err.println("GLDebugMessageHandler.init("+enable+")"); } @@ -113,7 +116,7 @@ public class GLDebugMessageHandler { public Long run() { try { return Long.valueOf( table.getAddressFor(functionName) ); - } catch (IllegalArgumentException iae) { + } catch (final IllegalArgumentException iae) { return Long.valueOf(0); } } @@ -132,7 +135,7 @@ public class GLDebugMessageHandler { } return; } - if(Platform.OS_TYPE == Platform.OSType.WINDOWS && Platform.is32Bit()) { + if(PlatformPropsImpl.OS_TYPE == Platform.OSType.WINDOWS && Platform.is32Bit()) { // Currently buggy, ie. throws an exception after leaving the native callback. // Probably a 32bit on 64bit JVM / OpenGL-driver issue. if(DEBUG) { @@ -216,7 +219,7 @@ public class GLDebugMessageHandler { /** * @see javax.media.opengl.GLContext#setGLDebugSynchronous(boolean) */ - public final void setSynchronous(boolean synchronous) { + public final void setSynchronous(final boolean synchronous) { this.synchronous = synchronous; if( isEnabled() ) { setSynchronousImpl(); @@ -225,9 +228,9 @@ public class GLDebugMessageHandler { private final void setSynchronousImpl() { if(isExtensionARB()) { if(synchronous) { - ctx.getGL().glEnable(GL2GL3.GL_DEBUG_OUTPUT_SYNCHRONOUS); + ctx.getGL().glEnable(GL2ES2.GL_DEBUG_OUTPUT_SYNCHRONOUS); } else { - ctx.getGL().glDisable(GL2GL3.GL_DEBUG_OUTPUT_SYNCHRONOUS); + ctx.getGL().glDisable(GL2ES2.GL_DEBUG_OUTPUT_SYNCHRONOUS); } if(DEBUG) { System.err.println("GLDebugMessageHandler: synchronous "+synchronous); @@ -238,14 +241,14 @@ public class GLDebugMessageHandler { /** * @see javax.media.opengl.GLContext#enableGLDebugMessage(boolean) */ - public final void enable(boolean enable) throws GLException { + public final void enable(final boolean enable) throws GLException { ctx.validateCurrent(); if(!isAvailable()) { return; } enableImpl(enable); } - final void enableImpl(boolean enable) throws GLException { + final void enableImpl(final boolean enable) throws GLException { if(enable) { if(0 == handle) { setSynchronousImpl(); @@ -271,19 +274,19 @@ public class GLDebugMessageHandler { return listenerImpl.size(); } - public final void addListener(GLDebugListener listener) { + public final void addListener(final GLDebugListener listener) { listenerImpl.addListener(-1, listener); } - public final void addListener(int index, GLDebugListener listener) { + public final void addListener(final int index, final GLDebugListener listener) { listenerImpl.addListener(index, listener); } - public final void removeListener(GLDebugListener listener) { + public final void removeListener(final GLDebugListener listener) { listenerImpl.removeListener(listener); } - private final void sendMessage(GLDebugMessage msg) { + private final void sendMessage(final GLDebugMessage msg) { synchronized(listenerImpl) { if(DEBUG) { System.err.println("GLDebugMessageHandler: "+msg); @@ -298,11 +301,11 @@ public class GLDebugMessageHandler { public static class StdErrGLDebugListener implements GLDebugListener { boolean threadDump; - public StdErrGLDebugListener(boolean threadDump) { + public StdErrGLDebugListener(final boolean threadDump) { this.threadDump = threadDump; } @Override - public void messageSent(GLDebugMessage event) { + public void messageSent(final GLDebugMessage event) { System.err.println(event); if(threadDump) { Thread.dumpStack(); @@ -314,12 +317,12 @@ public class GLDebugMessageHandler { // native -> java // - protected final void glDebugMessageARB(int source, int type, int id, int severity, String msg) { + protected final void glDebugMessageARB(final int source, final int type, final int id, final int severity, final String msg) { final GLDebugMessage event = new GLDebugMessage(ctx, System.currentTimeMillis(), source, type, id, severity, msg); sendMessage(event); } - protected final void glDebugMessageAMD(int id, int category, int severity, String msg) { + protected final void glDebugMessageAMD(final int id, final int category, final int severity, final String msg) { final GLDebugMessage event = GLDebugMessage.translateAMDEvent(ctx, System.currentTimeMillis(), id, category, severity, msg); sendMessage(event); } diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java index a401944ef..fd8052b96 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java @@ -95,7 +95,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { if( null != device) { return getOrCreateSharedResourceImpl( device ); } - } catch (GLException gle) { + } catch (final GLException gle) { if(DEBUG) { System.err.println("Caught exception on thread "+getThreadName()); gle.printStackTrace(); @@ -112,7 +112,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { * * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared the target device, may be null for the platform's default device. */ - public final GLContext getOrCreateSharedContext(AbstractGraphicsDevice device) { + public final GLContext getOrCreateSharedContext(final AbstractGraphicsDevice device) { final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device ); if(null!=sr) { return sr.getContext(); @@ -121,7 +121,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } @Override - protected final boolean createSharedResourceImpl(AbstractGraphicsDevice device) { + protected final boolean createSharedResourceImpl(final AbstractGraphicsDevice device) { final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device ); if(null!=sr) { return sr.isValid(); @@ -130,7 +130,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } @Override - public final GLRendererQuirks getRendererQuirks(AbstractGraphicsDevice device) { + public final GLRendererQuirks getRendererQuirks(final AbstractGraphicsDevice device) { final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device ); if(null!=sr) { return sr.getRendererQuirks(); @@ -145,7 +145,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { * * @param device which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be null for the platform's default device. */ - protected final AbstractGraphicsDevice getOrCreateSharedDevice(AbstractGraphicsDevice device) { + protected final AbstractGraphicsDevice getOrCreateSharedDevice(final AbstractGraphicsDevice device) { final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device ); if(null!=sr) { return sr.getDevice(); @@ -164,7 +164,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { // Dispatching GLDrawable construction in respect to the NativeSurface Capabilities // @Override - public final GLDrawable createGLDrawable(NativeSurface target) { + public final GLDrawable createGLDrawable(final NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } @@ -252,16 +252,16 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { public abstract boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp); @Override - public final GLPbuffer createGLPbuffer(AbstractGraphicsDevice deviceReq, - GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, - int width, - int height, - GLContext shareWith) { + public final GLPbuffer createGLPbuffer(final AbstractGraphicsDevice deviceReq, + final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, + final int width, + final int height, + final GLContext shareWith) { if(width<=0 || height<=0) { throw new GLException("initial size must be positive (were (" + width + " x " + height + "))"); } - AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq); + final AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq); if(null == device) { throw new GLException("No shared device for requested: "+deviceReq); } @@ -285,8 +285,8 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { // @Override - public final boolean canCreateFBO(AbstractGraphicsDevice deviceReq, GLProfile glp) { - AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq); + public final boolean canCreateFBO(final AbstractGraphicsDevice deviceReq, final GLProfile glp) { + final AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq); if(null == device) { throw new GLException("No shared device for requested: "+deviceReq); } @@ -294,11 +294,11 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } @Override - public final GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice deviceReq, - GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, - int width, int height, - GLContext shareWith) { + public final GLOffscreenAutoDrawable createOffscreenAutoDrawable(final AbstractGraphicsDevice deviceReq, + final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, + final int width, final int height, + final GLContext shareWith) { final GLDrawable drawable = createOffscreenDrawable( deviceReq, capsRequested, chooser, width, height ); drawable.setRealized(true); final GLContext context = drawable.createContext(shareWith); @@ -309,10 +309,10 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } @Override - public final GLOffscreenAutoDrawable createOffscreenAutoDrawable(AbstractGraphicsDevice deviceReq, - GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, - int width, int height) { + public final GLOffscreenAutoDrawable createOffscreenAutoDrawable(final AbstractGraphicsDevice deviceReq, + final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, + final int width, final int height) { final GLDrawable drawable = createOffscreenDrawable( deviceReq, capsRequested, chooser, width, height ); drawable.setRealized(true); if(drawable instanceof GLFBODrawableImpl) { @@ -322,7 +322,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } @Override - public final GLAutoDrawable createDummyAutoDrawable(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) { + public final GLAutoDrawable createDummyAutoDrawable(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser) { final GLDrawable drawable = createDummyDrawable(deviceReq, createNewDevice, capsRequested, chooser); drawable.setRealized(true); final GLAutoDrawable sharedDrawable = new GLAutoDrawableDelegate(drawable, null, null, true /*ownDevice*/, null) { }; @@ -330,10 +330,10 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } @Override - public final GLDrawable createOffscreenDrawable(AbstractGraphicsDevice deviceReq, - GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, - int width, int height) { + public final GLDrawable createOffscreenDrawable(final AbstractGraphicsDevice deviceReq, + final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, + final int width, final int height) { if(width<=0 || height<=0) { throw new GLException("initial size must be positive (were (" + width + " x " + height + "))"); } @@ -355,7 +355,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } @Override - public final GLDrawable createDummyDrawable(AbstractGraphicsDevice deviceReq, boolean createNewDevice, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) { + public final GLDrawable createDummyDrawable(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser) { final AbstractGraphicsDevice device = createNewDevice ? getOrCreateSharedDevice(deviceReq) : deviceReq; if(null == device) { throw new GLException("No shared device for requested: "+deviceReq+", createNewDevice "+createNewDevice); @@ -374,7 +374,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { } /** Creates a platform independent unrealized FBO offscreen GLDrawable */ - protected final GLFBODrawable createFBODrawableImpl(NativeSurface dummySurface, GLCapabilitiesImmutable fboCaps, int textureUnit) { + protected final GLFBODrawable createFBODrawableImpl(final NativeSurface dummySurface, final GLCapabilitiesImmutable fboCaps, final int textureUnit) { final GLDrawableImpl dummyDrawable = createOnscreenDrawableImpl(dummySurface); return new GLFBODrawableImpl(this, dummyDrawable, dummySurface, fboCaps, textureUnit); } @@ -424,8 +424,8 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { * * @return the created {@link ProxySurface} instance w/o defined surface handle but platform specific {@link UpstreamSurfaceHook}. */ - public final ProxySurface createDummySurface(AbstractGraphicsDevice deviceReq, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, - int width, int height) { + public final ProxySurface createDummySurface(final AbstractGraphicsDevice deviceReq, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, + final int width, final int height) { final AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq); if(null == device) { throw new GLException("No shared device for requested: "+deviceReq); @@ -461,8 +461,8 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { // @Override - public ProxySurface createProxySurface(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, - GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) { + public ProxySurface createProxySurface(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, + final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstream) { final AbstractGraphicsDevice device = getOrCreateSharedDevice(deviceReq); if(null == device) { throw new GLException("No shared device for requested: "+deviceReq); @@ -520,7 +520,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { * @param glProfile GLProfile to determine the factory type, ie EGLDrawableFactory, * or one of the native GLDrawableFactory's, ie X11/GLX, Windows/WGL or MacOSX/CGL. */ - public static GLDrawableFactoryImpl getFactoryImpl(GLProfile glp) { + public static GLDrawableFactoryImpl getFactoryImpl(final GLProfile glp) { return (GLDrawableFactoryImpl) getFactory(glp); } @@ -579,7 +579,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { * @throws IllegalArgumentException if any of the parameters were * out-of-bounds */ - public boolean setDisplayGamma(float gamma, float brightness, float contrast) throws IllegalArgumentException { + public boolean setDisplayGamma(final float gamma, final float brightness, final float contrast) throws IllegalArgumentException { if ((brightness < -1.0f) || (brightness > 1.0f)) { throw new IllegalArgumentException("Brightness must be between -1.0 and 1.0"); } @@ -587,13 +587,13 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { throw new IllegalArgumentException("Contrast must be greater than 0.0"); } // FIXME: ensure gamma is > 1.0? Are smaller / negative values legal? - int rampLength = getGammaRampLength(); + final int rampLength = getGammaRampLength(); if (rampLength == 0) { return false; } - float[] gammaRamp = new float[rampLength]; + final float[] gammaRamp = new float[rampLength]; for (int i = 0; i < rampLength; i++) { - float intensity = (float) i / (float) (rampLength - 1); + final float intensity = (float) i / (float) (rampLength - 1); // apply gamma float rampEntry = (float) java.lang.Math.pow(intensity, gamma); // apply brightness @@ -631,7 +631,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { /** Sets the gamma ramp for the main screen. Returns false if gamma ramp changes were not supported. */ - protected boolean setGammaRamp(float[] ramp) { + protected boolean setGammaRamp(final float[] ramp) { return false; } @@ -644,7 +644,7 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { /** Resets the gamma ramp, potentially using the specified Buffer as data to restore the original values. */ - protected void resetGammaRamp(Buffer originalGammaRamp) { + protected void resetGammaRamp(final Buffer originalGammaRamp) { } // Shutdown hook mechanism for resetting gamma diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java index bf791822f..aea9a5b7b 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java @@ -60,6 +60,8 @@ import javax.media.opengl.GLFBODrawable; import javax.media.opengl.GLRunnable; import javax.media.opengl.GLSharedContextSetter; +import com.jogamp.common.util.PropertyAccess; + /** Encapsulates the implementation of most of the GLAutoDrawable's methods to be able to share it between GLAutoDrawable implementations like GLAutoDrawableBase, GLCanvas and GLJPanel. */ public class GLDrawableHelper { @@ -68,7 +70,7 @@ public class GLDrawableHelper { static { Debug.initSingleton(); - PERF_STATS = Debug.isPropertyDefined("jogl.debug.GLDrawable.PerfStats", true); + PERF_STATS = PropertyAccess.isPropertyDefined("jogl.debug.GLDrawable.PerfStats", true); } protected static final boolean DEBUG = GLDrawableImpl.DEBUG; @@ -108,7 +110,7 @@ public class GLDrawableHelper { sharedAutoDrawable = null; } - public final void setSharedContext(GLContext thisContext, GLContext sharedContext) throws IllegalStateException { + public final void setSharedContext(final GLContext thisContext, final GLContext sharedContext) throws IllegalStateException { if( null == sharedContext ) { throw new IllegalStateException("Null shared GLContext"); } @@ -124,7 +126,7 @@ public class GLDrawableHelper { this.sharedContext = sharedContext; } - public final void setSharedAutoDrawable(GLAutoDrawable thisAutoDrawable, GLAutoDrawable sharedAutoDrawable) throws IllegalStateException { + public final void setSharedAutoDrawable(final GLAutoDrawable thisAutoDrawable, final GLAutoDrawable sharedAutoDrawable) throws IllegalStateException { if( null == sharedAutoDrawable ) { throw new IllegalStateException("Null shared GLAutoDrawable"); } @@ -146,7 +148,7 @@ public class GLDrawableHelper { * @return true if initialization is pending due to a set shared GLAutoDrawable or GLContext * which is not ready yet. Otherwise false. */ - public boolean isSharedGLContextPending(GLContext[] shared) { + public boolean isSharedGLContextPending(final GLContext[] shared) { final GLContext shareWith; final boolean pending; if ( null != sharedAutoDrawable ) { @@ -168,12 +170,12 @@ public class GLDrawableHelper { @Override public final String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append("GLAnimatorControl: "+animatorCtrl+", "); synchronized(listenersLock) { sb.append("GLEventListeners num "+listeners.size()+" ["); for (int i=0; i < listeners.size(); i++) { - Object l = listeners.get(i); + final Object l = listeners.get(i); sb.append(l); sb.append("[init "); sb.append( !listenersToBeInit.contains(l) ); @@ -195,7 +197,7 @@ public class GLDrawableHelper { *

* @param ctx */ - public static final void forceNativeRelease(GLContext ctx) { + public static final void forceNativeRelease(final GLContext ctx) { int releaseCount = 0; do { ctx.release(); @@ -236,7 +238,7 @@ public class GLDrawableHelper { * * @see GLAutoDrawable#setContext(GLContext, boolean) */ - public static final void switchContext(GLDrawable drawable, GLContext oldCtx, boolean destroyOldCtx, GLContext newCtx, int newCtxCreationFlags) { + public static final void switchContext(final GLDrawable drawable, final GLContext oldCtx, final boolean destroyOldCtx, final GLContext newCtx, final int newCtxCreationFlags) { if( null != oldCtx ) { if( destroyOldCtx ) { oldCtx.destroy(); @@ -268,7 +270,7 @@ public class GLDrawableHelper { * @param context maybe null * @return the new drawable */ - public static final GLDrawableImpl recreateGLDrawable(GLDrawableImpl drawable, GLContext context) { + public static final GLDrawableImpl recreateGLDrawable(GLDrawableImpl drawable, final GLContext context) { if( ! drawable.isRealized() ) { return drawable; } @@ -335,7 +337,7 @@ public class GLDrawableHelper { * @throws NativeWindowException is drawable is not offscreen or it's surface lock couldn't be claimed * @throws GLException may be thrown a resize operation */ - public static final GLDrawableImpl resizeOffscreenDrawable(GLDrawableImpl drawable, GLContext context, int newWidth, int newHeight) + public static final GLDrawableImpl resizeOffscreenDrawable(GLDrawableImpl drawable, final GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException { final NativeSurface ns = drawable.getNativeSurface(); @@ -385,11 +387,11 @@ public class GLDrawableHelper { return drawable; } - public final void addGLEventListener(GLEventListener listener) { + public final void addGLEventListener(final GLEventListener listener) { addGLEventListener(-1, listener); } - public final void addGLEventListener(int index, GLEventListener listener) { + public final void addGLEventListener(int index, final GLEventListener listener) { synchronized(listenersLock) { if(0>index) { index = listeners.size(); @@ -408,7 +410,7 @@ public class GLDrawableHelper { * Consider calling {@link #disposeGLEventListener(GLAutoDrawable, GLDrawable, GLContext, GLEventListener)}. * @return the removed listener, or null if listener was not added */ - public final GLEventListener removeGLEventListener(GLEventListener listener) { + public final GLEventListener removeGLEventListener(final GLEventListener listener) { synchronized(listenersLock) { listenersToBeInit.remove(listener); return listeners.remove(listener) ? listener : null; @@ -447,13 +449,13 @@ public class GLDrawableHelper { } } - public final boolean getGLEventListenerInitState(GLEventListener listener) { + public final boolean getGLEventListenerInitState(final GLEventListener listener) { synchronized(listenersLock) { return !listenersToBeInit.contains(listener); } } - public final void setGLEventListenerInitState(GLEventListener listener, boolean initialized) { + public final void setGLEventListenerInitState(final GLEventListener listener, final boolean initialized) { synchronized(listenersLock) { if(initialized) { listenersToBeInit.remove(listener); @@ -478,7 +480,7 @@ public class GLDrawableHelper { * @param remove if true, the listener gets removed * @return the disposed and/or removed listener, otherwise null if neither action is performed */ - public final GLEventListener disposeGLEventListener(GLAutoDrawable autoDrawable, GLEventListener listener, boolean remove) { + public final GLEventListener disposeGLEventListener(final GLAutoDrawable autoDrawable, final GLEventListener listener, final boolean remove) { synchronized(listenersLock) { if( remove ) { if( listeners.remove(listener) ) { @@ -512,7 +514,7 @@ public class GLDrawableHelper { * @param autoDrawable * @return the disposal count */ - public final int disposeAllGLEventListener(GLAutoDrawable autoDrawable, boolean remove) { + public final int disposeAllGLEventListener(final GLAutoDrawable autoDrawable, final boolean remove) { int disposeCount = 0; synchronized(listenersLock) { if( remove ) { @@ -613,7 +615,7 @@ public class GLDrawableHelper { } } - private final void init(GLEventListener l, GLAutoDrawable drawable, boolean sendReshape, boolean setViewport) { + private final void init(final GLEventListener l, final GLAutoDrawable drawable, final boolean sendReshape, final boolean setViewport) { l.init(drawable); if(sendReshape) { reshape(l, drawable, 0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), setViewport, false /* checkInit */); @@ -624,7 +626,7 @@ public class GLDrawableHelper { * The default init action to be called once after ctx is being created @ 1st makeCurrent(). * @param sendReshape set to true if the subsequent display call won't reshape, otherwise false to avoid double reshape. **/ - public final void init(GLAutoDrawable drawable, boolean sendReshape) { + public final void init(final GLAutoDrawable drawable, final boolean sendReshape) { synchronized(listenersLock) { final ArrayList _listeners = listeners; final int listenerCount = _listeners.size(); @@ -645,13 +647,13 @@ public class GLDrawableHelper { } } - public final void display(GLAutoDrawable drawable) { + public final void display(final GLAutoDrawable drawable) { displayImpl(drawable); if( glRunnables.size()>0 && !execGLRunnables(drawable) ) { // glRunnables volatile OK; execGL.. only executed if size > 0 displayImpl(drawable); } } - private final void displayImpl(GLAutoDrawable drawable) { + private final void displayImpl(final GLAutoDrawable drawable) { synchronized(listenersLock) { final ArrayList _listeners = listeners; final int listenerCount = _listeners.size(); @@ -667,8 +669,8 @@ public class GLDrawableHelper { } } - private final void reshape(GLEventListener listener, GLAutoDrawable drawable, - int x, int y, int width, int height, boolean setViewport, boolean checkInit) { + private final void reshape(final GLEventListener listener, final GLAutoDrawable drawable, + final int x, final int y, final int width, final int height, final boolean setViewport, final boolean checkInit) { if(checkInit) { // GLEventListener may need to be init, // in case this one is added after the realization of the GLAutoDrawable @@ -692,7 +694,7 @@ public class GLDrawableHelper { listener.reshape(drawable, x, y, width, height); } - public final void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { + public final void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { synchronized(listenersLock) { for (int i=0; i < listeners.size(); i++) { reshape(listeners.get(i), drawable, x, y, width, height, 0==i /* setViewport */, true /* checkInit */); @@ -700,7 +702,7 @@ public class GLDrawableHelper { } } - private final boolean execGLRunnables(GLAutoDrawable drawable) { // glRunnables.size()>0 + private final boolean execGLRunnables(final GLAutoDrawable drawable) { // glRunnables.size()>0 boolean res = true; // swap one-shot list asap final ArrayList _glRunnables; @@ -742,7 +744,7 @@ public class GLDrawableHelper { } } - public final void setAnimator(GLAnimatorControl animator) throws GLException { + public final void setAnimator(final GLAnimatorControl animator) throws GLException { synchronized(glRunnablesLock) { if(animatorCtrl!=animator && null!=animator && null!=animatorCtrl) { throw new GLException("Trying to register GLAnimatorControl "+animator+", where "+animatorCtrl+" is already registered. Unregister first."); @@ -789,14 +791,14 @@ public class GLDrawableHelper { * @param glRunnable the {@link GLRunnable} to execute within {@link #display()} * @return true if the {@link GLRunnable} has been processed or queued, otherwise false. */ - public final boolean invoke(GLAutoDrawable drawable, boolean wait, GLRunnable glRunnable) { + public final boolean invoke(final GLAutoDrawable drawable, boolean wait, final GLRunnable glRunnable) { if( null == glRunnable || null == drawable || wait && ( !drawable.isRealized() || null==drawable.getContext() ) ) { return false; } GLRunnableTask rTask = null; - Object rTaskLock = new Object(); + final Object rTaskLock = new Object(); Throwable throwable = null; synchronized(rTaskLock) { final boolean deferred; @@ -815,7 +817,7 @@ public class GLDrawableHelper { } else if( wait ) { try { rTaskLock.wait(); // free lock, allow execution of rTask - } catch (InterruptedException ie) { + } catch (final InterruptedException ie) { throwable = ie; } if(null==throwable) { @@ -829,7 +831,7 @@ public class GLDrawableHelper { return true; } - public final boolean invoke(GLAutoDrawable drawable, boolean wait, List newGLRunnables) { + public final boolean invoke(final GLAutoDrawable drawable, boolean wait, final List newGLRunnables) { if( null == newGLRunnables || newGLRunnables.size() == 0 || null == drawable || wait && ( !drawable.isRealized() || null==drawable.getContext() ) ) { return false; @@ -837,7 +839,7 @@ public class GLDrawableHelper { final int count = newGLRunnables.size(); GLRunnableTask rTask = null; - Object rTaskLock = new Object(); + final Object rTaskLock = new Object(); Throwable throwable = null; synchronized(rTaskLock) { final boolean deferred; @@ -859,7 +861,7 @@ public class GLDrawableHelper { } else if( wait ) { try { rTaskLock.wait(); // free lock, allow execution of rTask - } catch (InterruptedException ie) { + } catch (final InterruptedException ie) { throwable = ie; } if(null==throwable) { @@ -873,7 +875,7 @@ public class GLDrawableHelper { return true; } - public final void enqueue(GLRunnable glRunnable) { + public final void enqueue(final GLRunnable glRunnable) { if( null == glRunnable) { return; } @@ -882,7 +884,7 @@ public class GLDrawableHelper { } } - public final void setAutoSwapBufferMode(boolean enable) { + public final void setAutoSwapBufferMode(final boolean enable) { autoSwapBufferMode = enable; } @@ -921,7 +923,7 @@ public class GLDrawableHelper { * @return previous exclusive context thread * @throws GLException If an exclusive thread is still active but a new one is attempted to be set */ - public final Thread setExclusiveContextThread(Thread t, GLContext context) throws GLException { + public final Thread setExclusiveContextThread(final Thread t, final GLContext context) throws GLException { if (DEBUG) { System.err.println("GLDrawableHelper.setExclusiveContextThread(): START switch "+getExclusiveContextSwitchString()+", thread "+exclusiveContextThread+" -> "+t+" -- currentThread "+Thread.currentThread()); } @@ -938,7 +940,7 @@ public class GLDrawableHelper { if( null != context && context.isCurrent() ) { try { forceNativeRelease(context); - } catch (Throwable ex) { + } catch (final Throwable ex) { ex.printStackTrace(); throw new GLException(ex); } @@ -982,7 +984,7 @@ public class GLDrawableHelper { final Runnable initAction) { if(null==context) { if (DEBUG) { - Exception e = new GLException(getThreadName()+" Info: GLDrawableHelper " + this + ".invokeGL(): NULL GLContext"); + final Exception e = new GLException(getThreadName()+" Info: GLDrawableHelper " + this + ".invokeGL(): NULL GLContext"); e.printStackTrace(); } return; @@ -1010,7 +1012,7 @@ public class GLDrawableHelper { * @param destroyContext destroy context in the end while holding the lock */ public final void disposeGL(final GLAutoDrawable autoDrawable, - final GLContext context, boolean destroyContext) { + final GLContext context, final boolean destroyContext) { // Support for recursive makeCurrent() calls as well as calling // other drawables' display() methods from within another one's GLContext lastContext = GLContext.getCurrent(); @@ -1044,7 +1046,7 @@ public class GLDrawableHelper { forceNativeRelease(context); } flushGLRunnables(); - } catch (Exception e) { + } catch (final Exception e) { System.err.println("Caught exception on thread "+getThreadName()); e.printStackTrace(); } @@ -1130,7 +1132,7 @@ public class GLDrawableHelper { if( releaseContext ) { try { context.release(); - } catch (Exception e) { + } catch (final Exception e) { System.err.println("Caught exception on thread "+getThreadName()); e.printStackTrace(); } @@ -1188,14 +1190,14 @@ public class GLDrawableHelper { } } - long t0 = System.currentTimeMillis(); + final long t0 = System.currentTimeMillis(); long tdA = 0; // makeCurrent long tdR = 0; // render time long tdS = 0; // swapBuffers long tdX = 0; // release boolean ctxClaimed = false; boolean ctxReleased = false; - boolean ctxDestroyed = false; + final boolean ctxDestroyed = false; try { final boolean releaseContext; if( GLContext.CONTEXT_NOT_CURRENT == res ) { @@ -1236,7 +1238,7 @@ public class GLDrawableHelper { try { context.release(); ctxReleased = true; - } catch (Exception e) { + } catch (final Exception e) { System.err.println("Caught exception on thread "+getThreadName()); e.printStackTrace(); } @@ -1252,7 +1254,7 @@ public class GLDrawableHelper { } } } - long td = System.currentTimeMillis() - t0; + final long td = System.currentTimeMillis() - t0; System.err.println("td0 "+td+"ms, fps "+(1.0/(td/1000.0))+", td-makeCurrent: "+tdA+"ms, td-render "+tdR+"ms, td-swap "+tdS+"ms, td-release "+tdX+"ms, ctx claimed: "+ctxClaimed+", ctx release: "+ctxReleased+", ctx destroyed "+ctxDestroyed); } diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java index 2070c2f4e..3bb22612f 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java @@ -54,11 +54,11 @@ import javax.media.opengl.GLProfile; public abstract class GLDrawableImpl implements GLDrawable { protected static final boolean DEBUG = GLDrawableFactoryImpl.DEBUG; - protected GLDrawableImpl(GLDrawableFactory factory, NativeSurface comp, boolean realized) { + protected GLDrawableImpl(final GLDrawableFactory factory, final NativeSurface comp, final boolean realized) { this(factory, comp, (GLCapabilitiesImmutable) comp.getGraphicsConfiguration().getRequestedCapabilities(), realized); } - protected GLDrawableImpl(GLDrawableFactory factory, NativeSurface comp, GLCapabilitiesImmutable requestedCapabilities, boolean realized) { + protected GLDrawableImpl(final GLDrawableFactory factory, final NativeSurface comp, final GLCapabilitiesImmutable requestedCapabilities, final boolean realized) { this.factory = factory; this.surface = comp; this.realized = realized; @@ -120,7 +120,7 @@ public abstract class GLDrawableImpl implements GLDrawable { */ protected abstract void swapBuffersImpl(boolean doubleBuffered); - public final static String toHexString(long hex) { + public final static String toHexString(final long hex) { return "0x" + Long.toHexString(hex); } @@ -170,14 +170,14 @@ public abstract class GLDrawableImpl implements GLDrawable { } @Override - public final void setRealized(boolean realizedArg) { + public final void setRealized(final boolean realizedArg) { if ( realized != realizedArg ) { // volatile: OK (locked below) final boolean isProxySurface = surface instanceof ProxySurface; if(DEBUG) { System.err.println(getThreadName() + ": setRealized: drawable "+getClass().getSimpleName()+", surface "+surface.getClass().getSimpleName()+", isProxySurface "+isProxySurface+": "+realized+" -> "+realizedArg); Thread.dumpStack(); } - AbstractGraphicsDevice aDevice = surface.getGraphicsConfiguration().getScreen().getDevice(); + final AbstractGraphicsDevice aDevice = surface.getGraphicsConfiguration().getScreen().getDevice(); if(realizedArg) { if(isProxySurface) { ((ProxySurface)surface).createNotify(); @@ -238,7 +238,7 @@ public abstract class GLDrawableImpl implements GLDrawable { * @param ctx the just bounded or unbounded context * @param bound if true create an association, otherwise remove it */ - protected void associateContext(GLContext ctx, boolean bound) { } + protected void associateContext(final GLContext ctx, final boolean bound) { } /** * Callback for special implementations, allowing GLContext to trigger GL related lifecycle: makeCurrent, release. @@ -253,14 +253,14 @@ public abstract class GLDrawableImpl implements GLDrawable { *

* @see #associateContext(GLContext, boolean) */ - protected void contextMadeCurrent(GLContext glc, boolean current) { } + protected void contextMadeCurrent(final GLContext glc, final boolean current) { } /** Callback for special implementations, allowing GLContext to fetch a custom default render framebuffer. Defaults to zero.*/ protected int getDefaultDrawFramebuffer() { return 0; } /** Callback for special implementations, allowing GLContext to fetch a custom default read framebuffer. Defaults to zero. */ protected int getDefaultReadFramebuffer() { return 0; } /** Callback for special implementations, allowing GLContext to fetch a custom default read buffer of current framebuffer. */ - protected int getDefaultReadBuffer(GL gl, boolean hasDedicatedDrawableRead) { + protected int getDefaultReadBuffer(final GL gl, final boolean hasDedicatedDrawableRead) { if( gl.isGLES() || hasDedicatedDrawableRead || getChosenGLCapabilities().getDoubleBuffered() ) { // Note-1: Neither ES1 nor ES2 supports selecting the read buffer via glReadBuffer // Note-2: ES3 only supports GL_BACK, GL_NONE or GL_COLOR_ATTACHMENT0+i diff --git a/src/jogl/classes/jogamp/opengl/GLDynamicLookupHelper.java b/src/jogl/classes/jogamp/opengl/GLDynamicLookupHelper.java index 421f06205..95e13e26a 100644 --- a/src/jogl/classes/jogamp/opengl/GLDynamicLookupHelper.java +++ b/src/jogl/classes/jogamp/opengl/GLDynamicLookupHelper.java @@ -32,7 +32,7 @@ import com.jogamp.common.os.DynamicLibraryBundle; public class GLDynamicLookupHelper extends DynamicLibraryBundle { - public GLDynamicLookupHelper(GLDynamicLibraryBundleInfo info) { + public GLDynamicLookupHelper(final GLDynamicLibraryBundleInfo info) { super(info); } diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java index bf6a56afe..6046527d1 100644 --- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java @@ -11,6 +11,7 @@ import javax.media.opengl.GLContext; import javax.media.opengl.GLException; import javax.media.opengl.GLFBODrawable; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.VersionUtil; import com.jogamp.nativewindow.MutableGraphicsConfiguration; import com.jogamp.opengl.FBObject; @@ -43,7 +44,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { static { Debug.initSingleton(); DEBUG = GLDrawableImpl.DEBUG || Debug.debug("FBObject"); - DEBUG_SWAP = DEBUG || Debug.isPropertyDefined("jogl.debug.FBObject.Swap", true); + DEBUG_SWAP = DEBUG || PropertyAccess.isPropertyDefined("jogl.debug.FBObject.Swap", true); } private final GLDrawableImpl parent; @@ -84,8 +85,8 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { * @param fboCaps the requested FBO capabilities * @param textureUnit */ - protected GLFBODrawableImpl(GLDrawableFactoryImpl factory, GLDrawableImpl parent, NativeSurface surface, - GLCapabilitiesImmutable fboCaps, int textureUnit) { + protected GLFBODrawableImpl(final GLDrawableFactoryImpl factory, final GLDrawableImpl parent, final NativeSurface surface, + final GLCapabilitiesImmutable fboCaps, final int textureUnit) { super(factory, surface, fboCaps, false); this.initialized = false; @@ -101,7 +102,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { this.swapBufferContext = null; } - private final void initialize(boolean realize, GL gl) { + private final void initialize(final boolean realize, final GL gl) { if( !initialized && !realize ) { if( DEBUG ) { System.err.println("GLFBODrawableImpl.initialize(): WARNING - Already unrealized!"); @@ -175,11 +176,11 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } } - public final void setSwapBufferContext(SwapBufferContext sbc) { + public final void setSwapBufferContext(final SwapBufferContext sbc) { swapBufferContext = sbc; } - private final void reset(GL gl, int idx, int width, int height, int samples, int alphaBits, int stencilBits) { + private final void reset(final GL gl, final int idx, final int width, final int height, final int samples, final int alphaBits, final int stencilBits) { if( !fboResetQuirk ) { try { fbos[idx].reset(gl, width, height, samples, false); @@ -187,7 +188,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { throw new InternalError("Sample number mismatch: "+samples+", fbos["+idx+"] "+fbos[idx]); } return; - } catch (GLException e) { + } catch (final GLException e) { fboResetQuirk = true; if(DEBUG) { if(!resetQuirkInfoDumped) { @@ -227,7 +228,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } } - private final void reset(GL gl, int newSamples) throws GLException { + private final void reset(final GL gl, int newSamples) throws GLException { if(!initialized) { // NOP if not yet initializes return; @@ -275,7 +276,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { final GLCapabilities fboCapsNative = (GLCapabilities) surface.getGraphicsConfiguration().getChosenCapabilities(); fbos[0].formatToGLCapabilities(fboCapsNative); } - } catch (Throwable t) { + } catch (final Throwable t) { tFBO = t; } finally { try { @@ -283,7 +284,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { if(ctxSwitch) { curContext.makeCurrent(); } - } catch (Throwable t) { + } catch (final Throwable t) { tGL = t; } } @@ -303,7 +304,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { // @Override - public final GLContext createContext(GLContext shareWith) { + public final GLContext createContext(final GLContext shareWith) { final GLContext ctx = parent.createContext(shareWith); ctx.setGLDrawable(this, false); return ctx; @@ -325,7 +326,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { protected final int getDefaultReadFramebuffer() { return initialized ? fbos[fboIFront].getReadFramebuffer() : 0; } @Override - protected final int getDefaultReadBuffer(GL gl, boolean hasDedicatedDrawableRead) { + protected final int getDefaultReadBuffer(final GL gl, final boolean hasDedicatedDrawableRead) { return initialized ? fbos[fboIFront].getDefaultReadBuffer() : GL.GL_COLOR_ATTACHMENT0 ; } @@ -345,12 +346,12 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } @Override - protected void associateContext(GLContext glc, boolean bound) { + protected void associateContext(final GLContext glc, final boolean bound) { initialize(bound, glc.getGL()); } @Override - protected final void contextMadeCurrent(GLContext glc, boolean current) { + protected final void contextMadeCurrent(final GLContext glc, final boolean current) { final GL gl = glc.getGL(); if(current) { if( !initialized ) { @@ -371,7 +372,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } @Override - protected void swapBuffersImpl(boolean doubleBuffered) { + protected void swapBuffersImpl(final boolean doubleBuffered) { final GLContext ctx = GLContext.getCurrent(); boolean doPostSwap; if( null != ctx && ctx.getGLDrawable() == this && fboBound ) { @@ -392,7 +393,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } } - private final void swapFBOImplPost(GLContext glc) { + private final void swapFBOImplPost(final GLContext glc) { // Safely reset the previous front FBO - after completing propagating swap if(0 <= pendingFBOReset) { final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) surface.getGraphicsConfiguration().getChosenCapabilities(); @@ -401,12 +402,12 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } } - private final void swapFBOImpl(GLContext glc) { + private final void swapFBOImpl(final GLContext glc) { final GL gl = glc.getGL(); fbos[fboIBack].markUnbound(); // fast path, use(gl,..) is called below if(DEBUG) { - int _fboIFront = ( fboIFront + 1 ) % fbos.length; + final int _fboIFront = ( fboIFront + 1 ) % fbos.length; if(_fboIFront != fboIBack) { throw new InternalError("XXX: "+_fboIFront+"!="+fboIBack); } } fboIFront = fboIBack; @@ -446,7 +447,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } @Override - public final void resetSize(GL gl) throws GLException { + public final void resetSize(final GL gl) throws GLException { reset(gl, samples); } @@ -454,20 +455,20 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { public final int getTextureUnit() { return texUnit; } @Override - public final void setTextureUnit(int u) { texUnit = u; } + public final void setTextureUnit(final int u) { texUnit = u; } @Override public final int getNumSamples() { return samples; } @Override - public void setNumSamples(GL gl, int newSamples) throws GLException { + public void setNumSamples(final GL gl, final int newSamples) throws GLException { if(samples != newSamples) { reset(gl, newSamples); } } @Override - public final int setNumBuffers(int bufferCount) throws GLException { + public final int setNumBuffers(final int bufferCount) throws GLException { // FIXME: Implement return bufferCount; } @@ -495,7 +496,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } */ @Override - public FBObject getFBObject(int bufferName) throws IllegalArgumentException { + public FBObject getFBObject(final int bufferName) throws IllegalArgumentException { if(!initialized) { return null; } @@ -518,7 +519,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } @Override - public final TextureAttachment getTextureBuffer(int bufferName) throws IllegalArgumentException { + public final TextureAttachment getTextureBuffer(final int bufferName) throws IllegalArgumentException { if(!initialized) { return null; } @@ -559,17 +560,17 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } public static class ResizeableImpl extends GLFBODrawableImpl implements GLFBODrawable.Resizeable { - protected ResizeableImpl(GLDrawableFactoryImpl factory, GLDrawableImpl parent, ProxySurface surface, - GLCapabilitiesImmutable fboCaps, int textureUnit) { + protected ResizeableImpl(final GLDrawableFactoryImpl factory, final GLDrawableImpl parent, final ProxySurface surface, + final GLCapabilitiesImmutable fboCaps, final int textureUnit) { super(factory, parent, surface, fboCaps, textureUnit); } @Override - public final void setSurfaceSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException { + public final void setSurfaceSize(final GLContext context, final int newWidth, final int newHeight) throws NativeWindowException, GLException { if(DEBUG) { System.err.println("GLFBODrawableImpl.ResizeableImpl setSize: ("+getThreadName()+"): "+newWidth+"x"+newHeight+" - surfaceHandle 0x"+Long.toHexString(getNativeSurface().getSurfaceHandle())); } - int lockRes = lockSurface(); + final int lockRes = lockSurface(); if (NativeSurface.LOCK_SURFACE_NOT_READY >= lockRes) { throw new NativeWindowException("Could not lock surface: "+this); } diff --git a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java index 5c6b475b2..90d18eb60 100644 --- a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationFactory.java @@ -37,8 +37,8 @@ import javax.media.opengl.DefaultGLCapabilitiesChooser; public abstract class GLGraphicsConfigurationFactory extends GraphicsConfigurationFactory { - protected static int chooseCapabilities(CapabilitiesChooser chooser, CapabilitiesImmutable capsRequested, - List availableCaps, int recommendedIndex) { + protected static int chooseCapabilities(CapabilitiesChooser chooser, final CapabilitiesImmutable capsRequested, + final List availableCaps, final int recommendedIndex) { if (null == capsRequested) { throw new NativeWindowException("Null requested capabilities"); } @@ -69,7 +69,7 @@ public abstract class GLGraphicsConfigurationFactory extends GraphicsConfigurati } return chosenIndex; } - } catch (NativeWindowException e) { + } catch (final NativeWindowException e) { if (DEBUG) { e.printStackTrace(); } diff --git a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java index 702fb77de..1fb27cfcf 100644 --- a/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java +++ b/src/jogl/classes/jogamp/opengl/GLGraphicsConfigurationUtil.java @@ -45,7 +45,7 @@ public class GLGraphicsConfigurationUtil { public static final int FBO_BIT = 1 << 3; // generic bit must be mapped to native one at impl. level public static final int ALL_BITS = WINDOW_BIT | BITMAP_BIT | PBUFFER_BIT | FBO_BIT ; - public static final StringBuilder winAttributeBits2String(StringBuilder sb, int winattrbits) { + public static final StringBuilder winAttributeBits2String(StringBuilder sb, final int winattrbits) { if(null==sb) { sb = new StringBuilder(); } @@ -101,7 +101,7 @@ public class GLGraphicsConfigurationUtil { /** * @return bitmask representing the input boolean in exclusive or logic, ie only one bit will be set. */ - public static final int getExclusiveWinAttributeBits(boolean isOnscreen, boolean isFBO, boolean isPBuffer, boolean isBitmap) { + public static final int getExclusiveWinAttributeBits(final boolean isOnscreen, final boolean isFBO, final boolean isPBuffer, final boolean isBitmap) { final int winattrbits; if(isOnscreen) { winattrbits = WINDOW_BIT; @@ -120,11 +120,11 @@ public class GLGraphicsConfigurationUtil { /** * @see #getExclusiveWinAttributeBits(boolean, boolean, boolean, boolean) */ - public static final int getExclusiveWinAttributeBits(GLCapabilitiesImmutable caps) { + public static final int getExclusiveWinAttributeBits(final GLCapabilitiesImmutable caps) { return getExclusiveWinAttributeBits(caps.isOnscreen(), caps.isFBO(), caps.isPBuffer(), caps.isBitmap()); } - public static final GLCapabilities fixWinAttribBitsAndHwAccel(AbstractGraphicsDevice device, int winattrbits, GLCapabilities caps) { + public static final GLCapabilities fixWinAttribBitsAndHwAccel(final AbstractGraphicsDevice device, final int winattrbits, final GLCapabilities caps) { caps.setBitmap ( 0 != ( BITMAP_BIT & winattrbits ) ); caps.setPBuffer ( 0 != ( PBUFFER_BIT & winattrbits ) ); caps.setFBO ( 0 != ( FBO_BIT & winattrbits ) ); @@ -150,15 +150,15 @@ public class GLGraphicsConfigurationUtil { * @param device the device on which the drawable will be created, maybe null for the {@link GLDrawableFactory#getDefaultDevice() default device}. * @return either the given requested {@link GLCapabilitiesImmutable} instance if no modifications were required, or a modified {@link GLCapabilitiesImmutable} instance. */ - public static GLCapabilitiesImmutable fixGLCapabilities(GLCapabilitiesImmutable capsRequested, - GLDrawableFactory factory, AbstractGraphicsDevice device) { + public static GLCapabilitiesImmutable fixGLCapabilities(final GLCapabilitiesImmutable capsRequested, + final GLDrawableFactory factory, final AbstractGraphicsDevice device) { if( !capsRequested.isOnscreen() ) { return fixOffscreenGLCapabilities(capsRequested, factory, device); } return capsRequested; } - public static GLCapabilitiesImmutable fixOnscreenGLCapabilities(GLCapabilitiesImmutable capsRequested) + public static GLCapabilitiesImmutable fixOnscreenGLCapabilities(final GLCapabilitiesImmutable capsRequested) { if( !capsRequested.isOnscreen() || capsRequested.isFBO() || capsRequested.isPBuffer() || capsRequested.isBitmap() ) { // fix caps .. @@ -172,7 +172,7 @@ public class GLGraphicsConfigurationUtil { return capsRequested; } - public static GLCapabilitiesImmutable fixOffscreenBitOnly(GLCapabilitiesImmutable capsRequested) + public static GLCapabilitiesImmutable fixOffscreenBitOnly(final GLCapabilitiesImmutable capsRequested) { if( capsRequested.isOnscreen() ) { // fix caps .. @@ -195,8 +195,8 @@ public class GLGraphicsConfigurationUtil { * @param device the device on which the drawable will be created, maybe null for the {@link GLDrawableFactory#getDefaultDevice() default device}. * @return either the given requested {@link GLCapabilitiesImmutable} instance if no modifications were required, or a modified {@link GLCapabilitiesImmutable} instance. */ - public static GLCapabilitiesImmutable fixOffscreenGLCapabilities(GLCapabilitiesImmutable capsRequested, - GLDrawableFactory factory, AbstractGraphicsDevice device) { + public static GLCapabilitiesImmutable fixOffscreenGLCapabilities(final GLCapabilitiesImmutable capsRequested, + final GLDrawableFactory factory, AbstractGraphicsDevice device) { if(null == device) { device = factory.getDefaultDevice(); } @@ -250,7 +250,7 @@ public class GLGraphicsConfigurationUtil { return capsRequested; } - public static GLCapabilitiesImmutable fixGLPBufferGLCapabilities(GLCapabilitiesImmutable capsRequested) + public static GLCapabilitiesImmutable fixGLPBufferGLCapabilities(final GLCapabilitiesImmutable capsRequested) { if( capsRequested.isOnscreen() || !capsRequested.isPBuffer() || @@ -268,7 +268,7 @@ public class GLGraphicsConfigurationUtil { } /** Fix opaque setting while preserve alpha bits */ - public static GLCapabilities fixOpaqueGLCapabilities(GLCapabilities capsRequested, boolean isOpaque) + public static GLCapabilities fixOpaqueGLCapabilities(final GLCapabilities capsRequested, final boolean isOpaque) { if( capsRequested.isBackgroundOpaque() != isOpaque) { final int alphaBits = capsRequested.getAlphaBits(); @@ -279,7 +279,7 @@ public class GLGraphicsConfigurationUtil { } /** Fix double buffered setting */ - public static GLCapabilitiesImmutable fixDoubleBufferedGLCapabilities(GLCapabilitiesImmutable capsRequested, boolean doubleBuffered) + public static GLCapabilitiesImmutable fixDoubleBufferedGLCapabilities(final GLCapabilitiesImmutable capsRequested, final boolean doubleBuffered) { if( capsRequested.getDoubleBuffered() != doubleBuffered) { final GLCapabilities caps2 = (GLCapabilities) capsRequested.cloneMutable(); @@ -289,7 +289,7 @@ public class GLGraphicsConfigurationUtil { return capsRequested; } - public static GLCapabilitiesImmutable clipRGBAGLCapabilities(GLCapabilitiesImmutable caps, boolean allowRGB555, boolean allowAlpha) + public static GLCapabilitiesImmutable clipRGBAGLCapabilities(final GLCapabilitiesImmutable caps, final boolean allowRGB555, final boolean allowAlpha) { final int iR = caps.getRedBits(); final int iG = caps.getGreenBits(); @@ -320,7 +320,7 @@ public class GLGraphicsConfigurationUtil { return compOut; } - public static GLCapabilitiesImmutable fixGLProfile(GLCapabilitiesImmutable caps, GLProfile glp) + public static GLCapabilitiesImmutable fixGLProfile(final GLCapabilitiesImmutable caps, final GLProfile glp) { if( caps.getGLProfile() != glp ) { final GLCapabilities caps2 = (GLCapabilities) caps.cloneMutable(); diff --git a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java index edfebdcfe..95c4ceb98 100644 --- a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java @@ -52,12 +52,12 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen * @param upstreamWidget optional UI element holding this instance, see {@link #getUpstreamWidget()}. * @param lock optional upstream lock, may be null */ - public GLOffscreenAutoDrawableImpl(GLDrawable drawable, GLContext context, Object upstreamWidget, RecursiveLock lock) { + public GLOffscreenAutoDrawableImpl(final GLDrawable drawable, final GLContext context, final Object upstreamWidget, final RecursiveLock lock) { super(drawable, context, upstreamWidget, true, lock); } @Override - public void setSurfaceSize(int newWidth, int newHeight) throws NativeWindowException, GLException { + public void setSurfaceSize(final int newWidth, final int newHeight) throws NativeWindowException, GLException { this.defaultWindowResizedOp(newWidth, newHeight); } @@ -71,7 +71,7 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen * @param upstreamWidget optional UI element holding this instance, see {@link #getUpstreamWidget()}. * @param lock optional upstream lock, may be null */ - public FBOImpl(GLFBODrawableImpl drawable, GLContext context, Object upstreamWidget, RecursiveLock lock) { + public FBOImpl(final GLFBODrawableImpl drawable, final GLContext context, final Object upstreamWidget, final RecursiveLock lock) { super(drawable, context, upstreamWidget, lock); } @@ -86,7 +86,7 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen } @Override - public final void setTextureUnit(int unit) { + public final void setTextureUnit(final int unit) { ((GLFBODrawableImpl)drawable).setTextureUnit(unit); } @@ -96,13 +96,13 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen } @Override - public final void setNumSamples(GL gl, int newSamples) throws GLException { + public final void setNumSamples(final GL gl, final int newSamples) throws GLException { ((GLFBODrawableImpl)drawable).setNumSamples(gl, newSamples); windowRepaintOp(); } @Override - public final int setNumBuffers(int bufferCount) throws GLException { + public final int setNumBuffers(final int bufferCount) throws GLException { return ((GLFBODrawableImpl)drawable).setNumBuffers(bufferCount); } @@ -123,17 +123,17 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen } */ @Override - public final FBObject getFBObject(int bufferName) { + public final FBObject getFBObject(final int bufferName) { return ((GLFBODrawableImpl)drawable).getFBObject(bufferName); } @Override - public final FBObject.TextureAttachment getTextureBuffer(int bufferName) { + public final FBObject.TextureAttachment getTextureBuffer(final int bufferName) { return ((GLFBODrawableImpl)drawable).getTextureBuffer(bufferName); } @Override - public void resetSize(GL gl) throws GLException { + public void resetSize(final GL gl) throws GLException { ((GLFBODrawableImpl)drawable).resetSize(gl); } } diff --git a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java index c32957b86..ac5487961 100644 --- a/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLPbufferImpl.java @@ -50,7 +50,7 @@ import com.jogamp.common.util.locks.RecursiveLock; @SuppressWarnings("deprecation") public class GLPbufferImpl extends GLAutoDrawableBase implements GLPbuffer { - public GLPbufferImpl(GLDrawableImpl pbufferDrawable, GLContextImpl pbufferContext) { + public GLPbufferImpl(final GLDrawableImpl pbufferDrawable, final GLContextImpl pbufferContext) { super(pbufferDrawable, pbufferContext, true); // drawable := pbufferDrawable, context := pbufferContext } diff --git a/src/jogl/classes/jogamp/opengl/GLRunnableTask.java b/src/jogl/classes/jogamp/opengl/GLRunnableTask.java index 6de92f533..0ceef6bf7 100644 --- a/src/jogl/classes/jogamp/opengl/GLRunnableTask.java +++ b/src/jogl/classes/jogamp/opengl/GLRunnableTask.java @@ -44,7 +44,7 @@ public class GLRunnableTask implements GLRunnable { Throwable runnableException; - public GLRunnableTask(GLRunnable runnable, Object notifyObject, boolean catchExceptions) { + public GLRunnableTask(final GLRunnable runnable, final Object notifyObject, final boolean catchExceptions) { this.runnable = runnable ; this.notifyObject = notifyObject ; this.catchExceptions = catchExceptions; @@ -53,12 +53,12 @@ public class GLRunnableTask implements GLRunnable { } @Override - public boolean run(GLAutoDrawable drawable) { + public boolean run(final GLAutoDrawable drawable) { boolean res = true; if(null == notifyObject) { try { res = runnable.run(drawable); - } catch (Throwable t) { + } catch (final Throwable t) { runnableException = t; if(catchExceptions) { runnableException.printStackTrace(); @@ -72,7 +72,7 @@ public class GLRunnableTask implements GLRunnable { synchronized (notifyObject) { try { res = runnable.run(drawable); - } catch (Throwable t) { + } catch (final Throwable t) { runnableException = t; if(catchExceptions) { runnableException.printStackTrace(); diff --git a/src/jogl/classes/jogamp/opengl/GLStateTracker.java b/src/jogl/classes/jogamp/opengl/GLStateTracker.java index 706d51323..d532a2567 100644 --- a/src/jogl/classes/jogamp/opengl/GLStateTracker.java +++ b/src/jogl/classes/jogamp/opengl/GLStateTracker.java @@ -78,7 +78,7 @@ public class GLStateTracker { /** * set (client) pixel-store state, deep copy */ - private final void setPixelStateMap(IntIntHashMap pixelStateMap) { + private final void setPixelStateMap(final IntIntHashMap pixelStateMap) { this.pixelStateMap = (IntIntHashMap) pixelStateMap.clone(); } @@ -102,7 +102,7 @@ public class GLStateTracker { pixelStateMap.clear(); } - public final void setEnabled(boolean on) { + public final void setEnabled(final boolean on) { enabled = on; } diff --git a/src/jogl/classes/jogamp/opengl/GLVersionNumber.java b/src/jogl/classes/jogamp/opengl/GLVersionNumber.java index 431c1a387..ddcd9626e 100644 --- a/src/jogl/classes/jogamp/opengl/GLVersionNumber.java +++ b/src/jogl/classes/jogamp/opengl/GLVersionNumber.java @@ -39,7 +39,7 @@ public class GLVersionNumber extends VersionNumberString { private final boolean valid; - private GLVersionNumber(int[] val, int strEnd, short state, String versionString, boolean valid) { + private GLVersionNumber(final int[] val, final int strEnd, final short state, final String versionString, final boolean valid) { super(val[0], val[1], val[2], strEnd, state, versionString); this.valid = valid; } @@ -56,8 +56,8 @@ public class GLVersionNumber extends VersionNumberString { } private static volatile java.util.regex.Pattern _Pattern = null; - public static final GLVersionNumber create(String versionString) { - int[] val = new int[] { 0, 0, 0 }; + public static final GLVersionNumber create(final String versionString) { + final int[] val = new int[] { 0, 0, 0 }; int strEnd = 0; short state = 0; boolean valid = false; @@ -67,7 +67,7 @@ public class GLVersionNumber extends VersionNumberString { if (versionString.startsWith("GL_VERSION_")) { versionPattern = getUnderscorePattern(); } else { - versionPattern = VersionNumberString.getDefaultVersionNumberPattern(); + versionPattern = VersionNumber.getDefaultVersionNumberPattern(); } final VersionNumberString version = new VersionNumberString(versionString, versionPattern); strEnd = version.endOfStringMatch(); @@ -76,7 +76,7 @@ public class GLVersionNumber extends VersionNumberString { state = (short) ( ( version.hasMajor() ? VersionNumber.HAS_MAJOR : (short)0 ) | ( version.hasMinor() ? VersionNumber.HAS_MINOR : (short)0 ) ); valid = version.hasMajor() && version.hasMinor(); // Requires at least a defined major and minor version component! - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); System.err.println("Info: ExtensionAvailabilityCache: FunctionAvailabilityCache.Version.: " + e); val[0] = 1; @@ -101,7 +101,7 @@ public class GLVersionNumber extends VersionNumberString { * 4.3.0 NVIDIA 310.32 -> 310.32 (310.32) * */ - public static final VersionNumberString createVendorVersion(String versionString) { + public static final VersionNumberString createVendorVersion(final String versionString) { if (versionString == null || versionString.length() <= 0) { return null; } diff --git a/src/jogl/classes/jogamp/opengl/GLWorkerThread.java b/src/jogl/classes/jogamp/opengl/GLWorkerThread.java index 100b46a5e..131e6f3ac 100644 --- a/src/jogl/classes/jogamp/opengl/GLWorkerThread.java +++ b/src/jogl/classes/jogamp/opengl/GLWorkerThread.java @@ -86,7 +86,7 @@ public class GLWorkerThread { thread.start(); try { lock.wait(); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { } } @@ -149,7 +149,7 @@ public class GLWorkerThread { } } - public static void invoke(boolean wait, Runnable runnable) + public static void invoke(final boolean wait, final Runnable runnable) throws InvocationTargetException, InterruptedException { if(wait) { invokeAndWait(runnable); @@ -158,13 +158,13 @@ public class GLWorkerThread { } } - public static void invokeAndWait(Runnable runnable) + public static void invokeAndWait(final Runnable runnable) throws InvocationTargetException, InterruptedException { if (!started) { throw new RuntimeException(getThreadName()+": May not invokeAndWait on worker thread without starting it first"); } - Object lockTemp = lock; + final Object lockTemp = lock; if (lockTemp == null) { return; // Terminating } @@ -179,19 +179,19 @@ public class GLWorkerThread { lockTemp.notifyAll(); lockTemp.wait(); if (exception != null) { - Throwable localException = exception; + final Throwable localException = exception; exception = null; throw new InvocationTargetException(localException); } } } - public static void invokeLater(Runnable runnable) { + public static void invokeLater(final Runnable runnable) { if (!started) { throw new RuntimeException(getThreadName()+": May not invokeLater on worker thread without starting it first"); } - Object lockTemp = lock; + final Object lockTemp = lock; if (lockTemp == null) { return; // Terminating } @@ -237,7 +237,7 @@ public class GLWorkerThread { try { // Avoid race conditions with wanting to release contexts on this thread lock.wait(1000); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { } if (GLContext.getCurrent() != null) { @@ -256,7 +256,7 @@ public class GLWorkerThread { if (work != null) { try { work.run(); - } catch (Throwable t) { + } catch (final Throwable t) { exception = t; } finally { work = null; @@ -266,19 +266,19 @@ public class GLWorkerThread { while (!queue.isEmpty()) { try { - Runnable curAsync = queue.remove(0); + final Runnable curAsync = queue.remove(0); curAsync.run(); - } catch (Throwable t) { + } catch (final Throwable t) { System.err.println(getThreadName()+": Exception occurred on JOGL OpenGL worker thread:"); t.printStackTrace(); } } // See about releasing current context - GLContext curContext = GLContext.getCurrent(); + final GLContext curContext = GLContext.getCurrent(); if (curContext != null && (curContext instanceof GLContextImpl)) { - GLContextImpl impl = (GLContextImpl) curContext; + final GLContextImpl impl = (GLContextImpl) curContext; if (impl.hasWaiters()) { impl.release(); } diff --git a/src/jogl/classes/jogamp/opengl/ListenerSyncedImplStub.java b/src/jogl/classes/jogamp/opengl/ListenerSyncedImplStub.java index a64a2f5cd..12384ad1e 100644 --- a/src/jogl/classes/jogamp/opengl/ListenerSyncedImplStub.java +++ b/src/jogl/classes/jogamp/opengl/ListenerSyncedImplStub.java @@ -58,18 +58,18 @@ public class ListenerSyncedImplStub { return listeners.size(); } - public synchronized final void addListener(E listener) { + public synchronized final void addListener(final E listener) { addListener(-1, listener); } - public synchronized final void addListener(int index, E listener) { + public synchronized final void addListener(int index, final E listener) { if(0>index) { index = listeners.size(); } listeners.add(index, listener); } - public synchronized final void removeListener(E listener) { + public synchronized final void removeListener(final E listener) { listeners.remove(listener); } diff --git a/src/jogl/classes/jogamp/opengl/MemoryObject.java b/src/jogl/classes/jogamp/opengl/MemoryObject.java index 6ebefc517..942d62b9e 100644 --- a/src/jogl/classes/jogamp/opengl/MemoryObject.java +++ b/src/jogl/classes/jogamp/opengl/MemoryObject.java @@ -43,13 +43,13 @@ public class MemoryObject { private final long size; private final int hash; private ByteBuffer buffer=null; - public MemoryObject(long addr, long size) { + public MemoryObject(final long addr, final long size) { this.addr = addr; this.size = size; this.hash = HashUtil.getAddrSizeHash32_EqualDist(addr, size); } - public void setBuffer(ByteBuffer buffer) { + public void setBuffer(final ByteBuffer buffer) { this.buffer = buffer; } @@ -76,7 +76,7 @@ public class MemoryObject { * @return true of reference is equal or obj is of type MemoryObject * and addr and size is equal.
*/ - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if(this == obj) { return true; } if(obj instanceof MemoryObject) { final MemoryObject m = (MemoryObject) obj; @@ -90,7 +90,7 @@ public class MemoryObject { * @param obj0 the MemoryObject * @return either the already mapped MemoryObject - not changing the map, or the newly mapped one. */ - public static MemoryObject getOrAddSafe(HashMap map, MemoryObject obj0) { + public static MemoryObject getOrAddSafe(final HashMap map, final MemoryObject obj0) { final MemoryObject obj1 = map.get(obj0); // get identity (fast) if(null == obj1) { map.put(obj0, obj0); diff --git a/src/jogl/classes/jogamp/opengl/ProjectFloat.java b/src/jogl/classes/jogamp/opengl/ProjectFloat.java index 91fcbd7a4..2c7989237 100644 --- a/src/jogl/classes/jogamp/opengl/ProjectFloat.java +++ b/src/jogl/classes/jogamp/opengl/ProjectFloat.java @@ -158,7 +158,7 @@ public class ProjectFloat { * @param bottom * @param top */ - public void gluOrtho2D(GLMatrixFunc gl, float left, float right, float bottom, float top) { + public void gluOrtho2D(final GLMatrixFunc gl, final float left, final float right, final float bottom, final float top) { gl.glOrthof(left, right, bottom, top, -1, 1); } @@ -170,7 +170,7 @@ public class ProjectFloat { * @param zNear * @param zFar */ - public void gluPerspective(GLMatrixFunc gl, float fovy, float aspect, float zNear, float zFar) { + public void gluPerspective(final GLMatrixFunc gl, final float fovy, final float aspect, final float zNear, final float zFar) { gl.glMultMatrixf(FloatUtil.makePerspective(mat4Tmp1, 0, true, fovy / 2 * (float) Math.PI / 180, aspect, zNear, zFar), 0); } @@ -187,10 +187,10 @@ public class ProjectFloat { * @param upy * @param upz */ - public void gluLookAt(GLMatrixFunc gl, - float eyex, float eyey, float eyez, - float centerx, float centery, float centerz, - float upx, float upy, float upz) { + public void gluLookAt(final GLMatrixFunc gl, + final float eyex, final float eyey, final float eyez, + final float centerx, final float centery, final float centerz, + final float upx, final float upy, final float upz) { mat4Tmp2[0+0] = eyex; mat4Tmp2[1+0] = eyey; mat4Tmp2[2+0] = eyez; @@ -235,11 +235,11 @@ public class ProjectFloat { /** * Map object coordinates to window coordinates. */ - public boolean gluProject(float objx, float objy, float objz, - FloatBuffer modelMatrix, - FloatBuffer projMatrix, - int[] viewport, int viewport_offset, - float[] win_pos, int win_pos_offset ) { + public boolean gluProject(final float objx, final float objy, final float objz, + final FloatBuffer modelMatrix, + final FloatBuffer projMatrix, + final int[] viewport, final int viewport_offset, + final float[] win_pos, final int win_pos_offset ) { final float[] in = this.mat4Tmp1; final float[] out = this.mat4Tmp2; @@ -283,11 +283,11 @@ public class ProjectFloat { * * @return */ - public boolean gluProject(float objx, float objy, float objz, - FloatBuffer modelMatrix, - FloatBuffer projMatrix, - IntBuffer viewport, - FloatBuffer win_pos) { + public boolean gluProject(final float objx, final float objy, final float objz, + final FloatBuffer modelMatrix, + final FloatBuffer projMatrix, + final IntBuffer viewport, + final FloatBuffer win_pos) { final float[] in = this.mat4Tmp1; final float[] out = this.mat4Tmp2; @@ -337,11 +337,11 @@ public class ProjectFloat { * @param obj_pos_offset * @return true if successful, otherwise false (failed to invert matrix, or becomes infinity due to zero z) */ - public boolean gluUnProject(float winx, float winy, float winz, - float[] modelMatrix, int modelMatrix_offset, - float[] projMatrix, int projMatrix_offset, - int[] viewport, int viewport_offset, - float[] obj_pos, int obj_pos_offset) { + public boolean gluUnProject(final float winx, final float winy, final float winz, + final float[] modelMatrix, final int modelMatrix_offset, + final float[] projMatrix, final int projMatrix_offset, + final int[] viewport, final int viewport_offset, + final float[] obj_pos, final int obj_pos_offset) { return FloatUtil.mapWinToObjCoords(winx, winy, winz, modelMatrix, modelMatrix_offset, projMatrix, projMatrix_offset, @@ -422,11 +422,11 @@ public class ProjectFloat { * * @return true if successful, otherwise false (failed to invert matrix, or becomes z is infinity) */ - public boolean gluUnProject(float winx, float winy, float winz, - FloatBuffer modelMatrix, - FloatBuffer projMatrix, - IntBuffer viewport, - FloatBuffer obj_pos) { + public boolean gluUnProject(final float winx, final float winy, final float winz, + final FloatBuffer modelMatrix, + final FloatBuffer projMatrix, + final IntBuffer viewport, + final FloatBuffer obj_pos) { final int vPos = viewport.position(); final int oPos = obj_pos.position(); @@ -580,7 +580,7 @@ public class ProjectFloat { */ public void gluPickMatrix(final GLMatrixFunc gl, final float x, final float y, - float deltaX, final float deltaY, + final float deltaX, final float deltaY, final IntBuffer viewport) { if (deltaX <= 0 || deltaY <= 0) { return; diff --git a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java index 1688d1044..93a4eb32e 100644 --- a/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java +++ b/src/jogl/classes/jogamp/opengl/SharedResourceRunner.java @@ -89,17 +89,17 @@ public class SharedResourceRunner implements Runnable { String initConnection; String releaseConnection; - private boolean getDeviceTried(String connection) { // synchronized call + private boolean getDeviceTried(final String connection) { // synchronized call return devicesTried.contains(connection); } - private void addDeviceTried(String connection) { // synchronized call + private void addDeviceTried(final String connection) { // synchronized call devicesTried.add(connection); } - private void removeDeviceTried(String connection) { // synchronized call + private void removeDeviceTried(final String connection) { // synchronized call devicesTried.remove(connection); } - public SharedResourceRunner(Implementation impl) { + public SharedResourceRunner(final Implementation impl) { this.impl = impl; resetState(); } @@ -144,7 +144,7 @@ public class SharedResourceRunner implements Runnable { while (!running) { try { this.wait(); - } catch (InterruptedException ex) { } + } catch (final InterruptedException ex) { } } } } @@ -164,14 +164,14 @@ public class SharedResourceRunner implements Runnable { while (running) { try { this.wait(); - } catch (InterruptedException ex) { } + } catch (final InterruptedException ex) { } } } } } } - public SharedResourceRunner.Resource getOrCreateShared(AbstractGraphicsDevice device) { + public SharedResourceRunner.Resource getOrCreateShared(final AbstractGraphicsDevice device) { SharedResourceRunner.Resource sr = null; if(null != device) { synchronized (this) { @@ -198,7 +198,7 @@ public class SharedResourceRunner implements Runnable { return sr; } - public SharedResourceRunner.Resource releaseShared(AbstractGraphicsDevice device) { + public SharedResourceRunner.Resource releaseShared(final AbstractGraphicsDevice device) { SharedResourceRunner.Resource sr = null; if(null != device) { synchronized (this) { @@ -219,7 +219,7 @@ public class SharedResourceRunner implements Runnable { return sr; } - private final void doAndWait(String initConnection, String releaseConnection) { + private final void doAndWait(final String initConnection, final String releaseConnection) { synchronized (this) { // wait until thread becomes ready to init new device, // pass the device and release the sync @@ -230,7 +230,7 @@ public class SharedResourceRunner implements Runnable { while (!ready && running) { try { this.wait(); - } catch (InterruptedException ex) { } + } catch (final InterruptedException ex) { } } if (DEBUG) { System.err.println("SharedResourceRunner.doAndWait() set command: " + initConnection + ", release: "+releaseConnection+" - "+threadName); @@ -243,7 +243,7 @@ public class SharedResourceRunner implements Runnable { while ( running && ( !ready || null != this.initConnection || null != this.releaseConnection ) ) { try { this.wait(); - } catch (InterruptedException ex) { } + } catch (final InterruptedException ex) { } } if (DEBUG) { System.err.println("SharedResourceRunner.initializeAndWait END init: " + initConnection + ", release: "+releaseConnection+" - "+threadName); @@ -272,7 +272,7 @@ public class SharedResourceRunner implements Runnable { } notifyAll(); this.wait(); - } catch (InterruptedException ex) { + } catch (final InterruptedException ex) { shouldRelease = true; if(DEBUG) { System.err.println("SharedResourceRunner.run(): INTERRUPTED - "+threadName); @@ -293,7 +293,7 @@ public class SharedResourceRunner implements Runnable { Resource sr = null; try { sr = impl.createSharedResource(initConnection); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } if (null != sr) { @@ -304,12 +304,12 @@ public class SharedResourceRunner implements Runnable { if (DEBUG) { System.err.println("SharedResourceRunner.run(): release Shared for: " + releaseConnection + " - " + threadName); } - Resource sr = impl.mapGet(releaseConnection); + final Resource sr = impl.mapGet(releaseConnection); if (null != sr) { try { impl.releaseSharedResource(sr); impl.mapPut(releaseConnection, null); - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } } @@ -338,11 +338,11 @@ public class SharedResourceRunner implements Runnable { private void releaseSharedResources() { // synchronized call devicesTried.clear(); - Collection sharedResources = impl.mapValues(); - for (Iterator iter = sharedResources.iterator(); iter.hasNext();) { + final Collection sharedResources = impl.mapValues(); + for (final Iterator iter = sharedResources.iterator(); iter.hasNext();) { try { impl.releaseSharedResource(iter.next()); - } catch (Throwable t) { + } catch (final Throwable t) { System.err.println("Caught exception on thread "+getThreadName()); t.printStackTrace(); } diff --git a/src/jogl/classes/jogamp/opengl/SystemUtil.java b/src/jogl/classes/jogamp/opengl/SystemUtil.java index befe1a315..e7f078079 100644 --- a/src/jogl/classes/jogamp/opengl/SystemUtil.java +++ b/src/jogl/classes/jogamp/opengl/SystemUtil.java @@ -5,11 +5,11 @@ public class SystemUtil { private static volatile boolean getenvSupported = true; /** Wrapper for System.getenv(), which doesn't work on platforms earlier than JDK 5 */ - public static String getenv(String variableName) { + public static String getenv(final String variableName) { if (getenvSupported) { try { return System.getenv(variableName); - } catch (Error e) { + } catch (final Error e) { getenvSupported = false; } } diff --git a/src/jogl/classes/jogamp/opengl/ThreadingImpl.java b/src/jogl/classes/jogamp/opengl/ThreadingImpl.java index bf700d970..2b017e8e9 100644 --- a/src/jogl/classes/jogamp/opengl/ThreadingImpl.java +++ b/src/jogl/classes/jogamp/opengl/ThreadingImpl.java @@ -43,6 +43,7 @@ import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; import com.jogamp.common.JogampRuntimeException; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; /** Implementation of the {@link javax.media.opengl.Threading} class. */ @@ -53,7 +54,7 @@ public class ThreadingImpl { public final int id; - Mode(int id){ + Mode(final int id){ this.id = id; } } @@ -76,10 +77,10 @@ public class ThreadingImpl { public ToolkitThreadingPlugin run() { final String singleThreadProp; { - final String w = Debug.getProperty("jogl.1thread", true); + final String w = PropertyAccess.getProperty("jogl.1thread", true); singleThreadProp = null != w ? w.toLowerCase() : null; } - ClassLoader cl = ThreadingImpl.class.getClassLoader(); + final ClassLoader cl = ThreadingImpl.class.getClassLoader(); // Default to using the AWT thread on all platforms except // Windows. On OS X there is instability apparently due to // using the JAWT on non-AWT threads. On X11 platforms there @@ -121,7 +122,7 @@ public class ThreadingImpl { Exception error=null; try { threadingPlugin = (ToolkitThreadingPlugin) ReflectionUtil.createInstance("jogamp.opengl.awt.AWTThreadingPlugin", cl); - } catch (JogampRuntimeException jre) { error = jre; } + } catch (final JogampRuntimeException jre) { error = jre; } if( Mode.ST_AWT == mode && null==threadingPlugin ) { throw new GLException("Mode is AWT, but class 'jogamp.opengl.awt.AWTThreadingPlugin' is not available", error); } @@ -201,7 +202,7 @@ public class ThreadingImpl { false). It is up to the end user to check to see whether the current thread is the OpenGL thread and either execute the Runnable directly or perform the work inside it. */ - public static final void invokeOnOpenGLThread(boolean wait, Runnable r) throws GLException { + public static final void invokeOnOpenGLThread(final boolean wait, final Runnable r) throws GLException { if(null!=threadingPlugin) { threadingPlugin.invokeOnOpenGLThread(wait, r); return; @@ -217,13 +218,13 @@ public class ThreadingImpl { } } - public static final void invokeOnWorkerThread(boolean wait, Runnable r) throws GLException { + public static final void invokeOnWorkerThread(final boolean wait, final Runnable r) throws GLException { GLWorkerThread.start(); // singleton start via volatile-dbl-checked-locking try { GLWorkerThread.invoke(wait, r); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { throw new GLException(e); } } diff --git a/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java b/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java index 5778a1b6c..9aa1c882a 100644 --- a/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java +++ b/src/jogl/classes/jogamp/opengl/android/av/AndroidGLMediaPlayerAPI14.java @@ -41,9 +41,9 @@ import com.jogamp.opengl.util.av.GLMediaPlayer; import com.jogamp.opengl.util.texture.Texture; import com.jogamp.opengl.util.texture.TextureSequence; +import jogamp.common.os.PlatformPropsImpl; import jogamp.common.os.android.StaticContext; import jogamp.opengl.util.av.GLMediaPlayerImpl; - import android.graphics.SurfaceTexture; import android.graphics.SurfaceTexture.OnFrameAvailableListener; import android.hardware.Camera; @@ -81,7 +81,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { static { boolean _avail = false; - if(Platform.OS_TYPE.equals(Platform.OSType.ANDROID)) { + if(PlatformPropsImpl.OS_TYPE.equals(Platform.OSType.ANDROID)) { if(AndroidVersion.SDK_INT >= 14) { _avail = true; } @@ -116,18 +116,18 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { } @Override - protected final boolean setPlaySpeedImpl(float rate) { + protected final boolean setPlaySpeedImpl(final float rate) { // FIXME return false; } @Override - protected final boolean setAudioVolumeImpl(float v) { + protected final boolean setAudioVolumeImpl(final float v) { if(null != mp) { try { mp.setVolume(v, v); return true; - } catch (IllegalStateException ise) { + } catch (final IllegalStateException ise) { if(DEBUG) { ise.printStackTrace(); } @@ -145,7 +145,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { eos = false; mp.setOnCompletionListener(onCompletionListener); return true; - } catch (IllegalStateException ise) { + } catch (final IllegalStateException ise) { if(DEBUG) { ise.printStackTrace(); } @@ -156,7 +156,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { cam.startPreview(); } return true; - } catch (IllegalStateException ise) { + } catch (final IllegalStateException ise) { if(DEBUG) { ise.printStackTrace(); } @@ -172,7 +172,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { try { mp.pause(); return true; - } catch (IllegalStateException ise) { + } catch (final IllegalStateException ise) { if(DEBUG) { ise.printStackTrace(); } @@ -182,7 +182,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { try { cam.stopPreview(); return true; - } catch (IllegalStateException ise) { + } catch (final IllegalStateException ise) { if(DEBUG) { ise.printStackTrace(); } @@ -192,7 +192,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { } @Override - protected final int seekImpl(int msec) { + protected final int seekImpl(final int msec) { if(null != mp) { mp.seekTo(msec); return mp.getCurrentPosition(); @@ -200,7 +200,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { return 0; } - private void wakeUp(boolean newFrame) { + private void wakeUp(final boolean newFrame) { synchronized(updateSurfaceLock) { if(newFrame) { updateSurface = true; @@ -213,12 +213,12 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { protected final int getAudioPTSImpl() { return null != mp ? mp.getCurrentPosition() : 0; } @Override - protected final void destroyImpl(GL gl) { + protected final void destroyImpl(final GL gl) { if(null != mp) { wakeUp(false); try { mp.stop(); - } catch (IllegalStateException ise) { + } catch (final IllegalStateException ise) { if(DEBUG) { ise.printStackTrace(); } @@ -230,7 +230,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { wakeUp(false); try { cam.stopPreview(); - } catch (IllegalStateException ise) { + } catch (final IllegalStateException ise) { if(DEBUG) { ise.printStackTrace(); } @@ -241,7 +241,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { } public static class SurfaceTextureFrame extends TextureSequence.TextureFrame { - public SurfaceTextureFrame(Texture t, SurfaceTexture stex) { + public SurfaceTextureFrame(final Texture t, final SurfaceTexture stex) { super(t); this.surfaceTex = stex; } @@ -264,7 +264,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { int cameraId = 0; try { cameraId = Integer.valueOf(cameraPath); - } catch (NumberFormatException nfe) {} + } catch (final NumberFormatException nfe) {} if( 0 <= cameraId && cameraId < Camera.getNumberOfCameras() ) { cam = Camera.open(cameraId); } else { @@ -282,17 +282,17 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { try { final Uri _uri = Uri.parse(getURI().toString()); mp.setDataSource(StaticContext.getContext(), _uri); - } catch (IllegalArgumentException e) { + } catch (final IllegalArgumentException e) { throw new RuntimeException(e); - } catch (SecurityException e) { + } catch (final SecurityException e) { throw new RuntimeException(e); - } catch (IllegalStateException e) { + } catch (final IllegalStateException e) { throw new RuntimeException(e); } mp.setSurface(null); try { mp.prepare(); - } catch (IOException ioe) { + } catch (final IOException ioe) { throw new IOException("MediaPlayer failed to process stream <"+getURI().toString()+">: "+ioe.getMessage(), ioe); } final int r_aid = GLMediaPlayer.STREAM_ID_NONE == aid ? GLMediaPlayer.STREAM_ID_NONE : 1 /* fake */; @@ -340,7 +340,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { 0, 0, 0, icodec, icodec); } } - private static String camSz2Str(Camera.Size csize) { + private static String camSz2Str(final Camera.Size csize) { if( null != csize ) { return csize.width+"x"+csize.height; } else { @@ -348,7 +348,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { } } @Override - protected final void initGLImpl(GL gl) throws IOException, GLException { + protected final void initGLImpl(final GL gl) throws IOException, GLException { // NOP } @@ -359,12 +359,12 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { *

*/ @Override - protected int validateTextureCount(int desiredTextureCount) { + protected int validateTextureCount(final int desiredTextureCount) { return TEXTURE_COUNT_MIN; } @Override - protected final int getNextTextureImpl(GL gl, TextureFrame nextFrame) { + protected final int getNextTextureImpl(final GL gl, final TextureFrame nextFrame) { int pts = TimeFrameI.INVALID_PTS; if(null != mp || null != cam) { final SurfaceTextureFrame sTexFrame = null != nextFrame ? (SurfaceTextureFrame) nextFrame : singleSTexFrame; @@ -380,7 +380,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { try { cam.setPreviewTexture(sTexFrame.surfaceTex); cam.startPreview(); - } catch (IOException ioe) { + } catch (final IOException ioe) { throw new RuntimeException("MediaPlayer failed to process stream <"+getURI().toString()+">: "+ioe.getMessage(), ioe); } } @@ -401,7 +401,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { if(!updateSurface) { // volatile OK. try { updateSurfaceLock.wait(); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } } @@ -432,7 +432,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { *

*/ @Override - protected TextureFrame[] createTexFrames(GL gl, final int count) { + protected TextureFrame[] createTexFrames(final GL gl, final int count) { final int[] texNames = new int[1]; gl.glGenTextures(1, texNames, 0); final int err = gl.glGetError(); @@ -452,7 +452,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { *

*/ @Override - protected final TextureSequence.TextureFrame createTexImage(GL gl, int texName) { + protected final TextureSequence.TextureFrame createTexImage(final GL gl, final int texName) { sTexFrameCount++; if( 1 == sTexFrameCount ) { singleSTexFrame = new SurfaceTextureFrame( createTexImageImpl(gl, texName, getWidth(), getHeight()), new SurfaceTexture(texName) ); @@ -467,7 +467,7 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { *

*/ @Override - protected final void destroyTexFrame(GL gl, TextureSequence.TextureFrame frame) { + protected final void destroyTexFrame(final GL gl, final TextureSequence.TextureFrame frame) { sTexFrameCount--; if( 0 == sTexFrameCount ) { singleSTexFrame = null; @@ -480,14 +480,14 @@ public class AndroidGLMediaPlayerAPI14 extends GLMediaPlayerImpl { private final OnFrameAvailableListener onFrameAvailableListener = new OnFrameAvailableListener() { @Override - public void onFrameAvailable(SurfaceTexture surfaceTexture) { + public void onFrameAvailable(final SurfaceTexture surfaceTexture) { wakeUp(true); } }; private final OnCompletionListener onCompletionListener = new OnCompletionListener() { @Override - public void onCompletion(MediaPlayer mp) { + public void onCompletion(final MediaPlayer mp) { eos = true; } }; diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java b/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java index 72c9ac54b..26ec62785 100644 --- a/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java +++ b/src/jogl/classes/jogamp/opengl/awt/AWTThreadingPlugin.java @@ -86,7 +86,7 @@ public class AWTThreadingPlugin implements ToolkitThreadingPlugin { } @Override - public final void invokeOnOpenGLThread(boolean wait, Runnable r) throws GLException { + public final void invokeOnOpenGLThread(final boolean wait, final Runnable r) throws GLException { switch (ThreadingImpl.getMode()) { case ST_AWT: // FIXME: ideally should run all OpenGL work on the Java2D QFT diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java index 1c1d2350a..a5f5b4702 100644 --- a/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java +++ b/src/jogl/classes/jogamp/opengl/awt/AWTTilePainter.java @@ -83,11 +83,11 @@ public class AWTTilePainter { private Graphics2D g2d = null; private AffineTransform saveAT = null; - public static void dumpHintsAndScale(Graphics2D g2d) { + public static void dumpHintsAndScale(final Graphics2D g2d) { final RenderingHints rHints = g2d.getRenderingHints(); final Set> rEntries = rHints.entrySet(); int count = 0; - for(Iterator> rEntryIter = rEntries.iterator(); rEntryIter.hasNext(); count++) { + for(final Iterator> rEntryIter = rEntries.iterator(); rEntryIter.hasNext(); count++) { final Entry rEntry = rEntryIter.next(); System.err.println("Hint["+count+"]: "+rEntry.getKey()+" -> "+rEntry.getValue()); } @@ -105,7 +105,7 @@ public class AWTTilePainter { /** * @return resulting number of samples by comparing w/ {@link #customNumSamples} and the caps-config, 0 if disabled */ - public int getNumSamples(GLCapabilitiesImmutable caps) { + public int getNumSamples(final GLCapabilitiesImmutable caps) { if( 0 > customNumSamples ) { return 0; } else if( 0 < customNumSamples ) { @@ -137,7 +137,7 @@ public class AWTTilePainter { * @param tileHeight custom tile height for {@link TileRenderer#setTileSize(int, int, int) tile renderer}, pass -1 for default. * @param verbose */ - public AWTTilePainter(TileRenderer renderer, int componentCount, double scaleMatX, double scaleMatY, int numSamples, int tileWidth, int tileHeight, boolean verbose) { + public AWTTilePainter(final TileRenderer renderer, final int componentCount, final double scaleMatX, final double scaleMatY, final int numSamples, final int tileWidth, final int tileHeight, final boolean verbose) { this.renderer = renderer; this.renderer.setGLEventListener(preTileGLEL, postTileGLEL); this.componentCount = componentCount; @@ -160,16 +160,16 @@ public class AWTTilePainter { * @param flipVertical if true, the image will be flipped vertically (Default for OpenGL). * @param originBottomLeft if true, the image's origin is on the bottom left (Default for OpenGL). */ - public void setGLOrientation(boolean flipVertical, boolean originBottomLeft) { + public void setGLOrientation(final boolean flipVertical, final boolean originBottomLeft) { this.flipVertical = flipVertical; this.originBottomLeft = originBottomLeft; } - private static Rectangle2D getClipBounds2D(Graphics2D g) { + private static Rectangle2D getClipBounds2D(final Graphics2D g) { final Shape shape = g.getClip(); return null != shape ? shape.getBounds2D() : null; } - private static Rectangle2D clipNegative(Rectangle2D in) { + private static Rectangle2D clipNegative(final Rectangle2D in) { if( null == in ) { return null; } double x=in.getX(), y=in.getY(), width=in.getWidth(), height=in.getHeight(); if( 0 > x ) { @@ -201,7 +201,7 @@ public class AWTTilePainter { * @throws NoninvertibleTransformException if the {@link Graphics2D}'s {@link AffineTransform} {@link AffineTransform#invert() inversion} fails. * Since inversion is tested before scaling the given {@link Graphics2D}, caller shall ignore the whole term. */ - public void setupGraphics2DAndClipBounds(Graphics2D g2d, int width, int height) throws NoninvertibleTransformException { + public void setupGraphics2DAndClipBounds(final Graphics2D g2d, final int width, final int height) throws NoninvertibleTransformException { this.g2d = g2d; saveAT = g2d.getTransform(); if( null == saveAT ) { @@ -278,11 +278,11 @@ public class AWTTilePainter { final GLEventListener preTileGLEL = new GLEventListener() { @Override - public void init(GLAutoDrawable drawable) {} + public void init(final GLAutoDrawable drawable) {} @Override - public void dispose(GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { final GL gl = drawable.getGL(); if( null == tBuffer ) { final int tWidth = renderer.getParam(TileRenderer.TR_TILE_WIDTH); @@ -302,17 +302,17 @@ public class AWTTilePainter { } } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {} + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {} }; static int _counter = 0; final GLEventListener postTileGLEL = new GLEventListener() { @Override - public void init(GLAutoDrawable drawable) { + public void init(final GLAutoDrawable drawable) { } @Override - public void dispose(GLAutoDrawable drawable) {} + public void dispose(final GLAutoDrawable drawable) {} @Override - public void display(GLAutoDrawable drawable) { + public void display(final GLAutoDrawable drawable) { final DimensionImmutable cis = renderer.getClippedImageSize(); final int tWidth = renderer.getParam(TileRendererBase.TR_CURRENT_TILE_WIDTH); final int tHeight = renderer.getParam(TileRendererBase.TR_CURRENT_TILE_HEIGHT); @@ -337,7 +337,7 @@ public class AWTTilePainter { final File fout = new File(fname); try { ImageIO.write(tBuffer.image, "png", fout); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } } @@ -368,7 +368,7 @@ public class AWTTilePainter { final File fout = new File(fname); try { ImageIO.write(dstImage, "png", fout); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } _counter++; @@ -395,6 +395,6 @@ public class AWTTilePainter { } } @Override - public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {} + public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) {} }; } diff --git a/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java b/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java index dc286ca59..e34ec18b6 100644 --- a/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java +++ b/src/jogl/classes/jogamp/opengl/awt/AWTUtil.java @@ -59,7 +59,7 @@ public class AWTUtil { isOGLPipelineActive = j2dClazz.getMethod("isOGLPipelineActive", (Class[])null); isQueueFlusherThread = j2dClazz.getMethod("isQueueFlusherThread", (Class[])null); j2dOk = true; - } catch (Exception e) {} + } catch (final Exception e) {} } } @@ -84,7 +84,7 @@ public class AWTUtil { !((Boolean)isQueueFlusherThread.invoke(null, (Object[])null)).booleanValue() ) { NativeWindowFactory.getAWTToolkitLock().lock(); } - } catch (Exception e) { j2dOk=false; } + } catch (final Exception e) { j2dOk=false; } } if(!j2dOk) { NativeWindowFactory.getAWTToolkitLock().lock(); @@ -107,7 +107,7 @@ public class AWTUtil { !((Boolean)isQueueFlusherThread.invoke(null, (Object[])null)).booleanValue() ) { NativeWindowFactory.getAWTToolkitLock().unlock(); } - } catch (Exception e) { j2dOk=false; } + } catch (final Exception e) { j2dOk=false; } } if(!j2dOk) { NativeWindowFactory.getAWTToolkitLock().unlock(); diff --git a/src/jogl/classes/jogamp/opengl/awt/Java2D.java b/src/jogl/classes/jogamp/opengl/awt/Java2D.java index 5735b875e..86ca7650f 100644 --- a/src/jogl/classes/jogamp/opengl/awt/Java2D.java +++ b/src/jogl/classes/jogamp/opengl/awt/Java2D.java @@ -59,6 +59,7 @@ import javax.media.opengl.GLProfile; import com.jogamp.common.os.Platform; +import jogamp.common.os.PlatformPropsImpl; import jogamp.opengl.Debug; @@ -128,7 +129,7 @@ public class Java2D { // OpenGL graphics configuration final GraphicsConfiguration cfg; final String cfgName; - final boolean java2dOGLDisabledByOS = Platform.OS_TYPE == Platform.OSType.MACOS; + final boolean java2dOGLDisabledByOS = PlatformPropsImpl.OS_TYPE == Platform.OSType.MACOS; final boolean java2dOGLDisabledByProp; { boolean enabled = true; @@ -160,7 +161,7 @@ public class Java2D { if (isOGLPipelineActive) { try { // Try to get methods we need to integrate - Class utils = Class.forName("sun.java2d.opengl.OGLUtilities"); + final Class utils = Class.forName("sun.java2d.opengl.OGLUtilities"); invokeWithOGLContextCurrentMethod = utils.getDeclaredMethod("invokeWithOGLContextCurrent", new Class[] { Graphics.class, @@ -208,7 +209,7 @@ public class Java2D { Graphics.class }); getOGLSurfaceTypeMethod.setAccessible(true); - } catch (Exception e) { + } catch (final Exception e) { fbObjectSupportInitialized = false; if (DEBUG) { e.printStackTrace(); @@ -223,7 +224,7 @@ public class Java2D { Graphics.class }); getOGLTextureTypeMethod.setAccessible(true); - } catch (Exception e) { + } catch (final Exception e) { if (DEBUG) { e.printStackTrace(); System.err.println("Info: GL_ARB_texture_rectangle FBO support disabled"); @@ -236,7 +237,7 @@ public class Java2D { Class cglSurfaceData = null; try { cglSurfaceData = Class.forName("sun.java2d.opengl.CGLSurfaceData"); - } catch (Exception e) { + } catch (final Exception e) { if (DEBUG) { e.printStackTrace(); System.err.println("Info: Unable to find class sun.java2d.opengl.CGLSurfaceData for OS X"); @@ -268,7 +269,7 @@ public class Java2D { destroyOGLContextMethod.setAccessible(true); } } - } catch (Exception e) { + } catch (final Exception e) { caught = e; if (DEBUG) { System.err.println("Info: Disabling Java2D/JOGL integration"); @@ -277,9 +278,9 @@ public class Java2D { isOGLPipelineResourceCompatible = false; } } - } catch (HeadlessException e) { + } catch (final HeadlessException e) { // The AWT is running in headless mode, so the Java 2D / JOGL bridge is clearly disabled - } catch (Error e) { + } catch (final Error e) { // issued on OSX Java7: java.lang.Error: Could not find class: sun.awt.HeadlessGraphicsEnvironment caught = e; } @@ -312,9 +313,9 @@ public class Java2D { try { return ((Boolean) isQueueFlusherThreadMethod.invoke(null, (Object[])null)).booleanValue(); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } @@ -322,7 +323,7 @@ public class Java2D { /** Makes current the OpenGL context associated with the passed Graphics object and runs the given Runnable on the Queue Flushing Thread in one atomic action. */ - public static void invokeWithOGLContextCurrent(Graphics g, Runnable r) throws GLException { + public static void invokeWithOGLContextCurrent(final Graphics g, final Runnable r) throws GLException { checkActive(); try { @@ -341,9 +342,9 @@ public class Java2D { } finally { AWTUtil.unlockToolkit(); } - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } @@ -356,7 +357,7 @@ public class Java2D { JOGL must share textures and display lists with it. Returns false if the passed GraphicsConfiguration was not an OpenGL GraphicsConfiguration. */ - public static boolean invokeWithOGLSharedContextCurrent(GraphicsConfiguration g, Runnable r) throws GLException { + public static boolean invokeWithOGLSharedContextCurrent(final GraphicsConfiguration g, final Runnable r) throws GLException { checkCompatible(); try { @@ -366,9 +367,9 @@ public class Java2D { } finally { AWTUtil.unlockToolkit(); } - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } @@ -379,18 +380,18 @@ public class Java2D { call glViewport() with the returned rectangle's bounds in order to get correct rendering results. Should only be called from the Queue Flusher Thread. */ - public static Rectangle getOGLViewport(Graphics g, - int componentWidth, - int componentHeight) { + public static Rectangle getOGLViewport(final Graphics g, + final int componentWidth, + final int componentHeight) { checkCompatible(); try { return (Rectangle) getOGLViewportMethod.invoke(null, new Object[] {g, new Integer(componentWidth), new Integer(componentHeight)}); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } @@ -401,14 +402,14 @@ public class Java2D { method should be called and the resulting rectangle's bounds passed to a call to glScissor(). Should only be called from the Queue Flusher Thread. */ - public static Rectangle getOGLScissorBox(Graphics g) { + public static Rectangle getOGLScissorBox(final Graphics g) { checkCompatible(); try { return (Rectangle) getOGLScissorBoxMethod.invoke(null, new Object[] {g}); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } @@ -419,14 +420,14 @@ public class Java2D { changed and a new external GLDrawable and GLContext should be created (and the old ones destroyed). Should only be called from the Queue Flusher Thread.*/ - public static Object getOGLSurfaceIdentifier(Graphics g) { + public static Object getOGLSurfaceIdentifier(final Graphics g) { checkCompatible(); try { return getOGLSurfaceIdentifierMethod.invoke(null, new Object[] {g}); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } @@ -434,7 +435,7 @@ public class Java2D { /** Returns the underlying surface type for the given Graphics object. This indicates, in particular, whether Java2D is currently rendering into a pbuffer or FBO. */ - public static int getOGLSurfaceType(Graphics g) { + public static int getOGLSurfaceType(final Graphics g) { checkCompatible(); try { @@ -445,9 +446,9 @@ public class Java2D { } return ((Integer) getOGLSurfaceTypeMethod.invoke(null, new Object[] { g })).intValue(); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } @@ -455,7 +456,7 @@ public class Java2D { /** Returns the underlying texture target of the given Graphics object assuming it is rendering to an FBO. Returns either GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE_ARB. */ - public static int getOGLTextureType(Graphics g) { + public static int getOGLTextureType(final Graphics g) { checkCompatible(); if (getOGLTextureTypeMethod == null) { @@ -464,9 +465,9 @@ public class Java2D { try { return ((Integer) getOGLTextureTypeMethod.invoke(null, new Object[] { g })).intValue(); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } @@ -477,7 +478,7 @@ public class Java2D { used for rendering. FIXME: may need to alter the API in the future to indicate which GraphicsDevice the source context is associated with. */ - public static GLContext filterShareContext(GLContext shareContext) { + public static GLContext filterShareContext(final GLContext shareContext) { if (isHeadless) return shareContext; @@ -495,7 +496,7 @@ public class Java2D { context", with which all contexts created by JOGL must share textures and display lists when the FBO option is enabled for the Java2D/OpenGL pipeline. */ - public static GLContext getShareContext(GraphicsDevice device) { + public static GLContext getShareContext(final GraphicsDevice device) { initFBOShareContext(device); // FIXME: for full generality probably need to have multiple of // these, one per GraphicsConfiguration seen? @@ -509,41 +510,41 @@ public class Java2D { /** (Mac OS X-specific) Creates a new OpenGL context on the surface associated with the given Graphics object, sharing textures and display lists with the specified (CGLContextObj) share context. */ - public static long createOGLContextOnSurface(Graphics g, long shareCtx) { + public static long createOGLContextOnSurface(final Graphics g, final long shareCtx) { checkCompatible(); try { return ((Long) createOGLContextOnSurfaceMethod.invoke(null, new Object[] { g, new Long(shareCtx) })).longValue(); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } /** (Mac OS X-specific) Makes the given OpenGL context current on the surface associated with the given Graphics object. */ - public static boolean makeOGLContextCurrentOnSurface(Graphics g, long ctx) { + public static boolean makeOGLContextCurrentOnSurface(final Graphics g, final long ctx) { checkCompatible(); try { return ((Boolean) makeOGLContextCurrentOnSurfaceMethod.invoke(null, new Object[] { g, new Long(ctx) })).booleanValue(); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } /** (Mac OS X-specific) Destroys the given OpenGL context. */ - public static void destroyOGLContext(long ctx) { + public static void destroyOGLContext(final long ctx) { checkCompatible(); try { destroyOGLContextMethod.invoke(null, new Object[] { new Long(ctx) }); - } catch (InvocationTargetException e) { + } catch (final InvocationTargetException e) { throw new GLException(e.getTargetException()); - } catch (Exception e) { + } catch (final Exception e) { throw (InternalError) new InternalError().initCause(e); } } @@ -565,15 +566,15 @@ public class Java2D { } private static int getOGLUtilitiesIntField(final String name) { - Integer i = AccessController.doPrivileged(new PrivilegedAction() { + final Integer i = AccessController.doPrivileged(new PrivilegedAction() { @Override public Integer run() { try { - Class utils = Class.forName("sun.java2d.opengl.OGLUtilities"); - Field f = utils.getField(name); + final Class utils = Class.forName("sun.java2d.opengl.OGLUtilities"); + final Field f = utils.getField(name); f.setAccessible(true); return (Integer) f.get(null); - } catch (Exception e) { + } catch (final Exception e) { if (DEBUG) { e.printStackTrace(); } diff --git a/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java b/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java index 9173a38cb..2f87f01a9 100644 --- a/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java +++ b/src/jogl/classes/jogamp/opengl/awt/VersionApplet.java @@ -31,12 +31,12 @@ public class VersionApplet extends Applet { TextArea tareaCaps; GLCanvas canvas; - public static void main(String[] args) { - Frame frame = new Frame("JOGL Version Applet"); + public static void main(final String[] args) { + final Frame frame = new Frame("JOGL Version Applet"); frame.setSize(800, 600); frame.setLayout(new BorderLayout()); - VersionApplet va = new VersionApplet(); + final VersionApplet va = new VersionApplet(); frame.addWindowListener(new ClosingWindowAdapter(frame, va)); va.init(); @@ -50,12 +50,12 @@ public class VersionApplet extends Applet { static class ClosingWindowAdapter extends WindowAdapter { Frame f; VersionApplet va; - public ClosingWindowAdapter(Frame f, VersionApplet va) { + public ClosingWindowAdapter(final Frame f, final VersionApplet va) { this.f = f; this.va = va; } @Override - public void windowClosing(WindowEvent ev) { + public void windowClosing(final WindowEvent ev) { f.setVisible(false); va.stop(); va.destroy(); @@ -70,8 +70,8 @@ public class VersionApplet extends Applet { setEnabled(true); - GLProfile glp = GLProfile.getDefault(); - GLCapabilities glcaps = new GLCapabilities(glp); + final GLProfile glp = GLProfile.getDefault(); + final GLCapabilities glcaps = new GLCapabilities(glp); setLayout(new BorderLayout()); String s; @@ -96,16 +96,16 @@ public class VersionApplet extends Applet { tareaVersion.append(s); tareaCaps = new TextArea(120, 20); - GLDrawableFactory factory = GLDrawableFactory.getFactory(glp); - List availCaps = factory.getAvailableCapabilities(null); + final GLDrawableFactory factory = GLDrawableFactory.getFactory(glp); + final List availCaps = factory.getAvailableCapabilities(null); for(int i=0; i getToolGetProcAddressFuncNameList() { - List res = new ArrayList(); + final List res = new ArrayList(); res.add("eglGetProcAddress"); return res; } @Override - public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) { + public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { return EGL.eglGetProcAddress(toolGetProcAddressHandle, funcName); } @Override - public final boolean useToolGetProcAdressFirst(String funcName) { + public final boolean useToolGetProcAdressFirst(final String funcName) { return true; } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java index da1c8aa47..964401244 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLContext.java @@ -65,13 +65,13 @@ public class EGLContext extends GLContextImpl { // EGL extension functions. private EGLExtProcAddressTable eglExtProcAddressTable; - EGLContext(GLDrawableImpl drawable, - GLContext shareWith) { + EGLContext(final GLDrawableImpl drawable, + final GLContext shareWith) { super(drawable, shareWith); } @Override - protected void resetStates(boolean isInit) { + protected void resetStates(final boolean isInit) { eglQueryStringInitialized = false; eglQueryStringAvailable = false; eglExtProcAddressTable = null; @@ -140,12 +140,12 @@ public class EGLContext extends GLContextImpl { } @Override - protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) { + protected long createContextARBImpl(final long share, final boolean direct, final int ctp, final int major, final int minor) { return 0; // FIXME } @Override - protected void destroyContextARBImpl(long _context) { + protected void destroyContextARBImpl(final long _context) { if (!EGL.eglDestroyContext(drawable.getNativeSurface().getDisplayHandle(), _context)) { final int eglError = EGL.eglGetError(); if(EGL.EGL_SUCCESS != eglError) { /* oops, Mesa EGL impl. may return false, but has no EGL error */ @@ -175,7 +175,7 @@ public class EGLContext extends GLContextImpl { if( !EGL.eglBindAPI(EGL.EGL_OPENGL_ES_API) ) { throw new GLException("Caught: eglBindAPI to ES failed , error "+toHexString(EGL.eglGetError())); } - } catch (GLException glex) { + } catch (final GLException glex) { if (DEBUG) { glex.printStackTrace(); } @@ -272,7 +272,7 @@ public class EGLContext extends GLContextImpl { @Override protected final StringBuilder getPlatformExtensionsStringImpl() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); if (!eglQueryStringInitialized) { eglQueryStringAvailable = getDrawableImpl().getGLDynamicLookupHelper().isFunctionAvailable("eglQueryString"); eglQueryStringInitialized = true; @@ -288,7 +288,7 @@ public class EGLContext extends GLContextImpl { } @Override - protected boolean setSwapIntervalImpl(int interval) { + protected boolean setSwapIntervalImpl(final int interval) { if( hasRendererQuirk(GLRendererQuirks.NoSetSwapInterval) ) { return false; } @@ -299,11 +299,11 @@ public class EGLContext extends GLContextImpl { // Accessible .. // - /* pp */ void mapCurrentAvailableGLVersion(AbstractGraphicsDevice device) { + /* pp */ void mapCurrentAvailableGLVersion(final AbstractGraphicsDevice device) { mapStaticGLVersion(device, ctxVersion.getMajor(), ctxVersion.getMinor(), ctxOptions); } /* pp */ int getContextOptions() { return ctxOptions; } - /* pp */ static void mapStaticGLESVersion(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps) { + /* pp */ static void mapStaticGLESVersion(final AbstractGraphicsDevice device, final GLCapabilitiesImmutable caps) { final GLProfile glp = caps.getGLProfile(); final int[] reqMajorCTP = new int[2]; GLContext.getRequestMajorAndCompat(glp, reqMajorCTP); @@ -319,7 +319,7 @@ public class EGLContext extends GLContextImpl { } mapStaticGLVersion(device, reqMajorCTP[0], 0, reqMajorCTP[1]); } - /* pp */ static void mapStaticGLVersion(AbstractGraphicsDevice device, int major, int minor, int ctp) { + /* pp */ static void mapStaticGLVersion(final AbstractGraphicsDevice device, final int major, final int minor, final int ctp) { if( 0 != ( ctp & GLContext.CTX_PROFILE_ES) ) { // ES1, ES2, ES3, .. mapStaticGLVersion(device, major /* reqMajor */, major, minor, ctp); @@ -329,28 +329,28 @@ public class EGLContext extends GLContextImpl { } } } - private static void mapStaticGLVersion(AbstractGraphicsDevice device, int reqMajor, int major, int minor, int ctp) { + private static void mapStaticGLVersion(final AbstractGraphicsDevice device, final int reqMajor, final int major, final int minor, final int ctp) { GLContext.mapAvailableGLVersion(device, reqMajor, GLContext.CTX_PROFILE_ES, major, minor, ctp); if(! ( device instanceof EGLGraphicsDevice ) ) { final EGLGraphicsDevice eglDevice = new EGLGraphicsDevice(device.getHandle(), EGL.EGL_NO_DISPLAY, device.getConnection(), device.getUnitID(), null); GLContext.mapAvailableGLVersion(eglDevice, reqMajor, GLContext.CTX_PROFILE_ES, major, minor, ctp); } } - protected static String getGLVersion(int major, int minor, int ctp, String gl_version) { + protected static String getGLVersion(final int major, final int minor, final int ctp, final String gl_version) { return GLContext.getGLVersion(major, minor, ctp, gl_version); } - protected static boolean getAvailableGLVersionsSet(AbstractGraphicsDevice device) { + protected static boolean getAvailableGLVersionsSet(final AbstractGraphicsDevice device) { return GLContext.getAvailableGLVersionsSet(device); } - protected static void setAvailableGLVersionsSet(AbstractGraphicsDevice device) { + protected static void setAvailableGLVersionsSet(final AbstractGraphicsDevice device) { GLContext.setAvailableGLVersionsSet(device); } - protected static String toHexString(int hex) { + protected static String toHexString(final int hex) { return GLContext.toHexString(hex); } - protected static String toHexString(long hex) { + protected static String toHexString(final long hex) { return GLContext.toHexString(hex); } @@ -359,17 +359,17 @@ public class EGLContext extends GLContextImpl { // @Override - protected void copyImpl(GLContext source, int mask) throws GLException { + protected void copyImpl(final GLContext source, final int mask) throws GLException { throw new GLException("Not yet implemented"); } @Override - public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) { + public final ByteBuffer glAllocateMemoryNV(final int size, final float readFrequency, final float writeFrequency, final float priority) { throw new GLException("Should not call this"); } @Override - public final void glFreeMemoryNV(ByteBuffer pointer) { + public final void glFreeMemoryNV(final ByteBuffer pointer) { throw new GLException("Should not call this"); } } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java index c5f76f667..9499c70f4 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDisplayUtil.java @@ -75,7 +75,7 @@ public class EGLDisplayUtil { *

*/ static EGLDisplayRef getOrCreateOpened(final long eglDisplay, final IntBuffer major, final IntBuffer minor) { - EGLDisplayRef o = (EGLDisplayRef) openEGLDisplays.get(eglDisplay); + final EGLDisplayRef o = (EGLDisplayRef) openEGLDisplays.get(eglDisplay); if( null == o ) { if( EGL.eglInitialize(eglDisplay, major, minor) ) { final EGLDisplayRef n = new EGLDisplayRef(eglDisplay); @@ -123,7 +123,7 @@ public class EGLDisplayUtil { return o; } - private EGLDisplayRef(long eglDisplay) { + private EGLDisplayRef(final long eglDisplay) { this.eglDisplay = eglDisplay; this.initRefCount = 0; this.createdStack = DEBUG ? new Throwable() : null; @@ -144,7 +144,7 @@ public class EGLDisplayUtil { /** * @return number of unclosed EGL Displays.
*/ - public static int shutdown(boolean verbose) { + public static int shutdown(final boolean verbose) { if(DEBUG || verbose || openEGLDisplays.size() > 0 ) { System.err.println("EGLDisplayUtil.EGLDisplays: Shutdown (open: "+openEGLDisplays.size()+")"); if(DEBUG) { @@ -160,7 +160,7 @@ public class EGLDisplayUtil { public static void dumpOpenDisplayConnections() { System.err.println("EGLDisplayUtil: Open EGL Display Connections: "+openEGLDisplays.size()); int i=0; - for(Iterator iter = openEGLDisplays.iterator(); iter.hasNext(); i++) { + for(final Iterator iter = openEGLDisplays.iterator(); iter.hasNext(); i++) { final LongObjectHashMap.Entry e = iter.next(); final EGLDisplayRef v = (EGLDisplayRef) e.value; System.err.println("EGLDisplayUtil: Open["+i+"]: 0x"+Long.toHexString(e.key)+": "+v); @@ -170,9 +170,9 @@ public class EGLDisplayUtil { } } - /* pp */ static synchronized void setSingletonEGLDisplayOnly(boolean v) { useSingletonEGLDisplay = v; } + /* pp */ static synchronized void setSingletonEGLDisplayOnly(final boolean v) { useSingletonEGLDisplay = v; } - private static synchronized long eglGetDisplay(long nativeDisplay_id) { + private static synchronized long eglGetDisplay(final long nativeDisplay_id) { if( useSingletonEGLDisplay && null != singletonEGLDisplay ) { if(DEBUG) { System.err.println("EGLDisplayUtil.eglGetDisplay.s: eglDisplay("+EGLContext.toHexString(nativeDisplay_id)+"): "+ @@ -198,7 +198,7 @@ public class EGLDisplayUtil { * * @see EGL#eglInitialize(long, IntBuffer, IntBuffer) */ - private static synchronized boolean eglInitialize(long eglDisplay, IntBuffer major, IntBuffer minor) { + private static synchronized boolean eglInitialize(final long eglDisplay, final IntBuffer major, final IntBuffer minor) { if( EGL.EGL_NO_DISPLAY == eglDisplay) { return false; } @@ -222,7 +222,7 @@ public class EGLDisplayUtil { * @see #eglGetDisplay(long) * @see #eglInitialize(long, IntBuffer, IntBuffer) */ - private static synchronized int eglGetDisplayAndInitialize(long nativeDisplayID, long[] eglDisplay, int[] eglErr, IntBuffer major, IntBuffer minor) { + private static synchronized int eglGetDisplayAndInitialize(final long nativeDisplayID, final long[] eglDisplay, final int[] eglErr, final IntBuffer major, final IntBuffer minor) { eglDisplay[0] = EGL.EGL_NO_DISPLAY; final long _eglDisplay = eglGetDisplay( nativeDisplayID ); if ( EGL.EGL_NO_DISPLAY == _eglDisplay ) { @@ -247,7 +247,7 @@ public class EGLDisplayUtil { * @return the initialized EGL display ID * @throws GLException if not successful */ - private static synchronized long eglGetDisplayAndInitialize(long[] nativeDisplayID) { + private static synchronized long eglGetDisplayAndInitialize(final long[] nativeDisplayID) { final long[] eglDisplay = new long[1]; final int[] eglError = new int[1]; int eglRes = EGLDisplayUtil.eglGetDisplayAndInitialize(nativeDisplayID[0], eglDisplay, eglError, null, null); @@ -271,7 +271,7 @@ public class EGLDisplayUtil { * @param eglDisplay the EGL display handle * @return true if the eglDisplay is valid and it's reference counter becomes zero and {@link EGL#eglTerminate(long)} was successful, otherwise false */ - private static synchronized boolean eglTerminate(long eglDisplay) { + private static synchronized boolean eglTerminate(final long eglDisplay) { if( EGL.EGL_NO_DISPLAY == eglDisplay) { return false; } @@ -286,11 +286,11 @@ public class EGLDisplayUtil { private static final EGLGraphicsDevice.EGLDisplayLifecycleCallback eglLifecycleCallback = new EGLGraphicsDevice.EGLDisplayLifecycleCallback() { @Override - public long eglGetAndInitDisplay(long[] nativeDisplayID) { + public long eglGetAndInitDisplay(final long[] nativeDisplayID) { return eglGetDisplayAndInitialize(nativeDisplayID); } @Override - public void eglTerminate(long eglDisplayHandle) { + public void eglTerminate(final long eglDisplayHandle) { EGLDisplayUtil.eglTerminate(eglDisplayHandle); } }; @@ -309,7 +309,7 @@ public class EGLDisplayUtil { * @param unitID * @return an uninitialized {@link EGLGraphicsDevice} */ - public static EGLGraphicsDevice eglCreateEGLGraphicsDevice(long nativeDisplayID, String connection, int unitID) { + public static EGLGraphicsDevice eglCreateEGLGraphicsDevice(final long nativeDisplayID, final String connection, final int unitID) { return new EGLGraphicsDevice(nativeDisplayID, EGL.EGL_NO_DISPLAY, connection, unitID, eglLifecycleCallback); } @@ -325,7 +325,7 @@ public class EGLDisplayUtil { * @param surface * @return an uninitialized EGLGraphicsDevice */ - public static EGLGraphicsDevice eglCreateEGLGraphicsDevice(NativeSurface surface) { + public static EGLGraphicsDevice eglCreateEGLGraphicsDevice(final NativeSurface surface) { final long nativeDisplayID; if( NativeWindowFactory.TYPE_WINDOWS == NativeWindowFactory.getNativeWindowType(false) ) { nativeDisplayID = surface.getSurfaceHandle(); // don't even ask .. diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java index 76c6e5beb..bacf9f18e 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java @@ -52,7 +52,7 @@ import com.jogamp.nativewindow.egl.EGLGraphicsDevice; public abstract class EGLDrawable extends GLDrawableImpl { - protected EGLDrawable(EGLDrawableFactory factory, NativeSurface component) throws GLException { + protected EGLDrawable(final EGLDrawableFactory factory, final NativeSurface component) throws GLException { super(factory, component, false); } @@ -131,7 +131,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { } } - protected static boolean isValidEGLSurface(long eglDisplayHandle, long surfaceHandle) { + protected static boolean isValidEGLSurface(final long eglDisplayHandle, final long surfaceHandle) { if( 0 == surfaceHandle ) { return false; } @@ -154,7 +154,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { } @Override - protected final void swapBuffersImpl(boolean doubleBuffered) { + protected final void swapBuffersImpl(final boolean doubleBuffered) { if(doubleBuffered) { final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) surface.getGraphicsConfiguration().getScreen().getDevice(); // single-buffer is already filtered out @ GLDrawableImpl#swapBuffers() diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java index e50cb7262..71e5afe33 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawableFactory.java @@ -65,6 +65,7 @@ import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; +import jogamp.common.os.PlatformPropsImpl; import jogamp.nativewindow.WrappedSurface; import jogamp.opengl.Debug; import jogamp.opengl.GLContextImpl; @@ -77,6 +78,7 @@ import jogamp.opengl.SharedResourceRunner; import com.jogamp.common.nio.Buffers; import com.jogamp.common.nio.PointerBuffer; import com.jogamp.common.os.Platform; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.ReflectionUtil; import com.jogamp.nativewindow.egl.EGLGraphicsDevice; import com.jogamp.opengl.GLRendererQuirks; @@ -88,14 +90,14 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { static { Debug.initSingleton(); - QUERY_EGL_ES_NATIVE_TK = Debug.isPropertyDefined("jogl.debug.EGLDrawableFactory.QueryNativeTK", true); + QUERY_EGL_ES_NATIVE_TK = PropertyAccess.isPropertyDefined("jogl.debug.EGLDrawableFactory.QueryNativeTK", true); } private static GLDynamicLookupHelper eglES1DynamicLookupHelper = null; private static GLDynamicLookupHelper eglES2DynamicLookupHelper = null; - private static final boolean isANGLE(GLDynamicLookupHelper dl) { - if(Platform.OSType.WINDOWS == Platform.OS_TYPE) { + private static final boolean isANGLE(final GLDynamicLookupHelper dl) { + if(Platform.OSType.WINDOWS == PlatformPropsImpl.OS_TYPE) { return dl.isFunctionAvailable("eglQuerySurfacePointerANGLE") || dl.isFunctionAvailable("glBlitFramebufferANGLE") || dl.isFunctionAvailable("glRenderbufferStorageMultisampleANGLE"); @@ -104,7 +106,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } } - private static final boolean includesES1(GLDynamicLookupHelper dl) { + private static final boolean includesES1(final GLDynamicLookupHelper dl) { return dl.isFunctionAvailable("glLoadIdentity") && dl.isFunctionAvailable("glEnableClientState") && dl.isFunctionAvailable("glColorPointer"); @@ -122,7 +124,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { hasX11 = true; try { ReflectionUtil.createInstance("jogamp.opengl.x11.glx.X11GLXGraphicsConfigurationFactory", EGLDrawableFactory.class.getClassLoader()); - } catch (Exception jre) { /* n/a .. */ } + } catch (final Exception jre) { /* n/a .. */ } } // FIXME: Probably need to move EGL from a static model @@ -136,7 +138,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { GLDynamicLookupHelper tmp=null; try { tmp = new GLDynamicLookupHelper(new EGLES1DynamicLibraryBundleInfo()); - } catch (GLException gle) { + } catch (final GLException gle) { if(DEBUG) { gle.printStackTrace(); } @@ -157,7 +159,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { GLDynamicLookupHelper tmp=null; try { tmp = new GLDynamicLookupHelper(new EGLES2DynamicLibraryBundleInfo()); - } catch (GLException gle) { + } catch (final GLException gle) { if(DEBUG) { gle.printStackTrace(); } @@ -214,9 +216,9 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { if(DEBUG) { dumpMap(); } - Collection srl = sharedMap.values(); - for(Iterator sri = srl.iterator(); sri.hasNext(); ) { - SharedResource sr = sri.next(); + final Collection srl = sharedMap.values(); + for(final Iterator sri = srl.iterator(); sri.hasNext(); ) { + final SharedResource sr = sri.next(); if(DEBUG) { System.err.println("EGLDrawableFactory.shutdown: "+sr.device.toString()); } @@ -253,10 +255,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { synchronized(sharedMap) { System.err.println("EGLDrawableFactory.map "+sharedMap.size()); int i=0; - Set keys = sharedMap.keySet(); - for(Iterator keyI = keys.iterator(); keyI.hasNext(); i++) { - String key = keyI.next(); - SharedResource sr = sharedMap.get(key); + final Set keys = sharedMap.keySet(); + for(final Iterator keyI = keys.iterator(); keyI.hasNext(); i++) { + final String key = keyI.next(); + final SharedResource sr = sharedMap.get(key); System.err.println("EGLDrawableFactory.map["+i+"] "+key+" -> "+sr.getDevice()+", "+ "es1 [avail "+sr.wasES1ContextCreated+", pbuffer "+sr.hasPBufferES1+", quirks "+sr.rendererQuirksES1+", ctp "+EGLContext.getGLVersion(1, 0, sr.ctpES1, null)+"], "+ "es2/3 [es2 "+sr.wasES2ContextCreated+", es3 "+sr.wasES3ContextCreated+", [pbuffer "+sr.hasPBufferES3ES2+", quirks "+sr.rendererQuirksES3ES2+", ctp "+EGLContext.getGLVersion(2, 0, sr.ctpES3ES2, null)+"]]"); @@ -287,10 +289,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { private final boolean hasPBufferES1; private final boolean hasPBufferES3ES2; - SharedResource(EGLGraphicsDevice dev, - boolean wasContextES1Created, boolean hasPBufferES1, GLRendererQuirks rendererQuirksES1, int ctpES1, - boolean wasContextES2Created, boolean wasContextES3Created, - boolean hasPBufferES3ES2, GLRendererQuirks rendererQuirksES3ES2, int ctpES3ES2) { + SharedResource(final EGLGraphicsDevice dev, + final boolean wasContextES1Created, final boolean hasPBufferES1, final GLRendererQuirks rendererQuirksES1, final int ctpES1, + final boolean wasContextES2Created, final boolean wasContextES3Created, + final boolean hasPBufferES3ES2, final GLRendererQuirks rendererQuirksES3ES2, final int ctpES3ES2) { this.device = dev; // this.contextES1 = ctxES1; this.wasES1ContextCreated = wasContextES1Created; @@ -340,12 +342,12 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) { + public final boolean getIsDeviceCompatible(final AbstractGraphicsDevice device) { // via mappings (X11/WGL/.. -> EGL) we shall be able to handle all types. return null != sharedMap ; // null!=eglES2DynamicLookupHelper || null!=eglES1DynamicLookupHelper; } - private static List getAvailableEGLConfigs(EGLGraphicsDevice eglDisplay, GLCapabilitiesImmutable caps) { + private static List getAvailableEGLConfigs(final EGLGraphicsDevice eglDisplay, final GLCapabilitiesImmutable caps) { final IntBuffer numConfigs = Buffers.newDirectIntBuffer(1); if(!EGL.eglGetConfigs(eglDisplay.getHandle(), null, 0, numConfigs)) { throw new GLException("EGLDrawableFactory.getAvailableEGLConfigs: Get maxConfigs (eglGetConfigs) call failed, error "+EGLContext.toHexString(EGL.eglGetError())); @@ -368,8 +370,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { System.err.println(prefix+"EGL vendor "+eglVendor+", version "+eglVersion+", clientAPIs "+eglClientAPIs); } - private boolean mapAvailableEGLESConfig(AbstractGraphicsDevice adevice, int[] esProfile, - boolean[] hasPBuffer, GLRendererQuirks[] rendererQuirks, int[] ctp) { + private boolean mapAvailableEGLESConfig(final AbstractGraphicsDevice adevice, final int[] esProfile, + final boolean[] hasPBuffer, final GLRendererQuirks[] rendererQuirks, final int[] ctp) { final String profileString; switch( esProfile[0] ) { case 3: @@ -532,7 +534,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } } } - } catch (Throwable t) { + } catch (final Throwable t) { if (DEBUG) { System.err.println("EGLDrawableFactory.mapAvailableEGLESConfig: INFO: context create/makeCurrent failed"); t.printStackTrace(); @@ -543,7 +545,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } drawable.setRealized(false); } - } catch (Throwable t) { + } catch (final Throwable t) { if(DEBUG) { System.err.println("Caught exception on thread "+getThreadName()); t.printStackTrace(); @@ -565,7 +567,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { return success; } - private final boolean needsToCreateSharedResource(String key, SharedResource[] existing) { + private final boolean needsToCreateSharedResource(final String key, final SharedResource[] existing) { synchronized(sharedMap) { final SharedResource sr = sharedMap.get(key); if( null == sr ) { @@ -584,7 +586,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final SharedResource getOrCreateSharedResourceImpl(AbstractGraphicsDevice adevice) { + protected final SharedResource getOrCreateSharedResourceImpl(final AbstractGraphicsDevice adevice) { if(null == sharedMap) { // null == eglES1DynamicLookupHelper && null == eglES2DynamicLookupHelper return null; } @@ -617,16 +619,16 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } } - private SharedResource createEGLSharedResourceImpl(AbstractGraphicsDevice adevice) { + private SharedResource createEGLSharedResourceImpl(final AbstractGraphicsDevice adevice) { final boolean madeCurrentES1; - boolean[] hasPBufferES1 = new boolean[] { false }; - boolean[] hasPBufferES3ES2 = new boolean[] { false }; + final boolean[] hasPBufferES1 = new boolean[] { false }; + final boolean[] hasPBufferES3ES2 = new boolean[] { false }; // EGLContext[] eglCtxES1 = new EGLContext[] { null }; // EGLContext[] eglCtxES2 = new EGLContext[] { null }; - GLRendererQuirks[] rendererQuirksES1 = new GLRendererQuirks[] { null }; - GLRendererQuirks[] rendererQuirksES3ES2 = new GLRendererQuirks[] { null }; - int[] ctpES1 = new int[] { -1 }; - int[] ctpES3ES2 = new int[] { -1 }; + final GLRendererQuirks[] rendererQuirksES1 = new GLRendererQuirks[] { null }; + final GLRendererQuirks[] rendererQuirksES3ES2 = new GLRendererQuirks[] { null }; + final int[] ctpES1 = new int[] { -1 }; + final int[] ctpES3ES2 = new int[] { -1 }; if (DEBUG) { @@ -682,7 +684,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { return sr; } - private void handleDontCloseX11DisplayQuirk(GLRendererQuirks quirks) { + private void handleDontCloseX11DisplayQuirk(final GLRendererQuirks quirks) { if( null != quirks && quirks.exist( GLRendererQuirks.DontCloseX11Display ) ) { jogamp.nativewindow.x11.X11Util.markAllDisplaysUnclosable(); } @@ -698,7 +700,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper(int esProfile) { + public GLDynamicLookupHelper getGLDynamicLookupHelper(final int esProfile) { if ( 2==esProfile || 3==esProfile ) { return eglES2DynamicLookupHelper; } else if (1==esProfile) { @@ -709,7 +711,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected List getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { + protected List getAvailableCapabilitiesImpl(final AbstractGraphicsDevice device) { if(null == sharedMap) { // null == eglES1DynamicLookupHelper && null == eglES2DynamicLookupHelper return new ArrayList(); // null } @@ -717,7 +719,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) { + protected GLDrawableImpl createOnscreenDrawableImpl(final NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } @@ -725,12 +727,12 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) { + protected GLDrawableImpl createOffscreenDrawableImpl(final NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } - AbstractGraphicsConfiguration config = target.getGraphicsConfiguration(); - GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); + final AbstractGraphicsConfiguration config = target.getGraphicsConfiguration(); + final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); if(!caps.isPBuffer()) { throw new GLException("Non pbuffer not yet implemented"); } @@ -739,16 +741,16 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp) { + public boolean canCreateGLPbuffer(final AbstractGraphicsDevice device, final GLProfile glp) { // SharedResource sr = getOrCreateEGLSharedResource(device); // return sr.hasES1PBuffer() || sr.hasES2PBuffer(); return true; } @Override - protected ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) { + protected ProxySurface createMutableSurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstreamHook) { final boolean ownDevice; final EGLGraphicsDevice device; if( createNewDevice || ! (deviceReq instanceof EGLGraphicsDevice) ) { @@ -770,8 +772,8 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) { + public final ProxySurface createDummySurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) { chosenCaps = GLGraphicsConfigurationUtil.fixGLPBufferGLCapabilities(chosenCaps); // complete validation in EGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(..) above return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new EGLDummyUpstreamSurfaceHook(width, height)); } @@ -782,10 +784,10 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { * @param useTexture * @return the passed {@link MutableSurface} which now has the EGL pbuffer surface set as it's handle */ - protected static MutableSurface createPBufferSurfaceImpl(MutableSurface ms, boolean useTexture) { + protected static MutableSurface createPBufferSurfaceImpl(final MutableSurface ms, final boolean useTexture) { return null; } - protected static long createPBufferSurfaceImpl(EGLGraphicsConfiguration config, int width, int height, boolean useTexture) { + protected static long createPBufferSurfaceImpl(final EGLGraphicsConfiguration config, final int width, final int height, final boolean useTexture) { final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) config.getScreen().getDevice(); final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); final int texFormat; @@ -811,7 +813,7 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) { + protected ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstream) { final EGLGraphicsDevice eglDeviceReq = (EGLGraphicsDevice) deviceReq; final EGLGraphicsDevice device = EGLDisplayUtil.eglCreateEGLGraphicsDevice(eglDeviceReq.getNativeDisplayID(), deviceReq.getConnection(), deviceReq.getUnitID()); device.open(); @@ -822,12 +824,12 @@ public class EGLDrawableFactory extends GLDrawableFactoryImpl { @Override protected GLContext createExternalGLContextImpl() { - AbstractGraphicsScreen absScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_EGL); + final AbstractGraphicsScreen absScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_EGL); return new EGLExternalContext(absScreen); } @Override - public boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) { + public boolean canCreateExternalGLDrawable(final AbstractGraphicsDevice device) { return false; } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java index 205a94951..f00d7059d 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java @@ -17,12 +17,12 @@ public class EGLDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize * not the actual dummy surface height, * The latter is platform specific and small */ - public EGLDummyUpstreamSurfaceHook(int width, int height) { + public EGLDummyUpstreamSurfaceHook(final int width, final int height) { super(width, height); } @Override - public final void create(ProxySurface s) { + public final void create(final ProxySurface s) { final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) s.getGraphicsConfiguration().getScreen().getDevice(); eglDevice.lock(); try { @@ -41,7 +41,7 @@ public class EGLDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize } @Override - public final void destroy(ProxySurface s) { + public final void destroy(final ProxySurface s) { if( s.containsUpstreamOptionBits( ProxySurface.OPT_PROXY_OWNS_UPSTREAM_SURFACE ) ) { final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) s.getGraphicsConfiguration().getScreen().getDevice(); if( EGL.EGL_NO_SURFACE == s.getSurfaceHandle() ) { diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java index ebe8f49c8..05dae0b9d 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDynamicLibraryBundleInfo.java @@ -33,6 +33,7 @@ import com.jogamp.common.os.Platform; import java.util.*; +import jogamp.common.os.PlatformPropsImpl; import jogamp.opengl.*; /** @@ -61,7 +62,7 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle */ @Override public final boolean shallLookupGlobal() { - if ( Platform.OSType.ANDROID == Platform.OS_TYPE ) { + if ( Platform.OSType.ANDROID == PlatformPropsImpl.OS_TYPE ) { // Android requires global symbol lookup return true; } @@ -71,18 +72,18 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle @Override public final List getToolGetProcAddressFuncNameList() { - List res = new ArrayList(); + final List res = new ArrayList(); res.add("eglGetProcAddress"); return res; } @Override - public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) { + public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { return EGL.eglGetProcAddress(toolGetProcAddressHandle, funcName); } @Override - public final boolean useToolGetProcAdressFirst(String funcName) { + public final boolean useToolGetProcAdressFirst(final String funcName) { if ( AndroidVersion.isAvailable ) { // Android requires global dlsym lookup return false; @@ -92,7 +93,7 @@ public abstract class EGLDynamicLibraryBundleInfo extends GLDynamicLibraryBundle } protected final List getEGLLibNamesList() { - List eglLibNames = new ArrayList(); + final List eglLibNames = new ArrayList(); // this is the default EGL lib name, according to the spec eglLibNames.add("libEGL.so.1"); diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java b/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java index aff18fc81..babea4240 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLExternalContext.java @@ -43,7 +43,7 @@ import javax.media.nativewindow.*; public class EGLExternalContext extends EGLContext { - public EGLExternalContext(AbstractGraphicsScreen screen) { + public EGLExternalContext(final AbstractGraphicsScreen screen) { super(null, null); GLContextShareSet.contextCreated(this); if( !setGLFunctionAvailability(false, 0, 0, CTX_PROFILE_ES, false /* strictMatch */, false /* withinGLVersionsMapping */) ) { // use GL_VERSION diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java index e28b53235..a8dd7d5c8 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGLCapabilities.java @@ -52,7 +52,7 @@ public class EGLGLCapabilities extends GLCapabilities { * * May throw GLException if given GLProfile is not compatible w/ renderableType */ - public EGLGLCapabilities(long eglcfg, int eglcfgid, int visualID, GLProfile glp, int renderableType) { + public EGLGLCapabilities(final long eglcfg, final int eglcfgid, final int visualID, final GLProfile glp, final int renderableType) { super( glp ); this.eglcfg = eglcfg; this.eglcfgid = eglcfgid; @@ -73,19 +73,19 @@ public class EGLGLCapabilities extends GLCapabilities { public Object clone() { try { return super.clone(); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { throw new GLException(e); } } - final protected void setEGLConfig(long v) { eglcfg=v; } + final protected void setEGLConfig(final long v) { eglcfg=v; } final public long getEGLConfig() { return eglcfg; } final public int getEGLConfigID() { return eglcfgid; } final public int getRenderableType() { return renderableType; } final public int getNativeVisualID() { return nativeVisualID; } @Override - final public int getVisualID(VIDType type) throws NativeWindowException { + final public int getVisualID(final VIDType type) throws NativeWindowException { switch(type) { case INTRINSIC: case EGL_CONFIG: @@ -97,7 +97,7 @@ public class EGLGLCapabilities extends GLCapabilities { } } - public static boolean isCompatible(GLProfile glp, int renderableType) { + public static boolean isCompatible(final GLProfile glp, final int renderableType) { if(null == glp) { return true; } @@ -116,7 +116,7 @@ public class EGLGLCapabilities extends GLCapabilities { return false; } - public static GLProfile getCompatible(EGLGraphicsDevice device, int renderableType) { + public static GLProfile getCompatible(final EGLGraphicsDevice device, final int renderableType) { if(0 != (renderableType & EGLExt.EGL_OPENGL_ES3_BIT_KHR) && GLProfile.isAvailable(device, GLProfile.GLES3)) { return GLProfile.get(device, GLProfile.GLES3); } @@ -132,7 +132,7 @@ public class EGLGLCapabilities extends GLCapabilities { return null; } - public static StringBuilder renderableTypeToString(StringBuilder sink, int renderableType) { + public static StringBuilder renderableTypeToString(StringBuilder sink, final int renderableType) { if(null == sink) { sink = new StringBuilder(); } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java index 88ed0be92..1d90e63af 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfiguration.java @@ -72,8 +72,8 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return ((EGLGLCapabilities)capabilitiesChosen).getEGLConfigID(); } - EGLGraphicsConfiguration(AbstractGraphicsScreen absScreen, - EGLGLCapabilities capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) { + EGLGraphicsConfiguration(final AbstractGraphicsScreen absScreen, + final EGLGLCapabilities capsChosen, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser) { super(absScreen, capsChosen, capsRequested); this.chooser = chooser; } @@ -85,7 +85,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple * @return * @throws GLException if invalid EGL display. */ - public static EGLGraphicsConfiguration create(GLCapabilitiesImmutable capsRequested, AbstractGraphicsScreen absScreen, int eglConfigID) { + public static EGLGraphicsConfiguration create(final GLCapabilitiesImmutable capsRequested, final AbstractGraphicsScreen absScreen, final int eglConfigID) { final AbstractGraphicsDevice absDevice = absScreen.getDevice(); if(null==absDevice || !(absDevice instanceof EGLGraphicsDevice)) { throw new GLException("GraphicsDevice must be a valid EGLGraphicsDevice"); @@ -110,8 +110,8 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple } void updateGraphicsConfiguration() { - CapabilitiesImmutable capsChosen = getChosenCapabilities(); - EGLGraphicsConfiguration newConfig = (EGLGraphicsConfiguration) + final CapabilitiesImmutable capsChosen = getChosenCapabilities(); + final EGLGraphicsConfiguration newConfig = (EGLGraphicsConfiguration) GraphicsConfigurationFactory.getFactory(getScreen().getDevice(), capsChosen).chooseGraphicsConfiguration( capsChosen, getRequestedCapabilities(), chooser, getScreen(), VisualIDHolder.VID_UNDEFINED); if(null!=newConfig) { @@ -123,7 +123,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple } } - public static long EGLConfigId2EGLConfig(long display, int configID) { + public static long EGLConfigId2EGLConfig(final long display, final int configID) { final IntBuffer attrs = Buffers.newDirectIntBuffer(new int[] { EGL.EGL_CONFIG_ID, configID, EGL.EGL_NONE @@ -142,7 +142,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return configs.get(0); } - public static boolean isEGLConfigValid(long display, long config) { + public static boolean isEGLConfigValid(final long display, final long config) { if(0 == config) { return false; } @@ -190,8 +190,8 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple * @param forceTransparentFlag * @return */ - public static EGLGLCapabilities EGLConfig2Capabilities(GLRendererQuirks defaultQuirks, EGLGraphicsDevice device, GLProfile glp, - long config, int winattrmask, boolean forceTransparentFlag) { + public static EGLGLCapabilities EGLConfig2Capabilities(final GLRendererQuirks defaultQuirks, final EGLGraphicsDevice device, GLProfile glp, + final long config, final int winattrmask, final boolean forceTransparentFlag) { final long display = device.getHandle(); final int cfgID; final int rType; @@ -267,7 +267,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return null; } caps = new EGLGLCapabilities(config, cfgID, visualID, glp, rType); - } catch (GLException gle) { + } catch (final GLException gle) { if(DEBUG) { System.err.println("config "+toHexString(config)+": "+gle); } @@ -381,7 +381,7 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return (EGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, caps); } - public static IntBuffer GLCapabilities2AttribList(GLCapabilitiesImmutable caps) { + public static IntBuffer GLCapabilities2AttribList(final GLCapabilitiesImmutable caps) { final IntBuffer attrs = Buffers.newDirectIntBuffer(32); int idx=0; @@ -480,8 +480,8 @@ public class EGLGraphicsConfiguration extends MutableGraphicsConfiguration imple return attrs; } - public static IntBuffer CreatePBufferSurfaceAttribList(int width, int height, int texFormat) { - IntBuffer attrs = Buffers.newDirectIntBuffer(16); + public static IntBuffer CreatePBufferSurfaceAttribList(final int width, final int height, final int texFormat) { + final IntBuffer attrs = Buffers.newDirectIntBuffer(16); int idx=0; attrs.put(idx++, EGL.EGL_WIDTH); diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java index 5cfa378cb..9962c0617 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLGraphicsConfigurationFactory.java @@ -77,7 +77,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact static GraphicsConfigurationFactory fallbackGraphicsConfigurationFactory = null; static void registerFactory() { - GraphicsConfigurationFactory eglFactory = new EGLGraphicsConfigurationFactory(); + final GraphicsConfigurationFactory eglFactory = new EGLGraphicsConfigurationFactory(); // become the pre-selector for X11/.. to match the native visual id w/ EGL, if native ES is selected final String nwType = NativeWindowFactory.getNativeWindowType(false); @@ -117,8 +117,8 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact @Override protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl ( - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, - CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, + final CapabilitiesChooser chooser, final AbstractGraphicsScreen absScreen, final int nativeVisualID) { if (absScreen == null) { throw new IllegalArgumentException("This NativeWindowFactory accepts only AbstractGraphicsDevice objects"); } @@ -137,7 +137,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects"); } - AbstractGraphicsDevice absDevice = absScreen.getDevice(); + final AbstractGraphicsDevice absDevice = absScreen.getDevice(); if(null==absDevice) { throw new GLException("Null AbstractGraphicsDevice"); } @@ -181,7 +181,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact return cfg; } - protected static List getAvailableCapabilities(EGLDrawableFactory factory, AbstractGraphicsDevice device) { + protected static List getAvailableCapabilities(final EGLDrawableFactory factory, final AbstractGraphicsDevice device) { final EGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); if(null == sharedResource) { throw new GLException("Shared resource for device n/a: "+device); @@ -192,7 +192,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact throw new GLException("null eglDisplay"); } List availableCaps = null; - IntBuffer numConfigs = Buffers.newDirectIntBuffer(1); + final IntBuffer numConfigs = Buffers.newDirectIntBuffer(1); if(!EGL.eglGetConfigs(eglDisplay, null, 0, numConfigs)) { throw new GLException("Graphics configuration get maxConfigs (eglGetConfigs) call failed, error "+toHexString(EGL.eglGetError())); @@ -201,7 +201,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact throw new GLException("Graphics configuration get maxConfigs (eglGetConfigs) no configs"); } - PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0)); + final PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0)); if(!EGL.eglGetConfigs(eglDisplay, configs, configs.capacity(), numConfigs)) { throw new GLException("Graphics configuration get all configs (eglGetConfigs) call failed, error "+toHexString(EGL.eglGetError())); @@ -216,10 +216,10 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact } public static EGLGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilitiesImmutable capsChosen, - GLCapabilitiesImmutable capsReq, - GLCapabilitiesChooser chooser, - AbstractGraphicsScreen absScreen, int nativeVisualID, - boolean forceTransparentFlag) { + final GLCapabilitiesImmutable capsReq, + final GLCapabilitiesChooser chooser, + final AbstractGraphicsScreen absScreen, final int nativeVisualID, + final boolean forceTransparentFlag) { if (capsChosen == null) { capsChosen = new GLCapabilities(null); } @@ -227,7 +227,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact if(null==absScreen) { throw new GLException("Null AbstractGraphicsScreen"); } - AbstractGraphicsDevice absDevice = absScreen.getDevice(); + final AbstractGraphicsDevice absDevice = absScreen.getDevice(); if(null==absDevice) { throw new GLException("Null AbstractGraphicsDevice"); } @@ -323,18 +323,18 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact } - static EGLGraphicsConfiguration eglChooseConfig(EGLGraphicsDevice device, - GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, - AbstractGraphicsScreen absScreen, - int nativeVisualID, boolean forceTransparentFlag) { + static EGLGraphicsConfiguration eglChooseConfig(final EGLGraphicsDevice device, + final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, + final AbstractGraphicsScreen absScreen, + final int nativeVisualID, final boolean forceTransparentFlag) { final long eglDisplay = device.getHandle(); final GLProfile glp = capsChosen.getGLProfile(); final int winattrmask = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(capsChosen); List availableCaps = null; int recommendedIndex = -1; long recommendedEGLConfig = -1; - IntBuffer numConfigs = Buffers.newDirectIntBuffer(1); + final IntBuffer numConfigs = Buffers.newDirectIntBuffer(1); if(!EGL.eglGetConfigs(eglDisplay, null, 0, numConfigs)) { throw new GLException("EGLGraphicsConfiguration.eglChooseConfig: Get maxConfigs (eglGetConfigs) call failed, error "+toHexString(EGL.eglGetError())); @@ -353,7 +353,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact } final IntBuffer attrs = EGLGraphicsConfiguration.GLCapabilities2AttribList(capsChosen); - PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0)); + final PointerBuffer configs = PointerBuffer.allocateDirect(numConfigs.get(0)); // 1st choice: get GLCapabilities based on users GLCapabilities // setting recommendedIndex as preferred choice @@ -428,7 +428,7 @@ public class EGLGraphicsConfigurationFactory extends GLGraphicsConfigurationFact } if( VisualIDHolder.VID_UNDEFINED != nativeVisualID ) { // implies !hasEGLChosenCaps - List removedCaps = new ArrayList(); + final List removedCaps = new ArrayList(); for(int i=0; i eglConfigs2GLCaps(EGLGraphicsDevice device, GLProfile glp, PointerBuffer configs, int num, int winattrmask, boolean forceTransparentFlag, boolean onlyFirstValid) { + static List eglConfigs2GLCaps(final EGLGraphicsDevice device, final GLProfile glp, final PointerBuffer configs, final int num, final int winattrmask, final boolean forceTransparentFlag, final boolean onlyFirstValid) { final GLRendererQuirks defaultQuirks = GLRendererQuirks.getStickyDeviceQuirks( GLDrawableFactory.getEGLFactory().getDefaultDevice() ); - List bucket = new ArrayList(num); + final List bucket = new ArrayList(num); for(int i=0; i caps, PrintStream out) { + static void printCaps(final String prefix, final List caps, final PrintStream out) { for(int i=0; i this "+surface.getClass().getSimpleName()+" ): "; @@ -84,7 +84,7 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { } } - private final void evalUpstreamSurface(String dbgPrefix, ProxySurface surface) { + private final void evalUpstreamSurface(final String dbgPrefix, final ProxySurface surface) { // // evaluate nature of upstreamSurface, may create EGL instances if required // @@ -195,7 +195,7 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { } @Override - public final void destroy(ProxySurface surface) { + public final void destroy(final ProxySurface surface) { if(EGLDrawableFactory.DEBUG) { System.err.println("EGLUpstreamSurfaceHook.destroy("+surface.getClass().getSimpleName()+"): "+this); } @@ -206,12 +206,12 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { } @Override - public final int getSurfaceWidth(ProxySurface s) { + public final int getSurfaceWidth(final ProxySurface s) { return upstreamSurface.getSurfaceWidth(); } @Override - public final int getSurfaceHeight(ProxySurface s) { + public final int getSurfaceHeight(final ProxySurface s) { return upstreamSurface.getSurfaceHeight(); } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java b/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java index 4a5113b51..89024eed3 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLWrappedSurface.java @@ -13,14 +13,14 @@ import jogamp.nativewindow.WrappedSurface; */ public class EGLWrappedSurface extends WrappedSurface { - public static EGLWrappedSurface get(NativeSurface surface) { + public static EGLWrappedSurface get(final NativeSurface surface) { if(surface instanceof EGLWrappedSurface) { return (EGLWrappedSurface)surface; } return new EGLWrappedSurface(surface); } - public EGLWrappedSurface(NativeSurface surface) { + public EGLWrappedSurface(final NativeSurface surface) { super(surface.getGraphicsConfiguration(), EGL.EGL_NO_SURFACE, new EGLUpstreamSurfaceHook(surface), false /* tbd in UpstreamSurfaceHook */); if(EGLDrawableFactory.DEBUG) { System.err.println("EGLWrappedSurface.ctor(): "+this); diff --git a/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java b/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java index e0ec0f401..f0922644b 100644 --- a/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java +++ b/src/jogl/classes/jogamp/opengl/gl2/ProjectDouble.java @@ -190,7 +190,7 @@ public class ProjectDouble { upBuf = slice(locbuf, pos, sz); } - private static DoubleBuffer slice(DoubleBuffer buf, int pos, int len) { + private static DoubleBuffer slice(final DoubleBuffer buf, final int pos, final int len) { buf.position(pos); buf.limit(pos + len); return buf.slice(); @@ -199,8 +199,8 @@ public class ProjectDouble { /** * Make matrix an identity matrix */ - private void __gluMakeIdentityd(DoubleBuffer m) { - int oldPos = m.position(); + private void __gluMakeIdentityd(final DoubleBuffer m) { + final int oldPos = m.position(); m.put(IDENTITY_MATRIX); m.position(oldPos); } @@ -208,7 +208,7 @@ public class ProjectDouble { /** * Make matrix an identity matrix */ - private void __gluMakeIdentityd(double[] m) { + private void __gluMakeIdentityd(final double[] m) { for (int i = 0; i < 16; i++) { m[i] = IDENTITY_MATRIX[i]; } @@ -221,7 +221,7 @@ public class ProjectDouble { * @param in * @param out */ - private void __gluMultMatrixVecd(double[] matrix, int matrix_offset, double[] in, double[] out) { + private void __gluMultMatrixVecd(final double[] matrix, final int matrix_offset, final double[] in, final double[] out) { for (int i = 0; i < 4; i++) { out[i] = in[0] * matrix[0*4+i+matrix_offset] + @@ -238,10 +238,10 @@ public class ProjectDouble { * @param in * @param out */ - private void __gluMultMatrixVecd(DoubleBuffer matrix, DoubleBuffer in, DoubleBuffer out) { - int inPos = in.position(); - int outPos = out.position(); - int matrixPos = matrix.position(); + private void __gluMultMatrixVecd(final DoubleBuffer matrix, final DoubleBuffer in, final DoubleBuffer out) { + final int inPos = in.position(); + final int outPos = out.position(); + final int matrixPos = matrix.position(); for (int i = 0; i < 4; i++) { out.put(i + outPos, in.get(0+inPos) * matrix.get(0*4+i+matrixPos) + @@ -257,10 +257,10 @@ public class ProjectDouble { * * @return */ - private boolean __gluInvertMatrixd(double[] src, double[] inverse) { + private boolean __gluInvertMatrixd(final double[] src, final double[] inverse) { int i, j, k, swap; double t; - double[][] temp = tempMatrix; + final double[][] temp = tempMatrix; for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { @@ -327,14 +327,14 @@ public class ProjectDouble { * * @return */ - private boolean __gluInvertMatrixd(DoubleBuffer src, DoubleBuffer inverse) { + private boolean __gluInvertMatrixd(final DoubleBuffer src, final DoubleBuffer inverse) { int i, j, k, swap; double t; - int srcPos = src.position(); - int invPos = inverse.position(); + final int srcPos = src.position(); + final int invPos = inverse.position(); - DoubleBuffer temp = tempMatrixBuf; + final DoubleBuffer temp = tempMatrixBuf; for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { @@ -401,7 +401,7 @@ public class ProjectDouble { * @param b * @param r */ - private void __gluMultMatricesd(double[] a, int a_offset, double[] b, int b_offset, double[] r) { + private void __gluMultMatricesd(final double[] a, final int a_offset, final double[] b, final int b_offset, final double[] r) { for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { r[i*4+j] = @@ -419,10 +419,10 @@ public class ProjectDouble { * @param b * @param r */ - private void __gluMultMatricesd(DoubleBuffer a, DoubleBuffer b, DoubleBuffer r) { - int aPos = a.position(); - int bPos = b.position(); - int rPos = r.position(); + private void __gluMultMatricesd(final DoubleBuffer a, final DoubleBuffer b, final DoubleBuffer r) { + final int aPos = a.position(); + final int bPos = b.position(); + final int rPos = r.position(); for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { @@ -440,10 +440,10 @@ public class ProjectDouble { * * @param v */ - private static void normalize(DoubleBuffer v) { + private static void normalize(final DoubleBuffer v) { double r; - int vPos = v.position(); + final int vPos = v.position(); r = Math.sqrt(v.get(0+vPos) * v.get(0+vPos) + v.get(1+vPos) * v.get(1+vPos) + @@ -468,10 +468,10 @@ public class ProjectDouble { * @param v2 * @param result */ - private static void cross(DoubleBuffer v1, DoubleBuffer v2, DoubleBuffer result) { - int v1Pos = v1.position(); - int v2Pos = v2.position(); - int rPos = result.position(); + private static void cross(final DoubleBuffer v1, final DoubleBuffer v2, final DoubleBuffer result) { + final int v1Pos = v1.position(); + final int v2Pos = v2.position(); + final int rPos = result.position(); result.put(0+rPos, v1.get(1+v1Pos) * v2.get(2+v2Pos) - v1.get(2+v1Pos) * v2.get(1+v2Pos)); result.put(1+rPos, v1.get(2+v1Pos) * v2.get(0+v2Pos) - v1.get(0+v1Pos) * v2.get(2+v2Pos)); @@ -486,7 +486,7 @@ public class ProjectDouble { * @param bottom * @param top */ - public void gluOrtho2D(GL2 gl, double left, double right, double bottom, double top) { + public void gluOrtho2D(final GL2 gl, final double left, final double right, final double bottom, final double top) { gl.glOrtho(left, right, bottom, top, -1, 1); } @@ -498,9 +498,9 @@ public class ProjectDouble { * @param zNear * @param zFar */ - public void gluPerspective(GL2 gl, double fovy, double aspect, double zNear, double zFar) { + public void gluPerspective(final GL2 gl, final double fovy, final double aspect, final double zNear, final double zFar) { double sine, cotangent, deltaZ; - double radians = fovy / 2 * Math.PI / 180; + final double radians = fovy / 2 * Math.PI / 180; deltaZ = zFar - zNear; sine = Math.sin(radians); @@ -536,19 +536,19 @@ public class ProjectDouble { * @param upy * @param upz */ - public void gluLookAt(GL2 gl, - double eyex, - double eyey, - double eyez, - double centerx, - double centery, - double centerz, - double upx, - double upy, - double upz) { - DoubleBuffer forward = this.forwardBuf; - DoubleBuffer side = this.sideBuf; - DoubleBuffer up = this.upBuf; + public void gluLookAt(final GL2 gl, + final double eyex, + final double eyey, + final double eyez, + final double centerx, + final double centery, + final double centerz, + final double upx, + final double upy, + final double upz) { + final DoubleBuffer forward = this.forwardBuf; + final DoubleBuffer side = this.sideBuf; + final DoubleBuffer up = this.upBuf; forward.put(0, centerx - eyex); forward.put(1, centery - eyey); @@ -597,20 +597,20 @@ public class ProjectDouble { * * @return */ - public boolean gluProject(double objx, - double objy, - double objz, - double[] modelMatrix, - int modelMatrix_offset, - double[] projMatrix, - int projMatrix_offset, - int[] viewport, - int viewport_offset, - double[] win_pos, - int win_pos_offset ) { - - double[] in = this.in; - double[] out = this.out; + public boolean gluProject(final double objx, + final double objy, + final double objz, + final double[] modelMatrix, + final int modelMatrix_offset, + final double[] projMatrix, + final int projMatrix_offset, + final int[] viewport, + final int viewport_offset, + final double[] win_pos, + final int win_pos_offset ) { + + final double[] in = this.in; + final double[] out = this.out; in[0] = objx; in[1] = objy; @@ -651,16 +651,16 @@ public class ProjectDouble { * * @return */ - public boolean gluProject(double objx, - double objy, - double objz, - DoubleBuffer modelMatrix, - DoubleBuffer projMatrix, - IntBuffer viewport, - DoubleBuffer win_pos) { + public boolean gluProject(final double objx, + final double objy, + final double objz, + final DoubleBuffer modelMatrix, + final DoubleBuffer projMatrix, + final IntBuffer viewport, + final DoubleBuffer win_pos) { - DoubleBuffer in = this.inBuf; - DoubleBuffer out = this.outBuf; + final DoubleBuffer in = this.inBuf; + final DoubleBuffer out = this.outBuf; in.put(0, objx); in.put(1, objy); @@ -681,8 +681,8 @@ public class ProjectDouble { in.put(2, in.get(2) * in.get(3) + 0.5f); // Map x,y to viewport - int vPos = viewport.position(); - int wPos = win_pos.position(); + final int vPos = viewport.position(); + final int wPos = win_pos.position(); win_pos.put(0+wPos, in.get(0) * viewport.get(2+vPos) + viewport.get(0+vPos)); win_pos.put(1+wPos, in.get(1) * viewport.get(3+vPos) + viewport.get(1+vPos)); win_pos.put(2+wPos, in.get(2)); @@ -704,19 +704,19 @@ public class ProjectDouble { * * @return */ - public boolean gluUnProject(double winx, - double winy, - double winz, - double[] modelMatrix, - int modelMatrix_offset, - double[] projMatrix, - int projMatrix_offset, - int[] viewport, - int viewport_offset, - double[] obj_pos, - int obj_pos_offset) { - double[] in = this.in; - double[] out = this.out; + public boolean gluUnProject(final double winx, + final double winy, + final double winz, + final double[] modelMatrix, + final int modelMatrix_offset, + final double[] projMatrix, + final int projMatrix_offset, + final int[] viewport, + final int viewport_offset, + final double[] obj_pos, + final int obj_pos_offset) { + final double[] in = this.in; + final double[] out = this.out; __gluMultMatricesd(modelMatrix, modelMatrix_offset, projMatrix, projMatrix_offset, matrix); @@ -765,15 +765,15 @@ public class ProjectDouble { * * @return */ - public boolean gluUnProject(double winx, - double winy, - double winz, - DoubleBuffer modelMatrix, - DoubleBuffer projMatrix, - IntBuffer viewport, - DoubleBuffer obj_pos) { - DoubleBuffer in = this.inBuf; - DoubleBuffer out = this.outBuf; + public boolean gluUnProject(final double winx, + final double winy, + final double winz, + final DoubleBuffer modelMatrix, + final DoubleBuffer projMatrix, + final IntBuffer viewport, + final DoubleBuffer obj_pos) { + final DoubleBuffer in = this.inBuf; + final DoubleBuffer out = this.outBuf; __gluMultMatricesd(modelMatrix, projMatrix, matrixBuf); @@ -786,8 +786,8 @@ public class ProjectDouble { in.put(3, 1.0); // Map x and y from window coordinates - int vPos = viewport.position(); - int oPos = obj_pos.position(); + final int vPos = viewport.position(); + final int oPos = obj_pos.position(); in.put(0, (in.get(0) - viewport.get(0+vPos)) / viewport.get(2+vPos)); in.put(1, (in.get(1) - viewport.get(1+vPos)) / viewport.get(3+vPos)); @@ -827,22 +827,22 @@ public class ProjectDouble { * * @return */ - public boolean gluUnProject4(double winx, - double winy, - double winz, - double clipw, - double[] modelMatrix, - int modelMatrix_offset, - double[] projMatrix, - int projMatrix_offset, - int[] viewport, - int viewport_offset, - double near, - double far, - double[] obj_pos, - int obj_pos_offset ) { - double[] in = this.in; - double[] out = this.out; + public boolean gluUnProject4(final double winx, + final double winy, + final double winz, + final double clipw, + final double[] modelMatrix, + final int modelMatrix_offset, + final double[] projMatrix, + final int projMatrix_offset, + final int[] viewport, + final int viewport_offset, + final double near, + final double far, + final double[] obj_pos, + final int obj_pos_offset ) { + final double[] in = this.in; + final double[] out = this.out; __gluMultMatricesd(modelMatrix, modelMatrix_offset, projMatrix, projMatrix_offset, matrix); @@ -892,18 +892,18 @@ public class ProjectDouble { * * @return */ - public boolean gluUnProject4(double winx, - double winy, - double winz, - double clipw, - DoubleBuffer modelMatrix, - DoubleBuffer projMatrix, - IntBuffer viewport, - double near, - double far, - DoubleBuffer obj_pos) { - DoubleBuffer in = this.inBuf; - DoubleBuffer out = this.outBuf; + public boolean gluUnProject4(final double winx, + final double winy, + final double winz, + final double clipw, + final DoubleBuffer modelMatrix, + final DoubleBuffer projMatrix, + final IntBuffer viewport, + final double near, + final double far, + final DoubleBuffer obj_pos) { + final DoubleBuffer in = this.inBuf; + final DoubleBuffer out = this.outBuf; __gluMultMatricesd(modelMatrix, projMatrix, matrixBuf); @@ -916,7 +916,7 @@ public class ProjectDouble { in.put(3, clipw); // Map x and y from window coordinates - int vPos = viewport.position(); + final int vPos = viewport.position(); in.put(0, (in.get(0) - viewport.get(0+vPos)) / viewport.get(2+vPos)); in.put(1, (in.get(1) - viewport.get(1+vPos)) / viewport.get(3+vPos)); in.put(2, (in.get(2) - near) / (far - near)); @@ -931,7 +931,7 @@ public class ProjectDouble { if (out.get(3) == 0.0) return false; - int oPos = obj_pos.position(); + final int oPos = obj_pos.position(); obj_pos.put(0+oPos, out.get(0)); obj_pos.put(1+oPos, out.get(1)); obj_pos.put(2+oPos, out.get(2)); @@ -949,18 +949,18 @@ public class ProjectDouble { * @param deltaY * @param viewport */ - public void gluPickMatrix(GL2 gl, - double x, - double y, - double deltaX, - double deltaY, - IntBuffer viewport) { + public void gluPickMatrix(final GL2 gl, + final double x, + final double y, + final double deltaX, + final double deltaY, + final IntBuffer viewport) { if (deltaX <= 0 || deltaY <= 0) { return; } /* Translate and scale the picked region to the entire window */ - int vPos = viewport.position(); + final int vPos = viewport.position(); gl.glTranslated((viewport.get(2+vPos) - 2 * (x - viewport.get(0+vPos))) / deltaX, (viewport.get(3+vPos) - 2 * (y - viewport.get(1+vPos))) / deltaY, 0); @@ -977,13 +977,13 @@ public class ProjectDouble { * @param viewport * @param viewport_offset */ - public void gluPickMatrix(GL2 gl, - double x, - double y, - double deltaX, - double deltaY, - int[] viewport, - int viewport_offset) { + public void gluPickMatrix(final GL2 gl, + final double x, + final double y, + final double deltaX, + final double deltaY, + final int[] viewport, + final int viewport_offset) { if (deltaX <= 0 || deltaY <= 0) { return; } diff --git a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java index 717b1255c..977881e6b 100644 --- a/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java +++ b/src/jogl/classes/jogamp/opengl/glu/GLUquadricImpl.java @@ -132,7 +132,7 @@ import com.jogamp.opengl.util.glsl.ShaderState; */ public class GLUquadricImpl implements GLUquadric { - private boolean useGLSL; + private final boolean useGLSL; private int drawStyle; private int orientation; private boolean textureFlag; @@ -149,7 +149,7 @@ public class GLUquadricImpl implements GLUquadric { private ImmModeSink immModeSink=null; - public GLUquadricImpl(GL gl, boolean useGLSL, ShaderState st, int shaderProgram) { + public GLUquadricImpl(final GL gl, final boolean useGLSL, final ShaderState st, final int shaderProgram) { this.gl=gl; this.useGLSL = useGLSL; this.drawStyle = GLU.GLU_FILL; @@ -165,7 +165,7 @@ public class GLUquadricImpl implements GLUquadric { } @Override - public void enableImmModeSink(boolean val) { + public void enableImmModeSink(final boolean val) { if(gl.isGL2()) { immModeSinkEnabled=val; } else { @@ -182,7 +182,7 @@ public class GLUquadricImpl implements GLUquadric { } @Override - public void setImmMode(boolean val) { + public void setImmMode(final boolean val) { if(immModeSinkEnabled) { immModeSinkImmediate=val; } else { @@ -199,7 +199,7 @@ public class GLUquadricImpl implements GLUquadric { public ImmModeSink replaceImmModeSink() { if(!immModeSinkEnabled) return null; - ImmModeSink res = immModeSink; + final ImmModeSink res = immModeSink; if(useGLSL) { if(null != shaderState) { immModeSink = ImmModeSink.createGLSL (32, @@ -228,7 +228,7 @@ public class GLUquadricImpl implements GLUquadric { } @Override - public void resetImmModeSink(GL gl) { + public void resetImmModeSink(final GL gl) { if(immModeSinkEnabled) { immModeSink.reset(gl); } @@ -252,7 +252,7 @@ public class GLUquadricImpl implements GLUquadric { * * @param drawStyle The drawStyle to set */ - public void setDrawStyle(int drawStyle) { + public void setDrawStyle(final int drawStyle) { this.drawStyle = drawStyle; } @@ -269,7 +269,7 @@ public class GLUquadricImpl implements GLUquadric { * * @param normals The normals to set */ - public void setNormals(int normals) { + public void setNormals(final int normals) { this.normals = normals; } @@ -286,7 +286,7 @@ public class GLUquadricImpl implements GLUquadric { * * @param orientation The orientation to set */ - public void setOrientation(int orientation) { + public void setOrientation(final int orientation) { this.orientation = orientation; } @@ -301,7 +301,7 @@ public class GLUquadricImpl implements GLUquadric { * * @param textureFlag The textureFlag to set */ - public void setTextureFlag(boolean textureFlag) { + public void setTextureFlag(final boolean textureFlag) { this.textureFlag = textureFlag; } @@ -363,7 +363,7 @@ public class GLUquadricImpl implements GLUquadric { * @param slices Specifies the number of subdivisions around the z axis. * @param stacks Specifies the number of subdivisions along the z axis. */ - public void drawCylinder(GL gl, float baseRadius, float topRadius, float height, int slices, int stacks) { + public void drawCylinder(final GL gl, final float baseRadius, final float topRadius, final float height, final int slices, final int stacks) { float da, r, dr, dz; float x, y, z, nz, nsign; @@ -446,8 +446,8 @@ public class GLUquadricImpl implements GLUquadric { } glEnd(gl); } else if (drawStyle == GLU.GLU_FILL) { - float ds = 1.0f / slices; - float dt = 1.0f / stacks; + final float ds = 1.0f / slices; + final float dt = 1.0f / stacks; float t = 0.0f; z = 0.0f; r = baseRadius; @@ -505,7 +505,7 @@ public class GLUquadricImpl implements GLUquadric { * (1, 0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5), and at * (0, -r, 0) it is (0.5, 0). */ - public void drawDisk(GL gl, float innerRadius, float outerRadius, int slices, int loops) + public void drawDisk(final GL gl, final float innerRadius, final float outerRadius, final int slices, final int loops) { float da, dr; @@ -529,12 +529,12 @@ public class GLUquadricImpl implements GLUquadric { * x, y in [-outerRadius, +outerRadius]; s, t in [0, 1] * (linear mapping) */ - float dtc = 2.0f * outerRadius; + final float dtc = 2.0f * outerRadius; float sa, ca; float r1 = innerRadius; int l; for (l = 0; l < loops; l++) { - float r2 = r1 + dr; + final float r2 = r1 + dr; if (orientation == GLU.GLU_OUTSIDE) { int s; glBegin(gl, ImmModeSink.GL_QUAD_STRIP); @@ -580,22 +580,22 @@ public class GLUquadricImpl implements GLUquadric { int l, s; /* draw loops */ for (l = 0; l <= loops; l++) { - float r = innerRadius + l * dr; + final float r = innerRadius + l * dr; glBegin(gl, GL.GL_LINE_LOOP); for (s = 0; s < slices; s++) { - float a = s * da; + final float a = s * da; glVertex2f(gl, r * sin(a), r * cos(a)); } glEnd(gl); } /* draw spokes */ for (s = 0; s < slices; s++) { - float a = s * da; - float x = sin(a); - float y = cos(a); + final float a = s * da; + final float x = sin(a); + final float y = cos(a); glBegin(gl, GL.GL_LINE_STRIP); for (l = 0; l <= loops; l++) { - float r = innerRadius + l * dr; + final float r = innerRadius + l * dr; glVertex2f(gl, r * x, r * y); } glEnd(gl); @@ -607,12 +607,12 @@ public class GLUquadricImpl implements GLUquadric { int s; glBegin(gl, GL.GL_POINTS); for (s = 0; s < slices; s++) { - float a = s * da; - float x = sin(a); - float y = cos(a); + final float a = s * da; + final float x = sin(a); + final float y = cos(a); int l; for (l = 0; l <= loops; l++) { - float r = innerRadius * l * dr; + final float r = innerRadius * l * dr; glVertex2f(gl, r * x, r * y); } } @@ -625,8 +625,8 @@ public class GLUquadricImpl implements GLUquadric { float a; glBegin(gl, GL.GL_LINE_LOOP); for (a = 0.0f; a < 2.0 * PI; a += da) { - float x = innerRadius * sin(a); - float y = innerRadius * cos(a); + final float x = innerRadius * sin(a); + final float y = innerRadius * cos(a); glVertex2f(gl, x, y); } glEnd(gl); @@ -635,8 +635,8 @@ public class GLUquadricImpl implements GLUquadric { float a; glBegin(gl, GL.GL_LINE_LOOP); for (a = 0; a < 2.0f * PI; a += da) { - float x = outerRadius * sin(a); - float y = outerRadius * cos(a); + final float x = outerRadius * sin(a); + final float y = outerRadius * cos(a); glVertex2f(gl, x, y); } glEnd(gl); @@ -671,16 +671,16 @@ public class GLUquadricImpl implements GLUquadric { * is (1, 0.5), at (0, r, 0) it is (0.5, 1), at (-r, 0, 0) it is (0, 0.5), * and at (0, -r, 0) it is (0.5, 0). */ - public void drawPartialDisk(GL gl, - float innerRadius, - float outerRadius, + public void drawPartialDisk(final GL gl, + final float innerRadius, + final float outerRadius, int slices, - int loops, + final int loops, float startAngle, float sweepAngle) { int i, j; - float[] sinCache = new float[CACHE_SIZE]; - float[] cosCache = new float[CACHE_SIZE]; + final float[] sinCache = new float[CACHE_SIZE]; + final float[] cosCache = new float[CACHE_SIZE]; float angle; float sintemp, costemp; float deltaRadius; @@ -952,7 +952,7 @@ public class GLUquadricImpl implements GLUquadric { * 0.0 at the +y axis, to 0.25 at the +x axis, to 0.5 at the -y axis, to 0.75 * at the -x axis, and back to 1.0 at the +y axis. */ - public void drawSphere(GL gl, float radius, int slices, int stacks) { + public void drawSphere(final GL gl, final float radius, final int slices, final int stacks) { // TODO float rho, drho, theta, dtheta; @@ -1121,7 +1121,7 @@ public class GLUquadricImpl implements GLUquadric { private static final float PI = (float)Math.PI; private static final int CACHE_SIZE = 240; - private final void glBegin(GL gl, int mode) { + private final void glBegin(final GL gl, final int mode) { if(immModeSinkEnabled) { immModeSink.glBegin(mode); } else { @@ -1129,7 +1129,7 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glEnd(GL gl) { + private final void glEnd(final GL gl) { if(immModeSinkEnabled) { immModeSink.glEnd(gl, immModeSinkImmediate); } else { @@ -1137,7 +1137,7 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glVertex2f(GL gl, float x, float y) { + private final void glVertex2f(final GL gl, final float x, final float y) { if(immModeSinkEnabled) { immModeSink.glVertex2f(x, y); } else { @@ -1145,7 +1145,7 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glVertex3f(GL gl, float x, float y, float z) { + private final void glVertex3f(final GL gl, final float x, final float y, final float z) { if(immModeSinkEnabled) { immModeSink.glVertex3f(x, y, z); } else { @@ -1153,10 +1153,10 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glNormal3f_s(GL gl, float x, float y, float z) { - short a=(short)(x*0xFFFF); - short b=(short)(y*0xFFFF); - short c=(short)(z*0xFFFF); + private final void glNormal3f_s(final GL gl, final float x, final float y, final float z) { + final short a=(short)(x*0xFFFF); + final short b=(short)(y*0xFFFF); + final short c=(short)(z*0xFFFF); if(immModeSinkEnabled) { immModeSink.glNormal3s(a, b, c); } else { @@ -1164,10 +1164,10 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glNormal3f_b(GL gl, float x, float y, float z) { - byte a=(byte)(x*0xFF); - byte b=(byte)(y*0xFF); - byte c=(byte)(z*0xFF); + private final void glNormal3f_b(final GL gl, final float x, final float y, final float z) { + final byte a=(byte)(x*0xFF); + final byte b=(byte)(y*0xFF); + final byte c=(byte)(z*0xFF); if(immModeSinkEnabled) { immModeSink.glNormal3b(a, b, c); } else { @@ -1175,7 +1175,7 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glNormal3f(GL gl, float x, float y, float z) { + private final void glNormal3f(final GL gl, final float x, final float y, final float z) { switch(normalType) { case GL.GL_FLOAT: if(immModeSinkEnabled) { @@ -1193,7 +1193,7 @@ public class GLUquadricImpl implements GLUquadric { } } - private final void glTexCoord2f(GL gl, float x, float y) { + private final void glTexCoord2f(final GL gl, final float x, final float y) { if(immModeSinkEnabled) { immModeSink.glTexCoord2f(x, y); } else { @@ -1208,7 +1208,7 @@ public class GLUquadricImpl implements GLUquadric { * @param y * @param z */ - private void normal3f(GL gl, float x, float y, float z) { + private void normal3f(final GL gl, float x, float y, float z) { float mag; mag = (float)Math.sqrt(x * x + y * y + z * z); @@ -1220,15 +1220,15 @@ public class GLUquadricImpl implements GLUquadric { glNormal3f(gl, x, y, z); } - private final void TXTR_COORD(GL gl, float x, float y) { + private final void TXTR_COORD(final GL gl, final float x, final float y) { if (textureFlag) glTexCoord2f(gl, x,y); } - private float sin(float r) { + private float sin(final float r) { return (float)Math.sin(r); } - private float cos(float r) { + private float cos(final float r) { return (float)Math.cos(r); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/Glue.java b/src/jogl/classes/jogamp/opengl/glu/Glue.java index 2ad3d8c89..fc85b137f 100644 --- a/src/jogl/classes/jogamp/opengl/glu/Glue.java +++ b/src/jogl/classes/jogamp/opengl/glu/Glue.java @@ -94,7 +94,7 @@ public class Glue { public Glue() { } - public static String __gluNURBSErrorString( int errno ) { + public static String __gluNURBSErrorString( final int errno ) { return( __gluNurbsErrors[ errno ] ); } @@ -108,7 +108,7 @@ public class Glue { "need combine callback" }; - public static String __gluTessErrorString( int errno ) { + public static String __gluTessErrorString( final int errno ) { return( __gluTessErrors[ errno ] ); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/error/Error.java b/src/jogl/classes/jogamp/opengl/glu/error/Error.java index ffb8d9471..235c59717 100644 --- a/src/jogl/classes/jogamp/opengl/glu/error/Error.java +++ b/src/jogl/classes/jogamp/opengl/glu/error/Error.java @@ -76,7 +76,7 @@ public class Error { public Error() { } - public static String gluErrorString( int errorCode ) { + public static String gluErrorString( final int errorCode ) { if( errorCode == 0 ) { return( "no error" ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java index 4213dfd46..96da49a80 100644 --- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java +++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2CurveEvaluator.java @@ -1,42 +1,9 @@ package jogamp.opengl.glu.gl2.nurbs; import jogamp.opengl.glu.nurbs.*; -/* - ** License Applicability. Except to the extent portions of this file are - ** made subject to an alternative license as permitted in the SGI Free - ** Software License B, Version 2.0 (the "License"), the contents of this - ** file are subject only to the provisions of the License. You may not use - ** this file except in compliance with the License. You may obtain a copy - ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - ** - ** http://oss.sgi.com/projects/FreeB - ** - ** Note that, as provided in the License, the Software is distributed on an - ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - ** - ** Original Code. The Original Code is: OpenGL Sample Implementation, - ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - ** Copyright in any portions created by third parties is as indicated - ** elsewhere herein. All Rights Reserved. - ** - ** Additional Notice Provisions: The application programming interfaces - ** established by SGI in conjunction with the Original Code are The - ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - ** Window System(R) (Version 1.3), released October 19, 1998. This software - ** was created using the OpenGL(R) version 1.2.1 Sample Implementation - ** published by SGI, but has not been independently verified as being - ** compliant with the OpenGL(R) version 1.2.1 Specification. - */ - import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2GL3; import javax.media.opengl.glu.GLU; import javax.media.opengl.glu.gl2.GLUgl2; @@ -55,7 +22,7 @@ class GL2CurveEvaluator implements CurveEvaluator { /** * OpenGL object */ - private GL2 gl; + private final GL2 gl; /** * Not used @@ -130,8 +97,8 @@ class GL2CurveEvaluator implements CurveEvaluator { * @param ps control points */ @Override - public void map1f(int type, float ulo, float uhi, int stride, int order, - CArrayOfFloats ps) { + public void map1f(final int type, final float ulo, final float uhi, final int stride, final int order, + final CArrayOfFloats ps) { if (output_triangles) { // TODO code for callback (output_triangles probably indicates callback) // System.out.println("TODO curveevaluator.map1f-output_triangles"); @@ -157,7 +124,7 @@ class GL2CurveEvaluator implements CurveEvaluator { * @param type what to enable */ @Override - public void enable(int type) { + public void enable(final int type) { // DONE gl.glEnable(type); } @@ -169,7 +136,7 @@ class GL2CurveEvaluator implements CurveEvaluator { * @param u2 high u */ @Override - public void mapgrid1f(int nu, float u1, float u2) { + public void mapgrid1f(final int nu, final float u1, final float u2) { if (output_triangles) { // System.out.println("TODO curveevaluator.mapgrid1f"); } else @@ -185,7 +152,7 @@ class GL2CurveEvaluator implements CurveEvaluator { * @param to highest param */ @Override - public void mapmesh1f(int style, int from, int to) { + public void mapmesh1f(final int style, final int from, final int to) { /* //DEBUG drawing control points this.poradi++; if (poradi % 2 == 0) @@ -200,10 +167,10 @@ class GL2CurveEvaluator implements CurveEvaluator { switch (style) { case Backend.N_MESHFILL: case Backend.N_MESHLINE: - gl.glEvalMesh1(GL2.GL_LINE, from, to); + gl.glEvalMesh1(GL2GL3.GL_LINE, from, to); break; case Backend.N_MESHPOINT: - gl.glEvalMesh1(GL2.GL_POINT, from, to); + gl.glEvalMesh1(GL2GL3.GL_POINT, from, to); break; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java index e9c9fca3f..e5cb715ab 100644 --- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java +++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GL2SurfaceEvaluator.java @@ -1,42 +1,9 @@ package jogamp.opengl.glu.gl2.nurbs; import jogamp.opengl.glu.nurbs.*; -/* - ** License Applicability. Except to the extent portions of this file are - ** made subject to an alternative license as permitted in the SGI Free - ** Software License B, Version 2.0 (the "License"), the contents of this - ** file are subject only to the provisions of the License. You may not use - ** this file except in compliance with the License. You may obtain a copy - ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600 - ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at: - ** - ** http://oss.sgi.com/projects/FreeB - ** - ** Note that, as provided in the License, the Software is distributed on an - ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS - ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND - ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A - ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT. - ** - ** Original Code. The Original Code is: OpenGL Sample Implementation, - ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics, - ** Inc. The Original Code is Copyright (c) 1991-2000 Silicon Graphics, Inc. - ** Copyright in any portions created by third parties is as indicated - ** elsewhere herein. All Rights Reserved. - ** - ** Additional Notice Provisions: The application programming interfaces - ** established by SGI in conjunction with the Original Code are The - ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released - ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version - ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X - ** Window System(R) (Version 1.3), released October 19, 1998. This software - ** was created using the OpenGL(R) version 1.2.1 Sample Implementation - ** published by SGI, but has not been independently verified as being - ** compliant with the OpenGL(R) version 1.2.1 Specification. - */ - import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2GL3; import javax.media.opengl.glu.GLU; import javax.media.opengl.glu.gl2.GLUgl2; @@ -50,7 +17,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { /** * JOGL OpenGL object */ - private GL2 gl; + private final GL2 gl; /** * Output triangles (callback) @@ -90,18 +57,18 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { * @param style polygon mode (N_MESHFILL/N_MESHLINE/N_MESHPOINT) */ @Override - public void polymode(int style) { + public void polymode(final int style) { if (!output_triangles) { switch (style) { default: case NurbsConsts.N_MESHFILL: - gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_FILL); + gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL2GL3.GL_FILL); break; case NurbsConsts.N_MESHLINE: - gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_LINE); + gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL2GL3.GL_LINE); break; case NurbsConsts.N_MESHPOINT: - gl.glPolygonMode(GL2.GL_FRONT_AND_BACK, GL2.GL_POINT); + gl.glPolygonMode(GL.GL_FRONT_AND_BACK, GL2GL3.GL_POINT); break; } } @@ -130,7 +97,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { * @param vhi */ @Override - public void domain2f(float ulo, float uhi, float vlo, float vhi) { + public void domain2f(final float ulo, final float uhi, final float vlo, final float vhi) { // DONE } @@ -144,7 +111,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { * @param v1 highest v */ @Override - public void mapgrid2f(int nu, float u0, float u1, int nv, float v0, float v1) { + public void mapgrid2f(final int nu, final float u0, final float u1, final int nv, final float v0, final float v1) { if (output_triangles) { // System.out.println("TODO openglsurfaceavaluator.mapgrid2f output_triangles"); @@ -163,7 +130,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { * @param vmax maximum V */ @Override - public void mapmesh2f(int style, int umin, int umax, int vmin, int vmax) { + public void mapmesh2f(final int style, final int umin, final int umax, final int vmin, final int vmax) { if (output_triangles) { // System.out.println("TODO openglsurfaceavaluator.mapmesh2f output_triangles"); } else { @@ -176,13 +143,13 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { */ switch (style) { case NurbsConsts.N_MESHFILL: - gl.glEvalMesh2(GL2.GL_FILL, umin, umax, vmin, vmax); + gl.glEvalMesh2(GL2GL3.GL_FILL, umin, umax, vmin, vmax); break; case NurbsConsts.N_MESHLINE: - gl.glEvalMesh2(GL2.GL_LINE, umin, umax, vmin, vmax); + gl.glEvalMesh2(GL2GL3.GL_LINE, umin, umax, vmin, vmax); break; case NurbsConsts.N_MESHPOINT: - gl.glEvalMesh2(GL2.GL_POINT, umin, umax, vmin, vmax); + gl.glEvalMesh2(GL2GL3.GL_POINT, umin, umax, vmin, vmax); break; } } @@ -202,8 +169,8 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { * @param pts control points */ @Override - public void map2f(int type, float ulo, float uhi, int ustride, int uorder, - float vlo, float vhi, int vstride, int vorder, CArrayOfFloats pts) { + public void map2f(final int type, final float ulo, final float uhi, final int ustride, final int uorder, + final float vlo, final float vhi, final int vstride, final int vorder, final CArrayOfFloats pts) { // TODO Auto-generated method stub if (output_triangles) { // System.out.println("TODO openglsurfaceevaluator.map2f output_triangles"); @@ -218,7 +185,7 @@ class GL2SurfaceEvaluator implements SurfaceEvaluator { * @param type what to enable */ @Override - public void enable(int type) { + public void enable(final int type) { //DONE gl.glEnable(type); } diff --git a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java index f83b3a805..338d7e6d6 100644 --- a/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java +++ b/src/jogl/classes/jogamp/opengl/glu/gl2/nurbs/GLUgl2nurbsImpl.java @@ -67,17 +67,17 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Matrixes autoloading */ - private boolean autoloadmode; + private final boolean autoloadmode; /** * Using callback */ - private int callBackFlag; + private final int callBackFlag; /** * Object for error call backs */ - private Object errorCallback; + private final Object errorCallback; /** * List of map definitions @@ -122,7 +122,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Object holding rendering settings */ - private Renderhints renderhints; + private final Renderhints renderhints; /** * Display list @@ -132,7 +132,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { /** * Object for subdividing curves and surfaces */ - private Subdivider subdivider; + private final Subdivider subdivider; /** * Object responsible for rendering @@ -221,13 +221,13 @@ public class GLUgl2nurbsImpl implements GLUnurbs { defineMap(GL2.GL_MAP1_INDEX, 0, 1); setnurbsproperty(GL2.GL_MAP1_VERTEX_3, NurbsConsts.N_SAMPLINGMETHOD, - (float) NurbsConsts.N_PATHLENGTH); + NurbsConsts.N_PATHLENGTH); setnurbsproperty(GL2.GL_MAP1_VERTEX_4, NurbsConsts.N_SAMPLINGMETHOD, - (float) NurbsConsts.N_PATHLENGTH); + NurbsConsts.N_PATHLENGTH); setnurbsproperty(GL2.GL_MAP2_VERTEX_3, NurbsConsts.N_SAMPLINGMETHOD, - (float) NurbsConsts.N_PATHLENGTH); + NurbsConsts.N_PATHLENGTH); setnurbsproperty(GL2.GL_MAP2_VERTEX_4, NurbsConsts.N_SAMPLINGMETHOD, - (float) NurbsConsts.N_PATHLENGTH); + NurbsConsts.N_PATHLENGTH); setnurbsproperty(GL2.GL_MAP1_VERTEX_3, NurbsConsts.N_PIXEL_TOLERANCE, (float) 50.0); @@ -276,7 +276,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param d * distance */ - private void set_domain_distance_u_rate(double d) { + private void set_domain_distance_u_rate(final double d) { // DONE subdivider.set_domain_distance_u_rate(d); } @@ -287,7 +287,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param d * distance */ - private void set_domain_distance_v_rate(double d) { + private void set_domain_distance_v_rate(final double d) { // DONE subdivider.set_domain_distance_v_rate(d); } @@ -297,7 +297,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { */ public void bgncurve() { // DONE - O_curve o_curve = new O_curve(); + final O_curve o_curve = new O_curve(); thread("do_bgncurve", o_curve); } @@ -309,9 +309,9 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param arg * parameter to be passed to called method */ - private void thread(String name, Object arg) { + private void thread(final String name, final Object arg) { // DONE - Class partype[] = new Class[1]; + final Class partype[] = new Class[1]; partype[0] = arg.getClass(); Method m; try { @@ -321,7 +321,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { } else { m.invoke(this, new Object[] { arg }); } - } catch (Throwable e) { + } catch (final Throwable e) { e.printStackTrace(); } @@ -333,16 +333,16 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param name * name of a method to be called */ - private void thread2(String name) { + private void thread2(final String name) { // DONE try { - Method m = this.getClass().getMethod(name, (Class[]) null); + final Method m = this.getClass().getMethod(name, (Class[]) null); if (dl != null) { dl.append(this, m, null); } else { m.invoke(this, (Object[]) null); } - } catch (Throwable e) { + } catch (final Throwable e) { e.printStackTrace(); } } @@ -353,7 +353,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param o_curve * curve object */ - public void do_bgncurve(O_curve o_curve) { + public void do_bgncurve(final O_curve o_curve) { if (inCurve > 0) { do_nurbserror(6); endcurve(); @@ -385,7 +385,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param o_surface * surface object */ - public void do_bgnsurface(O_surface o_surface) { + public void do_bgnsurface(final O_surface o_surface) { // DONE if (inSurface > 0) { do_nurbserror(27); @@ -507,7 +507,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param i * error code */ - private void do_nurbserror(int i) { + private void do_nurbserror(final int i) { // TODO nurberror // System.out.println("TODO nurbserror " + i); } @@ -553,10 +553,10 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param realType * type of the curve */ - public void nurbscurve(int nknots, float[] knot, int stride, - float[] ctlarray, int order, int realType) { + public void nurbscurve(final int nknots, final float[] knot, final int stride, + final float[] ctlarray, final int order, final int realType) { // DONE - Mapdesc mapdesc = maplist.locate(realType); + final Mapdesc mapdesc = maplist.locate(realType); if (mapdesc == null) { do_nurbserror(35); isDataValid = 0; @@ -572,14 +572,14 @@ public class GLUgl2nurbsImpl implements GLUnurbs { isDataValid = 0; return; } - Knotvector knots = new Knotvector(nknots, stride, order, knot); + final Knotvector knots = new Knotvector(nknots, stride, order, knot); if (!do_check_knots(knots, "curve")) return; - O_nurbscurve o_nurbscurve = new O_nurbscurve(realType); + final O_nurbscurve o_nurbscurve = new O_nurbscurve(realType); o_nurbscurve.bezier_curves = new Quilt(mapdesc); - CArrayOfFloats ctrlcarr = new CArrayOfFloats(ctlarray); + final CArrayOfFloats ctrlcarr = new CArrayOfFloats(ctlarray); o_nurbscurve.bezier_curves.toBezier(knots, ctrlcarr, mapdesc .getNCoords()); thread("do_nurbscurve", o_nurbscurve); @@ -594,9 +594,9 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * error message * @return knot vector is / is not valid */ - public boolean do_check_knots(Knotvector knots, String msg) { + public boolean do_check_knots(final Knotvector knots, final String msg) { // DONE - int status = knots.validate(); + final int status = knots.validate(); if (status > 0) { do_nurbserror(status); if (renderhints.errorchecking != NurbsConsts.N_NOMSG) @@ -611,7 +611,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param o_nurbscurve * NURBS curve object */ - public void do_nurbscurve(O_nurbscurve o_nurbscurve) { + public void do_nurbscurve(final O_nurbscurve o_nurbscurve) { // DONE if (inCurve <= 0) { @@ -664,7 +664,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param o_nurbssurface * NURBS surface object */ - public void do_nurbssurface(O_nurbssurface o_nurbssurface) { + public void do_nurbssurface(final O_nurbssurface o_nurbssurface) { // DONE if (inSurface <= 0) { bgnsurface(); @@ -712,7 +712,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param ncoords * number of control point coordinates */ - public void defineMap(int type, int rational, int ncoords) { + public void defineMap(final int type, final int rational, final int ncoords) { // DONE maplist.define(type, rational, ncoords); } @@ -727,9 +727,9 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param value * property value */ - public void setnurbsproperty(int type, int tag, float value) { + public void setnurbsproperty(final int type, final int tag, final float value) { // DONE - Mapdesc mapdesc = maplist.locate(type); + final Mapdesc mapdesc = maplist.locate(type); if (mapdesc == null) { do_nurbserror(35); return; @@ -738,7 +738,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { do_nurbserror(26); return; } - Property prop = new Property(type, tag, value); + final Property prop = new Property(type, tag, value); thread("do_setnurbsproperty2", prop); } @@ -748,8 +748,8 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param prop * property */ - public void do_setnurbsproperty2(Property prop) { - Mapdesc mapdesc = maplist.find(prop.type); + public void do_setnurbsproperty2(final Property prop) { + final Mapdesc mapdesc = maplist.find(prop.type); mapdesc.setProperty(prop.tag, prop.value); } @@ -759,7 +759,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param prop * property to be set */ - public void do_setnurbsproperty(Property prop) { + public void do_setnurbsproperty(final Property prop) { // DONE renderhints.setProperty(prop); // TODO freeproperty? @@ -771,7 +771,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param i * domain distance sampling flag */ - public void set_is_domain_distance_sampling(int i) { + public void set_is_domain_distance_sampling(final int i) { // DONE subdivider.set_is_domain_distance_sampling(i); } @@ -781,7 +781,7 @@ public class GLUgl2nurbsImpl implements GLUnurbs { */ public void bgnsurface() { // DONE - O_surface o_surface = new O_surface(); + final O_surface o_surface = new O_surface(); // TODO nuid // System.out.println("TODO glunurbs.bgnsurface nuid"); thread("do_bgnsurface", o_surface); @@ -827,11 +827,11 @@ public class GLUgl2nurbsImpl implements GLUnurbs { * @param type * NURBS surface type (rational,...) */ - public void nurbssurface(int sknot_count, float[] sknot, int tknot_count, - float[] tknot, int s_stride, int t_stride, float[] ctlarray, - int sorder, int torder, int type) { + public void nurbssurface(final int sknot_count, final float[] sknot, final int tknot_count, + final float[] tknot, final int s_stride, final int t_stride, final float[] ctlarray, + final int sorder, final int torder, final int type) { // DONE - Mapdesc mapdesc = maplist.locate(type); + final Mapdesc mapdesc = maplist.locate(type); if (mapdesc == null) { do_nurbserror(35); isDataValid = 0; @@ -842,19 +842,19 @@ public class GLUgl2nurbsImpl implements GLUnurbs { isDataValid = 0; return; } - Knotvector sknotvector = new Knotvector(sknot_count, s_stride, sorder, + final Knotvector sknotvector = new Knotvector(sknot_count, s_stride, sorder, sknot); if (!do_check_knots(sknotvector, "surface")) return; - Knotvector tknotvector = new Knotvector(tknot_count, t_stride, torder, + final Knotvector tknotvector = new Knotvector(tknot_count, t_stride, torder, tknot); if (!do_check_knots(tknotvector, "surface")) return; - O_nurbssurface o_nurbssurface = new O_nurbssurface(type); + final O_nurbssurface o_nurbssurface = new O_nurbssurface(type); o_nurbssurface.bezier_patches = new Quilt(mapdesc); - CArrayOfFloats ctrlarr = new CArrayOfFloats(ctlarray); + final CArrayOfFloats ctrlarr = new CArrayOfFloats(ctlarray); o_nurbssurface.bezier_patches.toBezier(sknotvector, tknotvector, ctrlarr, mapdesc.getNCoords()); thread("do_nurbssurface", o_nurbssurface); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java index 81a99beab..337d93b80 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/BuildMipmap.java @@ -46,9 +46,15 @@ package jogamp.opengl.glu.mipmap; import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2ES3; +import javax.media.opengl.GL2GL3; import javax.media.opengl.glu.GLU; + import jogamp.opengl.Debug; + import com.jogamp.common.nio.Buffers; + import java.nio.*; import java.io.*; @@ -65,9 +71,9 @@ public class BuildMipmap { public BuildMipmap() { } - public static int gluBuild1DMipmapLevelsCore( GL gl, int target, int internalFormat, - int width, int widthPowerOf2, int format, int type, int userLevel, - int baseLevel, int maxLevel, ByteBuffer data ) { + public static int gluBuild1DMipmapLevelsCore( final GL gl, final int target, final int internalFormat, + final int width, final int widthPowerOf2, final int format, final int type, final int userLevel, + final int baseLevel, final int maxLevel, final ByteBuffer data ) { int newwidth; int level, levels; ShortBuffer newImage = null; @@ -75,9 +81,9 @@ public class BuildMipmap { ShortBuffer otherImage = null; ShortBuffer imageTemp = null; int memReq; - int maxsize; + final int maxsize; int cmpts; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 ); assert( width >= 1 ); @@ -90,40 +96,40 @@ public class BuildMipmap { Mipmap.retrieveStoreModes( gl, psm ); try { newImage = Buffers.newDirectByteBuffer( Mipmap.image_size( width, 1, format, - GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer(); - } catch( OutOfMemoryError ome ) { + GL.GL_UNSIGNED_SHORT ) ).asShortBuffer(); + } catch( final OutOfMemoryError ome ) { return( GLU.GLU_OUT_OF_MEMORY ); } newImage_width = width; Image.fill_image( psm, width, 1, format, type, Mipmap.is_index( format ), data, newImage ); cmpts = Mipmap.elements_per_group( format, type ); - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, 2 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, 2 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, 0 ); // if swap_bytes was set, swapping occurred in fill_image - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); for( level = userLevel; level <= levels; level++ ) { if( newImage_width == newwidth ) { // user newimage for this level if( baseLevel <= level && level <= maxLevel ) { gl.getGL2().glTexImage1D( target, level, internalFormat, newImage_width, 0, format, - GL2.GL_UNSIGNED_SHORT, newImage ); + GL.GL_UNSIGNED_SHORT, newImage ); } } else { if( otherImage == null ) { - memReq = Mipmap.image_size( newwidth, 1, format, GL2.GL_UNSIGNED_SHORT ); + memReq = Mipmap.image_size( newwidth, 1, format, GL.GL_UNSIGNED_SHORT ); try { otherImage = Buffers.newDirectByteBuffer( memReq ).asShortBuffer(); - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } } @@ -136,26 +142,26 @@ public class BuildMipmap { newImage_width = newwidth; if( baseLevel <= level && level <= maxLevel ) { gl.getGL2().glTexImage1D( target, level, internalFormat, newImage_width, 0, - format, GL2.GL_UNSIGNED_SHORT, newImage ); + format, GL.GL_UNSIGNED_SHORT, newImage ); } } if( newwidth > 1 ) { newwidth /= 2; } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( 0 ); } - public static int bitmapBuild2DMipmaps( GL gl, int target, int internalFormat, - int width, int height, int format, int type, ByteBuffer data ) { - int newwidth[] = new int[1]; - int newheight[] = new int[1]; + public static int bitmapBuild2DMipmaps( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int format, final int type, final ByteBuffer data ) { + final int newwidth[] = new int[1]; + final int newheight[] = new int[1]; int level, levels; ShortBuffer newImage = null; int newImage_width; @@ -163,9 +169,9 @@ public class BuildMipmap { ShortBuffer otherImage = null; ShortBuffer tempImage = null; int memReq; - int maxsize; + final int maxsize; int cmpts; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); Mipmap.retrieveStoreModes( gl, psm ); @@ -179,8 +185,8 @@ public class BuildMipmap { try { newImage = Buffers.newDirectByteBuffer( Mipmap.image_size( width, height, - format, GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer(); - } catch( OutOfMemoryError ome ) { + format, GL.GL_UNSIGNED_SHORT ) ).asShortBuffer(); + } catch( final OutOfMemoryError ome ) { return( GLU.GLU_OUT_OF_MEMORY ); } newImage_width = width; @@ -189,30 +195,30 @@ public class BuildMipmap { Image.fill_image( psm, width, height, format, type, Mipmap.is_index( format ), data, newImage ); cmpts = Mipmap.elements_per_group( format, type ); - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, 2 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, 2 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, 0 ); // if swap_bytes is set, swapping occurred in fill_image - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); for( level = 0; level < levels; level++ ) { if( newImage_width == newwidth[0] && newImage_height == newheight[0] ) { newImage.rewind(); gl.glTexImage2D( target, level, internalFormat, newImage_width, - newImage_height, 0, format, GL2.GL_UNSIGNED_SHORT, newImage ); + newImage_height, 0, format, GL.GL_UNSIGNED_SHORT, newImage ); } else { if( otherImage == null ) { - memReq = Mipmap.image_size( newwidth[0], newheight[0], format, GL2.GL_UNSIGNED_SHORT ); + memReq = Mipmap.image_size( newwidth[0], newheight[0], format, GL.GL_UNSIGNED_SHORT ); try { otherImage = Buffers.newDirectByteBuffer( memReq ).asShortBuffer(); - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } } @@ -227,7 +233,7 @@ public class BuildMipmap { newImage_height = newheight[0]; newImage.rewind(); gl.glTexImage2D( target, level, internalFormat, newImage_width, newImage_height, - 0, format, GL2.GL_UNSIGNED_SHORT, newImage ); + 0, format, GL.GL_UNSIGNED_SHORT, newImage ); } if( newheight[0] > 1 ) { newwidth[0] /= 2; @@ -236,38 +242,38 @@ public class BuildMipmap { newheight[0] /= 2; } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( 0 ); } - public static int gluBuild2DMipmapLevelsCore( GL gl, int target, int internalFormat, - int width, int height, int widthPowerOf2, int heightPowerOf2, - int format, int type, int userLevel, int baseLevel, int maxLevel, - ByteBuffer data ) { // PointerWrapper data + public static int gluBuild2DMipmapLevelsCore( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int widthPowerOf2, final int heightPowerOf2, + final int format, final int type, final int userLevel, final int baseLevel, final int maxLevel, + final ByteBuffer data ) { // PointerWrapper data int newwidth; int newheight; int level, levels; - int usersImage; + final int usersImage; ByteBuffer srcImage = null; ByteBuffer dstImage = null; ByteBuffer tempImage = null; - int newImage_width; - int newImage_height; - short[] SWAP_IMAGE = null; + final int newImage_width; + final int newImage_height; + final short[] SWAP_IMAGE = null; int memReq; - int maxsize; + final int maxsize; int cmpts; int mark=-1; boolean myswap_bytes; int groups_per_line, element_size, group_size; int rowsize, padding; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 ); assert( width >= 1 && height >= 1 ); @@ -310,9 +316,9 @@ public class BuildMipmap { mark = psm.getUnpackSkipRows() * rowsize + psm.getUnpackSkipPixels() * group_size; data.position( mark ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, 0 ); level = userLevel; @@ -324,11 +330,11 @@ public class BuildMipmap { gl.glTexImage2D( target, level, internalFormat, width, height, 0, format, type, data ); } if( levels == 0 ) { /* we're done. clean up and return */ - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( 0 ); } int nextWidth = newwidth / 2; @@ -345,97 +351,97 @@ public class BuildMipmap { try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } if( dstImage != null ) { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): HalveImage.halveImage_ubyte( cmpts, width, height, data, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): HalveImage.halveImage_byte( cmpts, width, height, data, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): HalveImage.halveImage_ushort( cmpts, width, height, data, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_SHORT ): + case( GL.GL_SHORT ): HalveImage.halveImage_short( cmpts, width, height, data, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT ): HalveImage.halveImage_uint( cmpts, width, height, data, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_INT ): + case( GL2ES2.GL_INT ): HalveImage.halveImage_int( cmpts, width, height, data, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_FLOAT ): + case( GL.GL_FLOAT ): HalveImage.halveImage_float( cmpts, width, height, data, dstImage.asFloatBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel( 3, new Extract332(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel( 3, new Extract233rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): HalveImage.halveImagePackedPixel( 3, new Extract565(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): HalveImage.halveImagePackedPixel( 3, new Extract565rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): HalveImage.halveImagePackedPixel( 4, new Extract4444(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): HalveImage.halveImagePackedPixel( 4, new Extract4444rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): HalveImage.halveImagePackedPixel( 4, new Extract5551(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): HalveImage.halveImagePackedPixel( 4, new Extract1555rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): HalveImage.halveImagePackedPixel( 4, new Extract8888(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): HalveImage.halveImagePackedPixel( 4, new Extract8888rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): HalveImage.halveImagePackedPixel( 4, new Extract1010102(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): HalveImage.halveImagePackedPixel( 4, new Extract2101010rev(), width, height, data, dstImage, element_size, rowsize, myswap_bytes ); break; default: @@ -462,36 +468,36 @@ public class BuildMipmap { dstImage = tempImage; try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } // level userLevel+1 is in srcImage; level userLevel already saved @@ -500,113 +506,113 @@ public class BuildMipmap { memReq = Mipmap.image_size( newwidth, newheight, format, type ); try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } data.position( mark ); switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): ScaleInternal.scale_internal_ubyte( cmpts, width, height, data, newwidth, newheight, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): ScaleInternal.scale_internal_byte( cmpts, width, height, data, newwidth, newheight, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): ScaleInternal.scale_internal_ushort( cmpts, width, height, data, newwidth, newheight, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_SHORT ): + case( GL.GL_SHORT ): ScaleInternal.scale_internal_ushort( cmpts, width, height, data, newwidth, newheight, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT ): ScaleInternal.scale_internal_uint( cmpts, width, height, data, newwidth, newheight, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_INT ): + case( GL2ES2.GL_INT ): ScaleInternal.scale_internal_int( cmpts, width, height, data, newwidth, newheight, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_FLOAT ): + case( GL.GL_FLOAT ): ScaleInternal.scale_internal_float( cmpts, width, height, data, newwidth, newheight, dstImage.asFloatBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): ScaleInternal.scaleInternalPackedPixel( 3, new Extract332(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): ScaleInternal.scaleInternalPackedPixel( 3, new Extract233rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): ScaleInternal.scaleInternalPackedPixel( 3, new Extract565(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): ScaleInternal.scaleInternalPackedPixel( 3, new Extract565rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract4444(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract4444rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract5551(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract1555rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract8888(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract8888rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract1010102(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): ScaleInternal.scaleInternalPackedPixel( 4, new Extract2101010rev(), width, height, data, newwidth, newheight, dstImage, element_size, rowsize, myswap_bytes ); break; @@ -634,36 +640,36 @@ public class BuildMipmap { memReq = Mipmap.image_size( nextWidth, nextHeight, format, type ); try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } } @@ -671,7 +677,7 @@ public class BuildMipmap { level = userLevel; } - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); if( baseLevel <= level && level <= maxLevel ) { srcImage.rewind(); gl.glTexImage2D( target, level, internalFormat, newwidth, newheight, 0, format, type, srcImage ); @@ -691,63 +697,63 @@ public class BuildMipmap { srcImage.rewind(); dstImage.rewind(); switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): HalveImage.halveImage_ubyte( cmpts, newwidth, newheight, srcImage, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): HalveImage.halveImage_byte( cmpts, newwidth, newheight, srcImage, dstImage, element_size, rowsize, group_size ); break; - case( GL2.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): HalveImage.halveImage_ushort( cmpts, newwidth, newheight, srcImage, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_SHORT ): + case( GL.GL_SHORT ): HalveImage.halveImage_short( cmpts, newwidth, newheight, srcImage, dstImage.asShortBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT ): HalveImage.halveImage_uint( cmpts, newwidth, newheight, srcImage, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_INT ): + case( GL2ES2.GL_INT ): HalveImage.halveImage_int( cmpts, newwidth, newheight, srcImage, dstImage.asIntBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_FLOAT ): + case( GL.GL_FLOAT ): HalveImage.halveImage_float( cmpts, newwidth, newheight, srcImage, dstImage.asFloatBuffer(), element_size, rowsize, group_size, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel( 3, new Extract332(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel( 3, new Extract233rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): HalveImage.halveImagePackedPixel( 3, new Extract565(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): HalveImage.halveImagePackedPixel( 3, new Extract565rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): HalveImage.halveImagePackedPixel( 4, new Extract4444(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): HalveImage.halveImagePackedPixel( 4, new Extract4444rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): HalveImage.halveImagePackedPixel( 4, new Extract5551(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): HalveImage.halveImagePackedPixel( 4, new Extract1555rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): HalveImage.halveImagePackedPixel( 4, new Extract8888(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): HalveImage.halveImagePackedPixel( 4, new Extract8888rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): HalveImage.halveImagePackedPixel( 4, new Extract1010102(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): HalveImage.halveImagePackedPixel( 4, new Extract2101010rev(), newwidth, newheight, srcImage, dstImage, element_size, rowsize, myswap_bytes ); break; default: @@ -768,7 +774,7 @@ public class BuildMipmap { newheight /= 2; } // compute amount to pad per row if any - int rowPad = rowsize % psm.getUnpackAlignment(); + final int rowPad = rowsize % psm.getUnpackAlignment(); // should row be padded if( rowPad == 0 ) { @@ -788,21 +794,21 @@ public class BuildMipmap { } } else { // compute length of new row in bytes, including padding - int newRowLength = rowsize + psm.getUnpackAlignment() - rowPad; + final int newRowLength = rowsize + psm.getUnpackAlignment() - rowPad; int ii, jj; - int dstTrav; - int srcTrav; + final int dstTrav; + final int srcTrav; // allocate new image for mipmap of size newRowLength x newheight ByteBuffer newMipmapImage = null; try { newMipmapImage = ByteBuffer.allocateDirect( newRowLength * newheight ); - } catch( OutOfMemoryError ome ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + } catch( final OutOfMemoryError ome ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( GLU.GLU_OUT_OF_MEMORY ); } srcImage.rewind(); @@ -828,19 +834,19 @@ public class BuildMipmap { } } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, (psm.getUnpackSwapBytes() ? 1 : 0) ); return( 0 ); } - public static int fastBuild2DMipmaps( GL gl, PixelStorageModes psm, int target, - int components, int width, int height, int format, int type, ByteBuffer data ) { - int[] newwidth = new int[1]; - int[] newheight = new int[1]; + public static int fastBuild2DMipmaps( final GL gl, final PixelStorageModes psm, final int target, + final int components, final int width, final int height, final int format, final int type, final ByteBuffer data ) { + final int[] newwidth = new int[1]; + final int[] newheight = new int[1]; int level, levels; ByteBuffer newImage; int newImage_width; @@ -848,7 +854,7 @@ public class BuildMipmap { ByteBuffer otherImage; ByteBuffer imageTemp; int memReq; - int maxsize; + final int maxsize; int cmpts; Mipmap.closestFit( gl, target, width, height, components, format, type, newwidth, @@ -876,12 +882,12 @@ public class BuildMipmap { int elements_per_line; int start; int iter; - int iter2; + final int iter2; int i, j; try { - newImage = Buffers.newDirectByteBuffer( Mipmap.image_size(width, height, format, GL2.GL_UNSIGNED_BYTE ) ); - } catch( OutOfMemoryError err ) { + newImage = Buffers.newDirectByteBuffer( Mipmap.image_size(width, height, format, GL.GL_UNSIGNED_BYTE ) ); + } catch( final OutOfMemoryError err ) { return( GLU.GLU_OUT_OF_MEMORY ); } newImage_width = width; @@ -907,29 +913,29 @@ public class BuildMipmap { } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, 1 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, 1 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); for( level = 0; level <= levels; level++ ) { if( newImage_width == newwidth[0] && newImage_height == newheight[0] ) { // use newImage for this level newImage.rewind(); gl.glTexImage2D( target, level, components, newImage_width, newImage_height, - 0, format, GL2.GL_UNSIGNED_BYTE, newImage ); + 0, format, GL.GL_UNSIGNED_BYTE, newImage ); } else { if( otherImage == null ) { - memReq = Mipmap.image_size( newwidth[0], newheight[0], format, GL2.GL_UNSIGNED_BYTE ); + memReq = Mipmap.image_size( newwidth[0], newheight[0], format, GL.GL_UNSIGNED_BYTE ); try { otherImage = Buffers.newDirectByteBuffer( memReq ); - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; + } catch( final OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; return( GLU.GLU_OUT_OF_MEMORY ); } } @@ -942,7 +948,7 @@ public class BuildMipmap { newImage_height = newheight[0]; newImage.rewind(); gl.glTexImage2D( target, level, components, newImage_width, newImage_height, - 0, format, GL2.GL_UNSIGNED_BYTE, newImage ); + 0, format, GL.GL_UNSIGNED_BYTE, newImage ); } if( newwidth[0] > 1 ) { newwidth[0] /= 2; @@ -951,30 +957,30 @@ public class BuildMipmap { newheight[0] /= 2; } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, ( psm.getUnpackSwapBytes() ? 1 : 0 ) ) ; return( 0 ); } - public static int gluBuild3DMipmapLevelsCore( GL gl, int target, int internalFormat, - int width, int height, int depth, int widthPowerOf2, int heightPowerOf2, - int depthPowerOf2, int format, int type, int userLevel, int baseLevel, - int maxLevel, ByteBuffer data ) { + public static int gluBuild3DMipmapLevelsCore( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int depth, final int widthPowerOf2, final int heightPowerOf2, + final int depthPowerOf2, final int format, final int type, final int userLevel, final int baseLevel, + final int maxLevel, final ByteBuffer data ) { int newWidth; int newHeight; int newDepth; int level, levels; ByteBuffer usersImage; ByteBuffer srcImage, dstImage, tempImage; - int newImageWidth; - int newImageHeight; - int newImageDepth; + final int newImageWidth; + final int newImageHeight; + final int newImageDepth; int memReq; - int maxSize; + final int maxSize; int cmpts; int mark=-1; @@ -982,7 +988,7 @@ public class BuildMipmap { int groupsPerLine, elementSize, groupSize; int rowsPerImage, imageSize; int rowSize, padding; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); assert( Mipmap.checkMipmapArgs( internalFormat, format, type ) == 0 ); assert( width >= 1 && height >= 1 && depth >= 1 ); @@ -1041,11 +1047,11 @@ public class BuildMipmap { psm.getUnpackSkipImages() * imageSize; usersImage.position( mark ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, 0 ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, 0 ); level = userLevel; @@ -1056,13 +1062,13 @@ public class BuildMipmap { 0, format, type, usersImage ); } if( levels == 0 ) { /* we're done. clean up and return */ - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( 0 ); } int nextWidth = newWidth / 2; @@ -1082,44 +1088,44 @@ public class BuildMipmap { memReq = Mipmap.imageSize3D( nextWidth, nextHeight, nextDepth, format, type ); try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + } catch( final OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( GLU.GLU_OUT_OF_MEMORY ); } if( dstImage != null ) { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUByte(), width, height, depth, usersImage, dstImage, elementSize, @@ -1129,7 +1135,7 @@ public class BuildMipmap { dstImage, elementSize, rowSize, groupSize ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSByte(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1139,7 +1145,7 @@ public class BuildMipmap { dstImage, elementSize, rowSize, groupSize ); } break; - case( GL2.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUShort(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1149,7 +1155,7 @@ public class BuildMipmap { dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_SHORT ): + case( GL.GL_SHORT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSShort(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1159,7 +1165,7 @@ public class BuildMipmap { dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUInt(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1169,7 +1175,7 @@ public class BuildMipmap { dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_INT ): + case( GL2ES2.GL_INT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSInt(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1179,7 +1185,7 @@ public class BuildMipmap { dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_FLOAT ): + case( GL.GL_FLOAT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractFloat(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1189,53 +1195,53 @@ public class BuildMipmap { dstImage.asFloatBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel3D( 3, new Extract332(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - assert( format == GL2.GL_RGB ); + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + assert( format == GL.GL_RGB ); HalveImage.halveImagePackedPixel3D( 3, new Extract233rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): HalveImage.halveImagePackedPixel3D( 3, new Extract565(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): HalveImage.halveImagePackedPixel3D( 3, new Extract565rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): HalveImage.halveImagePackedPixel3D( 4, new Extract4444(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract4444rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): HalveImage.halveImagePackedPixel3D( 4, new Extract5551(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract1555rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): HalveImage.halveImagePackedPixel3D( 4, new Extract8888(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract8888rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): HalveImage.halveImagePackedPixel3D( 4, new Extract1010102(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract2101010rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; @@ -1268,38 +1274,38 @@ public class BuildMipmap { dstImage = tempImage; try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + } catch( final OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( GLU.GLU_OUT_OF_MEMORY ); } @@ -1309,38 +1315,38 @@ public class BuildMipmap { memReq = Mipmap.imageSize3D( newWidth, newHeight, newDepth, format, type ); try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + } catch( final OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( GLU.GLU_OUT_OF_MEMORY ); } @@ -1371,38 +1377,38 @@ public class BuildMipmap { memReq = Mipmap.imageSize3D( nextWidth, nextHeight, nextDepth, format, type ); try { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): - case( GL2.GL_BYTE ): - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_INT ): - case( GL2.GL_FLOAT ): - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_FLOAT ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): dstImage = Buffers.newDirectByteBuffer( memReq ); break; default: return( GLU.GLU_INVALID_ENUM ); } - } catch( OutOfMemoryError err ) { - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + } catch( final OutOfMemoryError err ) { + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( GLU.GLU_OUT_OF_MEMORY ); } } @@ -1410,7 +1416,7 @@ public class BuildMipmap { level = userLevel; } - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, GL2.GL_FALSE ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, GL.GL_FALSE ); if( baseLevel <= level && level <= maxLevel ) { usersImage.position( mark ); gl.getGL2().glTexImage3D( target, level, internalFormat, width, height, depth, @@ -1419,7 +1425,7 @@ public class BuildMipmap { level++; for( ; level <= levels; level++ ) { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUByte(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1429,7 +1435,7 @@ public class BuildMipmap { dstImage, elementSize, rowSize, groupSize ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSByte(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1439,7 +1445,7 @@ public class BuildMipmap { dstImage, elementSize, rowSize, groupSize ); } break; - case( GL2.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUShort(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1449,7 +1455,7 @@ public class BuildMipmap { dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_SHORT ): + case( GL.GL_SHORT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSShort(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1459,7 +1465,7 @@ public class BuildMipmap { dstImage.asShortBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_UNSIGNED_INT ): + case( GL.GL_UNSIGNED_INT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractUInt(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1469,7 +1475,7 @@ public class BuildMipmap { dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_INT ): + case( GL2ES2.GL_INT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractSInt(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1479,7 +1485,7 @@ public class BuildMipmap { dstImage.asIntBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_FLOAT ): + case( GL.GL_FLOAT ): if( depth > 1 ) { HalveImage.halveImage3D( cmpts, new ExtractFloat(), width, height, depth, usersImage, dstImage, elementSize, groupSize, rowSize, @@ -1489,51 +1495,51 @@ public class BuildMipmap { dstImage.asFloatBuffer(), elementSize, rowSize, groupSize, myswapBytes ); } break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): HalveImage.halveImagePackedPixel3D( 3, new Extract332(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): HalveImage.halveImagePackedPixel3D( 3, new Extract233rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): HalveImage.halveImagePackedPixel3D( 3, new Extract565(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): HalveImage.halveImagePackedPixel3D( 3, new Extract565rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): HalveImage.halveImagePackedPixel3D( 4, new Extract4444(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract4444rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): HalveImage.halveImagePackedPixel3D( 4, new Extract5551(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract1555rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): HalveImage.halveImagePackedPixel3D( 4, new Extract8888(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract8888rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): HalveImage.halveImagePackedPixel3D( 4, new Extract1010102(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): HalveImage.halveImagePackedPixel3D( 4, new Extract2101010rev(), width, height, depth, usersImage, dstImage, elementSize, rowSize, imageSize, myswapBytes ); break; @@ -1563,22 +1569,22 @@ public class BuildMipmap { 0, format, type, usersImage ); } } - gl.glPixelStorei( GL2.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); - gl.glPixelStorei( GL2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); - gl.glPixelStorei( GL2.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); - gl.glPixelStorei( GL2.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); - gl.glPixelStorei( GL2.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); + gl.glPixelStorei( GL.GL_UNPACK_ALIGNMENT, psm.getUnpackAlignment() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_ROWS, psm.getUnpackSkipRows() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_SKIP_PIXELS, psm.getUnpackSkipPixels() ); + gl.glPixelStorei( GL2ES2.GL_UNPACK_ROW_LENGTH, psm.getUnpackRowLength() ); + gl.glPixelStorei( GL2GL3.GL_UNPACK_SWAP_BYTES, psm.getUnpackSwapBytes() ? 1 : 0 ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_SKIP_IMAGES, psm.getUnpackSkipImages() ); + gl.glPixelStorei( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, psm.getUnpackImageHeight() ); return( 0 ); } private static final int TARGA_HEADER_SIZE = 18; - private static void writeTargaFile(String filename, ByteBuffer data, - int width, int height) { + private static void writeTargaFile(final String filename, final ByteBuffer data, + final int width, final int height) { try { - FileOutputStream fos = new FileOutputStream(new File(filename)); - ByteBuffer header = ByteBuffer.allocateDirect(TARGA_HEADER_SIZE); + final FileOutputStream fos = new FileOutputStream(new File(filename)); + final ByteBuffer header = ByteBuffer.allocateDirect(TARGA_HEADER_SIZE); header.put(0, (byte) 0).put(1, (byte) 0); header.put(2, (byte) 2); // uncompressed type header.put(12, (byte) (width & 0xFF)); // width @@ -1590,7 +1596,7 @@ public class BuildMipmap { fos.write(data.array()); data.clear(); fos.close(); - } catch (IOException e) { + } catch (final IOException e) { e.printStackTrace(); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java index 0c155ff96..fe9c15e60 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1010102.java @@ -57,7 +57,7 @@ public class Extract1010102 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { long uint = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract1010102 implements Extract { // 00000000,00000000,00001111,11111100 == 0x00000FFC // 00000000,00000000,00000000,00000011 == 0x00000003 - extractComponents[0] = (float)( ( uint & 0xFFC00000 ) >> 22 ) / 1023.0f; - extractComponents[1] = (float)( ( uint & 0x003FF000 ) >> 12 ) / 1023.0f; - extractComponents[2] = (float)( ( uint & 0x00000FFC ) >> 2 ) / 1023.0f; - extractComponents[3] = (float)( ( uint & 0x00000003 ) ) / 3.0f; + extractComponents[0] = ( ( uint & 0xFFC00000 ) >> 22 ) / 1023.0f; + extractComponents[1] = ( ( uint & 0x003FF000 ) >> 12 ) / 1023.0f; + extractComponents[2] = ( ( uint & 0x00000FFC ) >> 2 ) / 1023.0f; + extractComponents[3] = ( ( uint & 0x00000003 ) ) / 3.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java index 5208ea537..d619502be 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract1555rev.java @@ -57,7 +57,7 @@ public class Extract1555rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract1555rev implements Extract { // 01111100,00000000 == 0x7C00 // 10000000,00000000 == 0x8000 - extractComponents[0] = (float)( ( ushort & 0x001F ) ) / 31.0f; - extractComponents[1] = (float)( ( ushort & 0x003E ) >> 5 ) / 31.0f; - extractComponents[2] = (float)( ( ushort & 0x7C00 ) >> 10) / 31.0f; - extractComponents[3] = (float)( ( ushort & 0x8000 ) >> 15); + extractComponents[0] = ( ( ushort & 0x001F ) ) / 31.0f; + extractComponents[1] = ( ( ushort & 0x003E ) >> 5 ) / 31.0f; + extractComponents[2] = ( ( ushort & 0x7C00 ) >> 10) / 31.0f; + extractComponents[3] = ( ushort & 0x8000 ) >> 15; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 00000000,00011111 == 0x001F // 00000011,11100000 == 0x03E0 // 01111100,00000000 == 0x7C00 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java index 1bf8abcc3..9d00badcb 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract2101010rev.java @@ -57,7 +57,7 @@ public class Extract2101010rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { long uint = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract2101010rev implements Extract { // 00000000,00000000,00001111,11111100 == 0x00000FFC // 00000000,00000000,00000000,00000011 == 0x00000003 - extractComponents[0] = (float)( ( uint & 0x000003FF ) ) / 1023.0f; - extractComponents[1] = (float)( ( uint & 0x000FFC00 ) >> 10 ) / 1023.0f; - extractComponents[2] = (float)( ( uint & 0x3FF00000 ) >> 20 ) / 1023.0f; - extractComponents[3] = (float)( ( uint & 0xC0000000 ) >> 30 ) / 3.0f; + extractComponents[0] = ( ( uint & 0x000003FF ) ) / 1023.0f; + extractComponents[1] = ( ( uint & 0x000FFC00 ) >> 10 ) / 1023.0f; + extractComponents[2] = ( ( uint & 0x3FF00000 ) >> 20 ) / 1023.0f; + extractComponents[3] = ( ( uint & 0xC0000000 ) >> 30 ) / 3.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java index c86b39e63..3bc797518 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract233rev.java @@ -57,18 +57,18 @@ public class Extract233rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { // 11100000 == 0xe0 // 00011100 == 0x1c // 00000011 == 0x03 - byte ubyte = packedPixel.get(); - extractComponents[0] = (float)((ubyte & 0x07) ) / 7.0f; - extractComponents[1] = (float)((ubyte & 0x38) >> 3) / 7.0f; - extractComponents[2] = (float)((ubyte & 0xC0) >> 6) / 3.0f; + final byte ubyte = packedPixel.get(); + extractComponents[0] = ((ubyte & 0x07) ) / 7.0f; + extractComponents[1] = ((ubyte & 0x38) >> 3) / 7.0f; + extractComponents[2] = ((ubyte & 0xC0) >> 6) / 3.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11100000 == 0xE0 // 00011100 == 0x1C // 00000011 == 0x03 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java index 706f0c3f2..93983f1d7 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract332.java @@ -57,18 +57,18 @@ public class Extract332 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { // 11100000 == 0xe0 // 00011100 == 0x1c // 00000011 == 0x03 - byte ubyte = packedPixel.get(); - extractComponents[0] = (float)((ubyte & 0xe0) >> 5) / 7.0f; - extractComponents[1] = (float)((ubyte & 0x1c) >> 2) / 7.0f; - extractComponents[2] = (float)((ubyte & 0x03)) / 3.0f; + final byte ubyte = packedPixel.get(); + extractComponents[0] = ((ubyte & 0xe0) >> 5) / 7.0f; + extractComponents[1] = ((ubyte & 0x1c) >> 2) / 7.0f; + extractComponents[2] = ((ubyte & 0x03)) / 3.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11100000 == 0xE0 // 00011100 == 0x1C // 00000011 == 0x03 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java index 182d66ce2..323ca7f1a 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444.java @@ -57,7 +57,7 @@ public class Extract4444 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract4444 implements Extract { // 00000000,11110000 == 0x00F0 // 00000000,00001111 == 0x000F - extractComponents[0] = (float)( ( ushort & 0xF000 ) >> 12 ) / 15.0f; - extractComponents[1] = (float)( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; - extractComponents[2] = (float)( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; - extractComponents[3] = (float)( ( ushort & 0x000F ) ) / 15.0f; + extractComponents[0] = ( ( ushort & 0xF000 ) >> 12 ) / 15.0f; + extractComponents[1] = ( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; + extractComponents[2] = ( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; + extractComponents[3] = ( ( ushort & 0x000F ) ) / 15.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java index 52ecdc17c..267286519 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract4444rev.java @@ -57,7 +57,7 @@ public class Extract4444rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract4444rev implements Extract { // 00001111,00000000 == 0x0F00 // 11110000,00000000 == 0xF000 - extractComponents[0] = (float)( ( ushort & 0x000F ) ) / 15.0f; - extractComponents[1] = (float)( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; - extractComponents[2] = (float)( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; - extractComponents[3] = (float)( ( ushort & 0xF000 ) >> 12 ) / 15.0f; + extractComponents[0] = ( ( ushort & 0x000F ) ) / 15.0f; + extractComponents[1] = ( ( ushort & 0x00F0 ) >> 4 ) / 15.0f; + extractComponents[2] = ( ( ushort & 0x0F00 ) >> 8 ) / 15.0f; + extractComponents[3] = ( ( ushort & 0xF000 ) >> 12 ) / 15.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java index 21f53aa1d..ee33ca7c1 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract5551.java @@ -57,7 +57,7 @@ public class Extract5551 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract5551 implements Extract { // 00000000,00111110 == 0x003E // 00000000,00000001 == 0x0001 - extractComponents[0] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; - extractComponents[1] = (float)( ( ushort & 0x00F0 ) >> 6 ) / 31.0f; - extractComponents[2] = (float)( ( ushort & 0x0F00 ) >> 1 ) / 31.0f; - extractComponents[3] = (float)( ( ushort & 0xF000 ) ); + extractComponents[0] = ( ( ushort & 0xF800 ) >> 11 ) / 31.0f; + extractComponents[1] = ( ( ushort & 0x00F0 ) >> 6 ) / 31.0f; + extractComponents[2] = ( ( ushort & 0x0F00 ) >> 1 ) / 31.0f; + extractComponents[3] = ( ( ushort & 0xF000 ) ); } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java index 7408c45b2..d63943a2e 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565.java @@ -57,7 +57,7 @@ public class Extract565 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -70,13 +70,13 @@ public class Extract565 implements Extract { // 00000111,11100000 == 0x07E0 // 00000000,00111111 == 0x001F - extractComponents[0] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; - extractComponents[1] = (float)( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; - extractComponents[2] = (float)( ( ushort & 0x001F ) ) / 31.0f; + extractComponents[0] = ( ( ushort & 0xF800 ) >> 11 ) / 31.0f; + extractComponents[1] = ( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; + extractComponents[2] = ( ( ushort & 0x001F ) ) / 31.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11111000,00000000 == 0xF800 // 00000111,11100000 == 0x07E0 // 00000000,00111111 == 0x001F diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java index adaafa7ea..cfea71487 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract565rev.java @@ -57,7 +57,7 @@ public class Extract565rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { int ushort = 0; if( isSwap ) { @@ -70,13 +70,13 @@ public class Extract565rev implements Extract { // 00000111,11100000 == 0x07E0 // 11111000,00000000 == 0xF800 - extractComponents[0] = (float)( ( ushort & 0x001F ) ) / 31.0f; - extractComponents[1] = (float)( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; - extractComponents[2] = (float)( ( ushort & 0xF800 ) >> 11 ) / 31.0f; + extractComponents[0] = ( ( ushort & 0x001F ) ) / 31.0f; + extractComponents[1] = ( ( ushort & 0x07E0 ) >> 5 ) / 63.0f; + extractComponents[2] = ( ( ushort & 0xF800 ) >> 11 ) / 31.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 00000000,00111111 == 0x001F // 00000111,11100000 == 0x07E0 // 11111000,00000000 == 0xF800 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java index be155d578..f6fe92c82 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888.java @@ -57,7 +57,7 @@ public class Extract8888 implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { long uint = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract8888 implements Extract { // 00000000,00111110 == 0x003E // 00000000,00000001 == 0x0001 - extractComponents[0] = (float)( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; - extractComponents[1] = (float)( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; - extractComponents[2] = (float)( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; - extractComponents[3] = (float)( ( uint & 0x000000FF ) ) / 255.0f; + extractComponents[0] = ( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; + extractComponents[1] = ( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; + extractComponents[2] = ( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; + extractComponents[3] = ( ( uint & 0x000000FF ) ) / 255.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java index 294e60e12..942f6d88a 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Extract8888rev.java @@ -57,7 +57,7 @@ public class Extract8888rev implements Extract { } @Override - public void extract( boolean isSwap, ByteBuffer packedPixel, float[] extractComponents ) { + public void extract( final boolean isSwap, final ByteBuffer packedPixel, final float[] extractComponents ) { long uint = 0; if( isSwap ) { @@ -71,14 +71,14 @@ public class Extract8888rev implements Extract { // 00000000,00111110 == 0x003E // 00000000,00000001 == 0x0001 - extractComponents[0] = (float)( ( uint & 0x000000FF ) ) / 255.0f; - extractComponents[1] = (float)( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; - extractComponents[2] = (float)( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; - extractComponents[3] = (float)( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; + extractComponents[0] = ( ( uint & 0x000000FF ) ) / 255.0f; + extractComponents[1] = ( ( uint & 0x0000FF00 ) >> 8 ) / 255.0f; + extractComponents[2] = ( ( uint & 0x00FF0000 ) >> 16 ) / 255.0f; + extractComponents[3] = ( ( uint & 0xFF000000 ) >> 24 ) / 255.0f; } @Override - public void shove( float[] shoveComponents, int index, ByteBuffer packedPixel ) { + public void shove( final float[] shoveComponents, final int index, final ByteBuffer packedPixel ) { // 11110000,00000000 == 0xF000 // 00001111,00000000 == 0x0F00 // 00000000,11110000 == 0x00F0 diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java index 1dd8bff8a..09d70e492 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractFloat.java @@ -57,7 +57,7 @@ public class ExtractFloat implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer data ) { + public double extract( final boolean isSwap, final ByteBuffer data ) { float f = 0; if( isSwap ) { f = Mipmap.GLU_SWAP_4_BYTES( data.getInt() ); @@ -69,7 +69,7 @@ public class ExtractFloat implements ExtractPrimitive { } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < 1.0); data.asFloatBuffer().put( index, (float)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java index dcbe52a40..e9b021413 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSByte.java @@ -57,14 +57,14 @@ public class ExtractSByte implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer sbyte ) { - byte b = sbyte.get(); + public double extract( final boolean isSwap, final ByteBuffer sbyte ) { + final byte b = sbyte.get(); assert( b <= 127 ); return( b ); } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { data.position( index ); data.put( (byte)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java index 547bd944a..9532fdade 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSInt.java @@ -57,7 +57,7 @@ public class ExtractSInt implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer uint ) { + public double extract( final boolean isSwap, final ByteBuffer uint ) { int i = 0; if( isSwap ) { i = Mipmap.GLU_SWAP_4_BYTES( uint.getInt() ); @@ -69,9 +69,9 @@ public class ExtractSInt implements ExtractPrimitive { } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < Integer.MAX_VALUE); - IntBuffer ib = data.asIntBuffer(); + final IntBuffer ib = data.asIntBuffer(); ib.position( index ); ib.put( (int)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java index 7dc172976..6e14f89c0 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractSShort.java @@ -57,7 +57,7 @@ public class ExtractSShort implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer ushort ) { + public double extract( final boolean isSwap, final ByteBuffer ushort ) { short s = 0; if( isSwap ) { s = Mipmap.GLU_SWAP_2_BYTES( ushort.getShort() ); @@ -69,9 +69,9 @@ public class ExtractSShort implements ExtractPrimitive { } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < 32768.0); - ShortBuffer sb = data.asShortBuffer(); + final ShortBuffer sb = data.asShortBuffer(); sb.position( index ); sb.put( (short)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java index 3e933811c..d9db0019b 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUByte.java @@ -57,14 +57,14 @@ public class ExtractUByte implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer ubyte ) { - int i = 0x000000FF & ubyte.get(); + public double extract( final boolean isSwap, final ByteBuffer ubyte ) { + final int i = 0x000000FF & ubyte.get(); assert( i <= 255 ); return( i ); } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < 256.0); data.position( index ); data.put( (byte)value ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java index 1c34828b3..3e4ad41c2 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUInt.java @@ -57,7 +57,7 @@ public class ExtractUInt implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer uint ) { + public double extract( final boolean isSwap, final ByteBuffer uint ) { long i = 0; if( isSwap ) { i = 0xFFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( uint.getInt() ); @@ -69,9 +69,9 @@ public class ExtractUInt implements ExtractPrimitive { } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < 0xFFFFFFFF); - IntBuffer ib = data.asIntBuffer(); + final IntBuffer ib = data.asIntBuffer(); ib.position( index ); ib.put( (int)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java index 8e0d25c42..b121c1054 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ExtractUShort.java @@ -57,7 +57,7 @@ public class ExtractUShort implements ExtractPrimitive { } @Override - public double extract( boolean isSwap, ByteBuffer ushort ) { + public double extract( final boolean isSwap, final ByteBuffer ushort ) { int i = 0; if( isSwap ) { i = 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( ushort.getShort() ); @@ -69,9 +69,9 @@ public class ExtractUShort implements ExtractPrimitive { } @Override - public void shove( double value, int index, ByteBuffer data ) { + public void shove( final double value, final int index, final ByteBuffer data ) { assert(0.0 <= value && value < 65536.0); - ShortBuffer sb = data.asShortBuffer(); + final ShortBuffer sb = data.asShortBuffer(); sb.position( index ); sb.put( (short)value ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java index 184c5fda8..100c6ba1f 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/HalveImage.java @@ -57,8 +57,8 @@ public class HalveImage { private static final int BOX4 = 4; private static final int BOX8 = 8; - public static void halveImage( int components, int width, int height, - ShortBuffer datain, ShortBuffer dataout ) { + public static void halveImage( final int components, final int width, final int height, + final ShortBuffer datain, final ShortBuffer dataout ) { int i, j, k; int newwidth, newheight; int delta; @@ -92,9 +92,9 @@ public class HalveImage { } } - public static void halveImage_ubyte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, - int element_size, int ysize, int group_size ) { + public static void halveImage_ubyte( final int components, final int width, final int height, + final ByteBuffer datain, final ByteBuffer dataout, + final int element_size, final int ysize, final int group_size ) { int i, j, k; int newwidth, newheight; int s; @@ -134,9 +134,9 @@ public class HalveImage { } } - public static void halve1Dimage_ubyte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, - int element_size, int ysize, int group_size ) { + public static void halve1Dimage_ubyte( final int components, final int width, final int height, + final ByteBuffer datain, final ByteBuffer dataout, + final int element_size, final int ysize, final int group_size ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -170,10 +170,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); halfWidth = 1; // one vertical column with possible pad bytes per row @@ -203,12 +203,12 @@ public class HalveImage { assert( dest == components * element_size * halfWidth * halfHeight ); } - public static void halveImage_byte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, int element_size, - int ysize, int group_size ) { + public static void halveImage_byte( final int components, final int width, final int height, + final ByteBuffer datain, final ByteBuffer dataout, final int element_size, + final int ysize, final int group_size ) { int i, j, k; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; byte temp = (byte)0; @@ -245,9 +245,9 @@ public class HalveImage { } } - public static void halve1Dimage_byte( int components, int width, int height, - ByteBuffer datain, ByteBuffer dataout, - int element_size, int ysize, int group_size ) { + public static void halve1Dimage_byte( final int components, final int width, final int height, + final ByteBuffer datain, final ByteBuffer dataout, + final int element_size, final int ysize, final int group_size ) { int halfWidth = width / 2; int halfHeight = width / 2; int src = 0; @@ -276,10 +276,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assert only } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); // widthxheight can't be 1 halfWidth = 1; // one vertical column with possible pad bytes per row @@ -304,12 +304,13 @@ public class HalveImage { assert( dest == components * element_size * halfWidth * halfHeight ); } - public static void halveImage_ushort( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_ushort( final int components, final int width, final int height, + final ByteBuffer datain, final ShortBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; int temp = 0; // handle case where there is only 1 column/row @@ -365,9 +366,9 @@ public class HalveImage { } } - public static void halve1Dimage_ushort( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_ushort( final int components, final int width, final int height, + final ByteBuffer datain, final ShortBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -384,7 +385,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < halfHeight; kk++ ) { - int[] ushort = new int[BOX2]; + final int[] ushort = new int[BOX2]; if( myswap_bytes ) { datain.position( src ); ushort[0] = ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); @@ -402,10 +403,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); // widthxheight can't be 1 halfWidth = 1; // one vertical column with possible pad bytes per row @@ -414,7 +415,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - int[] ushort = new int[BOX2]; + final int[] ushort = new int[BOX2]; if( myswap_bytes ) { datain.position( src ); ushort[0] = ( 0x0000FFFF & Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ) ); @@ -438,12 +439,13 @@ public class HalveImage { assert( dest == components * element_size * halfWidth * halfHeight ); } - public static void halveImage_short( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_short( final int components, final int width, final int height, + final ByteBuffer datain, final ShortBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; short temp = (short)0; // handle case where there is only 1 column/row @@ -472,7 +474,7 @@ public class HalveImage { temp += datain.getShort(); temp += 2; temp /= 4; - dataout.put( (short)temp ); + dataout.put( temp ); t += element_size; } t += group_size; @@ -483,8 +485,8 @@ public class HalveImage { for( i = 0; i < newheight; i++ ) { for( j = 0; j < newwidth; j++ ) { for( k = 0; k < components; k++ ) { - short b; - int buf; + final short b; + final int buf; datain.position( t ); temp = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); datain.position( t + group_size ); @@ -505,9 +507,9 @@ public class HalveImage { } } - public static void halve1Dimage_short( int components, int width, int height, - ByteBuffer datain, ShortBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_short( final int components, final int width, final int height, + final ByteBuffer datain, final ShortBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -524,7 +526,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - short[] sshort = new short[BOX2]; + final short[] sshort = new short[BOX2]; if( myswap_bytes ) { datain.position( src ); sshort[0] = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); @@ -542,10 +544,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); halfWidth = 1; // one vertical column with possible pad bytes per row @@ -554,7 +556,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - short[] sshort = new short[BOX2]; + final short[] sshort = new short[BOX2]; if( myswap_bytes ) { datain.position( src ); sshort[0] = Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ); @@ -578,12 +580,13 @@ public class HalveImage { assert( dest == ( components * element_size * halfWidth * halfHeight ) ); } - public static void halveImage_uint( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_uint( final int components, final int width, final int height, + final ByteBuffer datain, final IntBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; double temp = 0; @@ -644,9 +647,9 @@ public class HalveImage { } } - public static void halve1Dimage_uint( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_uint( final int components, final int width, final int height, + final ByteBuffer datain, final IntBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -663,7 +666,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < halfHeight; kk++ ) { - long[] uint = new long[BOX2]; + final long[] uint = new long[BOX2]; if( myswap_bytes ) { datain.position( src ); uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); @@ -681,10 +684,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { // 1 column - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); // widthxheight can't be 1 halfWidth = 1; // one vertical column with possible pad bytes per row @@ -693,7 +696,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - long[] uint = new long[BOX2]; + final long[] uint = new long[BOX2]; if( myswap_bytes ) { datain.position( src ); uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); @@ -717,12 +720,13 @@ public class HalveImage { assert( dest == components * element_size * halfWidth * halfHeight ); } - public static void halveImage_int( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_int( final int components, final int width, final int height, + final ByteBuffer datain, final IntBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; int temp = 0; @@ -786,9 +790,9 @@ public class HalveImage { } } - public static void halve1Dimage_int( int components, int width, int height, - ByteBuffer datain, IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_int( final int components, final int width, final int height, + final ByteBuffer datain, final IntBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -805,7 +809,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - long[] uint = new long[BOX2]; + final long[] uint = new long[BOX2]; if( myswap_bytes ) { datain.position( src ); uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); @@ -823,10 +827,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); halfWidth = 1; // one vertical column with possible pad bytes per row @@ -835,7 +839,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - long[] uint = new long[BOX2]; + final long[] uint = new long[BOX2]; if( myswap_bytes ) { datain.position( src ); uint[0] = ( 0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt() ) ); @@ -859,12 +863,13 @@ public class HalveImage { assert( dest == ( components * element_size * halfWidth * halfHeight ) ); } - public static void halveImage_float( int components, int width, int height, - ByteBuffer datain, FloatBuffer dataout, int element_size, - int ysize, int group_size, boolean myswap_bytes ) { - int i, j, k, l; + public static void halveImage_float( final int components, final int width, final int height, + final ByteBuffer datain, final FloatBuffer dataout, final int element_size, + final int ysize, final int group_size, final boolean myswap_bytes ) { + int i, j, k; + final int l; int newwidth, newheight; - int s = 0; + final int s = 0; int t = 0; float temp = 0.0f; // handle case where there is only 1 column/row @@ -921,9 +926,9 @@ public class HalveImage { } } - public static void halve1Dimage_float( int components, int width, int height, - ByteBuffer datain, FloatBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { + public static void halve1Dimage_float( final int components, final int width, final int height, + final ByteBuffer datain, final FloatBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -940,7 +945,7 @@ public class HalveImage { for( jj = 0; jj < halfWidth; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - float[] sfloat = new float[BOX2]; + final float[] sfloat = new float[BOX2]; if( myswap_bytes ) { datain.position( src ); sfloat[0] = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); @@ -958,10 +963,10 @@ public class HalveImage { } src += group_size; // skip to next 2 } - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); src += padBytes; // for assertion only } else if( width == 1 ) { - int padBytes = ysize - ( width * group_size ); + final int padBytes = ysize - ( width * group_size ); assert( height != 1 ); halfWidth = 1; // one vertical column with possible pad bytes per row @@ -970,7 +975,7 @@ public class HalveImage { for( jj = 0; jj < halfHeight; jj++ ) { int kk; for( kk = 0; kk < components; kk++ ) { - float[] sfloat = new float[BOX2]; + final float[] sfloat = new float[BOX2]; if( myswap_bytes ) { datain.position( src ); sfloat[0] = Mipmap.GLU_SWAP_4_BYTES( datain.getFloat() ); @@ -994,9 +999,9 @@ public class HalveImage { assert( dest == ( components * element_size * halfWidth * halfHeight ) ); } - public static void halveImagePackedPixel( int components, Extract extract, int width, - int height, ByteBuffer datain, ByteBuffer dataout, - int pixelSizeInBytes, int rowSizeInBytes, boolean isSwap ) { + public static void halveImagePackedPixel( final int components, final Extract extract, final int width, + final int height, final ByteBuffer datain, final ByteBuffer dataout, + final int pixelSizeInBytes, final int rowSizeInBytes, final boolean isSwap ) { if( width == 1 || height == 1 ) { assert( !( width == 1 && height == 1 ) ); halve1DimagePackedPixel( components, extract, width, height, datain, dataout, @@ -1005,16 +1010,16 @@ public class HalveImage { } int ii, jj; - int halfWidth = width / 2; - int halfHeight = height / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); int outIndex = 0; for( ii = 0; ii < halfHeight; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX4][4]; + final float totals[] = new float[4]; + final float extractTotals[][] = new float[BOX4][4]; int cc; datain.position( src ); @@ -1046,9 +1051,9 @@ public class HalveImage { assert( outIndex == halfWidth * halfHeight ); } - public static void halve1DimagePackedPixel( int components, Extract extract, int width, - int height, ByteBuffer datain, ByteBuffer dataout, - int pixelSizeInBytes, int rowSizeInBytes, boolean isSwap ) { + public static void halve1DimagePackedPixel( final int components, final Extract extract, final int width, + final int height, final ByteBuffer datain, final ByteBuffer dataout, + final int pixelSizeInBytes, final int rowSizeInBytes, final boolean isSwap ) { int halfWidth = width / 2; int halfHeight = height / 2; int src = 0; @@ -1066,8 +1071,8 @@ public class HalveImage { // one horizontal row with possible pad bytes for( jj = 0; jj < halfWidth; jj++ ) { - float[] totals = new float[4]; - float[][] extractTotals = new float[BOX2][4]; + final float[] totals = new float[4]; + final float[][] extractTotals = new float[BOX2][4]; int cc; datain.position( src ); @@ -1088,7 +1093,7 @@ public class HalveImage { // skip over to next group of 2 src += pixelSizeInBytes + pixelSizeInBytes; } - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); src += padBytes; assert( src == rowSizeInBytes ); @@ -1102,8 +1107,8 @@ public class HalveImage { // average two at a time for( jj = 0; jj < halfHeight; jj++ ) { - float[] totals = new float[4]; - float[][] extractTotals = new float[BOX2][4]; + final float[] totals = new float[4]; + final float[][] extractTotals = new float[BOX2][4]; int cc; // average two at a time, instead of four datain.position( src ); @@ -1129,16 +1134,16 @@ public class HalveImage { } } - public static void halveImagePackedPixelSlice( int components, Extract extract, - int width, int height, int depth, ByteBuffer dataIn, - ByteBuffer dataOut, int pixelSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { + public static void halveImagePackedPixelSlice( final int components, final Extract extract, + final int width, final int height, final int depth, final ByteBuffer dataIn, + final ByteBuffer dataOut, final int pixelSizeInBytes, final int rowSizeInBytes, + final int imageSizeInBytes, final boolean isSwap ) { int ii, jj; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; + final int halfDepth = depth / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); int outIndex = 0; assert( (width == 1 || height == 1) && depth >= 2 ); @@ -1148,8 +1153,8 @@ public class HalveImage { assert( depth >= 2 ); for( ii = 0; ii < halfDepth; ii++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX2][4]; + final float totals[] = new float[4]; + final float extractTotals[][] = new float[BOX2][4]; int cc; dataIn.position( src ); @@ -1178,8 +1183,8 @@ public class HalveImage { for( ii = 0; ii < halfDepth; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX4][4]; + final float totals[] = new float[4]; + final float extractTotals[][] = new float[BOX4][4]; int cc; dataIn.position( src ); @@ -1199,7 +1204,7 @@ public class HalveImage { for( kk = 0; kk < BOX4; kk++ ) { totals[cc]+= extractTotals[kk][cc]; } - totals[cc]/= (float)BOX4; + totals[cc]/= BOX4; } extract.shove( totals, outIndex, dataOut ); outIndex++; @@ -1212,8 +1217,8 @@ public class HalveImage { for( ii = 0; ii < halfDepth; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; - float extractTotals[][] = new float[BOX4][4]; + final float totals[] = new float[4]; + final float extractTotals[][] = new float[BOX4][4]; int cc; dataIn.position( src ); @@ -1233,7 +1238,7 @@ public class HalveImage { for( kk = 0; kk < BOX4; kk++ ) { totals[cc]+= extractTotals[kk][cc]; } - totals[cc]/= (float)BOX4; + totals[cc]/= BOX4; } extract.shove( totals, outIndex, dataOut ); outIndex++; @@ -1244,16 +1249,16 @@ public class HalveImage { } } - public static void halveImageSlice( int components, ExtractPrimitive extract, int width, - int height, int depth, ByteBuffer dataIn, ByteBuffer dataOut, - int elementSizeInBytes, int groupSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { + public static void halveImageSlice( final int components, final ExtractPrimitive extract, final int width, + final int height, final int depth, final ByteBuffer dataIn, final ByteBuffer dataOut, + final int elementSizeInBytes, final int groupSizeInBytes, final int rowSizeInBytes, + final int imageSizeInBytes, final boolean isSwap ) { int ii, jj; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; + final int halfDepth = depth / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); int outIndex = 0; assert( (width == 1 || height == 1) && depth >= 2 ); @@ -1265,8 +1270,8 @@ public class HalveImage { for( ii = 0; ii < halfDepth; ii++ ) { int cc; for( cc = 0; cc < components; cc++ ) { - double[] totals = new double[4]; - double[][] extractTotals = new double[BOX2][4]; + final double[] totals = new double[4]; + final double[][] extractTotals = new double[BOX2][4]; int kk; dataIn.position( src ); @@ -1281,7 +1286,7 @@ public class HalveImage { for( kk = 0; kk < BOX2; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (double)BOX2; + totals[cc] /= BOX2; extract.shove( totals[cc], outIndex, dataOut ); outIndex++; @@ -1301,8 +1306,8 @@ public class HalveImage { int cc; for( cc = 0; cc < components; cc++ ) { int kk; - double totals[] = new double[4]; - double extractTotals[][] = new double[BOX4][4]; + final double totals[] = new double[4]; + final double extractTotals[][] = new double[BOX4][4]; dataIn.position( src ); extractTotals[0][cc] = extract.extract( isSwap, dataIn ); @@ -1321,7 +1326,7 @@ public class HalveImage { for( kk = 0; kk < BOX4; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (double)BOX4; + totals[cc] /= BOX4; extract.shove( totals[cc], outIndex, dataOut ); outIndex++; @@ -1343,8 +1348,8 @@ public class HalveImage { int cc; for( cc = 0; cc < components; cc++ ) { int kk; - double totals[] = new double[4]; - double extractTotals[][] = new double[BOX4][4]; + final double totals[] = new double[4]; + final double extractTotals[][] = new double[BOX4][4]; dataIn.position( src ); extractTotals[0][cc] = extract.extract( isSwap, dataIn ); @@ -1364,7 +1369,7 @@ public class HalveImage { for( kk = 0; kk < BOX4; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (double)BOX4; + totals[cc] /= BOX4; extract.shove( totals[cc], outIndex, dataOut ); outIndex++; @@ -1381,10 +1386,10 @@ public class HalveImage { } } - public static void halveImage3D( int components, ExtractPrimitive extract, - int width, int height, int depth, ByteBuffer dataIn, ByteBuffer dataOut, - int elementSizeInBytes, int groupSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { + public static void halveImage3D( final int components, final ExtractPrimitive extract, + final int width, final int height, final int depth, final ByteBuffer dataIn, final ByteBuffer dataOut, + final int elementSizeInBytes, final int groupSizeInBytes, final int rowSizeInBytes, + final int imageSizeInBytes, final boolean isSwap ) { assert( depth > 1 ); // horizontal/vertical/onecolumn slice viewed from top @@ -1399,11 +1404,11 @@ public class HalveImage { int ii, jj, dd; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; + final int halfDepth = depth / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * groupSizeInBytes ); int outIndex = 0; for( dd = 0; dd < halfDepth; dd++ ) { @@ -1412,8 +1417,8 @@ public class HalveImage { int cc; for( cc = 0; cc < components; cc++ ) { int kk; - double totals[] = new double[4]; - double extractTotals[][] = new double[BOX8][4]; + final double totals[] = new double[4]; + final double extractTotals[][] = new double[BOX8][4]; dataIn.position( src ); extractTotals[0][cc] = extract.extract( isSwap, dataIn ); @@ -1437,7 +1442,7 @@ public class HalveImage { for( kk = 0; kk < BOX8; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (double)BOX8; + totals[cc] /= BOX8; extract.shove( totals[cc], outIndex, dataOut ); outIndex++; @@ -1457,10 +1462,10 @@ public class HalveImage { assert( outIndex == halfWidth * halfHeight * halfDepth * components ); } - public static void halveImagePackedPixel3D( int components, Extract extract, - int width, int height, int depth, ByteBuffer dataIn, - ByteBuffer dataOut, int pixelSizeInBytes, int rowSizeInBytes, - int imageSizeInBytes, boolean isSwap ) { + public static void halveImagePackedPixel3D( final int components, final Extract extract, + final int width, final int height, final int depth, final ByteBuffer dataIn, + final ByteBuffer dataOut, final int pixelSizeInBytes, final int rowSizeInBytes, + final int imageSizeInBytes, final boolean isSwap ) { if( depth == 1 ) { assert( 1 <= width && 1 <= height ); @@ -1476,18 +1481,18 @@ public class HalveImage { } int ii, jj, dd; - int halfWidth = width / 2; - int halfHeight = height / 2; - int halfDepth = depth / 2; + final int halfWidth = width / 2; + final int halfHeight = height / 2; + final int halfDepth = depth / 2; int src = 0; - int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); + final int padBytes = rowSizeInBytes - ( width * pixelSizeInBytes ); int outIndex = 0; for( dd = 0; dd < halfDepth; dd++ ) { for( ii = 0; ii < halfHeight; ii++ ) { for( jj = 0; jj < halfWidth; jj++ ) { - float totals[] = new float[4]; // 4 is max components - float extractTotals[][] = new float[BOX8][4]; + final float totals[] = new float[4]; // 4 is max components + final float extractTotals[][] = new float[BOX8][4]; int cc; dataIn.position( src ); @@ -1514,7 +1519,7 @@ public class HalveImage { for( kk = 0; kk < BOX8; kk++ ) { totals[cc] += extractTotals[kk][cc]; } - totals[cc] /= (float)BOX8; + totals[cc] /= BOX8; } extract.shove( totals, outIndex, dataOut ); outIndex++; diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java index 18f814dde..ef77f3555 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Image.java @@ -46,6 +46,9 @@ package jogamp.opengl.glu.mipmap; import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2GL3; + import java.nio.*; /** @@ -58,14 +61,14 @@ public class Image { public Image() { } - public static short getShortFromByteArray( byte[] array, int index ) { + public static short getShortFromByteArray( final byte[] array, final int index ) { short s; s = (short)(array[index] << 8 ); s |= (short)(0x00FF & array[index+1]); return( s ); } - public static int getIntFromByteArray( byte[] array, int index ) { + public static int getIntFromByteArray( final byte[] array, final int index ) { int i; i = ( array[index] << 24 ) & 0xFF000000; i |= ( array[index+1] << 16 ) & 0x00FF0000; @@ -74,8 +77,8 @@ public class Image { return( i ); } - public static float getFloatFromByteArray( byte[] array, int index ) { - int i = getIntFromByteArray( array, index ); + public static float getFloatFromByteArray( final byte[] array, final int index ) { + final int i = getIntFromByteArray( array, index ); return( Float.intBitsToFloat(i) ); } @@ -83,9 +86,9 @@ public class Image { * Extract array from user's data applying all pixel store modes. * The internal format used is an array of unsigned shorts. */ - public static void fill_image( PixelStorageModes psm, int width, int height, - int format, int type, boolean index_format, ByteBuffer userdata, - ShortBuffer newimage ) { + public static void fill_image( final PixelStorageModes psm, final int width, final int height, + final int format, final int type, final boolean index_format, final ByteBuffer userdata, + final ShortBuffer newimage ) { int components; int element_size; int rowsize; @@ -102,40 +105,40 @@ public class Image { // Create a Extract interface object Extract extract = null; switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): extract = new Extract332(); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): extract = new Extract233rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): extract = new Extract565(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): extract = new Extract565rev(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): extract = new Extract4444(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): extract = new Extract4444rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): extract = new Extract5551(); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): extract = new Extract1555rev(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): extract = new Extract8888(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): extract = new Extract8888rev(); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): extract = new Extract1010102(); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract = new Extract2101010rev(); break; } @@ -214,74 +217,74 @@ public class Image { iter = start; userdata.position( iter ); //*************************************** for( j = 0; j < elements_per_line; j++ ) { - Type_Widget widget = new Type_Widget(); - float[] extractComponents = new float[4]; + final Type_Widget widget = new Type_Widget(); + final float[] extractComponents = new float[4]; userdata.position( iter ); switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): extract.extract( false, userdata /*userdata[iter]*/, extractComponents ); for( k = 0; k < 3; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): extract.extract( false, userdata /*userdata[iter]*/, extractComponents ); for( k = 0; k < 3; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( index_format ) { newimage.put( iter2++, (short)( 0x000000FF & userdata.get() ) );//userdata[iter]; } else { newimage.put( iter2++, (short)( 0x000000FF & userdata.get()/*userdata[iter]*/ * 257 ) ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( index_format ) { newimage.put( iter2++, userdata.get() ); //userdata[iter]; } else { newimage.put( iter2++, (short)(userdata.get()/*userdata[iter]*/ * 516 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): extract.extract( myswap_bytes, userdata/*userdata[iter]*/, extractComponents ); for( k = 0; k < 3; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 3; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)(extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): if( myswap_bytes ) { widget.setUB1( userdata.get() ); widget.setUB0( userdata.get() ); @@ -289,7 +292,7 @@ public class Image { widget.setUB0( userdata.get() ); widget.setUB1( userdata.get() ); } - if( type == GL2.GL_SHORT ) { + if( type == GL.GL_SHORT ) { if( index_format ) { newimage.put( iter2++, widget.getS0() ); } else { @@ -299,33 +302,33 @@ public class Image { newimage.put( iter2++, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract.extract( myswap_bytes, userdata, extractComponents ); for( k = 0; k < 4; k++ ) { newimage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_INT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_FLOAT ): + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): if( myswap_bytes ) { widget.setUB3( userdata.get() ); widget.setUB2( userdata.get() ); @@ -337,13 +340,13 @@ public class Image { widget.setUB2( userdata.get() ); widget.setUB3( userdata.get() ); } - if( type == GL2.GL_FLOAT ) { + if( type == GL.GL_FLOAT ) { if( index_format ) { newimage.put( iter2++, (short)widget.getF() ); } else { newimage.put( iter2++, (short)(widget.getF() * 65535 ) ); } - } else if( type == GL2.GL_UNSIGNED_INT ) { + } else if( type == GL.GL_UNSIGNED_INT ) { if( index_format ) { newimage.put( iter2++, (short)( widget.getUI() ) ); } else { @@ -380,9 +383,9 @@ public class Image { * Theinternal format is an array of unsigned shorts. * empty_image() because it is the opposet of fill_image(). */ - public static void empty_image( PixelStorageModes psm, int width, int height, - int format, int type, boolean index_format, - ShortBuffer oldimage, ByteBuffer userdata ) { + public static void empty_image( final PixelStorageModes psm, final int width, final int height, + final int format, final int type, final boolean index_format, + final ShortBuffer oldimage, final ByteBuffer userdata ) { int components; int element_size; @@ -400,40 +403,40 @@ public class Image { // Create a Extract interface object Extract extract = null; switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): extract = new Extract332(); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): extract = new Extract233rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): extract = new Extract565(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): extract = new Extract565rev(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): extract = new Extract4444(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): extract = new Extract4444rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): extract = new Extract5551(); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): extract = new Extract1555rev(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): extract = new Extract8888(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): extract = new Extract8888rev(); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): extract = new Extract1010102(); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract = new Extract2101010rev(); break; } @@ -499,7 +502,7 @@ public class Image { start += rowsize; } } else { - float shoveComponents[] = new float[4]; + final float shoveComponents[] = new float[4]; element_size = Mipmap.bytes_per_element( type ); group_size = element_size * components; @@ -519,22 +522,22 @@ public class Image { for( i = 0; i < height; i++ ) { iter = start; for( j = 0; j < elements_per_line; j++ ) { - Type_Widget widget = new Type_Widget(); + final Type_Widget widget = new Type_Widget(); switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } extract.shove( shoveComponents, 0, userdata ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; } extract.shove( shoveComponents, 0, userdata ); break; - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( index_format ) { //userdata[iter] = (byte)oldimage[iter2++]; userdata.put( iter, (byte)oldimage.get(iter2++) ); @@ -543,7 +546,7 @@ public class Image { userdata.put( iter, (byte)( oldimage.get(iter2++) ) ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( index_format ) { //userdata[iter] = (byte)oldimage[iter2++]; userdata.put( iter, (byte)oldimage.get(iter2++) ); @@ -552,7 +555,7 @@ public class Image { userdata.put( iter, (byte)( oldimage.get(iter2++) ) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; } @@ -569,7 +572,7 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; } @@ -586,7 +589,7 @@ public class Image { userdata.put( iter, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get(iter2++) / 65535.0f; } @@ -603,7 +606,7 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -620,7 +623,7 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -637,7 +640,7 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -654,9 +657,9 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - if( type == GL2.GL_SHORT ) { + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + if( type == GL.GL_SHORT ) { if( index_format ) { widget.setS0( oldimage.get( iter2++ ) ); } else { @@ -677,7 +680,7 @@ public class Image { userdata.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -695,7 +698,7 @@ public class Image { userdata.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -713,7 +716,7 @@ public class Image { userdata.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -731,7 +734,7 @@ public class Image { userdata.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldimage.get( iter2++ ) / 65535.0f; } @@ -749,16 +752,16 @@ public class Image { userdata.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_INT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_FLOAT ): - if( type == GL2.GL_FLOAT ) { + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): + if( type == GL.GL_FLOAT ) { if( index_format ) { widget.setF( oldimage.get( iter2++ ) ); } else { widget.setF( oldimage.get( iter2++ ) / 65535.0f ); } - } else if( type == GL2.GL_UNSIGNED_INT ) { + } else if( type == GL.GL_UNSIGNED_INT ) { if( index_format ) { widget.setUI( oldimage.get( iter2++ ) ); } else { @@ -800,9 +803,9 @@ public class Image { } } - public static void fillImage3D( PixelStorageModes psm, int width, int height, - int depth, int format, int type, boolean indexFormat, ByteBuffer userImage, - ShortBuffer newImage ) { + public static void fillImage3D( final PixelStorageModes psm, final int width, final int height, + final int depth, final int format, final int type, final boolean indexFormat, final ByteBuffer userImage, + final ShortBuffer newImage ) { boolean myswapBytes; int components; int groupsPerLine; @@ -817,46 +820,46 @@ public class Image { int iter = 0; int iter2 = 0; int ww, hh, dd, k; - Type_Widget widget = new Type_Widget(); - float extractComponents[] = new float[4]; + final Type_Widget widget = new Type_Widget(); + final float extractComponents[] = new float[4]; // Create a Extract interface object Extract extract = null; switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): extract = new Extract332(); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): extract = new Extract233rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): extract = new Extract565(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): extract = new Extract565rev(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): extract = new Extract4444(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): extract = new Extract4444rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): extract = new Extract5551(); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): extract = new Extract1555rev(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): extract = new Extract8888(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): extract = new Extract8888rev(); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): extract = new Extract1010102(); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract = new Extract2101010rev(); break; } @@ -903,78 +906,78 @@ public class Image { for( ww = 0; ww < elementsPerLine; ww++ ) { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( indexFormat ) { newImage.put( iter2++, (short)(0x000000FF & userImage.get( iter ) ) ); } else { newImage.put( iter2++, (short)((0x000000FF & userImage.get( iter ) ) * 257 ) ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( indexFormat ) { newImage.put( iter2++, userImage.get( iter ) ); } else { newImage.put( iter2++, (short)(userImage.get( iter ) * 516 ) ); } break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): userImage.position( iter ); extract.extract( false, userImage, extractComponents ); for( k = 0; k < 3; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): userImage.position( iter ); extract.extract( false, userImage, extractComponents ); for( k = 0; k < 3; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)(extractComponents[k] * 65535) ); } break; - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): if( myswapBytes ) { widget.setUB0( userImage.get( iter + 1 ) ); widget.setUB1( userImage.get( iter ) ); @@ -982,7 +985,7 @@ public class Image { widget.setUB0( userImage.get( iter ) ); widget.setUB1( userImage.get( iter + 1 ) ); } - if( type == GL2.GL_SHORT ) { + if( type == GL.GL_SHORT ) { if( indexFormat ) { newImage.put( iter2++, widget.getUS0() ); } else { @@ -992,36 +995,36 @@ public class Image { newImage.put( iter2++, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): userImage.position( iter ); extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract.extract( myswapBytes, userImage, extractComponents ); for( k = 0; k < 4; k++ ) { newImage.put( iter2++, (short)( extractComponents[k] * 65535 ) ); } break; - case( GL2.GL_INT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_FLOAT ): + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): if( myswapBytes ) { widget.setUB0( userImage.get( iter + 3 ) ); widget.setUB1( userImage.get( iter + 2 ) ); @@ -1033,13 +1036,13 @@ public class Image { widget.setUB2( userImage.get( iter + 2 ) ); widget.setUB3( userImage.get( iter + 3 ) ); } - if( type == GL2.GL_FLOAT ) { + if( type == GL.GL_FLOAT ) { if( indexFormat ) { newImage.put( iter2++, (short)widget.getF() ); } else { newImage.put( iter2++, (short)( widget.getF() * 65535.0f ) ); } - } else if( type == GL2.GL_UNSIGNED_INT ) { + } else if( type == GL.GL_UNSIGNED_INT ) { if( indexFormat ) { newImage.put( iter2++, (short)widget.getUI() ); } else { @@ -1075,8 +1078,8 @@ public class Image { psm.getUnpackSkipImages() * imageSize ); } - public static void emptyImage3D( PixelStorageModes psm, int width, int height, int depth, - int format, int type, boolean indexFormat, ShortBuffer oldImage, ByteBuffer userImage ) { + public static void emptyImage3D( final PixelStorageModes psm, final int width, final int height, final int depth, + final int format, final int type, final boolean indexFormat, final ShortBuffer oldImage, final ByteBuffer userImage ) { boolean myswapBytes; int components; int groupsPerLine; @@ -1090,46 +1093,46 @@ public class Image { int ii, jj, dd, k; int rowsPerImage; int imageSize; - Type_Widget widget = new Type_Widget(); - float[] shoveComponents = new float[4]; + final Type_Widget widget = new Type_Widget(); + final float[] shoveComponents = new float[4]; // Create a Extract interface object Extract extract = null; switch( type ) { - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): extract = new Extract332(); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): extract = new Extract233rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): extract = new Extract565(); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): extract = new Extract565rev(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): extract = new Extract4444(); break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): extract = new Extract4444rev(); break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): extract = new Extract5551(); break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): extract = new Extract1555rev(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): extract = new Extract8888(); break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): extract = new Extract8888rev(); break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): extract = new Extract1010102(); break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): extract = new Extract2101010rev(); break; } @@ -1182,33 +1185,33 @@ public class Image { for( jj = 0; jj < elementsPerLine; jj++ ) { switch( type ) { - case( GL2.GL_UNSIGNED_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): if( indexFormat ) { userImage.put( iter, (byte)(oldImage.get( iter2++ ) ) ); } else { userImage.put( iter, (byte)(oldImage.get( iter2++ ) >> 8 ) ); } break; - case( GL2.GL_BYTE ): + case( GL.GL_BYTE ): if( indexFormat ) { userImage.put( iter, (byte)(oldImage.get(iter2++) ) ); } else { userImage.put( iter, (byte)(oldImage.get(iter2++) >> 9) ); } break; - case( GL2.GL_UNSIGNED_BYTE_3_3_2 ): + case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } extract.shove( shoveComponents, 0, userImage ); break; - case( GL2.GL_UNSIGNED_BYTE_2_3_3_REV ): + case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): for( k = 0; k < 3; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } extract.shove( shoveComponents, 0, userImage ); break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1220,7 +1223,7 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_6_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1232,7 +1235,7 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1244,7 +1247,7 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT_4_4_4_4_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1256,7 +1259,7 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1268,7 +1271,7 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT_1_5_5_5_REV ): + case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1280,16 +1283,16 @@ public class Image { userImage.putShort( iter, widget.getUS0() ); } break; - case( GL2.GL_UNSIGNED_SHORT ): - case( GL2.GL_SHORT ): - if( type == GL2.GL_SHORT ) { + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_SHORT ): + if( type == GL.GL_SHORT ) { if( indexFormat ) { - widget.setS0( (short)oldImage.get( iter2++ ) ); + widget.setS0( oldImage.get( iter2++ ) ); } else { widget.setS0( (short)(oldImage.get( iter2++ ) >> 1) ); } } else { - widget.setUS0( (short)oldImage.get( iter2++ ) ); + widget.setUS0( oldImage.get( iter2++ ) ); } if( myswapBytes ) { userImage.put( iter, widget.getUB1() ); @@ -1299,7 +1302,7 @@ public class Image { userImage.put( iter + 1, widget.getUB1() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8 ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1313,7 +1316,7 @@ public class Image { userImage.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_8_8_8_8_REV ): + case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1327,7 +1330,7 @@ public class Image { userImage.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1341,7 +1344,7 @@ public class Image { userImage.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): for( k = 0; k < 4; k++ ) { shoveComponents[k] = oldImage.get( iter2++ ) / 65535.0f; } @@ -1355,16 +1358,16 @@ public class Image { userImage.putInt( iter, widget.getUI() ); } break; - case( GL2.GL_INT ): - case( GL2.GL_UNSIGNED_INT ): - case( GL2.GL_FLOAT ): - if( type == GL2.GL_FLOAT ) { + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): + if( type == GL.GL_FLOAT ) { if( indexFormat ) { widget.setF( oldImage.get( iter2++ ) ); } else { widget.setF( oldImage.get( iter2++ ) / 65535.0f ); } - } else if( type == GL2.GL_UNSIGNED_INT ) { + } else if( type == GL.GL_UNSIGNED_INT ) { if( indexFormat ) { widget.setUI( oldImage.get( iter2++ ) ); } else { diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java index 938873ec5..fba6a231a 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Mipmap.java @@ -46,10 +46,14 @@ package jogamp.opengl.glu.mipmap; import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2ES2; +import javax.media.opengl.GL2ES3; import javax.media.opengl.GL2GL3; import javax.media.opengl.glu.GLU; import javax.media.opengl.GLException; + import java.nio.*; + import com.jogamp.common.nio.Buffers; /** @@ -108,7 +112,7 @@ public class Mipmap { return( s ); } - public static int GLU_SWAP_4_BYTES( int i ) { + public static int GLU_SWAP_4_BYTES( final int i ) { int t = i << 24; t |= 0x00FF0000 & ( i << 8 ); t |= 0x0000FF00 & ( i >>> 8 ); @@ -116,17 +120,17 @@ public class Mipmap { return( t ); } - public static float GLU_SWAP_4_BYTES( float f ) { - int i = Float.floatToRawIntBits( f ); - float temp = Float.intBitsToFloat( i ); + public static float GLU_SWAP_4_BYTES( final float f ) { + final int i = Float.floatToRawIntBits( f ); + final float temp = Float.intBitsToFloat( i ); return( temp ); } - public static int checkMipmapArgs( int internalFormat, int format, int type ) { + public static int checkMipmapArgs( final int internalFormat, final int format, final int type ) { if( !legalFormat( format ) || !legalType( type ) ) { return( GLU.GLU_INVALID_ENUM ); } - if( format == GL2GL3.GL_STENCIL_INDEX ) { + if( format == GL2ES2.GL_STENCIL_INDEX ) { return( GLU.GLU_INVALID_ENUM ); } if( !isLegalFormatForPackedPixelType( format, type ) ) { @@ -135,19 +139,19 @@ public class Mipmap { return( 0 ); } - public static boolean legalFormat( int format ) { + public static boolean legalFormat( final int format ) { switch( format ) { case( GL2.GL_COLOR_INDEX ): - case( GL2GL3.GL_STENCIL_INDEX ): - case( GL2GL3.GL_DEPTH_COMPONENT ): - case( GL2GL3.GL_RED ): - case( GL2GL3.GL_GREEN ): - case( GL2GL3.GL_BLUE ): - case( GL2GL3.GL_ALPHA ): - case( GL2GL3.GL_RGB ): - case( GL2GL3.GL_RGBA ): - case( GL2GL3.GL_LUMINANCE ): - case( GL2GL3.GL_LUMINANCE_ALPHA ): + case( GL2ES2.GL_STENCIL_INDEX ): + case( GL2ES2.GL_DEPTH_COMPONENT ): + case( GL2ES2.GL_RED ): + case( GL2ES3.GL_GREEN ): + case( GL2ES3.GL_BLUE ): + case( GL.GL_ALPHA ): + case( GL.GL_RGB ): + case( GL.GL_RGBA ): + case( GL.GL_LUMINANCE ): + case( GL.GL_LUMINANCE_ALPHA ): case( GL2GL3.GL_BGR ): case( GL.GL_BGRA ): return( true ); @@ -156,55 +160,55 @@ public class Mipmap { } } - public static boolean legalType( int type ) { + public static boolean legalType( final int type ) { switch( type ) { case( GL2.GL_BITMAP ): - case( GL2GL3.GL_BYTE ): - case( GL2GL3.GL_UNSIGNED_BYTE ): - case( GL2GL3.GL_SHORT ): - case( GL2GL3.GL_UNSIGNED_SHORT ): - case( GL2GL3.GL_INT ): - case( GL2GL3.GL_UNSIGNED_INT ): - case( GL2GL3.GL_FLOAT ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): + case( GL.GL_FLOAT ): case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): - case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2GL3.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): return( true ); default: return( false ); } } - public static boolean isTypePackedPixel( int type ) { + public static boolean isTypePackedPixel( final int type ) { assert( legalType( type ) ); if( type == GL2GL3.GL_UNSIGNED_BYTE_3_3_2 || type == GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5 || + type == GL.GL_UNSIGNED_SHORT_5_6_5 || type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 || + type == GL.GL_UNSIGNED_SHORT_4_4_4_4 || type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 || + type == GL.GL_UNSIGNED_SHORT_5_5_5_1 || type == GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV || type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8 || type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV || - type == GL2GL3.GL_UNSIGNED_INT_10_10_10_2 || - type == GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ) { + type == GL2ES2.GL_UNSIGNED_INT_10_10_10_2 || + type == GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ) { return( true ); } return( false ); } - public static boolean isLegalFormatForPackedPixelType( int format, int type ) { + public static boolean isLegalFormatForPackedPixelType( final int format, final int type ) { // if not a packed pixel type then return true if( isTypePackedPixel( type ) ) { return( true ); @@ -212,29 +216,29 @@ public class Mipmap { // 3_3_2/2_3_3_REV & 5_6_5/5_6_5_REV are only compatible with RGB if( (type == GL2GL3.GL_UNSIGNED_BYTE_3_3_2 || type == GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5 || type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ) - & format != GL2GL3.GL_RGB ) { + type == GL.GL_UNSIGNED_SHORT_5_6_5 || type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ) + & format != GL.GL_RGB ) { return( false ); } // 4_4_4_4/4_4_4_4_REV & 5_5_5_1/1_5_5_5_REV & 8_8_8_8/8_8_8_8_REV & // 10_10_10_2/2_10_10_10_REV are only campatible with RGBA, BGRA & ARGB_EXT - if( ( type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 || + if( ( type == GL.GL_UNSIGNED_SHORT_4_4_4_4 || type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 || + type == GL.GL_UNSIGNED_SHORT_5_5_5_1 || type == GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV || type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8 || type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV || - type == GL2GL3.GL_UNSIGNED_INT_10_10_10_2 || - type == GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ) && + type == GL2ES2.GL_UNSIGNED_INT_10_10_10_2 || + type == GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ) && (format != GL.GL_RGBA && format != GL.GL_BGRA) ) { return( false ); } return( true ); } - public static boolean isLegalLevels( int userLevel, int baseLevel, int maxLevel, - int totalLevels ) { + public static boolean isLegalLevels( final int userLevel, final int baseLevel, final int maxLevel, + final int totalLevels ) { if( (baseLevel < 0) || (baseLevel < userLevel) || (maxLevel < baseLevel) || (totalLevels < maxLevel) ) { return( false ); @@ -249,13 +253,13 @@ public class Mipmap { * advertise the texture extension. * Note that proxy textures are implemented but not according to spec in IMPACT* */ - public static void closestFit( GL gl, int target, int width, int height, int internalFormat, - int format, int type, int[] newWidth, int[] newHeight ) { + public static void closestFit( final GL gl, final int target, final int width, final int height, final int internalFormat, + final int format, final int type, final int[] newWidth, final int[] newHeight ) { // Use proxy textures if OpenGL version >= 1.1 if( Double.parseDouble( gl.glGetString( GL.GL_VERSION ).trim().substring( 0, 3 ) ) >= 1.1 ) { int widthPowerOf2 = nearestPower( width ); int heightPowerOf2 = nearestPower( height ); - int[] proxyWidth = new int[1]; + final int[] proxyWidth = new int[1]; boolean noProxyTextures = false; // Some drivers (in particular, ATI's) seem to set a GL error @@ -265,24 +269,24 @@ public class Mipmap { try { do { // compute level 1 width & height, clamping each at 1 - int widthAtLevelOne = ( ( width > 1 ) ? (widthPowerOf2 >> 1) : widthPowerOf2 ); - int heightAtLevelOne = ( ( height > 1 ) ? (heightPowerOf2 >> 1) : heightPowerOf2 ); + final int widthAtLevelOne = ( ( width > 1 ) ? (widthPowerOf2 >> 1) : widthPowerOf2 ); + final int heightAtLevelOne = ( ( height > 1 ) ? (heightPowerOf2 >> 1) : heightPowerOf2 ); int proxyTarget; assert( widthAtLevelOne > 0 ); assert( heightAtLevelOne > 0 ); // does width x height at level 1 & all their mipmaps fit? - if( target == GL2GL3.GL_TEXTURE_2D || target == GL2GL3.GL_PROXY_TEXTURE_2D ) { + if( target == GL.GL_TEXTURE_2D || target == GL2GL3.GL_PROXY_TEXTURE_2D ) { proxyTarget = GL2GL3.GL_PROXY_TEXTURE_2D; gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne, heightAtLevelOne, 0, format, type, null ); - } else if( (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_X) || - (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_X) || - (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_Y) || - (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) || - (target == GL2GL3.GL_TEXTURE_CUBE_MAP_POSITIVE_Z) || - (target == GL2GL3.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) ) { + } else if( (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_X) || + (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_X) || + (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Y) || + (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) || + (target == GL.GL_TEXTURE_CUBE_MAP_POSITIVE_Z) || + (target == GL.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) ) { proxyTarget = GL2GL3.GL_PROXY_TEXTURE_CUBE_MAP; gl.glTexImage2D( proxyTarget, 1, internalFormat, widthAtLevelOne, heightAtLevelOne, 0, format, type, null ); @@ -313,7 +317,7 @@ public class Mipmap { } // else it does fit } while( proxyWidth[0] == 0 ); - } catch (GLException e) { + } catch (final GLException e) { noProxyTextures = true; } // loop must terminate @@ -324,8 +328,8 @@ public class Mipmap { return; } } - int[] maxsize = new int[1]; - gl.glGetIntegerv( GL2GL3.GL_MAX_TEXTURE_SIZE, maxsize , 0); + final int[] maxsize = new int[1]; + gl.glGetIntegerv( GL.GL_MAX_TEXTURE_SIZE, maxsize , 0); // clamp user's texture sizes to maximum sizes, if necessary newWidth[0] = nearestPower( width ); if( newWidth[0] > maxsize[0] ) { @@ -337,26 +341,26 @@ public class Mipmap { } } - public static void closestFit3D( GL gl, int target, int width, int height, int depth, - int internalFormat, int format, int type, int[] newWidth, int[] newHeight, - int[] newDepth ) { + public static void closestFit3D( final GL gl, final int target, final int width, final int height, final int depth, + final int internalFormat, final int format, final int type, final int[] newWidth, final int[] newHeight, + final int[] newDepth ) { int widthPowerOf2 = nearestPower( width ); int heightPowerOf2 = nearestPower( height ); int depthPowerOf2 = nearestPower( depth ); - int[] proxyWidth = new int[1]; + final int[] proxyWidth = new int[1]; do { // compute level 1 width & height & depth, clamping each at 1 - int widthAtLevelOne = (widthPowerOf2 > 1) ? widthPowerOf2 >> 1 : widthPowerOf2; - int heightAtLevelOne = (heightPowerOf2 > 1) ? heightPowerOf2 >> 1 : heightPowerOf2; - int depthAtLevelOne = (depthPowerOf2 > 1) ? depthPowerOf2 >> 1 : depthPowerOf2; + final int widthAtLevelOne = (widthPowerOf2 > 1) ? widthPowerOf2 >> 1 : widthPowerOf2; + final int heightAtLevelOne = (heightPowerOf2 > 1) ? heightPowerOf2 >> 1 : heightPowerOf2; + final int depthAtLevelOne = (depthPowerOf2 > 1) ? depthPowerOf2 >> 1 : depthPowerOf2; int proxyTarget = 0; assert( widthAtLevelOne > 0 ); assert( heightAtLevelOne > 0 ); assert( depthAtLevelOne > 0 ); // does width x height x depth at level 1 & all their mipmaps fit? - if( target == GL2GL3.GL_TEXTURE_3D || target == GL2GL3.GL_PROXY_TEXTURE_3D ) { + if( target == GL2ES2.GL_TEXTURE_3D || target == GL2GL3.GL_PROXY_TEXTURE_3D ) { proxyTarget = GL2GL3.GL_PROXY_TEXTURE_3D; gl.getGL2GL3().glTexImage3D( proxyTarget, 1, internalFormat, widthAtLevelOne, heightAtLevelOne, depthAtLevelOne, 0, format, type, null ); @@ -385,31 +389,31 @@ public class Mipmap { newDepth[0] = depthPowerOf2; } - public static int elements_per_group( int format, int type ) { + public static int elements_per_group( final int format, final int type ) { // Return the number of elements per grtoup of a specified gromat // If the type is packedpixels then answer is 1 if( type == GL2GL3.GL_UNSIGNED_BYTE_3_3_2 || type == GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5 || + type == GL.GL_UNSIGNED_SHORT_5_6_5 || type == GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 || + type == GL.GL_UNSIGNED_SHORT_4_4_4_4 || type == GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV || - type == GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 || + type == GL.GL_UNSIGNED_SHORT_5_5_5_1 || type == GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV || type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8 || type == GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV || - type == GL2GL3.GL_UNSIGNED_INT_10_10_10_2 || - type == GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ) { + type == GL2ES2.GL_UNSIGNED_INT_10_10_10_2 || + type == GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ) { return( 1 ); } // Types are not packed pixels so get elements per group switch( format ) { - case( GL2GL3.GL_RGB ): + case( GL.GL_RGB ): case( GL2GL3.GL_BGR ): return( 3 ); - case( GL2GL3.GL_LUMINANCE_ALPHA ): + case( GL.GL_LUMINANCE_ALPHA ): return( 2 ); case( GL.GL_RGBA ): case( GL.GL_BGRA ): @@ -419,45 +423,45 @@ public class Mipmap { } } - public static int bytes_per_element( int type ) { + public static int bytes_per_element( final int type ) { // return the number of bytes per element, based on the element type switch( type ) { case( GL2.GL_BITMAP ): - case( GL2GL3.GL_BYTE ): - case( GL2GL3.GL_UNSIGNED_BYTE ): + case( GL.GL_BYTE ): + case( GL.GL_UNSIGNED_BYTE ): case( GL2GL3.GL_UNSIGNED_BYTE_3_3_2 ): case( GL2GL3.GL_UNSIGNED_BYTE_2_3_3_REV ): return( 1 ); - case( GL2GL3.GL_SHORT ): - case( GL2GL3.GL_UNSIGNED_SHORT ): - case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5 ): + case( GL.GL_SHORT ): + case( GL.GL_UNSIGNED_SHORT ): + case( GL.GL_UNSIGNED_SHORT_5_6_5 ): case( GL2GL3.GL_UNSIGNED_SHORT_5_6_5_REV ): - case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4 ): + case( GL.GL_UNSIGNED_SHORT_4_4_4_4 ): case( GL2GL3.GL_UNSIGNED_SHORT_4_4_4_4_REV ): - case( GL2GL3.GL_UNSIGNED_SHORT_5_5_5_1 ): + case( GL.GL_UNSIGNED_SHORT_5_5_5_1 ): case( GL2GL3.GL_UNSIGNED_SHORT_1_5_5_5_REV ): return( 2 ); - case( GL2GL3.GL_INT ): - case( GL2GL3.GL_UNSIGNED_INT ): + case( GL2ES2.GL_INT ): + case( GL.GL_UNSIGNED_INT ): case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8 ): case( GL2GL3.GL_UNSIGNED_INT_8_8_8_8_REV ): - case( GL2GL3.GL_UNSIGNED_INT_10_10_10_2 ): - case( GL2GL3.GL_UNSIGNED_INT_2_10_10_10_REV ): - case( GL2GL3.GL_FLOAT ): + case( GL2ES2.GL_UNSIGNED_INT_10_10_10_2 ): + case( GL2ES2.GL_UNSIGNED_INT_2_10_10_10_REV ): + case( GL.GL_FLOAT ): return( 4 ); default: return( 4 ); } } - public static boolean is_index( int format ) { - return( format == GL2.GL_COLOR_INDEX || format == GL2GL3.GL_STENCIL_INDEX ); + public static boolean is_index( final int format ) { + return( format == GL2.GL_COLOR_INDEX || format == GL2ES2.GL_STENCIL_INDEX ); } /* Compute memory required for internal packed array of data of given type and format. */ - public static int image_size( int width, int height, int format, int type ) { + public static int image_size( final int width, final int height, final int format, final int type ) { int bytes_per_row; int components; @@ -472,9 +476,9 @@ public class Mipmap { return( bytes_per_row * height * components ); } - public static int imageSize3D( int width, int height, int depth, int format, int type ) { - int components = elements_per_group( format, type ); - int bytes_per_row = bytes_per_element( type ) * width; + public static int imageSize3D( final int width, final int height, final int depth, final int format, final int type ) { + final int components = elements_per_group( format, type ); + final int bytes_per_row = bytes_per_element( type ) * width; assert( width > 0 && height > 0 && depth > 0 ); assert( type != GL2.GL_BITMAP ); @@ -482,28 +486,28 @@ public class Mipmap { return( bytes_per_row * height * depth * components ); } - public static void retrieveStoreModes( GL gl, PixelStorageModes psm ) { - int[] a = new int[1]; - gl.glGetIntegerv( GL2GL3.GL_UNPACK_ALIGNMENT, a, 0); + public static void retrieveStoreModes( final GL gl, final PixelStorageModes psm ) { + final int[] a = new int[1]; + gl.glGetIntegerv( GL.GL_UNPACK_ALIGNMENT, a, 0); psm.setUnpackAlignment( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_ROW_LENGTH, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_ROW_LENGTH, a, 0); psm.setUnpackRowLength( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_ROWS, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_SKIP_ROWS, a, 0); psm.setUnpackSkipRows( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_PIXELS, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_SKIP_PIXELS, a, 0); psm.setUnpackSkipPixels( a[0] ); gl.glGetIntegerv( GL2GL3.GL_UNPACK_LSB_FIRST, a, 0); psm.setUnpackLsbFirst( ( a[0] == 1 ) ); gl.glGetIntegerv( GL2GL3.GL_UNPACK_SWAP_BYTES, a, 0); psm.setUnpackSwapBytes( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL2GL3.GL_PACK_ALIGNMENT, a, 0); + gl.glGetIntegerv( GL.GL_PACK_ALIGNMENT, a, 0); psm.setPackAlignment( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_ROW_LENGTH, a, 0); + gl.glGetIntegerv( GL2ES3.GL_PACK_ROW_LENGTH, a, 0); psm.setPackRowLength( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_ROWS, a, 0); + gl.glGetIntegerv( GL2ES3.GL_PACK_SKIP_ROWS, a, 0); psm.setPackSkipRows( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_PIXELS, a, 0); + gl.glGetIntegerv( GL2ES3.GL_PACK_SKIP_PIXELS, a, 0); psm.setPackSkipPixels( a[0] ); gl.glGetIntegerv( GL2GL3.GL_PACK_LSB_FIRST, a, 0); psm.setPackLsbFirst( ( a[0] == 1 ) ); @@ -511,32 +515,32 @@ public class Mipmap { psm.setPackSwapBytes( ( a[0] == 1 ) ); } - public static void retrieveStoreModes3D( GL gl, PixelStorageModes psm ) { - int[] a = new int[1]; - gl.glGetIntegerv( GL2GL3.GL_UNPACK_ALIGNMENT, a, 0); + public static void retrieveStoreModes3D( final GL gl, final PixelStorageModes psm ) { + final int[] a = new int[1]; + gl.glGetIntegerv( GL.GL_UNPACK_ALIGNMENT, a, 0); psm.setUnpackAlignment( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_ROW_LENGTH, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_ROW_LENGTH, a, 0); psm.setUnpackRowLength( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_ROWS, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_SKIP_ROWS, a, 0); psm.setUnpackSkipRows( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_PIXELS, a, 0); + gl.glGetIntegerv( GL2ES2.GL_UNPACK_SKIP_PIXELS, a, 0); psm.setUnpackSkipPixels( a[0] ); gl.glGetIntegerv( GL2GL3.GL_UNPACK_LSB_FIRST, a, 0); psm.setUnpackLsbFirst( ( a[0] == 1 ) ); gl.glGetIntegerv( GL2GL3.GL_UNPACK_SWAP_BYTES, a, 0); psm.setUnpackSwapBytes( ( a[0] == 1 ) ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_SKIP_IMAGES, a, 0); + gl.glGetIntegerv( GL2ES3.GL_UNPACK_SKIP_IMAGES, a, 0); psm.setUnpackSkipImages( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_UNPACK_IMAGE_HEIGHT, a, 0); + gl.glGetIntegerv( GL2ES3.GL_UNPACK_IMAGE_HEIGHT, a, 0); psm.setUnpackImageHeight( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_ALIGNMENT, a, 0); + gl.glGetIntegerv( GL.GL_PACK_ALIGNMENT, a, 0); psm.setPackAlignment( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_ROW_LENGTH, a, 0); + gl.glGetIntegerv( GL2ES3.GL_PACK_ROW_LENGTH, a, 0); psm.setPackRowLength( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_ROWS, a, 0); + gl.glGetIntegerv( GL2ES3.GL_PACK_SKIP_ROWS, a, 0); psm.setPackSkipRows( a[0] ); - gl.glGetIntegerv( GL2GL3.GL_PACK_SKIP_PIXELS, a, 0 ); + gl.glGetIntegerv( GL2ES3.GL_PACK_SKIP_PIXELS, a, 0 ); psm.setPackSkipPixels( a[0] ); gl.glGetIntegerv( GL2GL3.GL_PACK_LSB_FIRST, a, 0 ); psm.setPackLsbFirst( ( a[0] == 1 ) ); @@ -548,17 +552,17 @@ public class Mipmap { psm.setPackImageHeight( a[0] ); } - public static int gluScaleImage( GL gl, int format, int widthin, int heightin, - int typein, ByteBuffer datain, int widthout, int heightout, - int typeout, ByteBuffer dataout ) { - int datainPos = datain.position(); - int dataoutPos = dataout.position(); + public static int gluScaleImage( final GL gl, final int format, final int widthin, final int heightin, + final int typein, final ByteBuffer datain, final int widthout, final int heightout, + final int typeout, final ByteBuffer dataout ) { + final int datainPos = datain.position(); + final int dataoutPos = dataout.position(); try { int components; ByteBuffer beforeimage; ByteBuffer afterimage; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); if( (widthin == 0) || (heightin == 0) || (widthout == 0) || (heightout == 0) ) { return( 0 ); @@ -575,8 +579,8 @@ public class Mipmap { if( !isLegalFormatForPackedPixelType( format, typeout ) ) { return( GLU.GLU_INVALID_OPERATION ); } - beforeimage = Buffers.newDirectByteBuffer( image_size( widthin, heightin, format, GL2GL3.GL_UNSIGNED_SHORT ) ); - afterimage = Buffers.newDirectByteBuffer( image_size( widthout, heightout, format, GL2GL3.GL_UNSIGNED_SHORT ) ); + beforeimage = Buffers.newDirectByteBuffer( image_size( widthin, heightin, format, GL.GL_UNSIGNED_SHORT ) ); + afterimage = Buffers.newDirectByteBuffer( image_size( widthout, heightout, format, GL.GL_UNSIGNED_SHORT ) ); if( beforeimage == null || afterimage == null ) { return( GLU.GLU_OUT_OF_MEMORY ); } @@ -594,15 +598,15 @@ public class Mipmap { } } - public static int gluBuild1DMipmapLevels( GL gl, int target, int internalFormat, - int width, int format, int type, int userLevel, int baseLevel, - int maxLevel, ByteBuffer data ) { - int dataPos = data.position(); + public static int gluBuild1DMipmapLevels( final GL gl, final int target, final int internalFormat, + final int width, final int format, final int type, final int userLevel, final int baseLevel, + final int maxLevel, final ByteBuffer data ) { + final int dataPos = data.position(); try { int levels; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } @@ -625,16 +629,16 @@ public class Mipmap { } } - public static int gluBuild1DMipmaps( GL gl, int target, int internalFormat, int width, - int format, int type, ByteBuffer data ) { - int dataPos = data.position(); + public static int gluBuild1DMipmaps( final GL gl, final int target, final int internalFormat, final int width, + final int format, final int type, final ByteBuffer data ) { + final int dataPos = data.position(); try { - int[] widthPowerOf2 = new int[1]; + final int[] widthPowerOf2 = new int[1]; int levels; - int[] dummy = new int[1]; + final int[] dummy = new int[1]; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } @@ -654,14 +658,14 @@ public class Mipmap { } - public static int gluBuild2DMipmapLevels( GL gl, int target, int internalFormat, - int width, int height, int format, int type, int userLevel, - int baseLevel, int maxLevel, Object data ) { + public static int gluBuild2DMipmapLevels( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int format, final int type, final int userLevel, + final int baseLevel, final int maxLevel, final Object data ) { int dataPos = 0; int level, levels; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } @@ -687,23 +691,23 @@ public class Mipmap { buffer = (ByteBuffer)data; dataPos = buffer.position(); } else if( data instanceof byte[] ) { - byte[] array = (byte[])data; + final byte[] array = (byte[])data; buffer = ByteBuffer.allocateDirect(array.length); buffer.put(array); } else if( data instanceof short[] ) { - short[] array = (short[])data; + final short[] array = (short[])data; buffer = ByteBuffer.allocateDirect( array.length * 2 ); - ShortBuffer sb = buffer.asShortBuffer(); + final ShortBuffer sb = buffer.asShortBuffer(); sb.put( array ); } else if( data instanceof int[] ) { - int[] array = (int[])data; + final int[] array = (int[])data; buffer = ByteBuffer.allocateDirect( array.length * 4 ); - IntBuffer ib = buffer.asIntBuffer(); + final IntBuffer ib = buffer.asIntBuffer(); ib.put( array ); } else if( data instanceof float[] ) { - float[] array = (float[])data; + final float[] array = (float[])data; buffer = ByteBuffer.allocateDirect( array.length * 4 ); - FloatBuffer fb = buffer.asFloatBuffer(); + final FloatBuffer fb = buffer.asFloatBuffer(); fb.put( array ); } @@ -717,15 +721,15 @@ public class Mipmap { } - public static int gluBuild2DMipmaps( GL gl, int target, int internalFormat, - int width, int height, int format, int type, Object data ) { + public static int gluBuild2DMipmaps( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int format, final int type, final Object data ) { int dataPos = 0; - int[] widthPowerOf2 = new int[1]; - int[] heightPowerOf2 = new int[1]; + final int[] widthPowerOf2 = new int[1]; + final int[] heightPowerOf2 = new int[1]; int level, levels; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } @@ -749,23 +753,23 @@ public class Mipmap { buffer = (ByteBuffer)data; dataPos = buffer.position(); } else if( data instanceof byte[] ) { - byte[] array = (byte[])data; + final byte[] array = (byte[])data; buffer = ByteBuffer.allocateDirect(array.length); buffer.put(array); } else if( data instanceof short[] ) { - short[] array = (short[])data; + final short[] array = (short[])data; buffer = ByteBuffer.allocateDirect( array.length * 2 ); - ShortBuffer sb = buffer.asShortBuffer(); + final ShortBuffer sb = buffer.asShortBuffer(); sb.put( array ); } else if( data instanceof int[] ) { - int[] array = (int[])data; + final int[] array = (int[])data; buffer = ByteBuffer.allocateDirect( array.length * 4 ); - IntBuffer ib = buffer.asIntBuffer(); + final IntBuffer ib = buffer.asIntBuffer(); ib.put( array ); } else if( data instanceof float[] ) { - float[] array = (float[])data; + final float[] array = (float[])data; buffer = ByteBuffer.allocateDirect( array.length * 4 ); - FloatBuffer fb = buffer.asFloatBuffer(); + final FloatBuffer fb = buffer.asFloatBuffer(); fb.put( array ); } @@ -779,17 +783,17 @@ public class Mipmap { } - public static int gluBuild3DMipmaps( GL gl, int target, int internalFormat, - int width, int height, int depth, int format, int type, ByteBuffer data ) { - int dataPos = data.position(); + public static int gluBuild3DMipmaps( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int depth, final int format, final int type, final ByteBuffer data ) { + final int dataPos = data.position(); try { - int[] widthPowerOf2 = new int[1]; - int[] heightPowerOf2 = new int[1]; - int[] depthPowerOf2 = new int[1]; + final int[] widthPowerOf2 = new int[1]; + final int[] heightPowerOf2 = new int[1]; + final int[] depthPowerOf2 = new int[1]; int level, levels; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } @@ -823,14 +827,14 @@ public class Mipmap { } } - public static int gluBuild3DMipmapLevels( GL gl, int target, int internalFormat, - int width, int height, int depth, int format, int type, int userLevel, - int baseLevel, int maxLevel, ByteBuffer data ) { - int dataPos = data.position(); + public static int gluBuild3DMipmapLevels( final GL gl, final int target, final int internalFormat, + final int width, final int height, final int depth, final int format, final int type, final int userLevel, + final int baseLevel, final int maxLevel, final ByteBuffer data ) { + final int dataPos = data.position(); try { int level, levels; - int rc = checkMipmapArgs( internalFormat, format, type ); + final int rc = checkMipmapArgs( internalFormat, format, type ); if( rc != 0 ) { return( rc ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java index 7eb98db35..9b26647a8 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/PixelStorageModes.java @@ -147,7 +147,7 @@ public class PixelStorageModes { * Setter for property packAlignment. * @param packAlignment New value of property packAlignment. */ - public void setPackAlignment(int packAlignment) { + public void setPackAlignment(final int packAlignment) { this.packAlignment = packAlignment; } @@ -165,7 +165,7 @@ public class PixelStorageModes { * Setter for property packRowLength. * @param packRowLength New value of property packRowLength. */ - public void setPackRowLength(int packRowLength) { + public void setPackRowLength(final int packRowLength) { this.packRowLength = packRowLength; } @@ -183,7 +183,7 @@ public class PixelStorageModes { * Setter for property packSkipRows. * @param packSkipRows New value of property packSkipRows. */ - public void setPackSkipRows(int packSkipRows) { + public void setPackSkipRows(final int packSkipRows) { this.packSkipRows = packSkipRows; } @@ -201,7 +201,7 @@ public class PixelStorageModes { * Setter for property packSkipPixels. * @param packSkipPixels New value of property packSkipPixels. */ - public void setPackSkipPixels(int packSkipPixels) { + public void setPackSkipPixels(final int packSkipPixels) { this.packSkipPixels = packSkipPixels; } @@ -219,7 +219,7 @@ public class PixelStorageModes { * Setter for property packLsbFirst. * @param packLsbFirst New value of property packLsbFirst. */ - public void setPackLsbFirst(boolean packLsbFirst) { + public void setPackLsbFirst(final boolean packLsbFirst) { this.packLsbFirst = packLsbFirst; } @@ -237,7 +237,7 @@ public class PixelStorageModes { * Setter for property packSwapBytes. * @param packSwapBytes New value of property packSwapBytes. */ - public void setPackSwapBytes(boolean packSwapBytes) { + public void setPackSwapBytes(final boolean packSwapBytes) { this.packSwapBytes = packSwapBytes; } @@ -255,7 +255,7 @@ public class PixelStorageModes { * Setter for property packSkipImages. * @param packSkipImages New value of property packSkipImages. */ - public void setPackSkipImages(int packSkipImages) { + public void setPackSkipImages(final int packSkipImages) { this.packSkipImages = packSkipImages; } @@ -273,7 +273,7 @@ public class PixelStorageModes { * Setter for property packImageHeight. * @param packImageHeight New value of property packImageHeight. */ - public void setPackImageHeight(int packImageHeight) { + public void setPackImageHeight(final int packImageHeight) { this.packImageHeight = packImageHeight; } @@ -291,7 +291,7 @@ public class PixelStorageModes { * Setter for property unpackAlignment. * @param unpackAlignment New value of property unpackAlignment. */ - public void setUnpackAlignment(int unpackAlignment) { + public void setUnpackAlignment(final int unpackAlignment) { this.unpackAlignment = unpackAlignment; } @@ -309,7 +309,7 @@ public class PixelStorageModes { * Setter for property unpackRowLength. * @param unpackRowLength New value of property unpackRowLength. */ - public void setUnpackRowLength(int unpackRowLength) { + public void setUnpackRowLength(final int unpackRowLength) { this.unpackRowLength = unpackRowLength; } @@ -327,7 +327,7 @@ public class PixelStorageModes { * Setter for property unpackSkipRows. * @param unpackSkipRows New value of property unpackSkipRows. */ - public void setUnpackSkipRows(int unpackSkipRows) { + public void setUnpackSkipRows(final int unpackSkipRows) { this.unpackSkipRows = unpackSkipRows; } @@ -345,7 +345,7 @@ public class PixelStorageModes { * Setter for property unpackSkipPixels. * @param unpackSkipPixels New value of property unpackSkipPixels. */ - public void setUnpackSkipPixels(int unpackSkipPixels) { + public void setUnpackSkipPixels(final int unpackSkipPixels) { this.unpackSkipPixels = unpackSkipPixels; } @@ -363,7 +363,7 @@ public class PixelStorageModes { * Setter for property unpackLsbFirst. * @param unpackLsbFirst New value of property unpackLsbFirst. */ - public void setUnpackLsbFirst(boolean unpackLsbFirst) { + public void setUnpackLsbFirst(final boolean unpackLsbFirst) { this.unpackLsbFirst = unpackLsbFirst; } @@ -381,7 +381,7 @@ public class PixelStorageModes { * Setter for property unpackSwapBytes. * @param unpackSwapBytes New value of property unpackSwapBytes. */ - public void setUnpackSwapBytes(boolean unpackSwapBytes) { + public void setUnpackSwapBytes(final boolean unpackSwapBytes) { this.unpackSwapBytes = unpackSwapBytes; } @@ -399,7 +399,7 @@ public class PixelStorageModes { * Setter for property unpackSkipImages. * @param unpackSkipImages New value of property unpackSkipImages. */ - public void setUnpackSkipImages(int unpackSkipImages) { + public void setUnpackSkipImages(final int unpackSkipImages) { this.unpackSkipImages = unpackSkipImages; } @@ -417,7 +417,7 @@ public class PixelStorageModes { * Setter for property unpackImageHeight. * @param unpackImageHeight New value of property unpackImageHeight. */ - public void setUnpackImageHeight(int unpackImageHeight) { + public void setUnpackImageHeight(final int unpackImageHeight) { this.unpackImageHeight = unpackImageHeight; } diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java index 9aca1fb03..ccb75091c 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/ScaleInternal.java @@ -56,16 +56,16 @@ import com.jogamp.common.nio.Buffers; */ public class ScaleInternal { - public static final float UINT_MAX = (float)(0x00000000FFFFFFFF); + public static final float UINT_MAX = (0x00000000FFFFFFFF); - public static void scale_internal( int components, int widthin, int heightin, - ShortBuffer datain, int widthout, int heightout, ShortBuffer dataout ) { + public static void scale_internal( final int components, final int widthin, final int heightin, + final ShortBuffer datain, final int widthout, final int heightout, final ShortBuffer dataout ) { float x, lowx, highx, convx, halfconvx; float y, lowy, highy, convy, halfconvy; float xpercent, ypercent; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, yint, xint, xindex, yindex; int temp; @@ -147,14 +147,16 @@ public class ScaleInternal { } } - public static void scale_internal_ubyte( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ByteBuffer dataout, int element_size, int ysize, int group_size ) { - float x, convx; - float y, convy; + public static void scale_internal_ubyte( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final ByteBuffer dataout, final int element_size, final int ysize, final int group_size ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -356,7 +358,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -372,15 +374,17 @@ public class ScaleInternal { } } - public static void scale_internal_byte( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ByteBuffer dataout, int element_size, int ysize, - int group_size ) { - float x, convx; - float y, convy; + public static void scale_internal_byte( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final ByteBuffer dataout, final int element_size, final int ysize, + final int group_size ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -581,7 +585,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -597,15 +601,17 @@ public class ScaleInternal { } } - public static void scale_internal_ushort( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ShortBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; + public static void scale_internal_ushort( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final ShortBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -673,7 +679,7 @@ public class ScaleInternal { for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { datain.position( temp_index ); if( myswap_bytes ) { - totals[k] += ( 0x0000FFFF & ((int)Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * percent; + totals[k] += ( 0x0000FFFF & (Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * percent; } else { totals[k] += ( 0x0000FFFF & datain.getShort() ) * percent; } @@ -684,7 +690,7 @@ public class ScaleInternal { for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { datain.position( temp_index ); if( myswap_bytes ) { - totals[k] += ( 0x0000FFFF & ((int)Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * y_percent; + totals[k] += ( 0x0000FFFF & (Mipmap.GLU_SWAP_2_BYTES( datain.getShort() ))) * y_percent; } else { totals[k] += ( 0x0000FFFF & datain.getShort()) * y_percent; } @@ -869,7 +875,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -885,15 +891,17 @@ public class ScaleInternal { } } - public static void scale_internal_short( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - ShortBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; + public static void scale_internal_short( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final ShortBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -1173,7 +1181,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -1189,15 +1197,17 @@ public class ScaleInternal { } } - public static void scale_internal_uint( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; + public static void scale_internal_uint( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final IntBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -1416,9 +1426,9 @@ public class ScaleInternal { percent = ( highy_float - lowy_float ) * ( highx_float - lowx_float ); temp = xindex + (lowy_int * ysize); for( k = 0, temp_index = temp; k < components; k++, temp_index += element_size ) { - long tempInt0 = ( 0xFFFFFFFFL & datain.getInt( temp_index ) ); + final long tempInt0 = ( 0xFFFFFFFFL & datain.getInt( temp_index ) ); datain.position( temp_index ); - long tempInt1 = ( 0xFFFFFFFFL & datain.getInt() ); + final long tempInt1 = ( 0xFFFFFFFFL & datain.getInt() ); datain.position( temp_index ); if( myswap_bytes ) { totals[k] += (0x00000000FFFFFFFF & Mipmap.GLU_SWAP_4_BYTES( datain.getInt())) * percent; @@ -1468,7 +1478,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -1484,15 +1494,17 @@ public class ScaleInternal { } } - public static void scale_internal_int( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - IntBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; + public static void scale_internal_int( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final IntBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -1772,7 +1784,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -1788,15 +1800,17 @@ public class ScaleInternal { } } - public static void scale_internal_float( int components, int widthin, int heightin, - ByteBuffer datain, int widthout, int heightout, - FloatBuffer dataout, int element_size, int ysize, - int group_size, boolean myswap_bytes ) { - float x, convx; - float y, convy; + public static void scale_internal_float( final int components, final int widthin, final int heightin, + final ByteBuffer datain, final int widthout, final int heightout, + final FloatBuffer dataout, final int element_size, final int ysize, + final int group_size, final boolean myswap_bytes ) { + final float x; + float convx; + final float y; + float convy; float percent; // Max components in a format is 4, so... - float[] totals = new float[4]; + final float[] totals = new float[4]; float area; int i, j, k, xindex; @@ -2076,7 +2090,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthin - 1) { - int delta = (highx_int - widthin + 1); + final int delta = (highx_int - widthin + 1); lowx_int -= delta; highx_int -= delta; } @@ -2092,25 +2106,27 @@ public class ScaleInternal { } } - public static void scaleInternalPackedPixel( int components, Extract extract, - int widthIn, int heightIn, ByteBuffer dataIn, int widthOut, - int heightOut, ByteBuffer dataOut, int pixelSizeInBytes, - int rowSizeInBytes, boolean isSwap ) { - float x, convx; - float y, convy; + public static void scaleInternalPackedPixel( final int components, final Extract extract, + final int widthIn, final int heightIn, final ByteBuffer dataIn, final int widthOut, + final int heightOut, final ByteBuffer dataOut, final int pixelSizeInBytes, + final int rowSizeInBytes, final boolean isSwap ) { + final float x; + float convx; + final float y; + float convy; float percent; // max components in a format is 4, so - float[] totals = new float[4]; - float[] extractTotals = new float[4]; - float[] extractMoreTotals = new float[4]; - float[] shoveTotals = new float[4]; + final float[] totals = new float[4]; + final float[] extractTotals = new float[4]; + final float[] extractMoreTotals = new float[4]; + final float[] shoveTotals = new float[4]; float area; int i, j, k, xindex; int temp, temp0; - int temp_index; + final int temp_index; int outIndex = 0; int lowx_int, highx_int, lowy_int, highy_int; @@ -2309,7 +2325,7 @@ public class ScaleInternal { // Clamp to make sure we don't run off the right edge if (highx_int > widthIn - 1) { - int delta = (highx_int - widthIn + 1); + final int delta = (highx_int - widthIn + 1); lowx_int -= delta; highx_int -= delta; } @@ -2326,16 +2342,16 @@ public class ScaleInternal { assert( outIndex == ( widthOut * heightOut - 1) ); } - public static void scaleInternal3D( int components, int widthIn, int heightIn, - int depthIn, ShortBuffer dataIn, int widthOut, int heightOut, - int depthOut, ShortBuffer dataOut ) { + public static void scaleInternal3D( final int components, final int widthIn, final int heightIn, + final int depthIn, final ShortBuffer dataIn, final int widthOut, final int heightOut, + final int depthOut, final ShortBuffer dataOut ) { float x, lowx, highx, convx, halfconvx; float y, lowy, highy, convy, halfconvy; float z, lowz, highz, convz, halfconvz; float xpercent, ypercent, zpercent; float percent; // max compnents in a format is 4 - float[] totals = new float[4]; + final float[] totals = new float[4]; float volume; int i, j, d, k, zint, yint, xint, xindex, yindex, zindex; int temp; @@ -2442,12 +2458,12 @@ public class ScaleInternal { } } - public static int gluScaleImage3D( GL gl, int format, int widthIn, int heightIn, - int depthIn, int typeIn, ByteBuffer dataIn, int widthOut, int heightOut, - int depthOut, int typeOut, ByteBuffer dataOut ) { + public static int gluScaleImage3D( final GL gl, final int format, final int widthIn, final int heightIn, + final int depthIn, final int typeIn, final ByteBuffer dataIn, final int widthOut, final int heightOut, + final int depthOut, final int typeOut, final ByteBuffer dataOut ) { int components; ShortBuffer beforeImage, afterImage; - PixelStorageModes psm = new PixelStorageModes(); + final PixelStorageModes psm = new PixelStorageModes(); if( widthIn == 0 || heightIn == 0 || depthIn == 0 || widthOut == 0 || heightOut == 0 || depthOut == 0 ) { @@ -2475,10 +2491,10 @@ public class ScaleInternal { try { beforeImage = Buffers.newDirectByteBuffer( Mipmap.imageSize3D( widthIn, - heightIn, depthIn, format, GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer(); + heightIn, depthIn, format, GL.GL_UNSIGNED_SHORT ) ).asShortBuffer(); afterImage = Buffers.newDirectByteBuffer( Mipmap.imageSize3D( widthIn, - heightIn, depthIn, format, GL2.GL_UNSIGNED_SHORT ) ).asShortBuffer(); - } catch( OutOfMemoryError err ) { + heightIn, depthIn, format, GL.GL_UNSIGNED_SHORT ) ).asShortBuffer(); + } catch( final OutOfMemoryError err ) { return( GLU.GLU_OUT_OF_MEMORY ); } Mipmap.retrieveStoreModes3D( gl, psm ); diff --git a/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java b/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java index dc401880d..8683f75ac 100644 --- a/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java +++ b/src/jogl/classes/jogamp/opengl/glu/mipmap/Type_Widget.java @@ -61,7 +61,7 @@ public class Type_Widget { buffer = ByteBuffer.allocate( 4 ); } - public void setUB0( byte b ) { + public void setUB0( final byte b ) { buffer.position( 0 ); buffer.put( b ); } @@ -71,7 +71,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setUB1( byte b ) { + public void setUB1( final byte b ) { buffer.position( 1 ); buffer.put( b ); } @@ -81,7 +81,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setUB2( byte b ) { + public void setUB2( final byte b ) { buffer.position( 2 ); buffer.put( b ); } @@ -91,7 +91,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setUB3( byte b ) { + public void setUB3( final byte b ) { buffer.position( 3 ); buffer.put( b ); } @@ -101,7 +101,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setUS0( short s ) { + public void setUS0( final short s ) { buffer.position( 0 ); buffer.putShort( s ); } @@ -111,7 +111,7 @@ public class Type_Widget { return( buffer.getShort() ); } - public void setUS1( short s ) { + public void setUS1( final short s ) { buffer.position( 2 ); buffer.putShort( s ); } @@ -121,7 +121,7 @@ public class Type_Widget { return( buffer.getShort() ); } - public void setUI( int i ) { + public void setUI( final int i ) { buffer.position( 0 ); buffer.putInt( i ); } @@ -131,7 +131,7 @@ public class Type_Widget { return( buffer.getInt() ); } - public void setB0( byte b ) { + public void setB0( final byte b ) { buffer.position( 0 ); buffer.put( b ); } @@ -141,7 +141,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setB1( byte b ) { + public void setB1( final byte b ) { buffer.position( 1 ); buffer.put( b ); } @@ -151,7 +151,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setB2( byte b ) { + public void setB2( final byte b ) { buffer.position( 2 ); buffer.put( b ); } @@ -161,7 +161,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setB3( byte b ) { + public void setB3( final byte b ) { buffer.position( 3 ); buffer.put( b ); } @@ -171,7 +171,7 @@ public class Type_Widget { return( buffer.get() ); } - public void setS0( short s ) { + public void setS0( final short s ) { buffer.position( 0 ); buffer.putShort( s ); } @@ -181,7 +181,7 @@ public class Type_Widget { return( buffer.getShort() ); } - public void setS1( short s ) { + public void setS1( final short s ) { buffer.position( 2 ); buffer.putShort( s ); } @@ -191,7 +191,7 @@ public class Type_Widget { return( buffer.getShort() ); } - public void setI( int i ) { + public void setI( final int i ) { buffer.position( 0 ); buffer.putInt( i ); } @@ -201,7 +201,7 @@ public class Type_Widget { return( buffer.getInt() ); } - public void setF( float f ) { + public void setF( final float f ) { buffer.position( 0 ); buffer.putFloat( f ); } @@ -216,8 +216,8 @@ public class Type_Widget { return( buffer ); } - public static void main( String args[] ) { - Type_Widget t = new Type_Widget(); + public static void main( final String args[] ) { + final Type_Widget t = new Type_Widget(); t.setI( 1000000 ); System.out.println("int: " + Integer.toHexString( t.getI() ) ); diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java index df2b9a147..2194eb672 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Arc.java @@ -68,7 +68,7 @@ public class Arc { /** * Corresponding berizer type arc */ - private BezierArc bezierArc; + private final BezierArc bezierArc; /** * Makes new arc at specified side @@ -76,7 +76,7 @@ public class Arc { * @param side * which side doeas this arc form */ - public Arc(int side) { + public Arc(final int side) { bezierArc = null; pwlArc = null; type = 0; @@ -90,7 +90,7 @@ public class Arc { * @param side * arc side */ - private void setside(int side) { + private void setside(final int side) { // DONE clearside(); type |= side << 8; @@ -152,7 +152,7 @@ public class Arc { * arc to be append * @return this */ - public Arc append(Arc jarc) { + public Arc append(final Arc jarc) { // DONE if (jarc != null) { next = jarc.next; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java index c299b10af..68263b90d 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcSdirSorter.java @@ -45,7 +45,7 @@ public class ArcSdirSorter { * Makes new ArcSdirSorter with Subdivider * @param subdivider subdivider */ - public ArcSdirSorter(Subdivider subdivider) { + public ArcSdirSorter(final Subdivider subdivider) { //TODO // System.out.println("TODO arcsdirsorter.constructor"); } @@ -55,7 +55,7 @@ public class ArcSdirSorter { * @param list arc list to be sorted * @param count size of list */ - public void qsort(CArrayOfArcs list, int count) { + public void qsort(final CArrayOfArcs list, final int count) { // TODO // System.out.println("TODO arcsdirsorter.qsort"); } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java index 1a584c396..dcd7d9fdc 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTdirSorter.java @@ -44,7 +44,7 @@ public class ArcTdirSorter { * Makes new ArcSdirSorter with Subdivider * @param subdivider subdivider */ - public ArcTdirSorter(Subdivider subdivider) { + public ArcTdirSorter(final Subdivider subdivider) { // TODO Auto-generated constructor stub // System.out.println("TODO arcTsorter.konstruktor"); } @@ -53,7 +53,7 @@ public class ArcTdirSorter { * @param list arc list to be sorted * @param count size of list */ - public void qsort(CArrayOfArcs list, int count) { + public void qsort(final CArrayOfArcs list, final int count) { // TODO Auto-generated method stub // System.out.println("TODO arcTsorter.qsort"); } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java index bd6311414..119ccbc81 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/ArcTesselator.java @@ -49,9 +49,9 @@ public class ArcTesselator { * @param t1 minimum t param * @param t2 maximum s param */ - public void bezier(Arc arc, float s1, float s2, float t1, float t2) { + public void bezier(final Arc arc, final float s1, final float s2, final float t1, final float t2) { // DONE - TrimVertex[] p = new TrimVertex[2]; + final TrimVertex[] p = new TrimVertex[2]; p[0] = new TrimVertex(); p[1] = new TrimVertex(); arc.pwlArc = new PwlArc(2, p); @@ -70,7 +70,7 @@ public class ArcTesselator { * @param t1 third tail * @param f stepsize */ - public void pwl_right(Arc newright, float s, float t1, float t2, float f) { + public void pwl_right(final Arc newright, final float s, final float t1, final float t2, final float f) { // TODO Auto-generated method stub // System.out.println("TODO arctesselator.pwl_right"); } @@ -83,7 +83,7 @@ public class ArcTesselator { * @param t1 third tail * @param f stepsize */ - public void pwl_left(Arc newright, float s, float t2, float t1, float f) { + public void pwl_left(final Arc newright, final float s, final float t2, final float t1, final float f) { // TODO Auto-generated method stub // System.out.println("TODO arctesselator.pwl_left"); } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java index 3e974247b..bde1e2cbb 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Backend.java @@ -101,8 +101,8 @@ public abstract class Backend { * @param ulo smallest u * @param uhi highest u */ - public void curvpts(int type, CArrayOfFloats ps, int stride, int order, - float ulo, float uhi) { + public void curvpts(final int type, final CArrayOfFloats ps, final int stride, final int order, + final float ulo, final float uhi) { // DONE curveEvaluator.map1f(type, ulo, uhi, stride, order, ps); curveEvaluator.enable(type); @@ -114,7 +114,7 @@ public abstract class Backend { * @param u2 highest u * @param nu number of pieces */ - public void curvgrid(float u1, float u2, int nu) { + public void curvgrid(final float u1, final float u2, final int nu) { // DONE curveEvaluator.mapgrid1f(nu, u1, u2); @@ -125,7 +125,7 @@ public abstract class Backend { * @param from low param * @param n step */ - public void curvmesh(int from, int n) { + public void curvmesh(final int from, final int n) { // DONE curveEvaluator.mapmesh1f(N_MESHFILL, from, from + n); } @@ -135,7 +135,7 @@ public abstract class Backend { * @param wiretris use triangles * @param wirequads use quads */ - public void bgnsurf(int wiretris, int wirequads) { + public void bgnsurf(final int wiretris, final int wirequads) { // DONE surfaceEvaluator.bgnmap2f(); @@ -160,7 +160,7 @@ public abstract class Backend { * @param vlo low v param * @param vhi high v param */ - public void patch(float ulo, float uhi, float vlo, float vhi) { + public void patch(final float ulo, final float uhi, final float vlo, final float vhi) { // DONE surfaceEvaluator.domain2f(ulo, uhi, vlo, vhi); } @@ -174,7 +174,7 @@ public abstract class Backend { * @param v1 highest v * @param nv number of pieces in v direction */ - public void surfgrid(float u0, float u1, int nu, float v0, float v1, int nv) { + public void surfgrid(final float u0, final float u1, final int nu, final float v0, final float v1, final int nv) { // DONE surfaceEvaluator.mapgrid2f(nu, u0, u1, nv, v0, v1); @@ -187,7 +187,7 @@ public abstract class Backend { * @param n step in u direction * @param m step in v direction */ - public void surfmesh(int u, int v, int n, int m) { + public void surfmesh(final int u, final int v, final int n, final int m) { // System.out.println("TODO backend.surfmesh wireframequads"); // TODO wireframequads surfaceEvaluator.mapmesh2f(NurbsConsts.N_MESHFILL, u, u + n, v, v + m); @@ -206,8 +206,8 @@ public abstract class Backend { * @param vlo lowest v * @param vhi hightest v */ - public void surfpts(int type, CArrayOfFloats pts, int ustride, int vstride, - int uorder, int vorder, float ulo, float uhi, float vlo, float vhi) { + public void surfpts(final int type, final CArrayOfFloats pts, final int ustride, final int vstride, + final int uorder, final int vorder, final float ulo, final float uhi, final float vlo, final float vhi) { // DONE surfaceEvaluator.map2f(type, ulo, uhi, ustride, uorder, vlo, vhi, vstride, vorder, pts); diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java index 17437ef01..638b018c9 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Bin.java @@ -64,7 +64,7 @@ public class Bin { * Adds and arc to linked list * @param jarc added arc */ - public void addarc(Arc jarc) { + public void addarc(final Arc jarc) { // DONE // if (head == null) // head = jarc; @@ -93,7 +93,7 @@ public class Bin { */ public Arc removearc() { // DONE - Arc jarc = head; + final Arc jarc = head; if (jarc != null) head = jarc.link; return jarc; @@ -147,7 +147,7 @@ public class Bin { */ private Arc nextarc() { // DONE - Arc jarc = current; + final Arc jarc = current; if (jarc != null) current = jarc.link; return jarc; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfArcs.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfArcs.java index b67764c30..6d2ab362b 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfArcs.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfArcs.java @@ -20,7 +20,7 @@ public class CArrayOfArcs { /** * Don't check for array borders? */ - private boolean noCheck = true; + private final boolean noCheck = true; /** * Makes new CArray @@ -30,7 +30,7 @@ public class CArrayOfArcs { * @param pointer * pointer (index) to array */ - public CArrayOfArcs(Arc[] array, int pointer) { + public CArrayOfArcs(final Arc[] array, final int pointer) { this.array = array; // this.pointer=pointer; setPointer(pointer); @@ -42,7 +42,7 @@ public class CArrayOfArcs { * @param carray * reference array */ - public CArrayOfArcs(CArrayOfArcs carray) { + public CArrayOfArcs(final CArrayOfArcs carray) { this.array = carray.array; // this.pointer=carray.pointer; setPointer(carray.pointer); @@ -54,7 +54,7 @@ public class CArrayOfArcs { * @param ctlarray * underlaying array */ - public CArrayOfArcs(Arc[] ctlarray) { + public CArrayOfArcs(final Arc[] ctlarray) { this.array = ctlarray; this.pointer = 0; } @@ -82,7 +82,7 @@ public class CArrayOfArcs { * @param f * desired value */ - public void set(Arc f) { + public void set(final Arc f) { array[pointer] = f; } @@ -94,7 +94,7 @@ public class CArrayOfArcs { * array index * @return element at index */ - public Arc get(int i) { + public Arc get(final int i) { return array[i]; } @@ -105,7 +105,7 @@ public class CArrayOfArcs { * relative index * @return element at relative index */ - public Arc getRelative(int i) { + public Arc getRelative(final int i) { return array[pointer + i]; } @@ -117,7 +117,7 @@ public class CArrayOfArcs { * @param value * value to be set */ - public void setRelative(int i, Arc value) { + public void setRelative(final int i, final Arc value) { array[pointer + i] = value; } @@ -127,7 +127,7 @@ public class CArrayOfArcs { * @param i * lessen by */ - public void lessenPointerBy(int i) { + public void lessenPointerBy(final int i) { // pointer-=i; setPointer(pointer - i); } @@ -147,7 +147,7 @@ public class CArrayOfArcs { * @param pointer * pointer value to be set */ - public void setPointer(int pointer) { + public void setPointer(final int pointer) { if (!noCheck && pointer > array.length) throw new IllegalArgumentException("Pointer " + pointer + " out of bounds " + array.length); @@ -160,7 +160,7 @@ public class CArrayOfArcs { * @param i * raise by */ - public void raisePointerBy(int i) { + public void raisePointerBy(final int i) { // pointer+=i; setPointer(pointer + i); } @@ -188,7 +188,7 @@ public class CArrayOfArcs { * @param array * underlaying array */ - public void setArray(Arc[] array) { + public void setArray(final Arc[] array) { this.array = array; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java index b5f588960..1c80289a3 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfBreakpts.java @@ -10,7 +10,7 @@ public class CArrayOfBreakpts { /** * Underlaying array */ - private Breakpt[] pole; + private final Breakpt[] pole; /** * Pointer to array member @@ -25,7 +25,7 @@ public class CArrayOfBreakpts { * @param pointer * pointer (index) to array */ - public CArrayOfBreakpts(Breakpt[] array, int pointer) { + public CArrayOfBreakpts(final Breakpt[] array, final int pointer) { this.pole = array; this.pointer = pointer; } @@ -36,7 +36,7 @@ public class CArrayOfBreakpts { * @param carray * reference array */ - public CArrayOfBreakpts(CArrayOfBreakpts carray) { + public CArrayOfBreakpts(final CArrayOfBreakpts carray) { this.pole = carray.pole; this.pointer = carray.pointer; } @@ -63,7 +63,7 @@ public class CArrayOfBreakpts { * @param f * desired value */ - public void set(Breakpt f) { + public void set(final Breakpt f) { pole[pointer] = f; } @@ -75,7 +75,7 @@ public class CArrayOfBreakpts { * array index * @return element at index */ - public Breakpt get(int i) { + public Breakpt get(final int i) { return pole[i]; } @@ -85,7 +85,7 @@ public class CArrayOfBreakpts { * @param i * lessen by */ - public void lessenPointerBy(int i) { + public void lessenPointerBy(final int i) { pointer -= i; } @@ -105,7 +105,7 @@ public class CArrayOfBreakpts { * @param pointer * pointer value to be set */ - public void setPointer(int pointer) { + public void setPointer(final int pointer) { this.pointer = pointer; } @@ -115,7 +115,7 @@ public class CArrayOfBreakpts { * @param i * raise by */ - public void raisePointerBy(int i) { + public void raisePointerBy(final int i) { pointer += i; } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java index d9e4d0ff1..c9d6a59ad 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfFloats.java @@ -21,7 +21,7 @@ public class CArrayOfFloats { /** * Don't check for array borders? */ - private boolean noCheck = true; + private final boolean noCheck = true; /** * Makes new CArray @@ -31,7 +31,7 @@ public class CArrayOfFloats { * @param pointer * pointer (index) to array */ - public CArrayOfFloats(float[] array, int pointer) { + public CArrayOfFloats(final float[] array, final int pointer) { this.array = array; // this.pointer=pointer; setPointer(pointer); @@ -43,7 +43,7 @@ public class CArrayOfFloats { * @param carray * reference array */ - public CArrayOfFloats(CArrayOfFloats carray) { + public CArrayOfFloats(final CArrayOfFloats carray) { this.array = carray.array; // this.pointer=carray.pointer; setPointer(carray.pointer); @@ -55,7 +55,7 @@ public class CArrayOfFloats { * @param ctlarray * underlaying array */ - public CArrayOfFloats(float[] ctlarray) { + public CArrayOfFloats(final float[] ctlarray) { this.array = ctlarray; this.pointer = 0; } @@ -83,7 +83,7 @@ public class CArrayOfFloats { * @param f * desired value */ - public void set(float f) { + public void set(final float f) { array[pointer] = f; } @@ -95,7 +95,7 @@ public class CArrayOfFloats { * array index * @return element at index */ - public float get(int i) { + public float get(final int i) { return array[i]; } @@ -106,7 +106,7 @@ public class CArrayOfFloats { * relative index * @return element at relative index */ - public float getRelative(int i) { + public float getRelative(final int i) { return array[pointer + i]; } @@ -118,7 +118,7 @@ public class CArrayOfFloats { * @param value * value to be set */ - public void setRelative(int i, float value) { + public void setRelative(final int i, final float value) { array[pointer + i] = value; } @@ -128,7 +128,7 @@ public class CArrayOfFloats { * @param i * lessen by */ - public void lessenPointerBy(int i) { + public void lessenPointerBy(final int i) { // pointer-=i; setPointer(pointer - i); } @@ -148,7 +148,7 @@ public class CArrayOfFloats { * @param pointer * pointer value to be set */ - public void setPointer(int pointer) { + public void setPointer(final int pointer) { if (!noCheck && pointer > array.length) throw new IllegalArgumentException("Pointer " + pointer + " out of bounds " + array.length); @@ -161,7 +161,7 @@ public class CArrayOfFloats { * @param i * raise by */ - public void raisePointerBy(int i) { + public void raisePointerBy(final int i) { // pointer+=i; setPointer(pointer + i); } @@ -189,7 +189,7 @@ public class CArrayOfFloats { * @param array * underlaying array */ - public void setArray(float[] array) { + public void setArray(final float[] array) { this.array = array; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfQuiltspecs.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfQuiltspecs.java index e7bbac16a..0d769004a 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfQuiltspecs.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/CArrayOfQuiltspecs.java @@ -25,7 +25,7 @@ public class CArrayOfQuiltspecs { * @param pointer * pointer (index) to array */ - public CArrayOfQuiltspecs(Quiltspec[] array, int pointer) { + public CArrayOfQuiltspecs(final Quiltspec[] array, final int pointer) { this.array = array; this.pointer = pointer; } @@ -36,7 +36,7 @@ public class CArrayOfQuiltspecs { * @param carray * reference array */ - public CArrayOfQuiltspecs(CArrayOfQuiltspecs carray) { + public CArrayOfQuiltspecs(final CArrayOfQuiltspecs carray) { this.array = carray.array; this.pointer = carray.pointer; } @@ -47,7 +47,7 @@ public class CArrayOfQuiltspecs { * @param array * underlaying array */ - public CArrayOfQuiltspecs(Quiltspec[] array) { + public CArrayOfQuiltspecs(final Quiltspec[] array) { this.array = array; this.pointer = 0; } @@ -74,7 +74,7 @@ public class CArrayOfQuiltspecs { * @param f * desired value */ - public void set(Quiltspec f) { + public void set(final Quiltspec f) { array[pointer] = f; } @@ -86,7 +86,7 @@ public class CArrayOfQuiltspecs { * array index * @return element at index */ - public Quiltspec get(int i) { + public Quiltspec get(final int i) { return array[i]; } @@ -96,7 +96,7 @@ public class CArrayOfQuiltspecs { * @param i * lessen by */ - public void lessenPointerBy(int i) { + public void lessenPointerBy(final int i) { pointer -= i; } @@ -116,7 +116,7 @@ public class CArrayOfQuiltspecs { * @param pointer * pointer value to be set */ - public void setPointer(int pointer) { + public void setPointer(final int pointer) { this.pointer = pointer; } @@ -126,7 +126,7 @@ public class CArrayOfQuiltspecs { * @param i * raise by */ - public void raisePointerBy(int i) { + public void raisePointerBy(final int i) { pointer += i; } @@ -154,7 +154,7 @@ public class CArrayOfQuiltspecs { * @param array * underlaying array */ - public void setArray(Quiltspec[] array) { + public void setArray(final Quiltspec[] array) { this.array = array; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java index ea3a3d14e..5fccbc598 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curve.java @@ -59,32 +59,32 @@ public class Curve { /** * OpenGL maps */ - private Mapdesc mapdesc; + private final Mapdesc mapdesc; /** * Does the curve need sampling */ - private boolean needsSampling; + private final boolean needsSampling; /** * Culling */ - private int cullval; + private final int cullval; /** * Number of coords */ - private int stride; + private final int stride; /** * Curve order */ - private int order; + private final int order; /** * Holds conversion range borders */ - private float[] range; + private final float[] range; /** * Subdivision stepsize @@ -110,7 +110,7 @@ public class Curve { * @param c * next curve in linked list */ - public Curve(Quilt geo, float[] pta, float[] ptb, Curve c) { + public Curve(final Quilt geo, final float[] pta, final float[] ptb, final Curve c) { spts = new float[MAXORDER * MAXCOORDS]; @@ -125,8 +125,8 @@ public class Curve { stride = MAXCOORDS; // CArrayOfFloats ps = geo.cpts; - CArrayOfFloats ps = new CArrayOfFloats(geo.cpts.getArray(), 0); - CArrayOfQuiltspecs qs = geo.qspec; + final CArrayOfFloats ps = new CArrayOfFloats(geo.cpts.getArray(), 0); + final CArrayOfQuiltspecs qs = geo.qspec; ps.raisePointerBy(qs.get().offset); ps.raisePointerBy(qs.get().index * qs.get().order * qs.get().stride); @@ -182,11 +182,11 @@ public class Curve { } else { assert (order <= MAXORDER); - float tmp[][] = new float[MAXORDER][MAXCOORDS]; + final float tmp[][] = new float[MAXORDER][MAXCOORDS]; - int tstride = (MAXORDER); + final int tstride = (MAXORDER); - int val = 0; + final int val = 0; // mapdesc.project(spts,stride,tmp,tstride,order); // System.out.println("TODO curve.getsptepsize mapdesc.project"); @@ -194,7 +194,7 @@ public class Curve { if (val == 0) { setstepsize(mapdesc.maxrate); } else { - float t = mapdesc.getProperty(NurbsConsts.N_PIXEL_TOLERANCE); + final float t = mapdesc.getProperty(NurbsConsts.N_PIXEL_TOLERANCE); if (mapdesc.isParametricDistanceSampling()) { // System.out.println("TODO curve.getstepsize - parametric"); } else if (mapdesc.isPathLengthSampling()) { @@ -212,7 +212,7 @@ public class Curve { * Sets maximum subdivision step size * @param max maximum subdivision step size */ - private void setstepsize(float max) { + private void setstepsize(final float max) { // DONE stepsize = (max >= 1) ? (range[2] / max) : range[2]; minstepsize = stepsize; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curvelist.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curvelist.java index 80baf207b..96081a8ec 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Curvelist.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Curvelist.java @@ -67,7 +67,7 @@ public class Curvelist { * @param pta range start * @param ptb range end */ - public Curvelist(Quilt qlist, float[] pta, float[] ptb) { + public Curvelist(final Quilt qlist, final float[] pta, final float[] ptb) { // DONE curve = null; range = new float[3]; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java index d9d012606..e1b4cb2bb 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/DisplayList.java @@ -49,7 +49,7 @@ public class DisplayList { * @param m invoked method * @param arg method argument */ - public void append(Object src, Method m, Object arg) { + public void append(final Object src, final Method m, final Object arg) { // TODO Auto-generated method stub // System.out.println("TODO displaylist append"); } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Flist.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Flist.java index f9c4c2d6f..30f52d5cc 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Flist.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Flist.java @@ -68,7 +68,7 @@ public class Flist { * Grows list * @param maxpts maximum desired size */ - public void grow(int maxpts) { + public void grow(final int maxpts) { // DONE if (npts < maxpts) { // npts=2*maxpts; @@ -106,7 +106,7 @@ public class Flist { * @param from start from * @param to end at */ - public void taper(float from, float to) { + public void taper(final float from, final float to) { // DONE while (pts[start] != from) { @@ -123,7 +123,7 @@ public class Flist { * Adds breakpoint value * @param f value */ - public void add(float f) { + public void add(final float f) { //DONE pts[end++] = f; } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java index 1dcf393a9..b7fa722ec 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotspec.java @@ -175,7 +175,7 @@ public class Knotspec { break; } - CArrayOfFloats k = new CArrayOfFloats(kfirst); + final CArrayOfFloats k = new CArrayOfFloats(kfirst); k.mm(); for (; k.getPointer() >= inkbegin.getPointer(); k.mm()) @@ -183,7 +183,7 @@ public class Knotspec { break; k.pp(); - Breakpt[] bbeginArray = new Breakpt[(klast.getPointer() - kfirst + final Breakpt[] bbeginArray = new Breakpt[(klast.getPointer() - kfirst .getPointer()) + 1]; for (int i = 0; i < bbeginArray.length; i++) bbeginArray[i] = new Breakpt(); @@ -218,7 +218,7 @@ public class Knotspec { */ private void factors() { // DONE - CArrayOfFloats mid = new CArrayOfFloats(outkend.getArray(), (outkend + final CArrayOfFloats mid = new CArrayOfFloats(outkend.getArray(), (outkend .getPointer() - 1) - order + bend.get().multi); @@ -226,18 +226,18 @@ public class Knotspec { if (sbegin != null) fptr = new CArrayOfFloats(sbegin); - for (CArrayOfBreakpts bpt = new CArrayOfBreakpts(bend); bpt + for (final CArrayOfBreakpts bpt = new CArrayOfBreakpts(bend); bpt .getPointer() >= bbegin.getPointer(); bpt.mm()) { mid.lessenPointerBy(bpt.get().multi); - int def = bpt.get().def - 1; + final int def = bpt.get().def - 1; if (def < 0) continue; - float kv = bpt.get().value; + final float kv = bpt.get().value; - CArrayOfFloats kf = new CArrayOfFloats(mid.getArray(), (mid + final CArrayOfFloats kf = new CArrayOfFloats(mid.getArray(), (mid .getPointer() - def) + (order - 1)); - for (CArrayOfFloats kl = new CArrayOfFloats(kf.getArray(), kf + for (final CArrayOfFloats kl = new CArrayOfFloats(kf.getArray(), kf .getPointer() + def); kl.getPointer() != kf.getPointer(); kl.mm()) { CArrayOfFloats kh, kt; @@ -257,10 +257,10 @@ public class Knotspec { */ private void knots() { // DONE - CArrayOfFloats inkpt = new CArrayOfFloats(kleft.getArray(), kleft + final CArrayOfFloats inkpt = new CArrayOfFloats(kleft.getArray(), kleft .getPointer() - order); - CArrayOfFloats inkend = new CArrayOfFloats(kright.getArray(), kright + final CArrayOfFloats inkend = new CArrayOfFloats(kright.getArray(), kright .getPointer() + bend.get().def); @@ -279,8 +279,8 @@ public class Knotspec { */ private void breakpoints() { // DONE - CArrayOfBreakpts ubpt = new CArrayOfBreakpts(bbegin); - CArrayOfBreakpts ubend = new CArrayOfBreakpts(bend); + final CArrayOfBreakpts ubpt = new CArrayOfBreakpts(bbegin); + final CArrayOfBreakpts ubend = new CArrayOfBreakpts(bend); int nfactors = 0; ubpt.get().value = ubend.get().value; @@ -320,13 +320,13 @@ public class Knotspec { * @param _outpt * output control points */ - public void copy(CArrayOfFloats _inpt, CArrayOfFloats _outpt) { - CArrayOfFloats inpt = new CArrayOfFloats(_inpt); - CArrayOfFloats outpt = new CArrayOfFloats(_outpt); + public void copy(final CArrayOfFloats _inpt, final CArrayOfFloats _outpt) { + final CArrayOfFloats inpt = new CArrayOfFloats(_inpt); + final CArrayOfFloats outpt = new CArrayOfFloats(_outpt); inpt.raisePointerBy(preoffset); if (next != null) { - for (CArrayOfFloats lpt = new CArrayOfFloats(outpt.getArray(), + for (final CArrayOfFloats lpt = new CArrayOfFloats(outpt.getArray(), outpt.getPointer() + prewidth); outpt.getPointer() != lpt .getPointer(); outpt.raisePointerBy(poststride)) { next.copy(inpt, outpt); @@ -334,7 +334,7 @@ public class Knotspec { } } else { - for (CArrayOfFloats lpt = new CArrayOfFloats(outpt.getArray(), + for (final CArrayOfFloats lpt = new CArrayOfFloats(outpt.getArray(), outpt.getPointer() + prewidth); outpt.getPointer() != lpt .getPointer(); outpt.raisePointerBy(poststride)) { pt_io_copy(outpt, inpt); @@ -352,7 +352,7 @@ public class Knotspec { * @param frompt * destination control point */ - private void pt_io_copy(CArrayOfFloats topt, CArrayOfFloats frompt) { + private void pt_io_copy(final CArrayOfFloats topt, final CArrayOfFloats frompt) { // DONE switch (ncoords) { case 4: @@ -378,8 +378,8 @@ public class Knotspec { * @param _p * inserted knot */ - public void transform(CArrayOfFloats _p) { - CArrayOfFloats p = new CArrayOfFloats(_p); + public void transform(final CArrayOfFloats _p) { + final CArrayOfFloats p = new CArrayOfFloats(_p); // DONE if (next != null) {//surface code if (this.equals(kspectotrans)) { @@ -387,13 +387,13 @@ public class Knotspec { } else { if (istransformed) { p.raisePointerBy(postoffset); - for (CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), + for (final CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), p.getPointer() + postwidth); p.getPointer() != pend .getPointer(); p.raisePointerBy(poststride)) next.transform(p); } else { - CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), p + final CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), p .getPointer() + prewidth); for (; p.getPointer() != pend.getPointer(); p @@ -408,13 +408,13 @@ public class Knotspec { } else { if (istransformed) { p.raisePointerBy(postoffset); - for (CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), + for (final CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), p.getPointer() + postwidth); p.getPointer() != pend .getPointer(); p.raisePointerBy(poststride)) { kspectotrans.insert(p); } } else { - CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), p + final CArrayOfFloats pend = new CArrayOfFloats(p.getArray(), p .getPointer() + prewidth); for (; p.getPointer() != pend.getPointer(); p @@ -432,27 +432,27 @@ public class Knotspec { * @param p * inserted knot */ - private void insert(CArrayOfFloats p) { + private void insert(final CArrayOfFloats p) { // DONE CArrayOfFloats fptr = null; if (sbegin != null) fptr = new CArrayOfFloats(sbegin); - CArrayOfFloats srcpt = new CArrayOfFloats(p.getArray(), p.getPointer() + final CArrayOfFloats srcpt = new CArrayOfFloats(p.getArray(), p.getPointer() + prewidth - poststride); // CArrayOfFloats srcpt = new CArrayOfFloats(p.getArray(), prewidth - // poststride); - CArrayOfFloats dstpt = new CArrayOfFloats(p.getArray(), p.getPointer() + final CArrayOfFloats dstpt = new CArrayOfFloats(p.getArray(), p.getPointer() + postwidth + postoffset - poststride); // CArrayOfFloats dstpt = new CArrayOfFloats(p.getArray(), postwidth + // postoffset - poststride); - CArrayOfBreakpts bpt = new CArrayOfBreakpts(bend); + final CArrayOfBreakpts bpt = new CArrayOfBreakpts(bend); - for (CArrayOfFloats pend = new CArrayOfFloats(srcpt.getArray(), srcpt + for (final CArrayOfFloats pend = new CArrayOfFloats(srcpt.getArray(), srcpt .getPointer() - poststride * bpt.get().def); srcpt.getPointer() != pend .getPointer(); pend.raisePointerBy(poststride)) { - CArrayOfFloats p1 = new CArrayOfFloats(srcpt); - for (CArrayOfFloats p2 = new CArrayOfFloats(srcpt.getArray(), srcpt + final CArrayOfFloats p1 = new CArrayOfFloats(srcpt); + for (final CArrayOfFloats p2 = new CArrayOfFloats(srcpt.getArray(), srcpt .getPointer() - poststride); p2.getPointer() != pend.getPointer(); p1 .setPointer(p2.getPointer()), p2 @@ -469,15 +469,15 @@ public class Knotspec { dstpt.lessenPointerBy(poststride); srcpt.lessenPointerBy(poststride); } - for (CArrayOfFloats pend = new CArrayOfFloats(srcpt.getArray(), + for (final CArrayOfFloats pend = new CArrayOfFloats(srcpt.getArray(), srcpt.getPointer() - poststride * bpt.get().def); srcpt .getPointer() != pend.getPointer(); pend .raisePointerBy(poststride), dstpt .lessenPointerBy(poststride)) { pt_oo_copy(dstpt, srcpt); - CArrayOfFloats p1 = new CArrayOfFloats(srcpt); + final CArrayOfFloats p1 = new CArrayOfFloats(srcpt); - for (CArrayOfFloats p2 = new CArrayOfFloats(srcpt.getArray(), + for (final CArrayOfFloats p2 = new CArrayOfFloats(srcpt.getArray(), srcpt.getPointer() - poststride); p2.getPointer() != pend .getPointer(); p1.setPointer(p2.getPointer()), p2 .lessenPointerBy(poststride)) { @@ -496,7 +496,7 @@ public class Knotspec { * @param frompt * distance ctrl point */ - private void pt_oo_copy(CArrayOfFloats topt, CArrayOfFloats frompt) { + private void pt_oo_copy(final CArrayOfFloats topt, final CArrayOfFloats frompt) { // DONE // this is a "trick" with case - "break" is omitted so it comes through all cases switch (ncoords) { @@ -531,8 +531,8 @@ public class Knotspec { * @param b * 1 - alpha */ - private void pt_oo_sum(CArrayOfFloats x, CArrayOfFloats y, - CArrayOfFloats z, float a, double b) { + private void pt_oo_sum(final CArrayOfFloats x, final CArrayOfFloats y, + final CArrayOfFloats z, final float a, final double b) { // DONE switch (ncoords) { case 4: diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java index 571f44f06..76b59231c 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Knotvector.java @@ -85,7 +85,7 @@ public class Knotvector { * @param knot * knots */ - public Knotvector(int nknots, int stride, int order, float[] knot) { + public Knotvector(final int nknots, final int stride, final int order, final float[] knot) { // DONE init(nknots, stride, order, knot); } @@ -102,7 +102,7 @@ public class Knotvector { * @param knot * knots */ - public void init(int nknots, int stride, int order, float[] knot) { + public void init(final int nknots, final int stride, final int order, final float[] knot) { // DONE this.knotcount = nknots; this.stride = stride; @@ -158,7 +158,7 @@ public class Knotvector { * @param msg * message to be shown */ - public void show(String msg) { + public void show(final String msg) { // TODO Auto-generated method stub // System.out.println("TODO knotvector.show"); @@ -173,7 +173,7 @@ public class Knotvector { * second knot * @return knots are/are not equal */ - public static boolean identical(float a, float b) { + public static boolean identical(final float a, final float b) { return ((a - b) < TOLERANCE) ? true : false; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java index 86638a827..95ce60c25 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Mapdesc.java @@ -64,22 +64,22 @@ public class Mapdesc { /** * Map type */ - private int type; + private final int type; /** * Number of homogenous coords */ - private int hcoords; + private final int hcoords; /** * Number of inhomogenous coords */ - private int inhcoords; + private final int inhcoords; /** * Not used */ - private int mask; + private final int mask; /** * Value of N_PIXEL_TOLERANCE property @@ -144,22 +144,22 @@ public class Mapdesc { /** * Not used */ - private float[][] bmat; + private final float[][] bmat; /** * Sampling matrix */ - private float[][] smat; + private final float[][] smat; /** * Not used */ - private float[][] cmat; + private final float[][] cmat; /** * Not used */ - private float[] bboxsize; + private final float[] bboxsize; /** * Makes new mapdesc @@ -168,7 +168,7 @@ public class Mapdesc { * @param ncoords number of control points coords * @param backend backend object */ - public Mapdesc(int type, int rational, int ncoords, Backend backend) { + public Mapdesc(final int type, final int rational, final int ncoords, final Backend backend) { // DONE this.type = type; this.isrational = rational; @@ -210,7 +210,7 @@ public class Mapdesc { * Make matrix identity matrix * @param arr matrix */ - private void identify(float[][] arr) { + private void identify(final float[][] arr) { // DONE for (int i = 0; i < MAXCOORDS; i++) for (int j = 0; j < MAXCOORDS; j++) @@ -225,7 +225,7 @@ public class Mapdesc { * @param tag property tag * @return is/is not property */ - public boolean isProperty(int tag) { + public boolean isProperty(final int tag) { boolean ret; switch (tag) { case NurbsConsts.N_PIXEL_TOLERANCE: @@ -347,7 +347,7 @@ public class Mapdesc { * @param tag property tag * @return property value */ - public float getProperty(int tag) { + public float getProperty(final int tag) { // TODO Auto-generated method stub // System.out.println("TODO mapdesc.getproperty"); return 0; @@ -358,7 +358,7 @@ public class Mapdesc { * @param tag property tag * @param value desired value */ - public void setProperty(int tag, float value) { + public void setProperty(final int tag, float value) { // TODO Auto-generated method stub switch (tag) { case NurbsConsts.N_PIXEL_TOLERANCE: @@ -412,8 +412,8 @@ public class Mapdesc { * @param sp breakpoints * @param outstride output number of control points' coordinates */ - public void xformSampling(CArrayOfFloats pts, int order, int stride, - float[] sp, int outstride) { + public void xformSampling(final CArrayOfFloats pts, final int order, final int stride, + final float[] sp, final int outstride) { // DONE xFormMat(smat, pts, order, stride, sp, outstride); } @@ -427,8 +427,8 @@ public class Mapdesc { * @param cp breakpoints * @param outstride output number of control points' coordinates */ - private void xFormMat(float[][] mat, CArrayOfFloats pts, int order, - int stride, float[] cp, int outstride) { + private void xFormMat(final float[][] mat, final CArrayOfFloats pts, final int order, + final int stride, final float[] cp, final int outstride) { // TODO Auto-generated method stub // System.out.println("TODO mapdsc.xformmat ; change cp from float[] to carrayoffloats"); diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Maplist.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Maplist.java index af8024109..7f9d7c5a0 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Maplist.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Maplist.java @@ -48,13 +48,13 @@ public class Maplist { /** * Backend class */ - private Backend backend; + private final Backend backend; /** * Makes new Maplist * @param backend Backend class */ - public Maplist(Backend backend) { + public Maplist(final Backend backend) { this.backend = backend; } @@ -72,9 +72,9 @@ public class Maplist { * @param rational is map rational * @param ncoords number of coords */ - public void define(int type, int rational, int ncoords) { + public void define(final int type, final int rational, final int ncoords) { // DONE - Mapdesc m = locate(type); + final Mapdesc m = locate(type); assert (m == null || (m.isrational == rational && m.ncoords == ncoords)); add(type, rational, ncoords); @@ -86,9 +86,9 @@ public class Maplist { * @param rational is map rational * @param ncoords number of coords */ - private void add(int type, int rational, int ncoords) { + private void add(final int type, final int rational, final int ncoords) { // DONE - Mapdesc map = new Mapdesc(type, rational, ncoords, backend); + final Mapdesc map = new Mapdesc(type, rational, ncoords, backend); if (maps == null) { maps = map; } else { @@ -102,7 +102,7 @@ public class Maplist { * @param type map type * @return Mapdesc of type or null if there is no such map */ - public Mapdesc locate(int type) { + public Mapdesc locate(final int type) { // DONE Mapdesc m = null; for (m = maps; m != null; m = m.next) @@ -116,7 +116,7 @@ public class Maplist { * @param type maptype * @return Mapdesc of type or null if there is no such map */ - public Mapdesc find(int type) { + public Mapdesc find(final int type) { return locate(type); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbscurve.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbscurve.java index a686da696..a957c21a8 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbscurve.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbscurve.java @@ -70,7 +70,7 @@ public class O_nurbscurve { * Makes new O_nurbscurve * @param realType type of curve */ - public O_nurbscurve(int realType) { + public O_nurbscurve(final int realType) { // DONE this.type = realType; this.owner = null; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbssurface.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbssurface.java index 867f43657..4df3c14ca 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbssurface.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/O_nurbssurface.java @@ -64,13 +64,13 @@ public class O_nurbssurface { /** * Surface type */ - private int type; + private final int type; /** * Makes new O_nurbssurface of type * @param type surface type */ - public O_nurbssurface(int type) { + public O_nurbssurface(final int type) { this.type = type; this.owner = null; this.next = null; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java index a44f2451c..0fd4baa81 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patch.java @@ -48,7 +48,7 @@ public class Patch { * @param ptb * @param patch */ - public Patch(Quilt q, float[] pta, float[] ptb, Patch patch) { + public Patch(final Quilt q, final float[] pta, final float[] ptb, final Patch patch) { // System.out.println("TODO patch.constructor"); } } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java index 240c905a2..68b01d8d0 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Patchlist.java @@ -57,7 +57,7 @@ public class Patchlist { * @param pta low border * @param ptb high border */ - public Patchlist(Quilt quilts, float[] pta, float[] ptb) { + public Patchlist(final Quilt quilts, final float[] pta, final float[] ptb) { // DONE patch = null; @@ -81,7 +81,7 @@ public class Patchlist { * @param param * @param mid */ - public Patchlist(Patchlist patchlist, int param, float mid) { + public Patchlist(final Patchlist patchlist, final int param, final float mid) { // TODO Auto-generated constructor stub // System.out.println("TODO patchlist.konstruktor 2"); } @@ -120,7 +120,7 @@ public class Patchlist { * @param i * @return false */ - public boolean needsSubdivision(int i) { + public boolean needsSubdivision(final int i) { // TODO Auto-generated method stub // System.out.println("TODO patchlist.needsSubdivision"); return false; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Property.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Property.java index 79f36ce43..155549bce 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Property.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Property.java @@ -67,7 +67,7 @@ public class Property { * @param value * property value */ - public Property(int type, int tag, float value) { + public Property(final int type, final int tag, final float value) { this.type = type; this.tag = tag; this.value = value; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/PwlArc.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/PwlArc.java index bcbd20a16..8e04baf88 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/PwlArc.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/PwlArc.java @@ -44,7 +44,7 @@ public class PwlArc { /** * Number of points */ - private int npts; + private final int npts; /** * Vertexes @@ -54,14 +54,14 @@ public class PwlArc { /** * Arc type */ - private int type; + private final int type; /** * Makes new trimming arc * @param i num ber of vertexes * @param p trimming vertexes array */ - public PwlArc(int i, TrimVertex[] p) { + public PwlArc(final int i, final TrimVertex[] p) { // DONE this.npts = i; this.pts = p; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java index 6bea4928c..2e2532a35 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Quilt.java @@ -74,10 +74,10 @@ public class Quilt { * Makes new quilt with mapdesc * @param mapdesc map description */ - public Quilt(Mapdesc mapdesc) { + public Quilt(final Mapdesc mapdesc) { // DONE this.mapdesc = mapdesc; - Quiltspec[] tmpquilts = new Quiltspec[MAXDIM]; + final Quiltspec[] tmpquilts = new Quiltspec[MAXDIM]; for (int i = 0; i < tmpquilts.length; i++) tmpquilts[i] = new Quiltspec(); this.qspec = new CArrayOfQuiltspecs(tmpquilts); @@ -91,9 +91,9 @@ public class Quilt { * @param ctrlarr control points * @param coords control points coords */ - public void toBezier(Knotvector sknotvector, Knotvector tknotvector, - CArrayOfFloats ctrlarr, int coords) { - Splinespec spline = new Splinespec(2); + public void toBezier(final Knotvector sknotvector, final Knotvector tknotvector, + final CArrayOfFloats ctrlarr, final int coords) { + final Splinespec spline = new Splinespec(2); spline.kspecinit(sknotvector, tknotvector); spline.select(); spline.layout(coords); @@ -108,9 +108,9 @@ public class Quilt { * @param ctlarray control points * @param ncoords number of coordinates */ - public void toBezier(Knotvector knots, CArrayOfFloats ctlarray, int ncoords) { + public void toBezier(final Knotvector knots, final CArrayOfFloats ctlarray, final int ncoords) { // DONE - Splinespec spline = new Splinespec(1); + final Splinespec spline = new Splinespec(1); spline.kspecinit(knots); spline.select(); spline.layout(ncoords); @@ -125,7 +125,7 @@ public class Quilt { * @param ptb high border * @param backend Backend */ - public void downloadAll(float[] pta, float[] ptb, Backend backend) { + public void downloadAll(final float[] pta, final float[] ptb, final Backend backend) { // DONE for (Quilt m = this; m != null; m = m.next) { m.select(pta, ptb); @@ -138,11 +138,11 @@ public class Quilt { * Renders arcs/patches * @param backend Backend for rendering */ - private void download(Backend backend) { + private void download(final Backend backend) { // DONE if (getDimension() == 2) { - CArrayOfFloats ps = new CArrayOfFloats(cpts); + final CArrayOfFloats ps = new CArrayOfFloats(cpts); ps.raisePointerBy(qspec.get(0).offset); ps.raisePointerBy(qspec.get(1).offset); ps.raisePointerBy(qspec.get(0).index * qspec.get(0).order @@ -159,7 +159,7 @@ public class Quilt { } else {// code for curves // CArrayOfFloats ps=new CArrayOfFloats(cpts); - CArrayOfFloats ps = new CArrayOfFloats(cpts.getArray(), 0); + final CArrayOfFloats ps = new CArrayOfFloats(cpts.getArray(), 0); ps.raisePointerBy(qspec.get(0).offset); ps.raisePointerBy(qspec.get(0).index * qspec.get(0).order * qspec.get(0).stride); @@ -185,9 +185,9 @@ public class Quilt { * @param pta range * @param ptb range */ - private void select(float[] pta, float[] ptb) { + private void select(final float[] pta, final float[] ptb) { // DONE - int dim = eqspec.getPointer() - qspec.getPointer(); + final int dim = eqspec.getPointer() - qspec.getPointer(); int i, j; for (i = 0; i < dim; i++) { for (j = qspec.get(i).width - 1; j >= 0; j--) @@ -205,7 +205,7 @@ public class Quilt { * @param to high param * @param bpts breakpoints */ - public void getRange(float[] from, float[] to, Flist bpts) { + public void getRange(final float[] from, final float[] to, final Flist bpts) { // DONE getRange(from, to, 0, bpts); @@ -218,9 +218,9 @@ public class Quilt { * @param i from/to array index * @param list breakpoints */ - private void getRange(float[] from, float[] to, int i, Flist list) { + private void getRange(final float[] from, final float[] to, final int i, final Flist list) { // DONE - Quilt maps = this; + final Quilt maps = this; from[i] = maps.qspec.get(i).breakpoints[0]; to[i] = maps.qspec.get(i).breakpoints[maps.qspec.get(i).width]; int maxpts = 0; @@ -262,7 +262,7 @@ public class Quilt { * @param slist u direction breakpoints * @param tlist v direction breakpoints */ - public void getRange(float[] from, float[] to, Flist slist, Flist tlist) { + public void getRange(final float[] from, final float[] to, final Flist slist, final Flist tlist) { // DONE getRange(from, to, 0, slist); getRange(from, to, 1, tlist); @@ -275,7 +275,7 @@ public class Quilt { * @param tbrkpts * @param rate */ - public void findRates(Flist sbrkpts, Flist tbrkpts, float[] rate) { + public void findRates(final Flist sbrkpts, final Flist tbrkpts, final float[] rate) { // TODO Auto-generated method stub // System.out.println("TODO quilt.findrates"); } diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Renderhints.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Renderhints.java index 7c636122f..5c180f345 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Renderhints.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Renderhints.java @@ -85,7 +85,7 @@ public class Renderhints { * Set property value * @param prop property */ - public void setProperty(Property prop) { + public void setProperty(final Property prop) { switch (prop.type) { case NurbsConsts.N_DISPLAY: display_method = (int) prop.value; diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Splinespec.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Splinespec.java index f1c779c2f..5e44c3259 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Splinespec.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Splinespec.java @@ -44,7 +44,7 @@ public class Splinespec { /** * Dimension */ - private int dim; + private final int dim; /** * Knot vector specs @@ -60,7 +60,7 @@ public class Splinespec { * Makes new Splinespec with given dimension * @param i dimension */ - public Splinespec(int i) { + public Splinespec(final int i) { // DONE this.dim = i; } @@ -69,7 +69,7 @@ public class Splinespec { * Initializes knotspec according to knotvector * @param knotvector basic knotvector */ - public void kspecinit(Knotvector knotvector) { + public void kspecinit(final Knotvector knotvector) { // DONE this.kspec = new Knotspec(); kspec.inkbegin = new CArrayOfFloats(knotvector.knotlist, 0); @@ -85,10 +85,10 @@ public class Splinespec { * @param sknotvector knotvector in u dir * @param tknotvector knotvector in v dir */ - public void kspecinit(Knotvector sknotvector, Knotvector tknotvector) { + public void kspecinit(final Knotvector sknotvector, final Knotvector tknotvector) { // DONE this.kspec = new Knotspec(); - Knotspec tkspec = new Knotspec(); + final Knotspec tkspec = new Knotspec(); kspec.inkbegin = new CArrayOfFloats(sknotvector.knotlist, 0); kspec.inkend = new CArrayOfFloats(sknotvector.knotlist, @@ -121,7 +121,7 @@ public class Splinespec { * Prepares for conversion * @param ncoords number of coords */ - public void layout(int ncoords) { + public void layout(final int ncoords) { // DONE int stride = ncoords; for (Knotspec knotspec = kspec; knotspec != null; knotspec = knotspec.next) { @@ -143,9 +143,9 @@ public class Splinespec { * Prepares quilt for conversion * @param quilt quilt to work with */ - public void setupquilt(Quilt quilt) { + public void setupquilt(final Quilt quilt) { // DONE - CArrayOfQuiltspecs qspec = new CArrayOfQuiltspecs(quilt.qspec); + final CArrayOfQuiltspecs qspec = new CArrayOfQuiltspecs(quilt.qspec); quilt.eqspec = new CArrayOfQuiltspecs(qspec.getArray(), dim); for (Knotspec knotspec = kspec; knotspec != null;) { qspec.get().stride = knotspec.poststride; @@ -159,8 +159,8 @@ public class Splinespec { qspec.get().bdry[1] = (knotspec.kright.getPointer() == knotspec.klast .getPointer()) ? 1 : 0; qspec.get().breakpoints = new float[qspec.get().width + 1]; - CArrayOfFloats k = new CArrayOfFloats(qspec.get().breakpoints, 0); - for (CArrayOfBreakpts bk = new CArrayOfBreakpts(knotspec.bbegin); bk + final CArrayOfFloats k = new CArrayOfFloats(qspec.get().breakpoints, 0); + for (final CArrayOfBreakpts bk = new CArrayOfBreakpts(knotspec.bbegin); bk .getPointer() <= knotspec.bend.getPointer(); bk.pp()) { k.set(bk.get().value); k.pp(); @@ -177,7 +177,7 @@ public class Splinespec { * Copies array of control points to output array * @param ctlarray control points array */ - public void copy(CArrayOfFloats ctlarray) { + public void copy(final CArrayOfFloats ctlarray) { // DONE kspec.copy(ctlarray, outcpts); diff --git a/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java b/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java index 4d8296cca..d7c1dbf3c 100644 --- a/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java +++ b/src/jogl/classes/jogamp/opengl/glu/nurbs/Subdivider.java @@ -148,7 +148,7 @@ public class Subdivider { /** * Initializes quilt list */ - public void beginQuilts(Backend backend) { + public void beginQuilts(final Backend backend) { // DONE qlist = null; renderhints = new Renderhints(); @@ -162,7 +162,7 @@ public class Subdivider { * Adds quilt to linked list * @param quilt added quilt */ - public void addQuilt(Quilt quilt) { + public void addQuilt(final Quilt quilt) { // DONE if (qlist == null) qlist = quilt; @@ -198,8 +198,8 @@ public class Subdivider { } } - float[] from = new float[2]; - float[] to = new float[2]; + final float[] from = new float[2]; + final float[] to = new float[2]; spbrkpts = new Flist(); tpbrkpts = new Flist(); @@ -215,7 +215,7 @@ public class Subdivider { makeBorderTrim(from, to); } } else { - float[] rate = new float[2]; + final float[] rate = new float[2]; qlist.findRates(spbrkpts, tpbrkpts, rate); // System.out.println("subdivider.drawsurfaces decompose"); } @@ -231,8 +231,8 @@ public class Subdivider { int num_v_steps; for (i = spbrkpts.start; i < spbrkpts.end - 1; i++) { for (j = tpbrkpts.start; j < tpbrkpts.end - 1; j++) { - float[] pta = new float[2]; - float[] ptb = new float[2]; + final float[] pta = new float[2]; + final float[] ptb = new float[2]; pta[0] = spbrkpts.pts[i]; ptb[0] = spbrkpts.pts[i + 1]; @@ -266,7 +266,7 @@ public class Subdivider { * Empty method * @param initialbin2 */ - private void freejarcs(Bin initialbin2) { + private void freejarcs(final Bin initialbin2) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.freejarcs"); } @@ -275,7 +275,7 @@ public class Subdivider { * Subdivide in U direction * @param source Trimming arcs source */ - private void subdivideInS(Bin source) { + private void subdivideInS(final Bin source) { // DONE if (renderhints.display_method == NurbsConsts.N_OUTLINE_PARAM) { outline(source); @@ -294,13 +294,13 @@ public class Subdivider { * @param start breakpoints start * @param end breakpoints end */ - private void splitInS(Bin source, int start, int end) { + private void splitInS(final Bin source, final int start, final int end) { // DONE if (source.isnonempty()) { if (start != end) { - int i = start + (end - start) / 2; - Bin left = new Bin(); - Bin right = new Bin(); + final int i = start + (end - start) / 2; + final Bin left = new Bin(); + final Bin right = new Bin(); split(source, left, right, 0, spbrkpts.pts[i]); splitInS(left, start, i); @@ -329,15 +329,15 @@ public class Subdivider { * @param start * @param end */ - private void splitInT(Bin source, int start, int end) { + private void splitInT(final Bin source, final int start, final int end) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.splitint"); if (source.isnonempty()) { if (start != end) { - int i = start + (end - start) / 2; - Bin left = new Bin(); - Bin right = new Bin(); + final int i = start + (end - start) / 2; + final Bin left = new Bin(); + final Bin right = new Bin(); split(source, left, right, 1, tpbrkpts.pts[i + 1]); splitInT(left, start, i); splitInT(right, i + 1, end); @@ -352,8 +352,8 @@ public class Subdivider { setArcTypeBezier(); setDegenerate(); - float[] pta = new float[2]; - float[] ptb = new float[2]; + final float[] pta = new float[2]; + final float[] ptb = new float[2]; pta[0] = spbrkpts.pts[s_index - 1]; pta[1] = tpbrkpts.pts[t_index - 1]; @@ -362,7 +362,7 @@ public class Subdivider { ptb[1] = tpbrkpts.pts[t_index]; qlist.downloadAll(pta, ptb, backend); - Patchlist patchlist = new Patchlist(qlist, pta, ptb); + final Patchlist patchlist = new Patchlist(qlist, pta, ptb); samplingSplit(source, patchlist, renderhints.maxsubdivisions, 0); @@ -381,8 +381,8 @@ public class Subdivider { * @param subdivisions * @param param */ - private void samplingSplit(Bin source, Patchlist patchlist, - int subdivisions, int param) { + private void samplingSplit(final Bin source, final Patchlist patchlist, + final int subdivisions, int param) { // DONE if (!source.isnonempty()) return; @@ -408,13 +408,13 @@ public class Subdivider { else param = 1 - param; - Bin left = new Bin(); - Bin right = new Bin(); + final Bin left = new Bin(); + final Bin right = new Bin(); - float mid = (float) ((patchlist.pspec[param].range[0] + patchlist.pspec[param].range[1]) * .5); + final float mid = (float) ((patchlist.pspec[param].range[0] + patchlist.pspec[param].range[1]) * .5); split(source, left, right, param, mid); - Patchlist subpatchlist = new Patchlist(patchlist, param, mid); + final Patchlist subpatchlist = new Patchlist(patchlist, param, mid); samplingSplit(left, subpatchlist, subdivisions - 1, param); samplingSplit(right, subpatchlist, subdivisions - 1, param); } else { @@ -433,18 +433,18 @@ public class Subdivider { * @param subdivisions * @param param */ - private void nonSamplingSplit(Bin source, Patchlist patchlist, - int subdivisions, int param) { + private void nonSamplingSplit(final Bin source, final Patchlist patchlist, + final int subdivisions, int param) { // DONE if (patchlist.needsNonSamplingSubdivision() && subdivisions > 0) { param = 1 - param; - Bin left = new Bin(); - Bin right = new Bin(); + final Bin left = new Bin(); + final Bin right = new Bin(); - float mid = (float) ((patchlist.pspec[param].range[0] + patchlist.pspec[param].range[1]) * .5); + final float mid = (float) ((patchlist.pspec[param].range[0] + patchlist.pspec[param].range[1]) * .5); split(source, left, right, param, mid); - Patchlist subpatchlist = new Patchlist(patchlist, param, mid); + final Patchlist subpatchlist = new Patchlist(patchlist, param, mid); if (left.isnonempty()) { if (subpatchlist.cullCheck() == CULL_TRIVIAL_REJECT) freejarcs(left); @@ -483,7 +483,7 @@ public class Subdivider { * @param start * @param end */ - private void monosplitInS(Bin source, int start, int end) { + private void monosplitInS(final Bin source, final int start, final int end) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.monosplitins"); } @@ -492,7 +492,7 @@ public class Subdivider { * Not used * @param source */ - private void findIrregularS(Bin source) { + private void findIrregularS(final Bin source) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.findIrregularS"); } @@ -510,7 +510,7 @@ public class Subdivider { * @param source * @param patchlist */ - private void tesselation(Bin source, Patchlist patchlist) { + private void tesselation(final Bin source, final Patchlist patchlist) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.tesselation"); } @@ -531,19 +531,19 @@ public class Subdivider { * @param param * @param value */ - private void split(Bin bin, Bin left, Bin right, int param, float value) { + private void split(final Bin bin, final Bin left, final Bin right, final int param, final float value) { // DONE - Bin intersections = new Bin(); - Bin unknown = new Bin(); + final Bin intersections = new Bin(); + final Bin unknown = new Bin(); partition(bin, left, intersections, right, unknown, param, value); - int count = intersections.numarcs(); + final int count = intersections.numarcs(); // TODO jumpbuffer ?? if (count % 2 == 0) { - Arc[] arclist = new Arc[MAXARCS]; + final Arc[] arclist = new Arc[MAXARCS]; CArrayOfArcs list; if (count >= MAXARCS) { list = new CArrayOfArcs(new Arc[count]); @@ -559,7 +559,7 @@ public class Subdivider { last.set(jarc); if (param == 0) {// sort into incrasing t order - ArcSdirSorter sorter = new ArcSdirSorter(this); + final ArcSdirSorter sorter = new ArcSdirSorter(this); sorter.qsort(list, count); for (lptr = new CArrayOfArcs(list); lptr.getPointer() < last @@ -578,7 +578,7 @@ public class Subdivider { } } else {// sort into decreasing s order - ArcTdirSorter sorter = new ArcTdirSorter(this); + final ArcTdirSorter sorter = new ArcTdirSorter(this); sorter.qsort(list, count); for (lptr = new CArrayOfArcs(list); lptr.getPointer() < last @@ -609,7 +609,7 @@ public class Subdivider { * @param arc * @param relative */ - private void join_t(Bin left, Bin right, Arc arc, Arc relative) { + private void join_t(final Bin left, final Bin right, final Arc arc, final Arc relative) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.join_t"); } @@ -619,7 +619,7 @@ public class Subdivider { * @param arc * @param relative */ - private void check_t(Arc arc, Arc relative) { + private void check_t(final Arc arc, final Arc relative) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.check_t"); } @@ -631,22 +631,22 @@ public class Subdivider { * @param jarc1 * @param jarc2 */ - private void join_s(Bin left, Bin right, Arc jarc1, Arc jarc2) { + private void join_s(final Bin left, final Bin right, Arc jarc1, Arc jarc2) { // DONE if (!jarc1.getitail()) jarc1 = jarc1.next; if (!jarc2.getitail()) jarc2 = jarc2.next; - float s = jarc1.tail()[0]; - float t1 = jarc1.tail()[1]; - float t2 = jarc2.tail()[1]; + final float s = jarc1.tail()[0]; + final float t1 = jarc1.tail()[1]; + final float t2 = jarc2.tail()[1]; if (t1 == t2) { simplelink(jarc1, jarc2); } else { - Arc newright = new Arc(Arc.ARC_RIGHT); - Arc newleft = new Arc(Arc.ARC_LEFT); + final Arc newright = new Arc(Arc.ARC_RIGHT); + final Arc newleft = new Arc(Arc.ARC_LEFT); if (isBezierArcType()) { arctesselator.bezier(newright, s, s, t1, t2); arctesselator.bezier(newleft, s, s, t2, t1); @@ -668,7 +668,7 @@ public class Subdivider { * @param newright * @param newleft */ - private void link(Arc jarc1, Arc jarc2, Arc newright, Arc newleft) { + private void link(final Arc jarc1, final Arc jarc2, final Arc newright, final Arc newleft) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.link"); } @@ -688,7 +688,7 @@ public class Subdivider { * @param jarc1 * @param jarc2 */ - private void simplelink(Arc jarc1, Arc jarc2) { + private void simplelink(final Arc jarc1, final Arc jarc2) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.simplelink"); } @@ -698,7 +698,7 @@ public class Subdivider { * @param arc * @param relative */ - private void check_s(Arc arc, Arc relative) { + private void check_s(final Arc arc, final Arc relative) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.check_s"); @@ -714,17 +714,17 @@ public class Subdivider { * @param param * @param value */ - private void partition(Bin bin, Bin left, Bin intersections, Bin right, - Bin unknown, int param, float value) { + private void partition(final Bin bin, final Bin left, final Bin intersections, final Bin right, + final Bin unknown, final int param, final float value) { - Bin headonleft = new Bin(); - Bin headonright = new Bin(); - Bin tailonleft = new Bin(); - Bin tailonright = new Bin(); + final Bin headonleft = new Bin(); + final Bin headonright = new Bin(); + final Bin tailonleft = new Bin(); + final Bin tailonright = new Bin(); for (Arc jarc = bin.removearc(); jarc != null; jarc = bin.removearc()) { - float tdiff = jarc.tail()[param] - value; - float hdiff = jarc.head()[param] - value; + final float tdiff = jarc.tail()[param] - value; + final float hdiff = jarc.head()[param] - value; if (tdiff > 0) { if (hdiff > 0) { @@ -732,7 +732,7 @@ public class Subdivider { } else if (hdiff == 0) { tailonright.addarc(jarc); } else { - Arc jtemp; + final Arc jtemp; switch (arc_split(jarc, param, value, 0)) { case 2: tailonright.addarc(jarc); @@ -785,8 +785,8 @@ public class Subdivider { * @param right * @param value */ - private void classify_tailonright_t(Bin tailonright, Bin intersections, - Bin right, float value) { + private void classify_tailonright_t(final Bin tailonright, final Bin intersections, + final Bin right, final float value) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.classify_tailonright_t"); @@ -799,14 +799,14 @@ public class Subdivider { * @param out * @param val */ - private void classify_tailonleft_s(Bin bin, Bin in, Bin out, float val) { + private void classify_tailonleft_s(final Bin bin, final Bin in, final Bin out, final float val) { // DONE Arc j; while ((j = bin.removearc()) != null) { j.clearitail(); - float diff = j.next.head()[0] - val; + final float diff = j.next.head()[0] - val; if (diff > 0) { in.addarc(j); } else if (diff < 0) { @@ -831,13 +831,13 @@ public class Subdivider { * @param out * @param val */ - private void classify_headonright_s(Bin bin, Bin in, Bin out, float val) { + private void classify_headonright_s(final Bin bin, final Bin in, final Bin out, final float val) { // DONE Arc j; while ((j = bin.removearc()) != null) { j.setitail(); - float diff = j.prev.tail()[0] - val; + final float diff = j.prev.tail()[0] - val; if (diff > 0) { if (ccwTurn_sr(j.prev, j)) out.addarc(j); @@ -860,7 +860,7 @@ public class Subdivider { * @param j * @return false */ - private boolean ccwTurn_sr(Arc prev, Arc j) { + private boolean ccwTurn_sr(final Arc prev, final Arc j) { // TODO Auto-generated method stub // System.out.println("TODO ccwTurn_sr"); return false; @@ -873,8 +873,8 @@ public class Subdivider { * @param right * @param value */ - private void classify_headonright_t(Bin headonright, Bin intersections, - Bin right, float value) { + private void classify_headonright_t(final Bin headonright, final Bin intersections, + final Bin right, final float value) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.classify_headonright_t"); } @@ -886,8 +886,8 @@ public class Subdivider { * @param left * @param value */ - private void classify_tailonleft_t(Bin tailonleft, Bin intersections, - Bin left, float value) { + private void classify_tailonleft_t(final Bin tailonleft, final Bin intersections, + final Bin left, final float value) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.classify_tailonleft_t"); } @@ -899,13 +899,13 @@ public class Subdivider { * @param out * @param val */ - private void classify_headonleft_t(Bin bin, Bin in, Bin out, float val) { + private void classify_headonleft_t(final Bin bin, final Bin in, final Bin out, final float val) { // DONE Arc j; while ((j = bin.removearc()) != null) { j.setitail(); - float diff = j.prev.tail()[1] - val; + final float diff = j.prev.tail()[1] - val; if (diff > 0) { out.addarc(j); } else if (diff < 0) { @@ -928,7 +928,7 @@ public class Subdivider { * @param j * @return false */ - private boolean ccwTurn_tl(Arc prev, Arc j) { + private boolean ccwTurn_tl(final Arc prev, final Arc j) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.ccwTurn_tl"); return false; @@ -941,13 +941,13 @@ public class Subdivider { * @param out * @param val */ - private void classify_tailonright_s(Bin bin, Bin in, Bin out, float val) { + private void classify_tailonright_s(final Bin bin, final Bin in, final Bin out, final float val) { // DONE Arc j; while ((j = bin.removearc()) != null) { j.clearitail(); - float diff = j.next.head()[0] - val; + final float diff = j.next.head()[0] - val; if (diff > 0) { if (ccwTurn_sr(j, j.next)) out.addarc(j); @@ -972,13 +972,13 @@ public class Subdivider { * @param out * @param val */ - private void classify_headonleft_s(Bin bin, Bin in, Bin out, float val) { + private void classify_headonleft_s(final Bin bin, final Bin in, final Bin out, final float val) { // DONE Arc j; while ((j = bin.removearc()) != null) { j.setitail(); - float diff = j.prev.tail()[0] - val; + final float diff = j.prev.tail()[0] - val; if (diff > 0) { out.addarc(j); } else if (diff < 0) { @@ -1002,7 +1002,7 @@ public class Subdivider { * @param j * @return false */ - private boolean ccwTurn_sl(Arc prev, Arc j) { + private boolean ccwTurn_sl(final Arc prev, final Arc j) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.ccwTurn_sl"); return false; @@ -1016,7 +1016,7 @@ public class Subdivider { * @param i * @return 0 */ - private int arc_split(Arc jarc, int param, float value, int i) { + private int arc_split(final Arc jarc, final int param, final float value, final int i) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.arc_split"); return 0; @@ -1043,7 +1043,7 @@ public class Subdivider { * Not used * @param source */ - private void outline(Bin source) { + private void outline(final Bin source) { // TODO Auto-generated method stub // System.out.println("TODO subdivider.outline"); } @@ -1053,13 +1053,13 @@ public class Subdivider { * @param from range beginnings * @param to range ends */ - private void makeBorderTrim(float[] from, float[] to) { + private void makeBorderTrim(final float[] from, final float[] to) { // DONE - float smin = from[0]; - float smax = to[0]; + final float smin = from[0]; + final float smax = to[0]; - float tmin = from[1]; - float tmax = to[1]; + final float tmin = from[1]; + final float tmax = to[1]; pjarc = null; Arc jarc = null; @@ -1092,10 +1092,10 @@ public class Subdivider { */ public void drawCurves() { // DONE - float[] from = new float[1]; - float[] to = new float[1]; + final float[] from = new float[1]; + final float[] to = new float[1]; - Flist bpts = new Flist(); + final Flist bpts = new Flist(); qlist.getRange(from, to, bpts); renderhints.init(); @@ -1103,13 +1103,13 @@ public class Subdivider { backend.bgncurv(); for (int i = bpts.start; i < bpts.end - 1; i++) { - float[] pta = new float[1]; - float[] ptb = new float[1]; + final float[] pta = new float[1]; + final float[] ptb = new float[1]; pta[0] = bpts.pts[i]; ptb[0] = bpts.pts[i + 1]; qlist.downloadAll(pta, ptb, backend); - Curvelist curvelist = new Curvelist(qlist, pta, ptb); + final Curvelist curvelist = new Curvelist(qlist, pta, ptb); samplingSplit(curvelist, renderhints.maxsubdivisions); } backend.endcurv(); @@ -1120,7 +1120,7 @@ public class Subdivider { * @param curvelist list of curves * @param maxsubdivisions maximum number of subdivisions */ - private void samplingSplit(Curvelist curvelist, int maxsubdivisions) { + private void samplingSplit(final Curvelist curvelist, final int maxsubdivisions) { if (curvelist.cullCheck() == CULL_TRIVIAL_REJECT) return; @@ -1130,7 +1130,7 @@ public class Subdivider { // TODO kód // System.out.println("TODO subdivider-needsSamplingSubdivision"); } else { - int nu = (int) (1 + curvelist.range[2] / curvelist.stepsize); + final int nu = (int) (1 + curvelist.range[2] / curvelist.stepsize); backend.curvgrid(curvelist.range[0], curvelist.range[1], nu); backend.curvmesh(0, nu); } @@ -1142,7 +1142,7 @@ public class Subdivider { * @param d new domain_distance_u_rate value */ - public void set_domain_distance_u_rate(double d) { + public void set_domain_distance_u_rate(final double d) { // DONE domain_distance_u_rate = (float) d; } @@ -1151,7 +1151,7 @@ public class Subdivider { * Sets new domain_distance_v_rate value * @param d new domain_distance_v_rate value */ - public void set_domain_distance_v_rate(double d) { + public void set_domain_distance_v_rate(final double d) { // DONE domain_distance_v_rate = (float) d; } @@ -1160,7 +1160,7 @@ public class Subdivider { * Sets new is_domain_distance_sampling value * @param i new is_domain_distance_sampling value */ - public void set_is_domain_distance_sampling(int i) { + public void set_is_domain_distance_sampling(final int i) { // DONE this.is_domain_distance_sampling = i; } diff --git a/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java b/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java index 9c8523e51..5cae679a2 100644 --- a/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java +++ b/src/jogl/classes/jogamp/opengl/glu/registry/Registry.java @@ -56,7 +56,7 @@ public class Registry { public Registry() { } - public static String gluGetString(int name) { + public static String gluGetString(final int name) { if( name == GLU.GLU_VERSION ) { return( "1.3" ); } else if( name == GLU.GLU_EXTENSIONS ) { @@ -65,7 +65,7 @@ public class Registry { return( null ); } - public static boolean gluCheckExtension( String extName, String extString ) { + public static boolean gluCheckExtension( final String extName, final String extString ) { if( extName == null || extString == null ) { return( false ); } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Dict.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Dict.java index 3ac9df67a..3bb759359 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Dict.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Dict.java @@ -60,8 +60,8 @@ class Dict { private Dict() { } - static Dict dictNewDict(Object frame, DictLeq leq) { - Dict dict = new Dict(); + static Dict dictNewDict(final Object frame, final DictLeq leq) { + final Dict dict = new Dict(); dict.head = new DictNode(); dict.head.key = null; @@ -74,22 +74,22 @@ class Dict { return dict; } - static void dictDeleteDict(Dict dict) { + static void dictDeleteDict(final Dict dict) { dict.head = null; dict.frame = null; dict.leq = null; } - static DictNode dictInsert(Dict dict, Object key) { + static DictNode dictInsert(final Dict dict, final Object key) { return dictInsertBefore(dict, dict.head, key); } - static DictNode dictInsertBefore(Dict dict, DictNode node, Object key) { + static DictNode dictInsertBefore(final Dict dict, DictNode node, final Object key) { do { node = node.prev; } while (node.key != null && !dict.leq.leq(dict.frame, node.key, key)); - DictNode newNode = new DictNode(); + final DictNode newNode = new DictNode(); newNode.key = key; newNode.next = node.next; node.next.prev = newNode; @@ -99,32 +99,32 @@ class Dict { return newNode; } - static Object dictKey(DictNode aNode) { + static Object dictKey(final DictNode aNode) { return aNode.key; } - static DictNode dictSucc(DictNode aNode) { + static DictNode dictSucc(final DictNode aNode) { return aNode.next; } - static DictNode dictPred(DictNode aNode) { + static DictNode dictPred(final DictNode aNode) { return aNode.prev; } - static DictNode dictMin(Dict aDict) { + static DictNode dictMin(final Dict aDict) { return aDict.head.next; } - static DictNode dictMax(Dict aDict) { + static DictNode dictMax(final Dict aDict) { return aDict.head.prev; } - static void dictDelete(Dict dict, DictNode node) { + static void dictDelete(final Dict dict, final DictNode node) { node.next.prev = node.prev; node.prev.next = node.next; } - static DictNode dictSearch(Dict dict, Object key) { + static DictNode dictSearch(final Dict dict, final Object key) { DictNode node = dict.head; do { diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java index 29944f9b2..a849058c8 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUhalfEdge.java @@ -65,7 +65,7 @@ class GLUhalfEdge { public int winding; /* change in winding number when crossing */ public boolean first; - public GLUhalfEdge(boolean first) { + public GLUhalfEdge(final boolean first) { this.first = first; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java index d594cb3eb..6f89a95f2 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/GLUtessellatorImpl.java @@ -177,11 +177,11 @@ public class GLUtessellatorImpl implements GLUtessellator { mesh = null; } - private void requireState(int newState) { + private void requireState(final int newState) { if (state != newState) gotoState(newState); } - private void gotoState(int newState) { + private void gotoState(final int newState) { while (state != newState) { /* We change the current state one level at a time, to get to * the desired state. @@ -211,7 +211,7 @@ public class GLUtessellatorImpl implements GLUtessellator { requireState(TessState.T_DORMANT); } - public void gluTessProperty(int which, double value) { + public void gluTessProperty(final int which, final double value) { switch (which) { case GLU.GLU_TESS_TOLERANCE: if (value < 0.0 || value > 1.0) break; @@ -219,7 +219,7 @@ public class GLUtessellatorImpl implements GLUtessellator { return; case GLU.GLU_TESS_WINDING_RULE: - int windingRule = (int) value; + final int windingRule = (int) value; if (windingRule != value) break; /* not an integer */ switch (windingRule) { @@ -250,7 +250,7 @@ public class GLUtessellatorImpl implements GLUtessellator { } /* Returns tessellator property */ - public void gluGetTessProperty(int which, double[] value, int value_offset) { + public void gluGetTessProperty(final int which, final double[] value, final int value_offset) { switch (which) { case GLU.GLU_TESS_TOLERANCE: /* tolerance should be in range [0..1] */ @@ -279,13 +279,13 @@ public class GLUtessellatorImpl implements GLUtessellator { } } /* gluGetTessProperty() */ - public void gluTessNormal(double x, double y, double z) { + public void gluTessNormal(final double x, final double y, final double z) { normal[0] = x; normal[1] = y; normal[2] = z; } - public void gluTessCallback(int which, GLUtessellatorCallback aCallback) { + public void gluTessCallback(final int which, final GLUtessellatorCallback aCallback) { switch (which) { case GLU.GLU_TESS_BEGIN: callBegin = aCallback == null ? NULL_CB : aCallback; @@ -340,7 +340,7 @@ public class GLUtessellatorImpl implements GLUtessellator { } } - private boolean addVertex(double[] coords, Object vertexData) { + private boolean addVertex(final double[] coords, final Object vertexData) { GLUhalfEdge e; e = lastEdge; @@ -377,12 +377,12 @@ public class GLUtessellatorImpl implements GLUtessellator { return true; } - private void cacheVertex(double[] coords, Object vertexData) { + private void cacheVertex(final double[] coords, final Object vertexData) { if (cache[cacheCount] == null) { cache[cacheCount] = new CachedVertex(); } - CachedVertex v = cache[cacheCount]; + final CachedVertex v = cache[cacheCount]; v.data = vertexData; v.coords[0] = coords[0]; @@ -393,13 +393,13 @@ public class GLUtessellatorImpl implements GLUtessellator { private boolean flushCache() { - CachedVertex[] v = cache; + final CachedVertex[] v = cache; mesh = Mesh.__gl_meshNewMesh(); if (mesh == null) return false; for (int i = 0; i < cacheCount; i++) { - CachedVertex vertex = v[i]; + final CachedVertex vertex = v[i]; if (!addVertex(vertex.coords, vertex.data)) return false; } cacheCount = 0; @@ -408,11 +408,11 @@ public class GLUtessellatorImpl implements GLUtessellator { return true; } - public void gluTessVertex(double[] coords, int coords_offset, Object vertexData) { + public void gluTessVertex(final double[] coords, final int coords_offset, final Object vertexData) { int i; boolean tooLarge = false; double x; - double[] clamped = new double[3]; + final double[] clamped = new double[3]; requireState(TessState.T_IN_CONTOUR); @@ -456,7 +456,7 @@ public class GLUtessellatorImpl implements GLUtessellator { } - public void gluTessBeginPolygon(Object data) { + public void gluTessBeginPolygon(final Object data) { requireState(TessState.T_DORMANT); state = TessState.T_IN_POLYGON; @@ -573,7 +573,7 @@ public class GLUtessellatorImpl implements GLUtessellator { Mesh.__gl_meshDeleteMesh(mesh); polygonData = null; mesh = null; - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); callErrorOrErrorData(GLU.GLU_OUT_OF_MEMORY); } @@ -590,7 +590,7 @@ public class GLUtessellatorImpl implements GLUtessellator { /*ARGSUSED*/ - public void gluNextContour(int type) { + public void gluNextContour(final int type) { gluTessEndContour(); gluTessBeginContour(); } @@ -601,21 +601,21 @@ public class GLUtessellatorImpl implements GLUtessellator { gluTessEndPolygon(); } - void callBeginOrBeginData(int a) { + void callBeginOrBeginData(final int a) { if (callBeginData != NULL_CB) callBeginData.beginData(a, polygonData); else callBegin.begin(a); } - void callVertexOrVertexData(Object a) { + void callVertexOrVertexData(final Object a) { if (callVertexData != NULL_CB) callVertexData.vertexData(a, polygonData); else callVertex.vertex(a); } - void callEdgeFlagOrEdgeFlagData(boolean a) { + void callEdgeFlagOrEdgeFlagData(final boolean a) { if (callEdgeFlagData != NULL_CB) callEdgeFlagData.edgeFlagData(a, polygonData); else @@ -629,14 +629,14 @@ public class GLUtessellatorImpl implements GLUtessellator { callEnd.end(); } - void callCombineOrCombineData(double[] coords, Object[] vertexData, float[] weights, Object[] outData) { + void callCombineOrCombineData(final double[] coords, final Object[] vertexData, final float[] weights, final Object[] outData) { if (callCombineData != NULL_CB) callCombineData.combineData(coords, vertexData, weights, outData, polygonData); else callCombine.combine(coords, vertexData, weights, outData); } - void callErrorOrErrorData(int a) { + void callErrorOrErrorData(final int a) { if (callErrorData != NULL_CB) callErrorData.errorData(a, polygonData); else diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Geom.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Geom.java index 3da2d267e..493052f79 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Geom.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Geom.java @@ -66,7 +66,7 @@ class Geom { * let r be the negated result (this evaluates (uw)(v->s)), then * r is guaranteed to satisfy MIN(u->t,w->t) <= r <= MAX(u->t,w->t). */ - static double EdgeEval(GLUvertex u, GLUvertex v, GLUvertex w) { + static double EdgeEval(final GLUvertex u, final GLUvertex v, final GLUvertex w) { double gapL, gapR; assert (VertLeq(u, v) && VertLeq(v, w)); @@ -85,7 +85,7 @@ class Geom { return 0; } - static double EdgeSign(GLUvertex u, GLUvertex v, GLUvertex w) { + static double EdgeSign(final GLUvertex u, final GLUvertex v, final GLUvertex w) { double gapL, gapR; assert (VertLeq(u, v) && VertLeq(v, w)); @@ -105,7 +105,7 @@ class Geom { * Define versions of EdgeSign, EdgeEval with s and t transposed. */ - static double TransEval(GLUvertex u, GLUvertex v, GLUvertex w) { + static double TransEval(final GLUvertex u, final GLUvertex v, final GLUvertex w) { /* Given three vertices u,v,w such that TransLeq(u,v) && TransLeq(v,w), * evaluates the t-coord of the edge uw at the s-coord of the vertex v. * Returns v->s - (uw)(v->t), ie. the signed distance from uw to v. @@ -134,7 +134,7 @@ class Geom { return 0; } - static double TransSign(GLUvertex u, GLUvertex v, GLUvertex w) { + static double TransSign(final GLUvertex u, final GLUvertex v, final GLUvertex w) { /* Returns a number whose sign matches TransEval(u,v,w) but which * is cheaper to evaluate. Returns > 0, == 0 , or < 0 * as v is above, on, or below the edge uw. @@ -154,7 +154,7 @@ class Geom { } - static boolean VertCCW(GLUvertex u, GLUvertex v, GLUvertex w) { + static boolean VertCCW(final GLUvertex u, final GLUvertex v, final GLUvertex w) { /* For almost-degenerate situations, the results are not reliable. * Unless the floating-point arithmetic can be performed without * rounding errors, *any* implementation will give incorrect results @@ -172,7 +172,7 @@ class Geom { * MIN(x,y) <= r <= MAX(x,y), and the results are very accurate * even when a and b differ greatly in magnitude. */ - static double Interpolate(double a, double x, double b, double y) { + static double Interpolate(double a, final double x, double b, final double y) { a = (a < 0) ? 0 : a; b = (b < 0) ? 0 : b; if (a <= b) { @@ -188,7 +188,7 @@ class Geom { static void EdgeIntersect(GLUvertex o1, GLUvertex d1, GLUvertex o2, GLUvertex d2, - GLUvertex v) + final GLUvertex v) /* Given edges (o1,d1) and (o2,d2), compute their point of intersection. * The computed point is guaranteed to lie in the intersection of the * bounding rectangles defined by each edge. @@ -204,12 +204,12 @@ class Geom { */ if (!VertLeq(o1, d1)) { - GLUvertex temp = o1; + final GLUvertex temp = o1; o1 = d1; d1 = temp; } if (!VertLeq(o2, d2)) { - GLUvertex temp = o2; + final GLUvertex temp = o2; o2 = d2; d2 = temp; } @@ -248,12 +248,12 @@ class Geom { /* Now repeat the process for t */ if (!TransLeq(o1, d1)) { - GLUvertex temp = o1; + final GLUvertex temp = o1; o1 = d1; d1 = temp; } if (!TransLeq(o2, d2)) { - GLUvertex temp = o2; + final GLUvertex temp = o2; o2 = d2; d2 = temp; } @@ -290,29 +290,29 @@ class Geom { } } - static boolean VertEq(GLUvertex u, GLUvertex v) { + static boolean VertEq(final GLUvertex u, final GLUvertex v) { return u.s == v.s && u.t == v.t; } - static boolean VertLeq(GLUvertex u, GLUvertex v) { + static boolean VertLeq(final GLUvertex u, final GLUvertex v) { return u.s < v.s || (u.s == v.s && u.t <= v.t); } /* Versions of VertLeq, EdgeSign, EdgeEval with s and t transposed. */ - static boolean TransLeq(GLUvertex u, GLUvertex v) { + static boolean TransLeq(final GLUvertex u, final GLUvertex v) { return u.t < v.t || (u.t == v.t && u.s <= v.s); } - static boolean EdgeGoesLeft(GLUhalfEdge e) { + static boolean EdgeGoesLeft(final GLUhalfEdge e) { return VertLeq(e.Sym.Org, e.Org); } - static boolean EdgeGoesRight(GLUhalfEdge e) { + static boolean EdgeGoesRight(final GLUhalfEdge e) { return VertLeq(e.Org, e.Sym.Org); } - static double VertL1dist(GLUvertex u, GLUvertex v) { + static double VertL1dist(final GLUvertex u, final GLUvertex v) { return Math.abs(u.s - v.s) + Math.abs(u.t - v.t); } @@ -320,13 +320,13 @@ class Geom { // Compute the cosine of the angle between the edges between o and // v1 and between o and v2 - static double EdgeCos(GLUvertex o, GLUvertex v1, GLUvertex v2) { - double ov1s = v1.s - o.s; - double ov1t = v1.t - o.t; - double ov2s = v2.s - o.s; - double ov2t = v2.t - o.t; + static double EdgeCos(final GLUvertex o, final GLUvertex v1, final GLUvertex v2) { + final double ov1s = v1.s - o.s; + final double ov1t = v1.t - o.t; + final double ov2s = v2.s - o.s; + final double ov2t = v2.t - o.t; double dotp = ov1s * ov2s + ov1t * ov2t; - double len = Math.sqrt(ov1s * ov1s + ov1t * ov1t) * Math.sqrt(ov2s * ov2s + ov2t * ov2t); + final double len = Math.sqrt(ov1s * ov1s + ov1t * ov1t) * Math.sqrt(ov2s * ov2s + ov2t * ov2t); if (len > 0.0) { dotp /= len; } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java index eb48aa5a4..e855a5531 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Mesh.java @@ -115,9 +115,9 @@ class Mesh { * depending on whether a and b belong to different face or vertex rings. * For more explanation see __gl_meshSplice() below. */ - static void Splice(jogamp.opengl.glu.tessellator.GLUhalfEdge a, jogamp.opengl.glu.tessellator.GLUhalfEdge b) { - jogamp.opengl.glu.tessellator.GLUhalfEdge aOnext = a.Onext; - jogamp.opengl.glu.tessellator.GLUhalfEdge bOnext = b.Onext; + static void Splice(final jogamp.opengl.glu.tessellator.GLUhalfEdge a, final jogamp.opengl.glu.tessellator.GLUhalfEdge b) { + final jogamp.opengl.glu.tessellator.GLUhalfEdge aOnext = a.Onext; + final jogamp.opengl.glu.tessellator.GLUhalfEdge bOnext = b.Onext; aOnext.Sym.Lnext = b; bOnext.Sym.Lnext = a; @@ -131,11 +131,11 @@ class Mesh { * the new vertex *before* vNext so that algorithms which walk the vertex * list will not see the newly created vertices. */ - static void MakeVertex(jogamp.opengl.glu.tessellator.GLUvertex newVertex, - jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig, jogamp.opengl.glu.tessellator.GLUvertex vNext) { + static void MakeVertex(final jogamp.opengl.glu.tessellator.GLUvertex newVertex, + final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig, final jogamp.opengl.glu.tessellator.GLUvertex vNext) { jogamp.opengl.glu.tessellator.GLUhalfEdge e; jogamp.opengl.glu.tessellator.GLUvertex vPrev; - jogamp.opengl.glu.tessellator.GLUvertex vNew = newVertex; + final jogamp.opengl.glu.tessellator.GLUvertex vNew = newVertex; assert (vNew != null); @@ -164,10 +164,10 @@ class Mesh { * the new face *before* fNext so that algorithms which walk the face * list will not see the newly created faces. */ - static void MakeFace(jogamp.opengl.glu.tessellator.GLUface newFace, jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig, jogamp.opengl.glu.tessellator.GLUface fNext) { + static void MakeFace(final jogamp.opengl.glu.tessellator.GLUface newFace, final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig, final jogamp.opengl.glu.tessellator.GLUface fNext) { jogamp.opengl.glu.tessellator.GLUhalfEdge e; jogamp.opengl.glu.tessellator.GLUface fPrev; - jogamp.opengl.glu.tessellator.GLUface fNew = newFace; + final jogamp.opengl.glu.tessellator.GLUface fNew = newFace; assert (fNew != null); @@ -218,8 +218,9 @@ class Mesh { /* KillVertex( vDel ) destroys a vertex and removes it from the global * vertex list. It updates the vertex loop to point to a given new vertex. */ - static void KillVertex(jogamp.opengl.glu.tessellator.GLUvertex vDel, jogamp.opengl.glu.tessellator.GLUvertex newOrg) { - jogamp.opengl.glu.tessellator.GLUhalfEdge e, eStart = vDel.anEdge; + static void KillVertex(final jogamp.opengl.glu.tessellator.GLUvertex vDel, final jogamp.opengl.glu.tessellator.GLUvertex newOrg) { + jogamp.opengl.glu.tessellator.GLUhalfEdge e; + final jogamp.opengl.glu.tessellator.GLUhalfEdge eStart = vDel.anEdge; jogamp.opengl.glu.tessellator.GLUvertex vPrev, vNext; /* change the origin of all affected edges */ @@ -239,8 +240,9 @@ class Mesh { /* KillFace( fDel ) destroys a face and removes it from the global face * list. It updates the face loop to point to a given new face. */ - static void KillFace(jogamp.opengl.glu.tessellator.GLUface fDel, jogamp.opengl.glu.tessellator.GLUface newLface) { - jogamp.opengl.glu.tessellator.GLUhalfEdge e, eStart = fDel.anEdge; + static void KillFace(final jogamp.opengl.glu.tessellator.GLUface fDel, final jogamp.opengl.glu.tessellator.GLUface newLface) { + jogamp.opengl.glu.tessellator.GLUhalfEdge e; + final jogamp.opengl.glu.tessellator.GLUhalfEdge eStart = fDel.anEdge; jogamp.opengl.glu.tessellator.GLUface fPrev, fNext; /* change the left face of all affected edges */ @@ -263,10 +265,10 @@ class Mesh { /* __gl_meshMakeEdge creates one edge, two vertices, and a loop (face). * The loop consists of the two new half-edges. */ - public static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshMakeEdge(jogamp.opengl.glu.tessellator.GLUmesh mesh) { - jogamp.opengl.glu.tessellator.GLUvertex newVertex1 = new jogamp.opengl.glu.tessellator.GLUvertex(); - jogamp.opengl.glu.tessellator.GLUvertex newVertex2 = new jogamp.opengl.glu.tessellator.GLUvertex(); - jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); + public static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshMakeEdge(final jogamp.opengl.glu.tessellator.GLUmesh mesh) { + final jogamp.opengl.glu.tessellator.GLUvertex newVertex1 = new jogamp.opengl.glu.tessellator.GLUvertex(); + final jogamp.opengl.glu.tessellator.GLUvertex newVertex2 = new jogamp.opengl.glu.tessellator.GLUvertex(); + final jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); jogamp.opengl.glu.tessellator.GLUhalfEdge e; e = MakeEdge(mesh.eHead); @@ -302,7 +304,7 @@ class Mesh { * If eDst == eOrg->Onext, the new vertex will have a single edge. * If eDst == eOrg->Oprev, the old vertex will have a single edge. */ - public static boolean __gl_meshSplice(jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg, jogamp.opengl.glu.tessellator.GLUhalfEdge eDst) { + public static boolean __gl_meshSplice(final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg, final jogamp.opengl.glu.tessellator.GLUhalfEdge eDst) { boolean joiningLoops = false; boolean joiningVertices = false; @@ -323,7 +325,7 @@ class Mesh { Splice(eDst, eOrg); if (!joiningVertices) { - jogamp.opengl.glu.tessellator.GLUvertex newVertex = new jogamp.opengl.glu.tessellator.GLUvertex(); + final jogamp.opengl.glu.tessellator.GLUvertex newVertex = new jogamp.opengl.glu.tessellator.GLUvertex(); /* We split one vertex into two -- the new vertex is eDst.Org. * Make sure the old vertex points to a valid half-edge. @@ -332,7 +334,7 @@ class Mesh { eOrg.Org.anEdge = eOrg; } if (!joiningLoops) { - jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); + final jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); /* We split one loop into two -- the new loop is eDst.Lface. * Make sure the old face points to a valid half-edge. @@ -355,8 +357,8 @@ class Mesh { * plus a few calls to memFree, but this would allocate and delete * unnecessary vertices and faces. */ - static boolean __gl_meshDelete(jogamp.opengl.glu.tessellator.GLUhalfEdge eDel) { - jogamp.opengl.glu.tessellator.GLUhalfEdge eDelSym = eDel.Sym; + static boolean __gl_meshDelete(final jogamp.opengl.glu.tessellator.GLUhalfEdge eDel) { + final jogamp.opengl.glu.tessellator.GLUhalfEdge eDelSym = eDel.Sym; boolean joiningLoops = false; /* First step: disconnect the origin vertex eDel.Org. We make all @@ -377,7 +379,7 @@ class Mesh { Splice(eDel, eDel.Sym.Lnext); if (!joiningLoops) { - jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); + final jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); /* We are splitting one loop into two -- create a new loop for eDel. */ MakeFace(newFace, eDel, eDel.Lface); @@ -415,9 +417,9 @@ class Mesh { * eNew == eOrg.Lnext, and eNew.Dst is a newly created vertex. * eOrg and eNew will have the same left face. */ - static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshAddEdgeVertex(jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg) { + static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshAddEdgeVertex(final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg) { jogamp.opengl.glu.tessellator.GLUhalfEdge eNewSym; - jogamp.opengl.glu.tessellator.GLUhalfEdge eNew = MakeEdge(eOrg); + final jogamp.opengl.glu.tessellator.GLUhalfEdge eNew = MakeEdge(eOrg); eNewSym = eNew.Sym; @@ -427,7 +429,7 @@ class Mesh { /* Set the vertex and face information */ eNew.Org = eOrg.Sym.Org; { - jogamp.opengl.glu.tessellator.GLUvertex newVertex = new jogamp.opengl.glu.tessellator.GLUvertex(); + final jogamp.opengl.glu.tessellator.GLUvertex newVertex = new jogamp.opengl.glu.tessellator.GLUvertex(); MakeVertex(newVertex, eNewSym, eNew.Org); } @@ -441,9 +443,9 @@ class Mesh { * such that eNew == eOrg.Lnext. The new vertex is eOrg.Sym.Org == eNew.Org. * eOrg and eNew will have the same left face. */ - public static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshSplitEdge(jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg) { + public static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshSplitEdge(final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg) { jogamp.opengl.glu.tessellator.GLUhalfEdge eNew; - jogamp.opengl.glu.tessellator.GLUhalfEdge tempHalfEdge = __gl_meshAddEdgeVertex(eOrg); + final jogamp.opengl.glu.tessellator.GLUhalfEdge tempHalfEdge = __gl_meshAddEdgeVertex(eOrg); eNew = tempHalfEdge.Sym; @@ -472,10 +474,10 @@ class Mesh { * If (eOrg.Lnext == eDst), the old face is reduced to a single edge. * If (eOrg.Lnext.Lnext == eDst), the old face is reduced to two edges. */ - static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshConnect(jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg, jogamp.opengl.glu.tessellator.GLUhalfEdge eDst) { + static jogamp.opengl.glu.tessellator.GLUhalfEdge __gl_meshConnect(final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrg, final jogamp.opengl.glu.tessellator.GLUhalfEdge eDst) { jogamp.opengl.glu.tessellator.GLUhalfEdge eNewSym; boolean joiningLoops = false; - jogamp.opengl.glu.tessellator.GLUhalfEdge eNew = MakeEdge(eOrg); + final jogamp.opengl.glu.tessellator.GLUhalfEdge eNew = MakeEdge(eOrg); eNewSym = eNew.Sym; @@ -498,7 +500,7 @@ class Mesh { eOrg.Lface.anEdge = eNewSym; if (!joiningLoops) { - jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); + final jogamp.opengl.glu.tessellator.GLUface newFace = new jogamp.opengl.glu.tessellator.GLUface(); /* We split one loop into two -- the new loop is eNew.Lface */ MakeFace(newFace, eNew, eOrg.Lface); @@ -516,8 +518,8 @@ class Mesh { * An entire mesh can be deleted by zapping its faces, one at a time, * in any order. Zapped faces cannot be used in further mesh operations! */ - static void __gl_meshZapFace(jogamp.opengl.glu.tessellator.GLUface fZap) { - jogamp.opengl.glu.tessellator.GLUhalfEdge eStart = fZap.anEdge; + static void __gl_meshZapFace(final jogamp.opengl.glu.tessellator.GLUface fZap) { + final jogamp.opengl.glu.tessellator.GLUhalfEdge eStart = fZap.anEdge; jogamp.opengl.glu.tessellator.GLUhalfEdge e, eNext, eSym; jogamp.opengl.glu.tessellator.GLUface fPrev, fNext; @@ -566,7 +568,7 @@ class Mesh { jogamp.opengl.glu.tessellator.GLUface f; jogamp.opengl.glu.tessellator.GLUhalfEdge e; jogamp.opengl.glu.tessellator.GLUhalfEdge eSym; - jogamp.opengl.glu.tessellator.GLUmesh mesh = new jogamp.opengl.glu.tessellator.GLUmesh(); + final jogamp.opengl.glu.tessellator.GLUmesh mesh = new jogamp.opengl.glu.tessellator.GLUmesh(); v = mesh.vHead; f = mesh.fHead; @@ -609,13 +611,13 @@ class Mesh { /* __gl_meshUnion( mesh1, mesh2 ) forms the union of all structures in * both meshes, and returns the new mesh (the old meshes are destroyed). */ - static jogamp.opengl.glu.tessellator.GLUmesh __gl_meshUnion(jogamp.opengl.glu.tessellator.GLUmesh mesh1, jogamp.opengl.glu.tessellator.GLUmesh mesh2) { - jogamp.opengl.glu.tessellator.GLUface f1 = mesh1.fHead; - jogamp.opengl.glu.tessellator.GLUvertex v1 = mesh1.vHead; - jogamp.opengl.glu.tessellator.GLUhalfEdge e1 = mesh1.eHead; - jogamp.opengl.glu.tessellator.GLUface f2 = mesh2.fHead; - jogamp.opengl.glu.tessellator.GLUvertex v2 = mesh2.vHead; - jogamp.opengl.glu.tessellator.GLUhalfEdge e2 = mesh2.eHead; + static jogamp.opengl.glu.tessellator.GLUmesh __gl_meshUnion(final jogamp.opengl.glu.tessellator.GLUmesh mesh1, final jogamp.opengl.glu.tessellator.GLUmesh mesh2) { + final jogamp.opengl.glu.tessellator.GLUface f1 = mesh1.fHead; + final jogamp.opengl.glu.tessellator.GLUvertex v1 = mesh1.vHead; + final jogamp.opengl.glu.tessellator.GLUhalfEdge e1 = mesh1.eHead; + final jogamp.opengl.glu.tessellator.GLUface f2 = mesh2.fHead; + final jogamp.opengl.glu.tessellator.GLUvertex v2 = mesh2.vHead; + final jogamp.opengl.glu.tessellator.GLUhalfEdge e2 = mesh2.eHead; /* Add the faces, vertices, and edges of mesh2 to those of mesh1 */ if (f2.next != f2) { @@ -645,8 +647,8 @@ class Mesh { /* __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh. */ - static void __gl_meshDeleteMeshZap(jogamp.opengl.glu.tessellator.GLUmesh mesh) { - jogamp.opengl.glu.tessellator.GLUface fHead = mesh.fHead; + static void __gl_meshDeleteMeshZap(final jogamp.opengl.glu.tessellator.GLUmesh mesh) { + final jogamp.opengl.glu.tessellator.GLUface fHead = mesh.fHead; while (fHead.next != fHead) { __gl_meshZapFace(fHead.next); @@ -656,7 +658,7 @@ class Mesh { /* __gl_meshDeleteMesh( mesh ) will free all storage for any valid mesh. */ - public static void __gl_meshDeleteMesh(jogamp.opengl.glu.tessellator.GLUmesh mesh) { + public static void __gl_meshDeleteMesh(final jogamp.opengl.glu.tessellator.GLUmesh mesh) { jogamp.opengl.glu.tessellator.GLUface f, fNext; jogamp.opengl.glu.tessellator.GLUvertex v, vNext; jogamp.opengl.glu.tessellator.GLUhalfEdge e, eNext; @@ -677,10 +679,10 @@ class Mesh { /* __gl_meshCheckMesh( mesh ) checks a mesh for self-consistency. */ - public static void __gl_meshCheckMesh(jogamp.opengl.glu.tessellator.GLUmesh mesh) { - jogamp.opengl.glu.tessellator.GLUface fHead = mesh.fHead; - jogamp.opengl.glu.tessellator.GLUvertex vHead = mesh.vHead; - jogamp.opengl.glu.tessellator.GLUhalfEdge eHead = mesh.eHead; + public static void __gl_meshCheckMesh(final jogamp.opengl.glu.tessellator.GLUmesh mesh) { + final jogamp.opengl.glu.tessellator.GLUface fHead = mesh.fHead; + final jogamp.opengl.glu.tessellator.GLUvertex vHead = mesh.vHead; + final jogamp.opengl.glu.tessellator.GLUhalfEdge eHead = mesh.eHead; jogamp.opengl.glu.tessellator.GLUface f, fPrev; jogamp.opengl.glu.tessellator.GLUvertex v, vPrev; jogamp.opengl.glu.tessellator.GLUhalfEdge e, ePrev; diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java index 196e6cf27..44668a943 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Normal.java @@ -83,11 +83,11 @@ class Normal { } } - private static double Dot(double[] u, double[] v) { + private static double Dot(final double[] u, final double[] v) { return (u[0] * v[0] + u[1] * v[1] + u[2] * v[2]); } - static void Normalize(double[] v) { + static void Normalize(final double[] v) { double len = v[0] * v[0] + v[1] * v[1] + v[2] * v[2]; assert (len > 0); @@ -97,7 +97,7 @@ class Normal { v[2] /= len; } - static int LongAxis(double[] v) { + static int LongAxis(final double[] v) { int i = 0; if (Math.abs(v[1]) > Math.abs(v[0])) { @@ -109,12 +109,12 @@ class Normal { return i; } - static void ComputeNormal(GLUtessellatorImpl tess, double[] norm) { + static void ComputeNormal(final GLUtessellatorImpl tess, final double[] norm) { jogamp.opengl.glu.tessellator.GLUvertex v, v1, v2; double c, tLen2, maxLen2; double[] maxVal, minVal, d1, d2, tNorm; jogamp.opengl.glu.tessellator.GLUvertex[] maxVert, minVert; - jogamp.opengl.glu.tessellator.GLUvertex vHead = tess.mesh.vHead; + final jogamp.opengl.glu.tessellator.GLUvertex vHead = tess.mesh.vHead; int i; maxVal = new double[3]; @@ -192,10 +192,12 @@ class Normal { } } - static void CheckOrientation(GLUtessellatorImpl tess) { + static void CheckOrientation(final GLUtessellatorImpl tess) { double area; - jogamp.opengl.glu.tessellator.GLUface f, fHead = tess.mesh.fHead; - jogamp.opengl.glu.tessellator.GLUvertex v, vHead = tess.mesh.vHead; + jogamp.opengl.glu.tessellator.GLUface f; + final jogamp.opengl.glu.tessellator.GLUface fHead = tess.mesh.fHead; + jogamp.opengl.glu.tessellator.GLUvertex v; + final jogamp.opengl.glu.tessellator.GLUvertex vHead = tess.mesh.vHead; jogamp.opengl.glu.tessellator.GLUhalfEdge e; /* When we compute the normal automatically, we choose the orientation @@ -224,10 +226,11 @@ class Normal { /* Determine the polygon normal and project vertices onto the plane * of the polygon. */ - public static void __gl_projectPolygon(GLUtessellatorImpl tess) { - jogamp.opengl.glu.tessellator.GLUvertex v, vHead = tess.mesh.vHead; + public static void __gl_projectPolygon(final GLUtessellatorImpl tess) { + jogamp.opengl.glu.tessellator.GLUvertex v; + final jogamp.opengl.glu.tessellator.GLUvertex vHead = tess.mesh.vHead; double w; - double[] norm = new double[3]; + final double[] norm = new double[3]; double[] sUnit, tUnit; int i; boolean computedNormal = false; diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQ.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQ.java index 25405ad64..1f9b9e5ed 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQ.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQ.java @@ -75,11 +75,11 @@ abstract class PriorityQ { // #else /* Violates modularity, but a little faster */ // #include "geom.h" - public static boolean LEQ(Leq leq, Object x, Object y) { + public static boolean LEQ(final Leq leq, final Object x, final Object y) { return jogamp.opengl.glu.tessellator.Geom.VertLeq((jogamp.opengl.glu.tessellator.GLUvertex) x, (jogamp.opengl.glu.tessellator.GLUvertex) y); } - static PriorityQ pqNewPriorityQ(Leq leq) { + static PriorityQ pqNewPriorityQ(final Leq leq) { return new PriorityQSort(leq); } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java index 1ac0fd438..74d981907 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQHeap.java @@ -61,7 +61,7 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { jogamp.opengl.glu.tessellator.PriorityQ.Leq leq; /* really __gl_pqHeapNewPriorityQ */ - public PriorityQHeap(jogamp.opengl.glu.tessellator.PriorityQ.Leq leq) { + public PriorityQHeap(final jogamp.opengl.glu.tessellator.PriorityQ.Leq leq) { size = 0; max = jogamp.opengl.glu.tessellator.PriorityQ.INIT_SIZE; nodes = new jogamp.opengl.glu.tessellator.PriorityQ.PQnode[jogamp.opengl.glu.tessellator.PriorityQ.INIT_SIZE + 1]; @@ -88,8 +88,8 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { } void FloatDown(int curr) { - jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; - jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; + final jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; + final jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; int hCurr, hChild; int child; @@ -117,8 +117,8 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { void FloatUp(int curr) { - jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; - jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; + final jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; + final jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; int hCurr, hParent; int parent; @@ -155,19 +155,19 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { /* really __gl_pqHeapInsert */ /* returns LONG_MAX iff out of memory */ @Override - int pqInsert(Object keyNew) { + int pqInsert(final Object keyNew) { int curr; int free; curr = ++size; if ((curr * 2) > max) { - jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] saveNodes = nodes; - jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] saveHandles = handles; + final jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] saveNodes = nodes; + final jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] saveHandles = handles; /* If the heap overflows, double its size. */ max <<= 1; // pq->nodes = (PQnode *)memRealloc( pq->nodes, (size_t) ((pq->max + 1) * sizeof( pq->nodes[0] ))); - PriorityQ.PQnode[] pqNodes = new PriorityQ.PQnode[max + 1]; + final PriorityQ.PQnode[] pqNodes = new PriorityQ.PQnode[max + 1]; System.arraycopy( nodes, 0, pqNodes, 0, nodes.length ); for (int i = nodes.length; i < pqNodes.length; i++) { pqNodes[i] = new PQnode(); @@ -179,7 +179,7 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { } // pq->handles = (PQhandleElem *)memRealloc( pq->handles,(size_t)((pq->max + 1) * sizeof( pq->handles[0] ))); - PriorityQ.PQhandleElem[] pqHandles = new PriorityQ.PQhandleElem[max + 1]; + final PriorityQ.PQhandleElem[] pqHandles = new PriorityQ.PQhandleElem[max + 1]; System.arraycopy( handles, 0, pqHandles, 0, handles.length ); for (int i = handles.length; i < pqHandles.length; i++) { pqHandles[i] = new PQhandleElem(); @@ -212,10 +212,10 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { /* really __gl_pqHeapExtractMin */ @Override Object pqExtractMin() { - jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; - jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; - int hMin = n[1].handle; - Object min = h[hMin].key; + final jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; + final jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; + final int hMin = n[1].handle; + final Object min = h[hMin].key; if (size > 0) { n[1].handle = n[size].handle; @@ -234,9 +234,9 @@ class PriorityQHeap extends jogamp.opengl.glu.tessellator.PriorityQ { /* really __gl_pqHeapDelete */ @Override - void pqDelete(int hCurr) { - jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; - jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; + void pqDelete(final int hCurr) { + final jogamp.opengl.glu.tessellator.PriorityQ.PQnode[] n = nodes; + final jogamp.opengl.glu.tessellator.PriorityQ.PQhandleElem[] h = handles; int curr; assert (hCurr >= 1 && hCurr <= max && h[hCurr].key != null); diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java index cf54b15c3..45e994b67 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/PriorityQSort.java @@ -59,7 +59,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { boolean initialized; jogamp.opengl.glu.tessellator.PriorityQ.Leq leq; - public PriorityQSort(jogamp.opengl.glu.tessellator.PriorityQ.Leq leq) { + public PriorityQSort(final jogamp.opengl.glu.tessellator.PriorityQ.Leq leq) { heap = new jogamp.opengl.glu.tessellator.PriorityQHeap(leq); keys = new Object[jogamp.opengl.glu.tessellator.PriorityQ.INIT_SIZE]; @@ -78,17 +78,17 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { keys = null; } - private static boolean LT(jogamp.opengl.glu.tessellator.PriorityQ.Leq leq, Object x, Object y) { - return (!jogamp.opengl.glu.tessellator.PriorityQHeap.LEQ(leq, y, x)); + private static boolean LT(final jogamp.opengl.glu.tessellator.PriorityQ.Leq leq, final Object x, final Object y) { + return (!PriorityQ.LEQ(leq, y, x)); } - private static boolean GT(jogamp.opengl.glu.tessellator.PriorityQ.Leq leq, Object x, Object y) { - return (!jogamp.opengl.glu.tessellator.PriorityQHeap.LEQ(leq, x, y)); + private static boolean GT(final jogamp.opengl.glu.tessellator.PriorityQ.Leq leq, final Object x, final Object y) { + return (!PriorityQ.LEQ(leq, x, y)); } - private static void Swap(int[] array, int a, int b) { + private static void Swap(final int[] array, final int a, final int b) { if (true) { - int tmp = array[a]; + final int tmp = array[a]; array[a] = array[b]; array[b] = tmp; } else { @@ -105,7 +105,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { boolean pqInit() { int p, r, i, j; int piv; - Stack[] stack = new Stack[50]; + final Stack[] stack = new Stack[50]; for (int k = 0; k < stack.length; k++) { stack[k] = new Stack(); } @@ -194,7 +194,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { /* really __gl_pqSortInsert */ /* returns LONG_MAX iff out of memory */ @Override - int pqInsert(Object keyNew) { + int pqInsert(final Object keyNew) { int curr; if (initialized) { @@ -202,12 +202,12 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { } curr = size; if (++size >= max) { - Object[] saveKey = keys; + final Object[] saveKey = keys; /* If the heap overflows, double its size. */ max <<= 1; // pq->keys = (PQHeapKey *)memRealloc( pq->keys,(size_t)(pq->max * sizeof( pq->keys[0] ))); - Object[] pqKeys = new Object[max]; + final Object[] pqKeys = new Object[max]; System.arraycopy( keys, 0, pqKeys, 0, keys.length ); keys = pqKeys; if (keys == null) { @@ -254,7 +254,7 @@ class PriorityQSort extends jogamp.opengl.glu.tessellator.PriorityQ { sortMin = keys[order[size - 1]]; if (!heap.pqIsEmpty()) { heapMin = heap.pqMinimum(); - if (jogamp.opengl.glu.tessellator.PriorityQHeap.LEQ(leq, heapMin, sortMin)) { + if (PriorityQ.LEQ(leq, heapMin, sortMin)) { return heapMin; } } diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java index a2e973508..6325de8d2 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Render.java @@ -73,7 +73,7 @@ class Render { public FaceCount() { } - public FaceCount(long size, jogamp.opengl.glu.tessellator.GLUhalfEdge eStart, renderCallBack render) { + public FaceCount(final long size, final jogamp.opengl.glu.tessellator.GLUhalfEdge eStart, final renderCallBack render) { this.size = size; this.eStart = eStart; this.render = render; @@ -97,7 +97,7 @@ class Render { * * The rendering output is provided as callbacks (see the api). */ - public static void __gl_renderMesh(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUmesh mesh) { + public static void __gl_renderMesh(final GLUtessellatorImpl tess, final jogamp.opengl.glu.tessellator.GLUmesh mesh) { jogamp.opengl.glu.tessellator.GLUface f; /* Make a list of separate triangles so we can render them all at once */ @@ -124,7 +124,7 @@ class Render { } - static void RenderMaximumFaceGroup(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUface fOrig) { + static void RenderMaximumFaceGroup(final GLUtessellatorImpl tess, final jogamp.opengl.glu.tessellator.GLUface fOrig) { /* We want to find the largest triangle fan or strip of unmarked faces * which includes the given face fOrig. There are 3 possible fans * passing through fOrig (one centered at each vertex), and 3 possible @@ -132,7 +132,7 @@ class Render { * is to try all of these, and take the primitive which uses the most * triangles (a greedy approach). */ - jogamp.opengl.glu.tessellator.GLUhalfEdge e = fOrig.anEdge; + final jogamp.opengl.glu.tessellator.GLUhalfEdge e = fOrig.anEdge; FaceCount max = new FaceCount(); FaceCount newFace = new FaceCount(); @@ -178,11 +178,11 @@ class Render { * more complicated, and we need a general tracking method like the * one here. */ - private static boolean Marked(jogamp.opengl.glu.tessellator.GLUface f) { + private static boolean Marked(final jogamp.opengl.glu.tessellator.GLUface f) { return !f.inside || f.marked; } - private static GLUface AddToTrail(jogamp.opengl.glu.tessellator.GLUface f, jogamp.opengl.glu.tessellator.GLUface t) { + private static GLUface AddToTrail(final jogamp.opengl.glu.tessellator.GLUface f, final jogamp.opengl.glu.tessellator.GLUface t) { f.trail = t; f.marked = true; return f; @@ -199,12 +199,12 @@ class Render { } } - static FaceCount MaximumFan(jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig) { + static FaceCount MaximumFan(final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig) { /* eOrig.Lface is the face we want to render. We want to find the size * of a maximal fan around eOrig.Org. To do this we just walk around * the origin vertex as far as possible in both directions. */ - FaceCount newFace = new FaceCount(0, null, renderFan); + final FaceCount newFace = new FaceCount(0, null, renderFan); jogamp.opengl.glu.tessellator.GLUface trail = null; jogamp.opengl.glu.tessellator.GLUhalfEdge e; @@ -223,11 +223,11 @@ class Render { } - private static boolean IsEven(long n) { + private static boolean IsEven(final long n) { return (n & 0x1L) == 0; } - static FaceCount MaximumStrip(jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig) { + static FaceCount MaximumStrip(final jogamp.opengl.glu.tessellator.GLUhalfEdge eOrig) { /* Here we are looking for a maximal strip that contains the vertices * eOrig.Org, eOrig.Dst, eOrig.Lnext.Dst (in that order or the * reverse, such that all triangles are oriented CCW). @@ -238,7 +238,7 @@ class Render { * We walk the strip starting on a side with an even number of triangles; * if both side have an odd number, we are forced to shorten one side. */ - FaceCount newFace = new FaceCount(0, null, renderStrip); + final FaceCount newFace = new FaceCount(0, null, renderStrip); long headSize = 0, tailSize = 0; jogamp.opengl.glu.tessellator.GLUface trail = null; jogamp.opengl.glu.tessellator.GLUhalfEdge e, eTail, eHead; @@ -280,7 +280,7 @@ class Render { private static class RenderTriangle implements renderCallBack { @Override - public void render(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUhalfEdge e, long size) { + public void render(final GLUtessellatorImpl tess, final jogamp.opengl.glu.tessellator.GLUhalfEdge e, final long size) { /* Just add the triangle to a triangle list, so we can render all * the separate triangles at once. */ @@ -290,7 +290,7 @@ class Render { } - static void RenderLonelyTriangles(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUface f) { + static void RenderLonelyTriangles(final GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUface f) { /* Now we render all the separate triangles which could not be * grouped into a triangle fan or strip. */ @@ -325,7 +325,7 @@ class Render { private static class RenderFan implements renderCallBack { @Override - public void render(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUhalfEdge e, long size) { + public void render(final GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUhalfEdge e, long size) { /* Render as many CCW triangles as possible in a fan starting from * edge "e". The fan *should* contain exactly "size" triangles * (otherwise we've goofed up somewhere). @@ -348,7 +348,7 @@ class Render { private static class RenderStrip implements renderCallBack { @Override - public void render(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUhalfEdge e, long size) { + public void render(final GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUhalfEdge e, long size) { /* Render as many CCW triangles as possible in a strip starting from * edge "e". The strip *should* contain exactly "size" triangles * (otherwise we've goofed up somewhere). @@ -381,7 +381,7 @@ class Render { * contour for each face marked "inside". The rendering output is * provided as callbacks (see the api). */ - public static void __gl_renderBoundary(GLUtessellatorImpl tess, jogamp.opengl.glu.tessellator.GLUmesh mesh) { + public static void __gl_renderBoundary(final GLUtessellatorImpl tess, final jogamp.opengl.glu.tessellator.GLUmesh mesh) { jogamp.opengl.glu.tessellator.GLUface f; jogamp.opengl.glu.tessellator.GLUhalfEdge e; @@ -403,7 +403,7 @@ class Render { private static final int SIGN_INCONSISTENT = 2; - static int ComputeNormal(GLUtessellatorImpl tess, double[] norm, boolean check) + static int ComputeNormal(final GLUtessellatorImpl tess, final double[] norm, final boolean check) /* * If check==false, we compute the polygon normal and place it in norm[]. * If check==true, we check that each triangle in the fan from v0 has a @@ -412,13 +412,13 @@ class Render { * are degenerate return 0; otherwise (no consistent orientation) return * SIGN_INCONSISTENT. */ { - jogamp.opengl.glu.tessellator.CachedVertex[] v = tess.cache; + final jogamp.opengl.glu.tessellator.CachedVertex[] v = tess.cache; // CachedVertex vn = v0 + tess.cacheCount; - int vn = tess.cacheCount; + final int vn = tess.cacheCount; // CachedVertex vc; int vc; double dot, xc, yc, zc, xp, yp, zp; - double[] n = new double[3]; + final double[] n = new double[3]; int sign = 0; /* Find the polygon normal. It is important to get a reasonable @@ -490,13 +490,13 @@ class Render { * Returns true if the polygon was successfully rendered. The rendering * output is provided as callbacks (see the api). */ - public static boolean __gl_renderCache(GLUtessellatorImpl tess) { - jogamp.opengl.glu.tessellator.CachedVertex[] v = tess.cache; + public static boolean __gl_renderCache(final GLUtessellatorImpl tess) { + final jogamp.opengl.glu.tessellator.CachedVertex[] v = tess.cache; // CachedVertex vn = v0 + tess.cacheCount; - int vn = tess.cacheCount; + final int vn = tess.cacheCount; // CachedVertex vc; int vc; - double[] norm = new double[3]; + final double[] norm = new double[3]; int sign; if (tess.cacheCount < 3) { diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java index d2c0db61e..9cf05378c 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/Sweep.java @@ -62,7 +62,7 @@ class Sweep { // #ifdef FOR_TRITE_TEST_PROGRAM // extern void DebugEvent( GLUtessellator *tess ); // #else - private static void DebugEvent(GLUtessellatorImpl tess) { + private static void DebugEvent(final GLUtessellatorImpl tess) { } // #endif @@ -100,21 +100,21 @@ class Sweep { /* When we merge two edges into one, we need to compute the combined * winding of the new edge. */ - private static void AddWinding(GLUhalfEdge eDst, GLUhalfEdge eSrc) { + private static void AddWinding(final GLUhalfEdge eDst, final GLUhalfEdge eSrc) { eDst.winding += eSrc.winding; eDst.Sym.winding += eSrc.Sym.winding; } - private static ActiveRegion RegionBelow(ActiveRegion r) { + private static ActiveRegion RegionBelow(final ActiveRegion r) { return ((ActiveRegion) Dict.dictKey(Dict.dictPred(r.nodeUp))); } - private static ActiveRegion RegionAbove(ActiveRegion r) { + private static ActiveRegion RegionAbove(final ActiveRegion r) { return ((ActiveRegion) Dict.dictKey(Dict.dictSucc(r.nodeUp))); } - static boolean EdgeLeq(GLUtessellatorImpl tess, ActiveRegion reg1, ActiveRegion reg2) + static boolean EdgeLeq(final GLUtessellatorImpl tess, final ActiveRegion reg1, final ActiveRegion reg2) /* * Both edges must be directed from right to left (this is the canonical * direction for the upper edge of each region). @@ -126,7 +126,7 @@ class Sweep { * Special case: if both edge destinations are at the sweep event, * we sort the edges by slope (they would otherwise compare equally). */ { - GLUvertex event = tess.event; + final GLUvertex event = tess.event; GLUhalfEdge e1, e2; double t1, t2; @@ -156,7 +156,7 @@ class Sweep { } - static void DeleteRegion(GLUtessellatorImpl tess, ActiveRegion reg) { + static void DeleteRegion(final GLUtessellatorImpl tess, final ActiveRegion reg) { if (reg.fixUpperEdge) { /* It was created with zero winding number, so it better be * deleted with zero winding number (ie. it better not get merged @@ -169,7 +169,7 @@ class Sweep { } - static boolean FixUpperEdge(ActiveRegion reg, GLUhalfEdge newEdge) + static boolean FixUpperEdge(final ActiveRegion reg, final GLUhalfEdge newEdge) /* * Replace an upper edge which needs fixing (see ConnectRightVertex). */ { @@ -183,7 +183,7 @@ class Sweep { } static ActiveRegion TopLeftRegion(ActiveRegion reg) { - GLUvertex org = reg.eUp.Org; + final GLUvertex org = reg.eUp.Org; GLUhalfEdge e; /* Find the region above the uppermost edge with the same origin */ @@ -204,7 +204,7 @@ class Sweep { } static ActiveRegion TopRightRegion(ActiveRegion reg) { - GLUvertex dst = reg.eUp.Sym.Org; + final GLUvertex dst = reg.eUp.Sym.Org; /* Find the region above the uppermost edge with the same destination */ do { @@ -213,16 +213,16 @@ class Sweep { return reg; } - static ActiveRegion AddRegionBelow(GLUtessellatorImpl tess, - ActiveRegion regAbove, - GLUhalfEdge eNewUp) + static ActiveRegion AddRegionBelow(final GLUtessellatorImpl tess, + final ActiveRegion regAbove, + final GLUhalfEdge eNewUp) /* * Add a new active region to the sweep line, *somewhere* below "regAbove" * (according to where the new edge belongs in the sweep-line dictionary). * The upper edge of the new region will be "eNewUp". * Winding number and "inside" flag are not updated. */ { - ActiveRegion regNew = new ActiveRegion(); + final ActiveRegion regNew = new ActiveRegion(); if (regNew == null) throw new RuntimeException(); regNew.eUp = eNewUp; @@ -237,7 +237,7 @@ class Sweep { return regNew; } - static boolean IsWindingInside(GLUtessellatorImpl tess, int n) { + static boolean IsWindingInside(final GLUtessellatorImpl tess, final int n) { switch (tess.windingRule) { case GLU.GLU_TESS_WINDING_ODD: return (n & 1) != 0; @@ -257,13 +257,13 @@ class Sweep { } - static void ComputeWinding(GLUtessellatorImpl tess, ActiveRegion reg) { + static void ComputeWinding(final GLUtessellatorImpl tess, final ActiveRegion reg) { reg.windingNumber = RegionAbove(reg).windingNumber + reg.eUp.winding; reg.inside = IsWindingInside(tess, reg.windingNumber); } - static void FinishRegion(GLUtessellatorImpl tess, ActiveRegion reg) + static void FinishRegion(final GLUtessellatorImpl tess, final ActiveRegion reg) /* * Delete a region from the sweep line. This happens when the upper * and lower chains of a region meet (at a vertex on the sweep line). @@ -271,8 +271,8 @@ class Sweep { * not do this before -- since the structure of the mesh is always * changing, this face may not have even existed until now). */ { - GLUhalfEdge e = reg.eUp; - GLUface f = e.Lface; + final GLUhalfEdge e = reg.eUp; + final GLUface f = e.Lface; f.inside = reg.inside; f.anEdge = e; /* optimization for __gl_meshTessellateMonoRegion() */ @@ -280,8 +280,8 @@ class Sweep { } - static GLUhalfEdge FinishLeftRegions(GLUtessellatorImpl tess, - ActiveRegion regFirst, ActiveRegion regLast) + static GLUhalfEdge FinishLeftRegions(final GLUtessellatorImpl tess, + final ActiveRegion regFirst, final ActiveRegion regLast) /* * We are given a vertex with one or more left-going edges. All affected * edges should be in the edge dictionary. Starting at regFirst.eUp, @@ -335,9 +335,9 @@ class Sweep { } - static void AddRightEdges(GLUtessellatorImpl tess, ActiveRegion regUp, - GLUhalfEdge eFirst, GLUhalfEdge eLast, GLUhalfEdge eTopLeft, - boolean cleanUp) + static void AddRightEdges(final GLUtessellatorImpl tess, final ActiveRegion regUp, + final GLUhalfEdge eFirst, final GLUhalfEdge eLast, GLUhalfEdge eTopLeft, + final boolean cleanUp) /* * Purpose: insert right-going edges into the edge dictionary, and update * winding numbers and mesh connectivity appropriately. All right-going @@ -406,16 +406,16 @@ class Sweep { } - static void CallCombine(GLUtessellatorImpl tess, GLUvertex isect, - Object[] data, float[] weights, boolean needed) { - double[] coords = new double[3]; + static void CallCombine(final GLUtessellatorImpl tess, final GLUvertex isect, + final Object[] data, final float[] weights, final boolean needed) { + final double[] coords = new double[3]; /* Copy coord data in case the callback changes it. */ coords[0] = isect.coords[0]; coords[1] = isect.coords[1]; coords[2] = isect.coords[2]; - Object[] outData = new Object[1]; + final Object[] outData = new Object[1]; tess.callCombineOrCombineData(coords, data, weights, outData); isect.data = outData[0]; if (isect.data == null) { @@ -432,14 +432,14 @@ class Sweep { } } - static void SpliceMergeVertices(GLUtessellatorImpl tess, GLUhalfEdge e1, - GLUhalfEdge e2) + static void SpliceMergeVertices(final GLUtessellatorImpl tess, final GLUhalfEdge e1, + final GLUhalfEdge e2) /* * Two vertices with idential coordinates are combined into one. * e1.Org is kept, while e2.Org is discarded. */ { - Object[] data = new Object[4]; - float[] weights = new float[]{0.5f, 0.5f, 0.0f, 0.0f}; + final Object[] data = new Object[4]; + final float[] weights = new float[]{0.5f, 0.5f, 0.0f, 0.0f}; data[0] = e1.Org.data; data[1] = e2.Org.data; @@ -447,8 +447,8 @@ class Sweep { if (!Mesh.__gl_meshSplice(e1, e2)) throw new RuntimeException(); } - static void VertexWeights(GLUvertex isect, GLUvertex org, GLUvertex dst, - float[] weights) + static void VertexWeights(final GLUvertex isect, final GLUvertex org, final GLUvertex dst, + final float[] weights) /* * Find some weights which describe how the intersection vertex is * a linear combination of "org" and "dest". Each of the two edges @@ -456,8 +456,8 @@ class Sweep { * splits the weight between its org and dst according to the * relative distance to "isect". */ { - double t1 = Geom.VertL1dist(org, isect); - double t2 = Geom.VertL1dist(dst, isect); + final double t1 = Geom.VertL1dist(org, isect); + final double t2 = Geom.VertL1dist(dst, isect); weights[0] = (float) (0.5 * t2 / (t1 + t2)); weights[1] = (float) (0.5 * t1 / (t1 + t2)); @@ -467,18 +467,18 @@ class Sweep { } - static void GetIntersectData(GLUtessellatorImpl tess, GLUvertex isect, - GLUvertex orgUp, GLUvertex dstUp, - GLUvertex orgLo, GLUvertex dstLo) + static void GetIntersectData(final GLUtessellatorImpl tess, final GLUvertex isect, + final GLUvertex orgUp, final GLUvertex dstUp, + final GLUvertex orgLo, final GLUvertex dstLo) /* * We've computed a new intersection point, now we need a "data" pointer * from the user so that we can refer to this new vertex in the * rendering callbacks. */ { - Object[] data = new Object[4]; - float[] weights = new float[4]; - float[] weights1 = new float[2]; - float[] weights2 = new float[2]; + final Object[] data = new Object[4]; + final float[] weights = new float[4]; + final float[] weights1 = new float[2]; + final float[] weights2 = new float[2]; data[0] = orgUp.data; data[1] = dstUp.data; @@ -494,7 +494,7 @@ class Sweep { CallCombine(tess, isect, data, weights, true); } - static boolean CheckForRightSplice(GLUtessellatorImpl tess, ActiveRegion regUp) + static boolean CheckForRightSplice(final GLUtessellatorImpl tess, final ActiveRegion regUp) /* * Check the upper and lower edge of "regUp", to make sure that the * eUp.Org is above eLo, or eLo.Org is below eUp (depending on which @@ -520,9 +520,9 @@ class Sweep { * This is a guaranteed solution, no matter how degenerate things get. * Basically this is a combinatorial solution to a numerical problem. */ { - ActiveRegion regLo = RegionBelow(regUp); - GLUhalfEdge eUp = regUp.eUp; - GLUhalfEdge eLo = regLo.eUp; + final ActiveRegion regLo = RegionBelow(regUp); + final GLUhalfEdge eUp = regUp.eUp; + final GLUhalfEdge eLo = regLo.eUp; if (Geom.VertLeq(eUp.Org, eLo.Org)) { if (Geom.EdgeSign(eLo.Sym.Org, eUp.Org, eLo.Org) > 0) return false; @@ -550,7 +550,7 @@ class Sweep { return true; } - static boolean CheckForLeftSplice(GLUtessellatorImpl tess, ActiveRegion regUp) + static boolean CheckForLeftSplice(final GLUtessellatorImpl tess, final ActiveRegion regUp) /* * Check the upper and lower edge of "regUp", to make sure that the * eUp.Sym.Org is above eLo, or eLo.Sym.Org is below eUp (depending on which @@ -569,9 +569,9 @@ class Sweep { * We fix the problem by just splicing the offending vertex into the * other edge. */ { - ActiveRegion regLo = RegionBelow(regUp); - GLUhalfEdge eUp = regUp.eUp; - GLUhalfEdge eLo = regLo.eUp; + final ActiveRegion regLo = RegionBelow(regUp); + final GLUhalfEdge eUp = regUp.eUp; + final GLUhalfEdge eLo = regLo.eUp; GLUhalfEdge e; assert (!Geom.VertEq(eUp.Sym.Org, eLo.Sym.Org)); @@ -599,7 +599,7 @@ class Sweep { } - static boolean CheckForIntersect(GLUtessellatorImpl tess, ActiveRegion regUp) + static boolean CheckForIntersect(final GLUtessellatorImpl tess, ActiveRegion regUp) /* * Check the upper and lower edges of the given region to see if * they intersect. If so, create the intersection and add it @@ -612,12 +612,12 @@ class Sweep { ActiveRegion regLo = RegionBelow(regUp); GLUhalfEdge eUp = regUp.eUp; GLUhalfEdge eLo = regLo.eUp; - GLUvertex orgUp = eUp.Org; - GLUvertex orgLo = eLo.Org; - GLUvertex dstUp = eUp.Sym.Org; - GLUvertex dstLo = eLo.Sym.Org; + final GLUvertex orgUp = eUp.Org; + final GLUvertex orgLo = eLo.Org; + final GLUvertex dstUp = eUp.Sym.Org; + final GLUvertex dstLo = eLo.Sym.Org; double tMinUp, tMaxLo; - GLUvertex isect = new GLUvertex(); + final GLUvertex isect = new GLUvertex(); GLUvertex orgMin; GLUhalfEdge e; @@ -752,7 +752,7 @@ class Sweep { return false; } - static void WalkDirtyRegions(GLUtessellatorImpl tess, ActiveRegion regUp) + static void WalkDirtyRegions(final GLUtessellatorImpl tess, ActiveRegion regUp) /* * When the upper or lower edge of any region changes, the region is * marked "dirty". This routine walks through all the dirty regions @@ -837,7 +837,7 @@ class Sweep { } - static void ConnectRightVertex(GLUtessellatorImpl tess, ActiveRegion regUp, + static void ConnectRightVertex(final GLUtessellatorImpl tess, ActiveRegion regUp, GLUhalfEdge eBottomLeft) /* * Purpose: connect a "right" vertex vEvent (one where all edges go left) @@ -872,9 +872,9 @@ class Sweep { */ { GLUhalfEdge eNew; GLUhalfEdge eTopLeft = eBottomLeft.Onext; - ActiveRegion regLo = RegionBelow(regUp); - GLUhalfEdge eUp = regUp.eUp; - GLUhalfEdge eLo = regLo.eUp; + final ActiveRegion regLo = RegionBelow(regUp); + final GLUhalfEdge eUp = regUp.eUp; + final GLUhalfEdge eLo = regLo.eUp; boolean degenerate = false; if (eUp.Sym.Org != eLo.Sym.Org) { @@ -930,8 +930,8 @@ class Sweep { */ private static final boolean TOLERANCE_NONZERO = false; - static void ConnectLeftDegenerate(GLUtessellatorImpl tess, - ActiveRegion regUp, GLUvertex vEvent) + static void ConnectLeftDegenerate(final GLUtessellatorImpl tess, + ActiveRegion regUp, final GLUvertex vEvent) /* * The event vertex lies exacty on an already-processed edge or vertex. * Adding the new vertex involves splicing it into the already-processed @@ -989,7 +989,7 @@ class Sweep { } - static void ConnectLeftVertex(GLUtessellatorImpl tess, GLUvertex vEvent) + static void ConnectLeftVertex(final GLUtessellatorImpl tess, final GLUvertex vEvent) /* * Purpose: connect a "left" vertex (one where both edges go right) * to the processed portion of the mesh. Let R be the active region @@ -1007,7 +1007,7 @@ class Sweep { */ { ActiveRegion regUp, regLo, reg; GLUhalfEdge eUp, eLo, eNew; - ActiveRegion tmp = new ActiveRegion(); + final ActiveRegion tmp = new ActiveRegion(); /* assert ( vEvent.anEdge.Onext.Onext == vEvent.anEdge ); */ @@ -1035,7 +1035,7 @@ class Sweep { eNew = Mesh.__gl_meshConnect(vEvent.anEdge.Sym, eUp.Lnext); if (eNew == null) throw new RuntimeException(); } else { - GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(eLo.Sym.Onext.Sym, vEvent.anEdge); + final GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(eLo.Sym.Onext.Sym, vEvent.anEdge); if (tempHalfEdge == null) throw new RuntimeException(); eNew = tempHalfEdge.Sym; @@ -1055,7 +1055,7 @@ class Sweep { } - static void SweepEvent(GLUtessellatorImpl tess, GLUvertex vEvent) + static void SweepEvent(final GLUtessellatorImpl tess, final GLUvertex vEvent) /* * Does everything necessary when the sweep line crosses a vertex. * Updates the mesh and the edge dictionary. @@ -1114,13 +1114,13 @@ class Sweep { */ private static final double SENTINEL_COORD = (4.0 * GLU.GLU_TESS_MAX_COORD); - static void AddSentinel(GLUtessellatorImpl tess, double t) + static void AddSentinel(final GLUtessellatorImpl tess, final double t) /* * We add two sentinel edges above and below all other edges, * to avoid special cases at the top and bottom. */ { GLUhalfEdge e; - ActiveRegion reg = new ActiveRegion(); + final ActiveRegion reg = new ActiveRegion(); if (reg == null) throw new RuntimeException(); e = Mesh.__gl_meshMakeEdge(tess.mesh); @@ -1151,7 +1151,7 @@ class Sweep { /* __gl_dictListNewDict */ tess.dict = Dict.dictNewDict(tess, new Dict.DictLeq() { @Override - public boolean leq(Object frame, Object key1, Object key2) { + public boolean leq(final Object frame, final Object key1, final Object key2) { return EdgeLeq(tess, (ActiveRegion) key1, (ActiveRegion) key2); } }); @@ -1162,7 +1162,7 @@ class Sweep { } - static void DoneEdgeDict(GLUtessellatorImpl tess) { + static void DoneEdgeDict(final GLUtessellatorImpl tess) { ActiveRegion reg; int fixedEdges = 0; @@ -1185,12 +1185,12 @@ class Sweep { } - static void RemoveDegenerateEdges(GLUtessellatorImpl tess) + static void RemoveDegenerateEdges(final GLUtessellatorImpl tess) /* * Remove zero-length edges, and contours with fewer than 3 vertices. */ { GLUhalfEdge e, eNext, eLnext; - GLUhalfEdge eHead = tess.mesh.eHead; + final GLUhalfEdge eHead = tess.mesh.eHead; /*LINTED*/ for (e = eHead.next; e != eHead; e = eNext) { @@ -1222,7 +1222,7 @@ class Sweep { } } - static boolean InitPriorityQ(GLUtessellatorImpl tess) + static boolean InitPriorityQ(final GLUtessellatorImpl tess) /* * Insert all vertices into the priority queue which determines the * order in which vertices cross the sweep line. @@ -1233,7 +1233,7 @@ class Sweep { /* __gl_pqSortNewPriorityQ */ pq = tess.pq = PriorityQ.pqNewPriorityQ(new PriorityQ.Leq() { @Override - public boolean leq(Object key1, Object key2) { + public boolean leq(final Object key1, final Object key2) { return Geom.VertLeq(((GLUvertex) key1), (GLUvertex) key2); } }); @@ -1254,12 +1254,12 @@ class Sweep { } - static void DonePriorityQ(GLUtessellatorImpl tess) { + static void DonePriorityQ(final GLUtessellatorImpl tess) { tess.pq.pqDeletePriorityQ(); /* __gl_pqSortDeletePriorityQ */ } - static boolean RemoveDegenerateFaces(GLUmesh mesh) + static boolean RemoveDegenerateFaces(final GLUmesh mesh) /* * Delete any degenerate faces with only two edges. WalkDirtyRegions() * will catch almost all of these, but it won't catch degenerate faces @@ -1292,7 +1292,7 @@ class Sweep { return true; } - public static boolean __gl_computeInterior(GLUtessellatorImpl tess) + public static boolean __gl_computeInterior(final GLUtessellatorImpl tess) /* * __gl_computeInterior( tess ) computes the planar arrangement specified * by the given contours, and further subdivides this arrangement diff --git a/src/jogl/classes/jogamp/opengl/glu/tessellator/TessMono.java b/src/jogl/classes/jogamp/opengl/glu/tessellator/TessMono.java index 5db543c80..63994ba82 100644 --- a/src/jogl/classes/jogamp/opengl/glu/tessellator/TessMono.java +++ b/src/jogl/classes/jogamp/opengl/glu/tessellator/TessMono.java @@ -80,7 +80,7 @@ class TessMono { * to the fan is a simple orientation test. By making the fan as large * as possible, we restore the invariant (check it yourself). */ - static boolean __gl_meshTessellateMonoRegion(GLUface face, boolean avoidDegenerateTris) { + static boolean __gl_meshTessellateMonoRegion(final GLUface face, final boolean avoidDegenerateTris) { GLUhalfEdge up, lo; /* All edges are oriented CCW around the boundary of the region. @@ -135,7 +135,7 @@ class TessMono { */ while (lo.Lnext != up && (Geom.EdgeGoesLeft(lo.Lnext) || Geom.EdgeSign(lo.Org, lo.Sym.Org, lo.Lnext.Sym.Org) <= 0)) { - GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(lo.Lnext, lo); + final GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(lo.Lnext, lo); mustConnect = false; if (tempHalfEdge == null) return false; lo = tempHalfEdge.Sym; @@ -145,7 +145,7 @@ class TessMono { /* lo.Org is on the left. We can make CCW triangles from up.Sym.Org. */ while (lo.Lnext != up && (Geom.EdgeGoesRight(up.Onext.Sym) || Geom.EdgeSign(up.Sym.Org, up.Org, up.Onext.Sym.Org) >= 0)) { - GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(up, up.Onext.Sym); + final GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(up, up.Onext.Sym); mustConnect = false; if (tempHalfEdge == null) return false; up = tempHalfEdge.Sym; @@ -159,7 +159,7 @@ class TessMono { */ assert (lo.Lnext != up); while (lo.Lnext.Lnext != up) { - GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(lo.Lnext, lo); + final GLUhalfEdge tempHalfEdge = Mesh.__gl_meshConnect(lo.Lnext, lo); if (tempHalfEdge == null) return false; lo = tempHalfEdge.Sym; } @@ -172,7 +172,7 @@ class TessMono { * the mesh which is marked "inside" the polygon. Each such region * must be monotone. */ - public static boolean __gl_meshTessellateInterior(GLUmesh mesh, boolean avoidDegenerateTris) { + public static boolean __gl_meshTessellateInterior(final GLUmesh mesh, final boolean avoidDegenerateTris) { GLUface f, next; /*LINTED*/ @@ -193,7 +193,7 @@ class TessMono { * on NULL faces are not allowed, the main purpose is to clean up the * mesh so that exterior loops are not represented in the data structure. */ - public static void __gl_meshDiscardExterior(GLUmesh mesh) { + public static void __gl_meshDiscardExterior(final GLUmesh mesh) { GLUface f, next; /*LINTED*/ @@ -216,7 +216,7 @@ class TessMono { * If keepOnlyBoundary is TRUE, it also deletes all edges which do not * separate an interior region from an exterior one. */ - public static boolean __gl_meshSetWindingNumber(GLUmesh mesh, int value, boolean keepOnlyBoundary) { + public static boolean __gl_meshSetWindingNumber(final GLUmesh mesh, final int value, final boolean keepOnlyBoundary) { GLUhalfEdge e, eNext; for (e = mesh.eHead.next; e != mesh.eHead; e = eNext) { diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index dadad1e15..a6ab635e4 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -59,6 +59,7 @@ import javax.media.opengl.GLContext; import javax.media.opengl.GLException; import javax.media.opengl.GLProfile; import javax.media.opengl.GLUniformData; +import javax.media.opengl.fixedfunc.GLMatrixFunc; import jogamp.nativewindow.macosx.OSXUtil; import jogamp.opengl.GLContextImpl; @@ -107,9 +108,9 @@ public class MacOSXCGLContext extends GLContextImpl isMavericksOrLater = osvn.compareTo(Platform.OSXVersion.Mavericks) >= 0; } - static boolean isGLProfileSupported(int ctp, int major, int minor) { - boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ; - boolean ctCore = 0 != ( CTX_PROFILE_CORE & ctp ) ; + static boolean isGLProfileSupported(final int ctp, final int major, final int minor) { + final boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ; + final boolean ctCore = 0 != ( CTX_PROFILE_CORE & ctp ) ; // We exclude 3.0, since we would map it's core to GL2. Hence we force mapping 2.1 to GL2 if( 3 < major || 3 == major && 1 <= minor ) { @@ -135,7 +136,7 @@ public class MacOSXCGLContext extends GLContextImpl } return false; // 3.0 && > 3.2 } - static int GLProfile2CGLOGLProfileValue(AbstractGraphicsDevice device, int ctp, int major, int minor) { + static int GLProfile2CGLOGLProfileValue(final AbstractGraphicsDevice device, final int ctp, final int major, final int minor) { if(!MacOSXCGLContext.isGLProfileSupported(ctp, major, minor)) { throw new GLException("OpenGL profile not supported: "+getGLVersion(major, minor, ctp, "@GLProfile2CGLOGLProfileVersion")); } @@ -158,7 +159,7 @@ public class MacOSXCGLContext extends GLContextImpl private static final String shaderBasename = "texture01_xxx"; - private static ShaderProgram createCALayerShader(GL3ES3 gl) { + private static ShaderProgram createCALayerShader(final GL3ES3 gl) { // Create & Link the shader program final ShaderProgram sp = new ShaderProgram(); final ShaderCode vp = ShaderCode.create(gl, GL2ES2.GL_VERTEX_SHADER, MacOSXCGLContext.class, @@ -176,9 +177,9 @@ public class MacOSXCGLContext extends GLContextImpl // setup mgl_PMVMatrix final PMVMatrix pmvMatrix = new PMVMatrix(); - pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_PROJECTION); pmvMatrix.glLoadIdentity(); - pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); + pmvMatrix.glMatrixMode(GLMatrixFunc.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); final GLUniformData pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv pmvMatrixUniform.setLocation(gl, sp.program()); @@ -203,14 +204,14 @@ public class MacOSXCGLContext extends GLContextImpl private long updateHandle = 0; private int lastWidth, lastHeight; - protected MacOSXCGLContext(GLDrawableImpl drawable, - GLContext shareWith) { + protected MacOSXCGLContext(final GLDrawableImpl drawable, + final GLContext shareWith) { super(drawable, shareWith); initOpenGLImpl(getOpenGLMode()); } @Override - protected void resetStates(boolean isInit) { + protected void resetStates(final boolean isInit) { // no inner state _cglExt = null; cglExtProcAddressTable = null; super.resetStates(isInit); @@ -248,7 +249,7 @@ public class MacOSXCGLContext extends GLContextImpl protected Map getExtensionNameMap() { return null; } @Override - protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) { + protected long createContextARBImpl(final long share, final boolean direct, final int ctp, final int major, final int minor) { if(!isGLProfileSupported(ctp, major, minor)) { if(DEBUG) { System.err.println(getThreadName() + ": createContextARBImpl: Not supported "+getGLVersion(major, minor, ctp, "@creation on OSX "+Platform.getOSVersionNumber())); @@ -276,7 +277,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - protected void destroyContextARBImpl(long _context) { + protected void destroyContextARBImpl(final long _context) { impl.release(_context); impl.destroy(_context); } @@ -380,7 +381,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - protected void associateDrawable(boolean bound) { + protected void associateDrawable(final boolean bound) { // context stuff depends on drawable stuff if(bound) { super.associateDrawable(true); // 1) init drawable stuff @@ -399,7 +400,7 @@ public class MacOSXCGLContext extends GLContextImpl @Override - protected void copyImpl(GLContext source, int mask) throws GLException { + protected void copyImpl(final GLContext source, final int mask) throws GLException { if( isNSContext() != ((MacOSXCGLContext)source).isNSContext() ) { throw new GLException("Source/Destination OpenGL Context tyoe mismatch: source "+source+", dest: "+this); } @@ -416,18 +417,18 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - protected boolean setSwapIntervalImpl(int interval) { + protected boolean setSwapIntervalImpl(final int interval) { return impl.setSwapInterval(interval); } @Override - public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) { + public final ByteBuffer glAllocateMemoryNV(final int size, final float readFrequency, final float writeFrequency, final float priority) { // FIXME: apparently the Apple extension doesn't require a custom memory allocator throw new GLException("Not yet implemented"); } @Override - public final void glFreeMemoryNV(ByteBuffer pointer) { + public final void glFreeMemoryNV(final ByteBuffer pointer) { // FIXME: apparently the Apple extension doesn't require a custom memory allocator throw new GLException("Not yet implemented"); } @@ -467,7 +468,7 @@ public class MacOSXCGLContext extends GLContextImpl } // Support for "mode switching" as described in MacOSXCGLDrawable - public void setOpenGLMode(GLBackendType mode) { + public void setOpenGLMode(final GLBackendType mode) { if (mode == openGLMode) { return; } @@ -485,7 +486,7 @@ public class MacOSXCGLContext extends GLContextImpl } public final GLBackendType getOpenGLMode() { return openGLMode; } - protected void initOpenGLImpl(GLBackendType backend) { + protected void initOpenGLImpl(final GLBackendType backend) { switch (backend) { case NSOPENGL: impl = new NSOpenGLImpl(); @@ -500,7 +501,7 @@ public class MacOSXCGLContext extends GLContextImpl @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); super.append(sb); @@ -528,7 +529,7 @@ public class MacOSXCGLContext extends GLContextImpl /** Only returns a valid NSView. If !NSView, return null and mark either pbuffer and FBO. */ - private long getNSViewHandle(boolean[] isPBuffer, boolean[] isFBO) { + private long getNSViewHandle(final boolean[] isPBuffer, final boolean[] isFBO) { final long nsViewHandle; if(drawable instanceof GLFBODrawableImpl) { nsViewHandle = 0; @@ -562,7 +563,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public long create(long share, int ctp, int major, int minor) { + public long create(final long share, final int ctp, final int major, final int minor) { long ctx = 0; final NativeSurface surface = drawable.getNativeSurface(); final MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) surface.getGraphicsConfiguration(); @@ -571,8 +572,8 @@ public class MacOSXCGLContext extends GLContextImpl final boolean isPBuffer; final boolean isFBO; { - boolean[] _isPBuffer = { false }; - boolean[] _isFBO = { false }; + final boolean[] _isPBuffer = { false }; + final boolean[] _isFBO = { false }; nsViewHandle = getNSViewHandle(_isPBuffer, _isFBO); isPBuffer = _isPBuffer[0]; isFBO = _isFBO[0]; @@ -654,7 +655,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean destroy(long ctx) { + public boolean destroy(final long ctx) { if(0!=pixelFormat) { CGL.deletePixelFormat(pixelFormat); pixelFormat = 0; @@ -690,8 +691,8 @@ public class MacOSXCGLContext extends GLContextImpl /** Synchronized by instance's monitor */ boolean valid; - AttachGLLayerCmd(OffscreenLayerSurface ols, long ctx, int shaderProgram, long pfmt, long pbuffer, int texID, - boolean isOpaque, int texWidth, int texHeight, int winWidth, int winHeight) { + AttachGLLayerCmd(final OffscreenLayerSurface ols, final long ctx, final int shaderProgram, final long pfmt, final long pbuffer, final int texID, + final boolean isOpaque, final int texWidth, final int texHeight, final int winWidth, final int winHeight) { this.ols = ols; this.ctx = ctx; this.shaderProgram = shaderProgram; @@ -745,7 +746,7 @@ public class MacOSXCGLContext extends GLContextImpl surfaceLock.unlock(); } } - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } if( !valid ) { @@ -764,7 +765,7 @@ public class MacOSXCGLContext extends GLContextImpl class DetachGLLayerCmd implements Runnable { final AttachGLLayerCmd cmd; - DetachGLLayerCmd(AttachGLLayerCmd cmd) { + DetachGLLayerCmd(final AttachGLLayerCmd cmd) { this.cmd = cmd; } @@ -784,7 +785,7 @@ public class MacOSXCGLContext extends GLContextImpl if( 0 != l ) { ols.detachSurfaceLayer(); } - } catch(Throwable t) { + } catch(final Throwable t) { System.err.println("Caught exception on thread "+getThreadName()); t.printStackTrace(); } @@ -802,7 +803,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public void associateDrawable(boolean bound) { + public void associateDrawable(final boolean bound) { backingLayerHost = NativeWindowFactory.getOffscreenLayerSurface(drawable.getNativeSurface(), true); if(DEBUG) { @@ -831,7 +832,7 @@ public class MacOSXCGLContext extends GLContextImpl pbufferHandle = 0; fbod.setSwapBufferContext(new GLFBODrawableImpl.SwapBufferContext() { @Override - public void swapBuffers(boolean doubleBuffered) { + public void swapBuffers(final boolean doubleBuffered) { MacOSXCGLContext.NSOpenGLImpl.this.swapBuffers(); } } ) ; } else if( CGL.isNSOpenGLPixelBuffer(drawableHandle) ) { @@ -870,8 +871,8 @@ public class MacOSXCGLContext extends GLContextImpl } else { // -> null == backingLayerHost lastWidth = drawable.getSurfaceWidth(); lastHeight = drawable.getSurfaceHeight(); - boolean[] isPBuffer = { false }; - boolean[] isFBO = { false }; + final boolean[] isPBuffer = { false }; + final boolean[] isFBO = { false }; CGL.setContextView(contextHandle, getNSViewHandle(isPBuffer, isFBO)); } } else { // -> !bound @@ -906,7 +907,7 @@ public class MacOSXCGLContext extends GLContextImpl } } - private final void validatePBufferConfig(long ctx) { + private final void validatePBufferConfig(final long ctx) { final long drawableHandle = drawable.getHandle(); if( needsSetContextPBuffer && 0 != drawableHandle && CGL.isNSOpenGLPixelBuffer(drawableHandle) ) { // Must associate the pbuffer with our newly-created context @@ -919,7 +920,7 @@ public class MacOSXCGLContext extends GLContextImpl } /** Returns true if size has been updated, otherwise false (same size). */ - private final boolean validateDrawableSizeConfig(long ctx) { + private final boolean validateDrawableSizeConfig(final long ctx) { final int width = drawable.getSurfaceWidth(); final int height = drawable.getSurfaceHeight(); if( lastWidth != width || lastHeight != height ) { @@ -934,13 +935,13 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean copyImpl(long src, int mask) { + public boolean copyImpl(final long src, final int mask) { CGL.copyContext(contextHandle, src, mask); return true; } @Override - public boolean makeCurrent(long ctx) { + public boolean makeCurrent(final long ctx) { final long cglCtx = CGL.getCGLContext(ctx); if(0 == cglCtx) { throw new InternalError("Null CGLContext for: "+this); @@ -956,12 +957,12 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean release(long ctx) { + public boolean release(final long ctx) { try { if( hasRendererQuirk(GLRendererQuirks.GLFlushBeforeRelease) && null != MacOSXCGLContext.this.getGLProcAddressTable() ) { gl.glFlush(); } - } catch (GLException gle) { + } catch (final GLException gle) { if(DEBUG) { System.err.println("MacOSXCGLContext.NSOpenGLImpl.release: INFO: glFlush() caught exception:"); gle.printStackTrace(); @@ -987,7 +988,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean setSwapInterval(int interval) { + public boolean setSwapInterval(final int interval) { final AttachGLLayerCmd cmd = attachGLLayerCmd; if(null != cmd) { synchronized(cmd) { @@ -1001,7 +1002,7 @@ public class MacOSXCGLContext extends GLContextImpl return true; } - private void setSwapIntervalImpl(final long l, int interval) { + private void setSwapIntervalImpl(final long l, final int interval) { if( 0 != l ) { CGL.setNSOpenGLLayerSwapInterval(l, interval); if( 0 < interval ) { @@ -1124,7 +1125,7 @@ public class MacOSXCGLContext extends GLContextImpl public boolean isNSContext() { return false; } @Override - public long create(long share, int ctp, int major, int minor) { + public long create(final long share, final int ctp, final int major, final int minor) { long ctx = 0; final MacOSXCGLGraphicsConfiguration config = (MacOSXCGLGraphicsConfiguration) drawable.getNativeSurface().getGraphicsConfiguration(); final GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable)config.getChosenCapabilities(); @@ -1135,7 +1136,7 @@ public class MacOSXCGLContext extends GLContextImpl } try { // Create new context - PointerBuffer ctxPB = PointerBuffer.allocateDirect(1); + final PointerBuffer ctxPB = PointerBuffer.allocateDirect(1); if (DEBUG) { System.err.println("Share context for CGL-based pbuffer context is " + toHexString(share)); } @@ -1173,22 +1174,22 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean destroy(long ctx) { + public boolean destroy(final long ctx) { return CGL.CGLDestroyContext(ctx) == CGL.kCGLNoError; } @Override - public void associateDrawable(boolean bound) { + public void associateDrawable(final boolean bound) { } @Override - public boolean copyImpl(long src, int mask) { + public boolean copyImpl(final long src, final int mask) { CGL.CGLCopyContext(src, contextHandle, mask); return true; } @Override - public boolean makeCurrent(long ctx) { + public boolean makeCurrent(final long ctx) { int err = CGL.CGLLockContext(ctx); if(CGL.kCGLNoError == err) { err = CGL.CGLSetCurrentContext(ctx); @@ -1204,22 +1205,22 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean release(long ctx) { + public boolean release(final long ctx) { try { if( hasRendererQuirk(GLRendererQuirks.GLFlushBeforeRelease) && null != MacOSXCGLContext.this.getGLProcAddressTable() ) { gl.glFlush(); } - } catch (GLException gle) { + } catch (final GLException gle) { if(DEBUG) { System.err.println("MacOSXCGLContext.CGLImpl.release: INFO: glFlush() caught exception:"); gle.printStackTrace(); } } - int err = CGL.CGLSetCurrentContext(0); + final int err = CGL.CGLSetCurrentContext(0); if(DEBUG && CGL.kCGLNoError != err) { System.err.println("CGL: Could not release current context: err 0x"+Integer.toHexString(err)+": "+this); } - int err2 = CGL.CGLUnlockContext(ctx); + final int err2 = CGL.CGLUnlockContext(ctx); if(DEBUG && CGL.kCGLNoError != err2) { System.err.println("CGL: Could not unlock context: err 0x"+Integer.toHexString(err2)+": "+this); } @@ -1237,7 +1238,7 @@ public class MacOSXCGLContext extends GLContextImpl } @Override - public boolean setSwapInterval(int interval) { + public boolean setSwapInterval(final int interval) { final IntBuffer lval = Buffers.newDirectIntBuffer(1); lval.put(0, interval); CGL.CGLSetParameter(contextHandle, CGL.kCGLCPSwapInterval, lval); diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java index 448e3e221..8ea84a32d 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDrawable.java @@ -91,7 +91,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { public final int id; - GLBackendType(int id){ + GLBackendType(final int id){ this.id = id; } } @@ -100,7 +100,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { private boolean haveSetOpenGLMode = false; private GLBackendType openGLMode = GLBackendType.NSOPENGL; - public MacOSXCGLDrawable(GLDrawableFactory factory, NativeSurface comp, boolean realized) { + public MacOSXCGLDrawable(final GLDrawableFactory factory, final NativeSurface comp, final boolean realized) { super(factory, comp, realized); initOpenGLImpl(getOpenGLMode()); } @@ -110,7 +110,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { } @Override - protected void associateContext(GLContext ctx, boolean bound) { + protected void associateContext(final GLContext ctx, final boolean bound) { // NOTE: we need to keep track of the created contexts in order to // implement swapBuffers() because of how Mac OS X implements its // OpenGL window interface @@ -132,7 +132,7 @@ public abstract class MacOSXCGLDrawable extends GLDrawableImpl { } @Override - protected final void swapBuffersImpl(boolean doubleBuffered) { + protected final void swapBuffersImpl(final boolean doubleBuffered) { if(doubleBuffered) { synchronized (createdContexts) { for(int i=0; i(); @@ -144,7 +144,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper(int profile) { + public GLDynamicLookupHelper getGLDynamicLookupHelper(final int profile) { return macOSXCGLDynamicLookupHelper; } @@ -161,9 +161,9 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { boolean hasRECTTextures; boolean hasAppleFloatPixels; - SharedResource(MacOSXGraphicsDevice device, boolean valid, - boolean hasNPOTTextures, boolean hasRECTTextures, boolean hasAppletFloatPixels - /* MacOSXCGLDrawable draw, MacOSXCGLContext ctx */, GLRendererQuirks glRendererQuirks) { + SharedResource(final MacOSXGraphicsDevice device, final boolean valid, + final boolean hasNPOTTextures, final boolean hasRECTTextures, final boolean hasAppletFloatPixels + /* MacOSXCGLDrawable draw, MacOSXCGLContext ctx */, final GLRendererQuirks glRendererQuirks) { // drawable = draw; // this.context = ctx; this.glRendererQuirks = glRendererQuirks; @@ -207,7 +207,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) { + public final boolean getIsDeviceCompatible(final AbstractGraphicsDevice device) { if(null!=macOSXCGLDynamicLookupHelper && device instanceof MacOSXGraphicsDevice) { return true; } @@ -216,24 +216,24 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { private final HashSet devicesTried = new HashSet(); - private boolean getDeviceTried(String connection) { + private boolean getDeviceTried(final String connection) { synchronized (devicesTried) { return devicesTried.contains(connection); } } - private void addDeviceTried(String connection) { + private void addDeviceTried(final String connection) { synchronized (devicesTried) { devicesTried.add(connection); } } - private void removeDeviceTried(String connection) { + private void removeDeviceTried(final String connection) { synchronized (devicesTried) { devicesTried.remove(connection); } } @Override - protected final SharedResource getOrCreateSharedResourceImpl(AbstractGraphicsDevice adevice) { + protected final SharedResource getOrCreateSharedResourceImpl(final AbstractGraphicsDevice adevice) { final String connection = adevice.getConnection(); SharedResource sr; synchronized(sharedMap) { @@ -248,7 +248,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { boolean hasRECTTextures = false; boolean hasAppleFloatPixels = false; { - GLProfile glp = GLProfile.get(sharedDevice, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false); + final GLProfile glp = GLProfile.get(sharedDevice, GLProfile.GL_PROFILE_LIST_MIN_DESKTOP, false); if (null == glp) { throw new GLException("Couldn't get default GLProfile for device: "+sharedDevice); } @@ -265,13 +265,13 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { sharedContext.makeCurrent(); // could cause exception isValid = sharedContext.isCurrent(); if(isValid) { - GL gl = sharedContext.getGL(); + final GL gl = sharedContext.getGL(); hasNPOTTextures = gl.isNPOTTextureAvailable(); hasRECTTextures = gl.isExtensionAvailable(GLExtensions.EXT_texture_rectangle); hasAppleFloatPixels = gl.isExtensionAvailable(GLExtensions.APPLE_float_pixels); glRendererQuirks = sharedContext.getRendererQuirks(); } - } catch (GLException gle) { + } catch (final GLException gle) { if (DEBUG) { System.err.println("MacOSXCGLDrawableFactory.createShared: INFO: makeCurrent caught exception:"); gle.printStackTrace(); @@ -279,7 +279,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } finally { try { sharedContext.destroy(); - } catch (GLException gle) { + } catch (final GLException gle) { if (DEBUG) { System.err.println("MacOSXCGLDrawableFactory.createShared: INFO: destroy caught exception:"); gle.printStackTrace(); @@ -308,12 +308,12 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected List getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { + protected List getAvailableCapabilitiesImpl(final AbstractGraphicsDevice device) { return MacOSXCGLGraphicsConfiguration.getAvailableCapabilities(this, device); } @Override - protected GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) { + protected GLDrawableImpl createOnscreenDrawableImpl(final NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } @@ -321,7 +321,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) { + protected GLDrawableImpl createOffscreenDrawableImpl(final NativeSurface target) { final MutableGraphicsConfiguration config = (MutableGraphicsConfiguration) target.getGraphicsConfiguration(); final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); if(!caps.isPBuffer()) { @@ -336,7 +336,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp) { + public boolean canCreateGLPbuffer(final AbstractGraphicsDevice device, final GLProfile glp) { if( glp.isGL2() ) { // OSX only supports pbuffer w/ compatible, non-core, context. return true; @@ -346,9 +346,9 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) { + protected ProxySurface createMutableSurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstreamHook) { final MacOSXGraphicsDevice device; if( createNewDevice || !(deviceReq instanceof MacOSXGraphicsDevice) ) { device = new MacOSXGraphicsDevice(deviceReq.getUnitID()); @@ -364,15 +364,15 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) { + public final ProxySurface createDummySurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) { chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps); return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new OSXDummyUpstreamSurfaceHook(width, height)); } @Override - protected ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) { + protected ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstream) { final MacOSXGraphicsDevice device = new MacOSXGraphicsDevice(deviceReq.getUnitID()); final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, screenIdx); final MacOSXCGLGraphicsConfiguration config = MacOSXCGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsRequested, capsRequested, chooser, screen, true); @@ -385,7 +385,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) { + public boolean canCreateExternalGLDrawable(final AbstractGraphicsDevice device) { return false; } @@ -409,7 +409,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected boolean setGammaRamp(float[] ramp) { + protected boolean setGammaRamp(final float[] ramp) { final FloatBuffer rampNIO = Buffers.newDirectFloatBuffer(ramp); return CGL.setGammaRamp(ramp.length, rampNIO, rampNIO, rampNIO); @@ -421,7 +421,7 @@ public class MacOSXCGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected void resetGammaRamp(Buffer originalGammaRamp) { + protected void resetGammaRamp(final Buffer originalGammaRamp) { CGL.resetGammaRamp(); } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java index cda8307c7..3ec40ffce 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLDynamicLibraryBundleInfo.java @@ -56,7 +56,7 @@ public final class MacOSXCGLDynamicLibraryBundleInfo extends DesktopGLDynamicLib } @Override - public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) { + public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { return 0; /** OSX manual says: NSImage use is discouraged return CGL.getProcAddress(glFuncName); // manual implementation diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java index 481c0b94b..cd89ad526 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfiguration.java @@ -53,8 +53,8 @@ import com.jogamp.nativewindow.MutableGraphicsConfiguration; public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration implements Cloneable { - MacOSXCGLGraphicsConfiguration(AbstractGraphicsScreen screen, - GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested) { + MacOSXCGLGraphicsConfiguration(final AbstractGraphicsScreen screen, + final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested) { super(screen, capsChosen, capsRequested); } @@ -63,8 +63,8 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration return super.clone(); } - protected static List getAvailableCapabilities(MacOSXCGLDrawableFactory factory, AbstractGraphicsDevice device) { - MacOSXCGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); + protected static List getAvailableCapabilities(final MacOSXCGLDrawableFactory factory, final AbstractGraphicsDevice device) { + final MacOSXCGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); if(null == sharedResource) { throw new GLException("Shared resource for device n/a: "+device); } @@ -88,7 +88,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration CGL.NSOpenGLPFASampleBuffers, CGL.NSOpenGLPFASamples }); - static IntBuffer GLCapabilities2NSAttribList(AbstractGraphicsDevice device, IntBuffer attrToken, GLCapabilitiesImmutable caps, int ctp, int major, int minor) { + static IntBuffer GLCapabilities2NSAttribList(final AbstractGraphicsDevice device, final IntBuffer attrToken, final GLCapabilitiesImmutable caps, final int ctp, final int major, final int minor) { final int len = attrToken.remaining(); final int off = attrToken.position(); final IntBuffer ivalues = Buffers.newDirectIntBuffer(len); @@ -155,7 +155,7 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration return ivalues; } - static long GLCapabilities2NSPixelFormat(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps, int ctp, int major, int minor) { + static long GLCapabilities2NSPixelFormat(final AbstractGraphicsDevice device, final GLCapabilitiesImmutable caps, final int ctp, final int major, final int minor) { final IntBuffer attrToken = cglInternalAttributeToken.duplicate(); if ( !MacOSXCGLContext.isLionOrLater ) { // no OpenGLProfile @@ -165,11 +165,11 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration return CGL.createPixelFormat(attrToken, attrToken.remaining(), ivalues); } - static GLCapabilities NSPixelFormat2GLCapabilities(GLProfile glp, long pixelFormat) { + static GLCapabilities NSPixelFormat2GLCapabilities(final GLProfile glp, final long pixelFormat) { return PixelFormat2GLCapabilities(glp, pixelFormat, true); } - static long GLCapabilities2CGLPixelFormat(AbstractGraphicsDevice device, GLCapabilitiesImmutable caps, int ctp, int major, int minor) { + static long GLCapabilities2CGLPixelFormat(final AbstractGraphicsDevice device, final GLCapabilitiesImmutable caps, final int ctp, final int major, final int minor) { // Set up pixel format attributes final IntBuffer attrs = Buffers.newDirectIntBuffer(256); int i = 0; @@ -214,20 +214,20 @@ public class MacOSXCGLGraphicsConfiguration extends MutableGraphicsConfiguration } // Use attribute array to select pixel format - PointerBuffer fmt = PointerBuffer.allocateDirect(1); - IntBuffer numScreens = Buffers.newDirectIntBuffer(1); - int res = CGL.CGLChoosePixelFormat(attrs, fmt, numScreens); + final PointerBuffer fmt = PointerBuffer.allocateDirect(1); + final IntBuffer numScreens = Buffers.newDirectIntBuffer(1); + final int res = CGL.CGLChoosePixelFormat(attrs, fmt, numScreens); if (res != CGL.kCGLNoError) { throw new GLException("Error code " + res + " while choosing pixel format"); } return fmt.get(0); } - static GLCapabilities CGLPixelFormat2GLCapabilities(long pixelFormat) { + static GLCapabilities CGLPixelFormat2GLCapabilities(final long pixelFormat) { return PixelFormat2GLCapabilities(null, pixelFormat, false); } - private static GLCapabilities PixelFormat2GLCapabilities(GLProfile glp, long pixelFormat, boolean nsUsage) { + private static GLCapabilities PixelFormat2GLCapabilities(GLProfile glp, final long pixelFormat, final boolean nsUsage) { final IntBuffer attrToken = cglInternalAttributeToken.duplicate(); final int off; if ( !MacOSXCGLContext.isLionOrLater ) { diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java index db2a1df68..50de70227 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLGraphicsConfigurationFactory.java @@ -61,8 +61,8 @@ public class MacOSXCGLGraphicsConfigurationFactory extends GLGraphicsConfigurati @Override protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, - CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, + final CapabilitiesChooser chooser, final AbstractGraphicsScreen absScreen, final int nativeVisualID) { if (absScreen == null) { throw new IllegalArgumentException("AbstractGraphicsScreen is null"); @@ -84,15 +84,15 @@ public class MacOSXCGLGraphicsConfigurationFactory extends GLGraphicsConfigurati } static MacOSXCGLGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilitiesImmutable capsChosen, - GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, - AbstractGraphicsScreen absScreen, boolean usePBuffer) { + final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, + final AbstractGraphicsScreen absScreen, final boolean usePBuffer) { if (absScreen == null) { throw new IllegalArgumentException("AbstractGraphicsScreen is null"); } final AbstractGraphicsDevice device = absScreen.getDevice(); capsChosen = GLGraphicsConfigurationUtil.fixGLCapabilities( capsChosen, GLDrawableFactory.getDesktopFactory(), device); - return new MacOSXCGLGraphicsConfiguration(absScreen, (GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested); + return new MacOSXCGLGraphicsConfiguration(absScreen, capsChosen, capsRequested); } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java index 150feac55..c17ed7d59 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java @@ -56,7 +56,7 @@ import jogamp.opengl.macosx.cgl.MacOSXCGLDrawable.GLBackendType; public class MacOSXExternalCGLContext extends MacOSXCGLContext { - private MacOSXExternalCGLContext(Drawable drawable, boolean isNSContext, long handle) { + private MacOSXExternalCGLContext(final Drawable drawable, final boolean isNSContext, final long handle) { super(drawable, null); setOpenGLMode(isNSContext ? GLBackendType.NSOPENGL : GLBackendType.CGL ); this.contextHandle = handle; @@ -67,13 +67,13 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext { getGLStateTracker().setEnabled(false); // external context usage can't track state in Java } - protected static MacOSXExternalCGLContext create(GLDrawableFactory factory) { + protected static MacOSXExternalCGLContext create(final GLDrawableFactory factory) { long pixelFormat = 0; long currentDrawable = 0; long contextHandle = CGL.getCurrentContext(); // Check: MacOSX 10.3 .. - boolean isNSContext = 0 != contextHandle; + final boolean isNSContext = 0 != contextHandle; if( isNSContext ) { - long ctx = CGL.getCGLContext(contextHandle); + final long ctx = CGL.getCGLContext(contextHandle); if (ctx == 0) { throw new GLException("Error: NULL Context (CGL) of Context (NS) 0x" +Long.toHexString(contextHandle)); } @@ -100,19 +100,19 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext { if (0 == pixelFormat) { throw new GLException("Error: current pixelformat of current Context 0x"+Long.toHexString(contextHandle)+" is null"); } - GLCapabilitiesImmutable caps = MacOSXCGLGraphicsConfiguration.CGLPixelFormat2GLCapabilities(pixelFormat); + final GLCapabilitiesImmutable caps = MacOSXCGLGraphicsConfiguration.CGLPixelFormat2GLCapabilities(pixelFormat); if(DEBUG) { System.err.println("MacOSXExternalCGLContext Create "+caps); } - AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_MACOSX); - MacOSXCGLGraphicsConfiguration cfg = new MacOSXCGLGraphicsConfiguration(aScreen, caps, caps); + final AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_MACOSX); + final MacOSXCGLGraphicsConfiguration cfg = new MacOSXCGLGraphicsConfiguration(aScreen, caps, caps); if(0 == currentDrawable) { // set a fake marker stating a valid drawable currentDrawable = 1; } - WrappedSurface ns = new WrappedSurface(cfg, currentDrawable, 64, 64, true); + final WrappedSurface ns = new WrappedSurface(cfg, currentDrawable, 64, 64, true); return new MacOSXExternalCGLContext(new Drawable(factory, ns), isNSContext, contextHandle); } @@ -135,12 +135,12 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext { // Need to provide the display connection to extension querying APIs static class Drawable extends MacOSXCGLDrawable { - Drawable(GLDrawableFactory factory, NativeSurface comp) { + Drawable(final GLDrawableFactory factory, final NativeSurface comp) { super(factory, comp, true); } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { throw new GLException("Should not call this"); } @@ -154,7 +154,7 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext { throw new GLException("Should not call this"); } - public void setSize(int width, int height) { + public void setSize(final int width, final int height) { throw new GLException("Should not call this"); } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java index 446a834b9..c613efa63 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOffscreenCGLDrawable.java @@ -46,13 +46,13 @@ import javax.media.opengl.GLDrawableFactory; public class MacOSXOffscreenCGLDrawable extends MacOSXPbufferCGLDrawable { - public MacOSXOffscreenCGLDrawable(GLDrawableFactory factory, - NativeSurface target) { + public MacOSXOffscreenCGLDrawable(final GLDrawableFactory factory, + final NativeSurface target) { super(factory, target); } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new MacOSXCGLContext(this, shareWith); } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java index c6f0c1383..e9ea2ff61 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXOnscreenCGLDrawable.java @@ -46,12 +46,12 @@ import javax.media.opengl.GLDrawableFactory; public class MacOSXOnscreenCGLDrawable extends MacOSXCGLDrawable { - protected MacOSXOnscreenCGLDrawable(GLDrawableFactory factory, NativeSurface component) { + protected MacOSXOnscreenCGLDrawable(final GLDrawableFactory factory, final NativeSurface component) { super(factory, component, false); } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new MacOSXCGLContext(this, shareWith); } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java index eba97a9ca..b1d560f4a 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java @@ -73,7 +73,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { protected int pBufferTexTarget, pBufferTexWidth, pBufferTexHeight; - public MacOSXPbufferCGLDrawable(GLDrawableFactory factory, NativeSurface target) { + public MacOSXPbufferCGLDrawable(final GLDrawableFactory factory, final NativeSurface target) { super(factory, target, false); } @@ -87,7 +87,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new MacOSXCGLContext(this, shareWith); } @@ -121,7 +121,7 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { final DefaultGraphicsConfiguration config = (DefaultGraphicsConfiguration) ms.getGraphicsConfiguration(); final GLCapabilitiesImmutable capabilities = (GLCapabilitiesImmutable)config.getChosenCapabilities(); final GLProfile glProfile = capabilities.getGLProfile(); - MacOSXCGLDrawableFactory.SharedResource sr = ((MacOSXCGLDrawableFactory)factory).getOrCreateSharedResourceImpl(config.getScreen().getDevice()); + final MacOSXCGLDrawableFactory.SharedResource sr = ((MacOSXCGLDrawableFactory)factory).getOrCreateSharedResourceImpl(config.getScreen().getDevice()); if (DEBUG) { System.out.println(getThreadName()+": Pbuffer config: " + config); @@ -160,13 +160,13 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { } @Override - public void setOpenGLMode(GLBackendType mode) { + public void setOpenGLMode(final GLBackendType mode) { super.setOpenGLMode(mode); createPbuffer(); // recreate } @Override - protected void initOpenGLImpl(GLBackendType backend) { + protected void initOpenGLImpl(final GLBackendType backend) { switch (backend) { case NSOPENGL: impl = new NSOpenGLImpl(); @@ -182,12 +182,12 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { // NSOpenGLPixelBuffer implementation class NSOpenGLImpl implements GLBackendImpl { @Override - public long create(int renderTarget, int internalFormat, int width, int height) { + public long create(final int renderTarget, final int internalFormat, final int width, final int height) { return CGL.createPBuffer(renderTarget, internalFormat, width, height); } @Override - public void destroy(long pbuffer) { + public void destroy(final long pbuffer) { CGL.destroyPBuffer(pbuffer); } } @@ -195,9 +195,9 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { // CGL implementation class CGLImpl implements GLBackendImpl { @Override - public long create(int renderTarget, int internalFormat, int width, int height) { - PointerBuffer pbuffer = PointerBuffer.allocateDirect(1); - int res = CGL.CGLCreatePBuffer(width, height, renderTarget, internalFormat, 0, pbuffer); + public long create(final int renderTarget, final int internalFormat, final int width, final int height) { + final PointerBuffer pbuffer = PointerBuffer.allocateDirect(1); + final int res = CGL.CGLCreatePBuffer(width, height, renderTarget, internalFormat, 0, pbuffer); if (res != CGL.kCGLNoError) { throw new GLException("Error creating CGL-based pbuffer: error code " + res); } @@ -205,8 +205,8 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { } @Override - public void destroy(long pbuffer) { - int res = CGL.CGLDestroyPBuffer(pbuffer); + public void destroy(final long pbuffer) { + final int res = CGL.CGLDestroyPBuffer(pbuffer); if (res != CGL.kCGLNoError) { throw new GLException("Error destroying CGL-based pbuffer: error code " + res); } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java index 21923531f..01300b005 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/awt/MacOSXAWTCGLGraphicsConfigurationFactory.java @@ -65,8 +65,8 @@ public class MacOSXAWTCGLGraphicsConfigurationFactory extends GLGraphicsConfigur @Override protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, - CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, + final CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, final int nativeVisualID) { GraphicsDevice device = null; if (absScreen != null && !(absScreen instanceof AWTGraphicsScreen)) { @@ -76,7 +76,7 @@ public class MacOSXAWTCGLGraphicsConfigurationFactory extends GLGraphicsConfigur if(null==absScreen) { absScreen = AWTGraphicsScreen.createDefault(); } - AWTGraphicsScreen awtScreen = (AWTGraphicsScreen) absScreen; + final AWTGraphicsScreen awtScreen = (AWTGraphicsScreen) absScreen; device = ((AWTGraphicsDevice)awtScreen.getDevice()).getGraphicsDevice(); if ( !(capsChosen instanceof GLCapabilitiesImmutable) ) { @@ -96,14 +96,14 @@ public class MacOSXAWTCGLGraphicsConfigurationFactory extends GLGraphicsConfigur System.err.println("MacOSXAWTCGLGraphicsConfigurationFactory: got "+absScreen); } - MacOSXGraphicsDevice macDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); - DefaultGraphicsScreen macScreen = new DefaultGraphicsScreen(macDevice, awtScreen.getIndex()); + final MacOSXGraphicsDevice macDevice = new MacOSXGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); + final DefaultGraphicsScreen macScreen = new DefaultGraphicsScreen(macDevice, awtScreen.getIndex()); if(DEBUG) { System.err.println("MacOSXAWTCGLGraphicsConfigurationFactory: made "+macScreen); } - GraphicsConfiguration gc = device.getDefaultConfiguration(); - MacOSXCGLGraphicsConfiguration macConfig = (MacOSXCGLGraphicsConfiguration) + final GraphicsConfiguration gc = device.getDefaultConfiguration(); + final MacOSXCGLGraphicsConfiguration macConfig = (MacOSXCGLGraphicsConfiguration) GraphicsConfigurationFactory.getFactory(macDevice, capsChosen).chooseGraphicsConfiguration(capsChosen, capsRequested, chooser, macScreen, nativeVisualID); diff --git a/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java b/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java index 6817ece8f..b6ffced9f 100644 --- a/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java +++ b/src/jogl/classes/jogamp/opengl/openal/av/ALAudioSink.java @@ -34,13 +34,16 @@ import java.util.Arrays; import jogamp.opengl.Debug; import com.jogamp.common.util.LFRingbuffer; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.common.util.Ringbuffer; import com.jogamp.common.util.locks.LockFactory; import com.jogamp.common.util.locks.RecursiveLock; import com.jogamp.openal.AL; import com.jogamp.openal.ALC; +import com.jogamp.openal.ALCConstants; import com.jogamp.openal.ALCcontext; import com.jogamp.openal.ALCdevice; +import com.jogamp.openal.ALConstants; import com.jogamp.openal.ALExt; import com.jogamp.openal.ALFactory; import com.jogamp.openal.util.ALHelpers; @@ -74,10 +77,10 @@ public class ALAudioSink implements AudioSink { static class ALAudioFrame extends AudioFrame { private final int alBuffer; - ALAudioFrame(int alBuffer) { + ALAudioFrame(final int alBuffer) { this.alBuffer = alBuffer; } - public ALAudioFrame(int alBuffer, int pts, int duration, int dataSize) { + public ALAudioFrame(final int alBuffer, final int pts, final int duration, final int dataSize) { super(pts, duration, dataSize); this.alBuffer = alBuffer; } @@ -112,7 +115,7 @@ public class ALAudioSink implements AudioSink { static { Debug.initSingleton(); - DEBUG_TRACE = Debug.isPropertyDefined("jogl.debug.AudioSink.trace", true); + DEBUG_TRACE = PropertyAccess.isPropertyDefined("jogl.debug.AudioSink.trace", true); ALC _alc = null; AL _al = null; @@ -121,7 +124,7 @@ public class ALAudioSink implements AudioSink { _alc = ALFactory.getALC(); _al = ALFactory.getAL(); _alExt = ALFactory.getALExt(); - } catch(Throwable t) { + } catch(final Throwable t) { if( DEBUG ) { System.err.println("ALAudioSink: Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); @@ -139,7 +142,7 @@ public class ALAudioSink implements AudioSink { private boolean checkALError(final String prefix) { final int alcErr = alc.alcGetError(device); final int alErr = al.alGetError(); - final boolean ok = ALC.ALC_NO_ERROR == alcErr && AL.AL_NO_ERROR == alErr; + final boolean ok = ALCConstants.ALC_NO_ERROR == alcErr && ALConstants.AL_NO_ERROR == alErr; if( DEBUG ) { System.err.println("ALAudioSink."+prefix+": ok "+ok+", err [alc "+toHexString(alcErr)+", al "+toHexString(alErr)+"]"); } @@ -165,7 +168,7 @@ public class ALAudioSink implements AudioSink { clearPreALError("init."+checkErrIter++); // Get the device specifier. - deviceSpecifier = alc.alcGetString(device, ALC.ALC_DEVICE_SPECIFIER); + deviceSpecifier = alc.alcGetString(device, ALCConstants.ALC_DEVICE_SPECIFIER); if (deviceSpecifier == null) { throw new RuntimeException(getThreadName()+": ALAudioSink: Error getting specifier for default OpenAL device"); } @@ -181,7 +184,7 @@ public class ALAudioSink implements AudioSink { lockContext(); try { // Check for an error. - if ( alc.alcGetError(device) != ALC.ALC_NO_ERROR ) { + if ( alc.alcGetError(device) != ALCConstants.ALC_NO_ERROR ) { throw new RuntimeException(getThreadName()+": ALAudioSink: Error making OpenAL context current"); } @@ -191,11 +194,11 @@ public class ALAudioSink implements AudioSink { clearPreALError("init."+checkErrIter++); preferredAudioFormat = new AudioFormat(querySampleRate(), DefaultFormat.sampleSize, DefaultFormat.channelCount, DefaultFormat.signed, DefaultFormat.fixedP, DefaultFormat.planar, DefaultFormat.littleEndian); if( DEBUG ) { - System.out.println("ALAudioSink: OpenAL Extensions:"+al.alGetString(AL.AL_EXTENSIONS)); + System.out.println("ALAudioSink: OpenAL Extensions:"+al.alGetString(ALConstants.AL_EXTENSIONS)); clearPreALError("init."+checkErrIter++); - System.out.println("ALAudioSink: Null device OpenAL Extensions:"+alc.alcGetString(null, ALC.ALC_EXTENSIONS)); + System.out.println("ALAudioSink: Null device OpenAL Extensions:"+alc.alcGetString(null, ALCConstants.ALC_EXTENSIONS)); clearPreALError("init."+checkErrIter++); - System.out.println("ALAudioSink: Device "+deviceSpecifier+" OpenAL Extensions:"+alc.alcGetString(device, ALC.ALC_EXTENSIONS)); + System.out.println("ALAudioSink: Device "+deviceSpecifier+" OpenAL Extensions:"+alc.alcGetString(device, ALCConstants.ALC_EXTENSIONS)); System.out.println("ALAudioSink: hasSOFTBufferSamples "+hasSOFTBufferSamples); System.out.println("ALAudioSink: hasALC_thread_local_context "+hasALC_thread_local_context); System.out.println("ALAudioSink: preferredAudioFormat "+preferredAudioFormat); @@ -207,7 +210,7 @@ public class ALAudioSink implements AudioSink { alSource = new int[1]; al.alGenSources(1, alSource, 0); final int err = al.alGetError(); - if( AL.AL_NO_ERROR != err ) { + if( ALConstants.AL_NO_ERROR != err ) { alSource = null; throw new RuntimeException(getThreadName()+": ALAudioSink: Error generating Source: 0x"+Integer.toHexString(err)); } @@ -221,7 +224,7 @@ public class ALAudioSink implements AudioSink { unlockContext(); } return; - } catch ( Exception e ) { + } catch ( final Exception e ) { if( DEBUG ) { System.err.println(e.getMessage()); e.printStackTrace(); @@ -234,10 +237,10 @@ public class ALAudioSink implements AudioSink { private final int querySampleRate() { final int sampleRate; final int[] value = new int[1]; - alc.alcGetIntegerv(device, ALC.ALC_FREQUENCY, 1, value, 0); + alc.alcGetIntegerv(device, ALCConstants.ALC_FREQUENCY, 1, value, 0); final int alcErr = alc.alcGetError(device); final int alErr = al.alGetError(); - if ( ALC.ALC_NO_ERROR == alcErr && AL.AL_NO_ERROR == alErr && 0 != value[0] ) { + if ( ALCConstants.ALC_NO_ERROR == alcErr && ALConstants.AL_NO_ERROR == alErr && 0 != value[0] ) { sampleRate = value[0]; } else { sampleRate = DefaultFormat.sampleRate; @@ -256,7 +259,7 @@ public class ALAudioSink implements AudioSink { alc.alcMakeContextCurrent(context); } final int alcErr = alc.alcGetError(null); - if( ALC.ALC_NO_ERROR != alcErr ) { + if( ALCConstants.ALC_NO_ERROR != alcErr ) { final String err = getThreadName()+": ALCError "+toHexString(alcErr)+" while makeCurrent. "+this; System.err.println(err); Thread.dumpStack(); @@ -264,7 +267,7 @@ public class ALAudioSink implements AudioSink { throw new RuntimeException(err); } final int alErr = al.alGetError(); - if( ALC.ALC_NO_ERROR != alErr ) { + if( ALCConstants.ALC_NO_ERROR != alErr ) { if( DEBUG ) { System.err.println(getThreadName()+": Prev - ALError "+toHexString(alErr)+" @ makeCurrent. "+this); Thread.dumpStack(); @@ -285,7 +288,7 @@ public class ALAudioSink implements AudioSink { if( null != context ) { try { alc.alcDestroyContext(context); - } catch (Throwable t) { + } catch (final Throwable t) { if( DEBUG ) { System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); @@ -346,7 +349,7 @@ public class ALAudioSink implements AudioSink { } @Override - public final boolean isSupported(AudioFormat format) { + public final boolean isSupported(final AudioFormat format) { if( !staticAvailable ) { return false; } @@ -355,13 +358,13 @@ public class ALAudioSink implements AudioSink { return false; } final int alChannelLayout = ALHelpers.getDefaultALChannelLayout(format.channelCount); - if( AL.AL_NONE != alChannelLayout ) { + if( ALConstants.AL_NONE != alChannelLayout ) { final int alSampleType = ALHelpers.getALSampleType(format.sampleSize, format.signed, format.fixedP); - if( AL.AL_NONE != alSampleType ) { + if( ALConstants.AL_NONE != alSampleType ) { lockContext(); try { final int alFormat = ALHelpers.getALFormat(alChannelLayout, alSampleType, hasSOFTBufferSamples, al, alExt); - return AL.AL_NONE != alFormat; + return ALConstants.AL_NONE != alFormat; } finally { unlockContext(); } @@ -371,7 +374,7 @@ public class ALAudioSink implements AudioSink { } @Override - public final boolean init(AudioFormat requestedFormat, float frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) { + public final boolean init(final AudioFormat requestedFormat, final float frameDuration, final int initialQueueSize, final int queueGrowAmount, final int queueLimit) { if( !staticAvailable ) { return false; } @@ -379,12 +382,12 @@ public class ALAudioSink implements AudioSink { alSampleType = ALHelpers.getALSampleType(requestedFormat.sampleSize, requestedFormat.signed, requestedFormat.fixedP); lockContext(); try { - if( AL.AL_NONE != alChannelLayout && AL.AL_NONE != alSampleType ) { + if( ALConstants.AL_NONE != alChannelLayout && ALConstants.AL_NONE != alSampleType ) { alFormat = ALHelpers.getALFormat(alChannelLayout, alSampleType, hasSOFTBufferSamples, al, alExt); } else { - alFormat = AL.AL_NONE; + alFormat = ALConstants.AL_NONE; } - if( AL.AL_NONE == alFormat ) { + if( ALConstants.AL_NONE == alFormat ) { // not supported return false; } @@ -398,7 +401,7 @@ public class ALAudioSink implements AudioSink { alBufferNames = new int[initialFrameCount]; al.alGenBuffers(initialFrameCount, alBufferNames, 0); final int err = al.alGetError(); - if( AL.AL_NO_ERROR != err ) { + if( ALConstants.AL_NO_ERROR != err ) { alBufferNames = null; throw new RuntimeException(getThreadName()+": ALAudioSink: Error generating Buffers: 0x"+Integer.toHexString(err)); } @@ -431,7 +434,7 @@ public class ALAudioSink implements AudioSink { return chosenFormat; } - private static int[] concat(int[] first, int[] second) { + private static int[] concat(final int[] first, final int[] second) { final int[] result = Arrays.copyOf(first, first.length + second.length); System.arraycopy(second, 0, result, first.length, second.length); return result; @@ -457,7 +460,7 @@ public class ALAudioSink implements AudioSink { final int[] newALBufferNames = new int[frameGrowAmount]; al.alGenBuffers(frameGrowAmount, newALBufferNames, 0); final int err = al.alGetError(); - if( AL.AL_NO_ERROR != err ) { + if( ALConstants.AL_NO_ERROR != err ) { if( DEBUG ) { System.err.println(getThreadName()+": ALAudioSink.growBuffers: Error generating "+frameGrowAmount+" new Buffers: 0x"+Integer.toHexString(err)); } @@ -493,7 +496,7 @@ public class ALAudioSink implements AudioSink { if( null != alBufferNames ) { try { al.alDeleteBuffers(alBufferNames.length, alBufferNames, 0); - } catch (Throwable t) { + } catch (final Throwable t) { if( DEBUG ) { System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); @@ -523,7 +526,7 @@ public class ALAudioSink implements AudioSink { if( null != alSource ) { try { al.alDeleteSources(1, alSource, 0); - } catch (Throwable t) { + } catch (final Throwable t) { if( DEBUG ) { System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); @@ -539,7 +542,7 @@ public class ALAudioSink implements AudioSink { if( null != device ) { try { alc.alcCloseDevice(device); - } catch (Throwable t) { + } catch (final Throwable t) { if( DEBUG ) { System.err.println("Caught "+t.getClass().getName()+": "+t.getMessage()); t.printStackTrace(); @@ -556,16 +559,16 @@ public class ALAudioSink implements AudioSink { } private final int dequeueBuffer(final boolean wait, final boolean ignoreBufferInconsistency) { - int alErr = AL.AL_NO_ERROR; + int alErr = ALConstants.AL_NO_ERROR; final int releaseBufferCount; if( alBufferBytesQueued > 0 ) { final int releaseBufferLimes = Math.max(1, alFramesPlaying.size() / 4 ); final int[] val=new int[1]; int i=0; do { - al.alGetSourcei(alSource[0], AL.AL_BUFFERS_PROCESSED, val, 0); + al.alGetSourcei(alSource[0], ALConstants.AL_BUFFERS_PROCESSED, val, 0); alErr = al.alGetError(); - if( AL.AL_NO_ERROR != alErr ) { + if( ALConstants.AL_NO_ERROR != alErr ) { throw new RuntimeException(getThreadName()+": ALError "+toHexString(alErr)+" while quering processed buffers at source. "+this); } if( wait && val[0] < releaseBufferLimes ) { @@ -574,12 +577,12 @@ public class ALAudioSink implements AudioSink { final int avgBufferDura = chosenFormat.getBytesDuration( alBufferBytesQueued / alFramesPlaying.size() ); final int sleep = Math.max(2, Math.min(100, releaseBufferLimes * avgBufferDura)); if( DEBUG ) { - System.err.println(getThreadName()+": ALAudioSink: Dequeue.wait["+i+"]: avgBufferDura "+avgBufferDura+", releaseBufferLimes "+releaseBufferLimes+", sleep "+sleep+" ms, playImpl "+(AL.AL_PLAYING == getSourceState(false))+", processed "+val[0]+", "+this); + System.err.println(getThreadName()+": ALAudioSink: Dequeue.wait["+i+"]: avgBufferDura "+avgBufferDura+", releaseBufferLimes "+releaseBufferLimes+", sleep "+sleep+" ms, playImpl "+(ALConstants.AL_PLAYING == getSourceState(false))+", processed "+val[0]+", "+this); } unlockContext(); try { Thread.sleep( sleep - 1 ); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { } finally { lockContext(); } @@ -594,7 +597,7 @@ public class ALAudioSink implements AudioSink { final int[] buffers = new int[releaseBufferCount]; al.alSourceUnqueueBuffers(alSource[0], releaseBufferCount, buffers, 0); alErr = al.alGetError(); - if( AL.AL_NO_ERROR != alErr ) { + if( ALConstants.AL_NO_ERROR != alErr ) { throw new RuntimeException(getThreadName()+": ALError "+toHexString(alErr)+" while dequeueing "+releaseBufferCount+" buffers. "+this); } for ( int i=0; i Hello JOAL"); System.err.println("JOAL: "+JoalVersion.getInstance().toString()); } diff --git a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java index 89e01edd8..3119b96ca 100644 --- a/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java +++ b/src/jogl/classes/jogamp/opengl/util/GLArrayHandlerInterleaved.java @@ -42,30 +42,30 @@ import com.jogamp.opengl.util.GLArrayDataEditable; public class GLArrayHandlerInterleaved extends GLVBOArrayHandler { private final List subArrays = new ArrayList(); - public GLArrayHandlerInterleaved(GLArrayDataEditable ad) { + public GLArrayHandlerInterleaved(final GLArrayDataEditable ad) { super(ad); } @Override - public final void setSubArrayVBOName(int vboName) { + public final void setSubArrayVBOName(final int vboName) { for(int i=0; i * @throws IllegalArgumentException if the given ordinal is out of range, i.e. not within [ 0 .. SampleFormat.values().length-1 ] */ - public static AudioSampleFormat valueOf(int ordinal) throws IllegalArgumentException { + public static AudioSampleFormat valueOf(final int ordinal) throws IllegalArgumentException { final AudioSampleFormat[] all = AudioSampleFormat.values(); if( 0 <= ordinal && ordinal < all.length ) { return all[ordinal]; diff --git a/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java index 25686a170..f9df9153f 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java +++ b/src/jogl/classes/jogamp/opengl/util/av/EGLMediaPlayerImpl.java @@ -50,14 +50,14 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl { public final int id; - TextureType(int id){ + TextureType(final int id){ this.id = id; } } public static class EGLTextureFrame extends TextureSequence.TextureFrame { - public EGLTextureFrame(Buffer clientBuffer, Texture t, long khrImage, long khrSync) { + public EGLTextureFrame(final Buffer clientBuffer, final Texture t, final long khrImage, final long khrSync) { super(t); this.clientBuffer = clientBuffer; this.image = khrImage; @@ -78,14 +78,14 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl { } - protected EGLMediaPlayerImpl(TextureType texType, boolean useKHRSync) { + protected EGLMediaPlayerImpl(final TextureType texType, final boolean useKHRSync) { super(); this.texType = texType; this.useKHRSync = useKHRSync; } @Override - protected TextureSequence.TextureFrame createTexImage(GL gl, int texName) { + protected TextureSequence.TextureFrame createTexImage(final GL gl, final int texName) { final Texture texture = super.createTexImageImpl(gl, texName, getWidth(), getHeight()); final Buffer clientBuffer; final long image; @@ -106,7 +106,7 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl { } if(TextureType.KHRImage == texType) { - IntBuffer nioTmp = Buffers.newDirectIntBuffer(1); + final IntBuffer nioTmp = Buffers.newDirectIntBuffer(1); // create EGLImage from texture clientBuffer = null; // FIXME nioTmp.put(0, EGL.EGL_NONE); @@ -122,7 +122,7 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl { } if(useKHRSync) { - IntBuffer tmp = Buffers.newDirectIntBuffer(1); + final IntBuffer tmp = Buffers.newDirectIntBuffer(1); // Create sync object so that we can be sure that gl has finished // rendering the EGLImage texture before we tell OpenMAX to fill // it with a new frame. @@ -138,7 +138,7 @@ public abstract class EGLMediaPlayerImpl extends GLMediaPlayerImpl { } @Override - protected void destroyTexFrame(GL gl, TextureSequence.TextureFrame frame) { + protected void destroyTexFrame(final GL gl, final TextureSequence.TextureFrame frame) { final boolean eglUsage = TextureType.KHRImage == texType || useKHRSync ; final EGLContext eglCtx; final EGLExt eglExt; diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java index 73b14b3d1..9cfa94a60 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java +++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java @@ -37,6 +37,7 @@ import java.util.Map; import javax.media.nativewindow.AbstractGraphicsDevice; import javax.media.opengl.GL; import javax.media.opengl.GL2; +import javax.media.opengl.GL2GL3; import javax.media.opengl.GLContext; import javax.media.opengl.GLDrawable; import javax.media.opengl.GLDrawableFactory; @@ -201,7 +202,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } @Override - public final void setTextureUnit(int u) { texUnit = u; } + public final void setTextureUnit(final int u) { texUnit = u; } @Override public final int getTextureUnit() { return texUnit; } @@ -216,20 +217,20 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { @Override public final int getTextureCount() { return textureCount; } - protected final void setTextureTarget(int target) { textureTarget=target; } - protected final void setTextureFormat(int internalFormat, int format) { + protected final void setTextureTarget(final int target) { textureTarget=target; } + protected final void setTextureFormat(final int internalFormat, final int format) { textureInternalFormat=internalFormat; textureFormat=format; } - protected final void setTextureType(int t) { textureType=t; } + protected final void setTextureType(final int t) { textureType=t; } @Override - public final void setTextureMinMagFilter(int[] minMagFilter) { texMinMagFilter[0] = minMagFilter[0]; texMinMagFilter[1] = minMagFilter[1];} + public final void setTextureMinMagFilter(final int[] minMagFilter) { texMinMagFilter[0] = minMagFilter[0]; texMinMagFilter[1] = minMagFilter[1];} @Override public final int[] getTextureMinMagFilter() { return texMinMagFilter; } @Override - public final void setTextureWrapST(int[] wrapST) { texWrapST[0] = wrapST[0]; texWrapST[1] = wrapST[1];} + public final void setTextureWrapST(final int[] wrapST) { texWrapST[0] = wrapST[0]; texWrapST[1] = wrapST[1];} @Override public final int[] getTextureWrapST() { return texWrapST; } @@ -253,7 +254,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { checkGLInit(); switch(textureTarget) { case GL.GL_TEXTURE_2D: - case GL2.GL_TEXTURE_RECTANGLE: + case GL2GL3.GL_TEXTURE_RECTANGLE: return TextureSequence.sampler2D; case GLES2.GL_TEXTURE_EXTERNAL_OES: return TextureSequence.samplerExternalOES; @@ -269,7 +270,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { * if not overridden by specialization. */ @Override - public String getTextureLookupFunctionName(String desiredFuncName) throws IllegalStateException { + public String getTextureLookupFunctionName(final String desiredFuncName) throws IllegalStateException { checkGLInit(); return "texture2D"; } @@ -355,10 +356,10 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { protected abstract boolean playImpl(); @Override - public final State pause(boolean flush) { + public final State pause(final boolean flush) { return pauseImpl(flush, 0); } - private final State pauseImpl(boolean flush, int event_mask) { + private final State pauseImpl(final boolean flush, int event_mask) { synchronized( stateLock ) { final State preState = state; if( State.Playing == state ) { @@ -384,10 +385,10 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { protected abstract boolean pauseImpl(); @Override - public final State destroy(GL gl) { + public final State destroy(final GL gl) { return destroyImpl(gl, 0); } - private final State destroyImpl(GL gl, int event_mask) { + private final State destroyImpl(final GL gl, final int event_mask) { synchronized( stateLock ) { if( null != streamWorker ) { streamWorker.doStop(); @@ -475,7 +476,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { * at {@link AudioSink#enqueueData(com.jogamp.opengl.util.av.AudioSink.AudioFrame)}. *

*/ - protected boolean setPlaySpeedImpl(float rate) { + protected boolean setPlaySpeedImpl(final float rate) { if( null != audioSink ) { audioSinkPlaySpeedSet = audioSink.setPlaySpeed(rate); } @@ -521,7 +522,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { /** * Override if not using AudioSink, or AudioSink's {@link AudioSink#setVolume(float)} is not sufficient! */ - protected boolean setAudioVolumeImpl(float v) { + protected boolean setAudioVolumeImpl(final float v) { if( null != audioSink ) { return audioSink.setVolume(v); } @@ -530,7 +531,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } @Override - public final void initStream(URI streamLoc, final int vid, final int aid, int reqTextureCount) throws IllegalStateException, IllegalArgumentException { + public final void initStream(final URI streamLoc, final int vid, final int aid, final int reqTextureCount) throws IllegalStateException, IllegalArgumentException { synchronized( stateLock ) { if(State.Uninitialized != state) { throw new IllegalStateException("Instance not in state unintialized: "+this); @@ -577,7 +578,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { try { // StreamWorker may be used, see API-doc of StreamWorker initStreamImpl(vid, aid); - } catch (Throwable t) { + } catch (final Throwable t) { streamErr = new StreamException(t.getClass().getSimpleName()+" while initializing: "+GLMediaPlayerImpl.this.toString(), t); changeState(GLMediaEventListener.EVENT_CHANGE_ERR, GLMediaPlayer.State.Uninitialized); } // also initializes width, height, .. etc @@ -612,7 +613,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } @Override - public final void initGL(GL gl) throws IllegalStateException, StreamException, GLException { + public final void initGL(final GL gl) throws IllegalStateException, StreamException, GLException { synchronized( stateLock ) { if(State.Initialized != state ) { throw new IllegalStateException("Stream not in state initialized: "+this); @@ -656,7 +657,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { lastFrame = null; } changeState(0, State.Paused); - } catch (Throwable t) { + } catch (final Throwable t) { destroyImpl(gl, GLMediaEventListener.EVENT_CHANGE_ERR); // -> GLMediaPlayer.State.Uninitialized throw new GLException("Error initializing GL resources", t); } @@ -683,11 +684,11 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { * Implementation must at least return a texture count of {@link #TEXTURE_COUNT_MIN}, two, the last texture and the decoding texture. *

*/ - protected int validateTextureCount(int desiredTextureCount) { + protected int validateTextureCount(final int desiredTextureCount) { return desiredTextureCount < TEXTURE_COUNT_MIN ? TEXTURE_COUNT_MIN : desiredTextureCount; } - protected TextureFrame[] createTexFrames(GL gl, final int count) { + protected TextureFrame[] createTexFrames(final GL gl, final int count) { final int[] texNames = new int[count]; gl.glGenTextures(count, texNames, 0); final int err = gl.glGetError(); @@ -702,7 +703,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } protected abstract TextureFrame createTexImage(GL gl, int texName); - protected final Texture createTexImageImpl(GL gl, int texName, int tWidth, int tHeight) { + protected final Texture createTexImageImpl(final GL gl, final int texName, final int tWidth, final int tHeight) { if( 0 > texName ) { throw new RuntimeException("TextureName "+toHexString(texName)+" invalid."); } @@ -749,7 +750,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { tWidth, tHeight, width, height, !isInGLOrientation); } - protected void destroyTexFrame(GL gl, TextureFrame frame) { + protected void destroyTexFrame(final GL gl, final TextureFrame frame) { frame.getTexture().destroy(gl); } @@ -766,7 +767,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { return lastFrame; } - private final void removeAllTextureFrames(GL gl) { + private final void removeAllTextureFrames(final GL gl) { final TextureFrame[] texFrames = videoFramesOrig; videoFramesOrig = null; videoFramesFree = null; @@ -794,7 +795,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { private final boolean[] stGotVFrame = { false }; @Override - public final TextureFrame getNextTexture(GL gl) throws IllegalStateException { + public final TextureFrame getNextTexture(final GL gl) throws IllegalStateException { synchronized( stateLock ) { if( State.Paused != state && State.Playing != state ) { throw new IllegalStateException("Instance not paused or playing: "+this); @@ -940,7 +941,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } lastTimeMillis = currentTimeMillis; } while( dropFrame ); - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } } @@ -948,8 +949,8 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { return lastFrame; } } - protected void preNextTextureImpl(GL gl) {} - protected void postNextTextureImpl(GL gl) {} + protected void preNextTextureImpl(final GL gl) {} + protected void postNextTextureImpl(final GL gl) {} /** * Process stream until the next video frame, i.e. {@link TextureFrame}, has been reached. * Audio frames, i.e. {@link AudioSink.AudioFrame}, shall be handled in the process. @@ -973,7 +974,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { */ protected abstract int getNextTextureImpl(GL gl, TextureFrame nextFrame); - protected final int getNextSingleThreaded(final GL gl, final TextureFrame nextFrame, boolean[] gotVFrame) throws InterruptedException { + protected final int getNextSingleThreaded(final GL gl, final TextureFrame nextFrame, final boolean[] gotVFrame) throws InterruptedException { final int pts; if( STREAM_ID_NONE != vid ) { preNextTextureImpl(gl); @@ -1013,7 +1014,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { * w/ current pts value in milliseconds. * @param audio_scr_t0 */ - protected void setFirstAudioPTS2SCR(int pts) { + protected void setFirstAudioPTS2SCR(final int pts) { if( audioSCR_reset ) { audio_scr_t0 = Platform.currentTimeMillis() - pts; audioSCR_reset = false; @@ -1049,13 +1050,13 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { return (int) ( video_dpts_cum * (1.0f - VIDEO_DPTS_COEFF) + 0.5f ); } - private final void newFrameAvailable(TextureFrame frame, long currentTimeMillis) { + private final void newFrameAvailable(final TextureFrame frame, final long currentTimeMillis) { decodedFrameCount++; if( 0 == frame.getDuration() ) { // patch frame duration if not set already frame.setDuration( (int) frame_duration ); } synchronized(eventListenersLock) { - for(Iterator i = eventListeners.iterator(); i.hasNext(); ) { + for(final Iterator i = eventListeners.iterator(); i.hasNext(); ) { i.next().newFrameAvailable(this, frame, currentTimeMillis); } } @@ -1092,14 +1093,14 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { this.notifyAll(); // wake-up startup-block try { this.wait(); // wait until started - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } } } } - private void makeCurrent(GLContext ctx) { + private void makeCurrent(final GLContext ctx) { if( GLContext.CONTEXT_NOT_CURRENT >= ctx.makeCurrent() ) { throw new GLException("Couldn't make ctx current: "+ctx); } @@ -1112,7 +1113,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { // so we can continue with the destruction. try { sharedGLCtx.destroy(); - } catch (GLException gle) { + } catch (final GLException gle) { gle.printStackTrace(); } } @@ -1126,7 +1127,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } } - public final synchronized void initGL(GL gl) { + public final synchronized void initGL(final GL gl) { final GLContext glCtx = gl.getContext(); final boolean glCtxCurrent = glCtx.isCurrent(); final GLProfile glp = gl.getGLProfile(); @@ -1152,7 +1153,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { while( isActive && isRunning ) { try { this.wait(); // wait until paused - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } } @@ -1167,7 +1168,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { this.notifyAll(); // wake-up pause-block try { this.wait(); // wait until resumed - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } } @@ -1185,7 +1186,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { this.notifyAll(); // wake-up pause-block (opt) try { this.wait(); // wait until stopped - } catch (InterruptedException e) { + } catch (final InterruptedException e) { e.printStackTrace(); } } @@ -1217,7 +1218,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { this.notifyAll(); // wake-up doPause() try { this.wait(); // wait until resumed - } catch (InterruptedException e) { + } catch (final InterruptedException e) { if( !shallPause ) { e.printStackTrace(); } @@ -1296,12 +1297,12 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } pauseImpl(true, GLMediaEventListener.EVENT_CHANGE_EOS); } - } catch (InterruptedException e) { + } catch (final InterruptedException e) { isBlocked = false; if( !shallStop && !shallPause ) { streamErr = new StreamException("InterruptedException while decoding: "+GLMediaPlayerImpl.this.toString(), e); } - } catch (Throwable t) { + } catch (final Throwable t) { streamErr = new StreamException(t.getClass().getSimpleName()+" while decoding: "+GLMediaPlayerImpl.this.toString(), t); } finally { if( null != nextFrame ) { // put back @@ -1339,7 +1340,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { private volatile StreamWorker streamWorker = null; private volatile StreamException streamErr = null; - protected final int addStateEventMask(int event_mask, State newState) { + protected final int addStateEventMask(int event_mask, final State newState) { if( state != newState ) { switch( newState ) { case Uninitialized: @@ -1359,18 +1360,18 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { return event_mask; } - protected final void attributesUpdated(int event_mask) { + protected final void attributesUpdated(final int event_mask) { if( 0 != event_mask ) { final long now = Platform.currentTimeMillis(); synchronized(eventListenersLock) { - for(Iterator i = eventListeners.iterator(); i.hasNext(); ) { + for(final Iterator i = eventListeners.iterator(); i.hasNext(); ) { i.next().attributesChanged(this, event_mask, now); } } } } - protected final void changeState(int event_mask, State newState) { + protected final void changeState(int event_mask, final State newState) { event_mask = addStateEventMask(event_mask, newState); if( 0 != event_mask ) { setState( newState ); @@ -1381,9 +1382,9 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } } - protected final void updateAttributes(int vid, int aid, int width, int height, int bps_stream, - int bps_video, int bps_audio, float fps, - int videoFrames, int audioFrames, int duration, String vcodec, String acodec) { + protected final void updateAttributes(int vid, final int aid, final int width, final int height, final int bps_stream, + final int bps_video, final int bps_audio, final float fps, + final int videoFrames, final int audioFrames, final int duration, final String vcodec, final String acodec) { int event_mask = 0; final boolean wasUninitialized = state == State.Uninitialized; @@ -1458,7 +1459,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { attributesUpdated(event_mask); } - protected void setIsGLOriented(boolean isGLOriented) { + protected void setIsGLOriented(final boolean isGLOriented) { if( isInGLOrientation != isGLOriented ) { if( DEBUG ) { System.err.println("XXX gl-orient "+isInGLOrientation+" -> "+isGLOriented); @@ -1569,7 +1570,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } @Override - public final void addEventListener(GLMediaEventListener l) { + public final void addEventListener(final GLMediaEventListener l) { if(l == null) { return; } @@ -1579,7 +1580,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { } @Override - public final void removeEventListener(GLMediaEventListener l) { + public final void removeEventListener(final GLMediaEventListener l) { if (l == null) { return; } @@ -1598,33 +1599,33 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer { private final Object eventListenersLock = new Object(); @Override - public final Object getAttachedObject(String name) { + public final Object getAttachedObject(final String name) { return attachedObjects.get(name); } @Override - public final Object attachObject(String name, Object obj) { + public final Object attachObject(final String name, final Object obj) { return attachedObjects.put(name, obj); } @Override - public final Object detachObject(String name) { + public final Object detachObject(final String name) { return attachedObjects.remove(name); } private final HashMap attachedObjects = new HashMap(); - protected static final String toHexString(long v) { + protected static final String toHexString(final long v) { return "0x"+Long.toHexString(v); } - protected static final String toHexString(int v) { + protected static final String toHexString(final int v) { return "0x"+Integer.toHexString(v); } - protected static final int getPropIntVal(Map props, String key) { + protected static final int getPropIntVal(final Map props, final String key) { final String val = props.get(key); try { return Integer.valueOf(val).intValue(); - } catch (NumberFormatException nfe) { + } catch (final NumberFormatException nfe) { if(DEBUG) { System.err.println("Not a valid integer for <"+key+">: <"+val+">"); } diff --git a/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java b/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java index f5b2dd8ea..a24e77b7d 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java +++ b/src/jogl/classes/jogamp/opengl/util/av/JavaSoundAudioSink.java @@ -43,7 +43,7 @@ public class JavaSoundAudioSink implements AudioSink { try { AudioSystem.getAudioFileTypes(); ok = true; - } catch (Throwable t) { + } catch (final Throwable t) { } staticAvailable=ok; @@ -59,7 +59,7 @@ public class JavaSoundAudioSink implements AudioSink { public final float getPlaySpeed() { return 1.0f; } // FIXME @Override - public final boolean setPlaySpeed(float rate) { + public final boolean setPlaySpeed(final float rate) { return false; // FIXME } @@ -70,7 +70,7 @@ public class JavaSoundAudioSink implements AudioSink { } @Override - public final boolean setVolume(float v) { + public final boolean setVolume(final float v) { // FIXME volume = v; return true; @@ -87,12 +87,12 @@ public class JavaSoundAudioSink implements AudioSink { } @Override - public final boolean isSupported(AudioSink.AudioFormat format) { + public final boolean isSupported(final AudioSink.AudioFormat format) { return true; } @Override - public boolean init(AudioSink.AudioFormat requestedFormat, float frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) { + public boolean init(final AudioSink.AudioFormat requestedFormat, final float frameDuration, final int initialQueueSize, final int queueGrowAmount, final int queueLimit) { if( !staticAvailable ) { return false; } @@ -112,7 +112,7 @@ public class JavaSoundAudioSink implements AudioSink { System.out.println("JavaSound audio sink"); initialized=true; chosenFormat = requestedFormat; - } catch (Exception e) { + } catch (final Exception e) { initialized=false; } return true; @@ -186,7 +186,7 @@ public class JavaSoundAudioSink implements AudioSink { } @Override - public AudioFrame enqueueData(AudioDataFrame audioDataFrame) { + public AudioFrame enqueueData(final AudioDataFrame audioDataFrame) { int byteSize = audioDataFrame.getByteSize(); final ByteBuffer byteBuffer = audioDataFrame.getData(); final byte[] bytes = new byte[byteSize]; @@ -206,7 +206,7 @@ public class JavaSoundAudioSink implements AudioSink { } @Override - public AudioFrame enqueueData(int pts, ByteBuffer bytes, int byteCount) { + public AudioFrame enqueueData(final int pts, final ByteBuffer bytes, final int byteCount) { return enqueueData(new AudioDataFrame(pts, chosenFormat.getBytesDuration(byteCount), bytes, byteCount)); } @@ -224,7 +224,7 @@ public class JavaSoundAudioSink implements AudioSink { public int getQueuedTime() { return getQueuedTimeImpl( getQueuedByteCount() ); } - private final int getQueuedTimeImpl(int byteCount) { + private final int getQueuedTimeImpl(final int byteCount) { final int bytesPerSample = chosenFormat.sampleSize >>> 3; // /8 return byteCount / ( chosenFormat.channelCount * bytesPerSample * ( chosenFormat.sampleRate / 1000 ) ); } diff --git a/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java b/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java index 4ab90322d..3aa9d7ab6 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java +++ b/src/jogl/classes/jogamp/opengl/util/av/NullAudioSink.java @@ -70,7 +70,7 @@ public class NullAudioSink implements AudioSink { } @Override - public final boolean setVolume(float v) { + public final boolean setVolume(final float v) { // FIXME volume = v; return true; @@ -87,7 +87,7 @@ public class NullAudioSink implements AudioSink { } @Override - public final boolean isSupported(AudioFormat format) { + public final boolean isSupported(final AudioFormat format) { /** * If we like to emulate constraints .. * @@ -102,7 +102,7 @@ public class NullAudioSink implements AudioSink { } @Override - public boolean init(AudioFormat requestedFormat, float frameDuration, int initialQueueSize, int queueGrowAmount, int queueLimit) { + public boolean init(final AudioFormat requestedFormat, final float frameDuration, final int initialQueueSize, final int queueGrowAmount, final int queueLimit) { chosenFormat = requestedFormat; return true; } @@ -171,12 +171,12 @@ public class NullAudioSink implements AudioSink { } @Override - public AudioFrame enqueueData(AudioDataFrame audioDataFrame) { + public AudioFrame enqueueData(final AudioDataFrame audioDataFrame) { return enqueueData(audioDataFrame.getPTS(), audioDataFrame.getData(), audioDataFrame.getByteSize()); } @Override - public AudioFrame enqueueData(int pts, ByteBuffer bytes, int byteCount) { + public AudioFrame enqueueData(final int pts, final ByteBuffer bytes, final int byteCount) { if( !initialized || null == chosenFormat ) { return null; } diff --git a/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java index 2b4a386d4..4a15c7422 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/NullGLMediaPlayer.java @@ -61,7 +61,7 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl { } @Override - protected final boolean setPlaySpeedImpl(float rate) { + protected final boolean setPlaySpeedImpl(final float rate) { return false; } @@ -77,14 +77,14 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl { } @Override - protected final int seekImpl(int msec) { + protected final int seekImpl(final int msec) { pos_ms = msec; validatePos(); return pos_ms; } @Override - protected final int getNextTextureImpl(GL gl, TextureFrame nextFrame) { + protected final int getNextTextureImpl(final GL gl, final TextureFrame nextFrame) { final int pts = getAudioPTSImpl(); nextFrame.setPTS( pts ); return pts; @@ -98,7 +98,7 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl { } @Override - protected final void destroyImpl(GL gl) { + protected final void destroyImpl(final GL gl) { if(null != texData) { texData.destroy(); texData = null; @@ -108,17 +108,17 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl { public final static TextureData createTestTextureData() { TextureData res = null; try { - URLConnection urlConn = IOUtil.getResource("jogl/util/data/av/test-ntsc01-28x16.png", NullGLMediaPlayer.class.getClassLoader()); + final URLConnection urlConn = IOUtil.getResource("jogl/util/data/av/test-ntsc01-28x16.png", NullGLMediaPlayer.class.getClassLoader()); if(null != urlConn) { res = TextureIO.newTextureData(GLProfile.getGL2ES2(), urlConn.getInputStream(), false, TextureIO.PNG); } - } catch (Exception e) { + } catch (final Exception e) { e.printStackTrace(); } if(null == res) { final int w = 160; final int h = 90; - ByteBuffer buffer = Buffers.newDirectByteBuffer(w*h*4); + final ByteBuffer buffer = Buffers.newDirectByteBuffer(w*h*4); while(buffer.hasRemaining()) { buffer.put((byte) 0xEA); buffer.put((byte) 0xEA); buffer.put((byte) 0xEA); buffer.put((byte) 0xEA); } @@ -132,7 +132,7 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl { } @Override - protected final void initStreamImpl(int vid, int aid) throws IOException { + protected final void initStreamImpl(final int vid, final int aid) throws IOException { texData = createTestTextureData(); final float _fps = 24f; final int _duration = 10*60*1000; // msec @@ -143,7 +143,7 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl { _totalFrames, 0, _duration, "png-static", null); } @Override - protected final void initGLImpl(GL gl) throws IOException, GLException { + protected final void initGLImpl(final GL gl) throws IOException, GLException { setIsGLOriented(true); } @@ -154,12 +154,12 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl { *

*/ @Override - protected int validateTextureCount(int desiredTextureCount) { + protected int validateTextureCount(final int desiredTextureCount) { return TEXTURE_COUNT_MIN; } @Override - protected final TextureSequence.TextureFrame createTexImage(GL gl, int texName) { + protected final TextureSequence.TextureFrame createTexImage(final GL gl, final int texName) { final Texture texture = super.createTexImageImpl(gl, texName, getWidth(), getHeight()); if(null != texData) { texture.updateImage(gl, texData); @@ -168,7 +168,7 @@ public class NullGLMediaPlayer extends GLMediaPlayerImpl { } @Override - protected final void destroyTexFrame(GL gl, TextureSequence.TextureFrame frame) { + protected final void destroyTexFrame(final GL gl, final TextureSequence.TextureFrame frame) { super.destroyTexFrame(gl, frame); } diff --git a/src/jogl/classes/jogamp/opengl/util/av/VideoPixelFormat.java b/src/jogl/classes/jogamp/opengl/util/av/VideoPixelFormat.java index 380ff9ea8..44d83e78d 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/VideoPixelFormat.java +++ b/src/jogl/classes/jogamp/opengl/util/av/VideoPixelFormat.java @@ -181,7 +181,7 @@ public enum VideoPixelFormat { * * @throws IllegalArgumentException if the given ordinal is out of range, i.e. not within [ 0 .. PixelFormat.values().length-1 ] */ - public static VideoPixelFormat valueOf(int ordinal) throws IllegalArgumentException { + public static VideoPixelFormat valueOf(final int ordinal) throws IllegalArgumentException { final VideoPixelFormat[] all = VideoPixelFormat.values(); if( 0 <= ordinal && ordinal < all.length ) { return all[ordinal]; diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java index e7a425a54..42a908f93 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGDynamicLibraryBundleInfo.java @@ -188,12 +188,12 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { GLProfile.initSingleton(); boolean _ready = false; /** util, format, codec, device, avresample, swresample */ - boolean[] _loaded= new boolean[6]; + final boolean[] _loaded= new boolean[6]; /** util, format, codec, avresample, swresample */ - VersionNumber[] _versions = new VersionNumber[5]; + final VersionNumber[] _versions = new VersionNumber[5]; try { _ready = initSymbols(_loaded, _versions); - } catch (Throwable t) { + } catch (final Throwable t) { t.printStackTrace(); } libsUFCLoaded = _loaded[LIB_IDX_UTI] && _loaded[LIB_IDX_FMT] && _loaded[LIB_IDX_COD]; @@ -250,7 +250,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { * @param versions 5: util, format, codec, avresample, swresample * @return */ - private static final boolean initSymbols(boolean[] loaded, VersionNumber[] versions) { + private static final boolean initSymbols(final boolean[] loaded, final VersionNumber[] versions) { for(int i=0; i<6; i++) { loaded[i] = false; } @@ -331,7 +331,7 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { @Override public final List> getToolLibNames() { - List> libsList = new ArrayList>(); + final List> libsList = new ArrayList>(); // 6: util, format, codec, device, avresample, swresample @@ -424,12 +424,12 @@ class FFMPEGDynamicLibraryBundleInfo implements DynamicLibraryBundleInfo { } @Override - public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) { + public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { return 0; } @Override - public final boolean useToolGetProcAdressFirst(String funcName) { + public final boolean useToolGetProcAdressFirst(final String funcName) { return false; } diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java index 9cfd3d80e..8ac1232b5 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGMediaPlayer.java @@ -49,6 +49,7 @@ import com.jogamp.opengl.util.av.AudioSinkFactory; import com.jogamp.opengl.util.av.GLMediaPlayer; import com.jogamp.opengl.util.texture.Texture; +import jogamp.common.os.PlatformPropsImpl; import jogamp.opengl.GLContextImpl; import jogamp.opengl.util.av.AudioSampleFormat; import jogamp.opengl.util.av.GLMediaPlayerImpl; @@ -265,7 +266,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { } @Override - protected final void destroyImpl(GL gl) { + protected final void destroyImpl(final GL gl) { if (moviePtr != 0) { natives.destroyInstance0(moviePtr); moviePtr = 0; @@ -283,7 +284,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { public static final String dev_video_linux = "/dev/video"; @Override - protected final void initStreamImpl(int vid, int aid) throws IOException { + protected final void initStreamImpl(final int vid, final int aid) throws IOException { if(0==moviePtr) { throw new GLException("FFMPEG native instance null"); } @@ -309,7 +310,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { int rw=-1, rh=-1, rr=-1; String sizes = null; if( isCameraInput ) { - switch(Platform.OS_TYPE) { + switch(PlatformPropsImpl.OS_TYPE) { case ANDROID: // ?? case FREEBSD: @@ -351,7 +352,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { } @Override - protected final void initGLImpl(GL gl) throws IOException, GLException { + protected final void initGLImpl(final GL gl) throws IOException, GLException { if(0==moviePtr) { throw new GLException("FFMPEG native instance null"); } @@ -406,7 +407,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { if( null != gl && STREAM_ID_NONE != getVID() ) { int tf, tif=GL.GL_RGBA; // texture format and internal format - int tt = GL.GL_UNSIGNED_BYTE; + final int tt = GL.GL_UNSIGNED_BYTE; switch(vBytesPerPixelPerPlane) { case 1: if( gl.isGL3ES3() ) { @@ -414,22 +415,22 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { tf = GL2ES2.GL_RED; tif=GL2ES2.GL_RED; singleTexComp = "r"; } else { // ALPHA is supported on ES2 and GL2, i.e. <= GL3 [core] or compatibility - tf = GL2ES2.GL_ALPHA; tif=GL2ES2.GL_ALPHA; singleTexComp = "a"; + tf = GL.GL_ALPHA; tif=GL.GL_ALPHA; singleTexComp = "a"; } break; case 2: if( vPixelFmt == VideoPixelFormat.YUYV422 ) { // YUYV422: // < packed YUV 4:2:2, 2x 16bpp, Y0 Cb Y1 Cr // Stuffed into RGBA half width texture - tf = GL2ES2.GL_RGBA; tif=GL2ES2.GL_RGBA; break; + tf = GL.GL_RGBA; tif=GL.GL_RGBA; break; } else { tf = GL2ES2.GL_RG; tif=GL2ES2.GL_RG; break; } - case 3: tf = GL2ES2.GL_RGB; tif=GL.GL_RGB; break; + case 3: tf = GL.GL_RGB; tif=GL.GL_RGB; break; case 4: if( vPixelFmt == VideoPixelFormat.BGRA ) { - tf = GL2ES2.GL_BGRA; tif=GL.GL_RGBA; break; + tf = GL.GL_BGRA; tif=GL.GL_RGBA; break; } else { - tf = GL2ES2.GL_RGBA; tif=GL.GL_RGBA; break; + tf = GL.GL_RGBA; tif=GL.GL_RGBA; break; } default: throw new RuntimeException("Unsupported bytes-per-pixel / plane "+vBytesPerPixelPerPlane); } @@ -442,7 +443,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { } } @Override - protected final TextureFrame createTexImage(GL gl, int texName) { + protected final TextureFrame createTexImage(final GL gl, final int texName) { return new TextureFrame( createTexImageImpl(gl, texName, texWidth, texHeight) ); } @@ -464,7 +465,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { * @param audioSampleRate sample rate in Hz (1/s) * @param audioChannels number of channels */ - final boolean isAudioFormatSupported(int audioSampleFmt, int audioSampleRate, int audioChannels) { + final boolean isAudioFormatSupported(final int audioSampleFmt, final int audioSampleRate, final int audioChannels) { final AudioSampleFormat avFmt = AudioSampleFormat.valueOf(audioSampleFmt); final AudioFormat audioFormat = avAudioFormat2Local(avFmt, audioSampleRate, audioChannels); final boolean res = audioSink.isSupported(audioFormat); @@ -480,7 +481,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { * @param audioSampleRate sample rate in Hz (1/s) * @param audioChannels number of channels */ - private final AudioFormat avAudioFormat2Local(AudioSampleFormat audioSampleFmt, int audioSampleRate, int audioChannels) { + private final AudioFormat avAudioFormat2Local(final AudioSampleFormat audioSampleFmt, final int audioSampleRate, final int audioChannels) { final int sampleSize; boolean planar = true; boolean fixedP = true; @@ -540,10 +541,10 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { * @param audioChannels * @param audioSamplesPerFrameAndChannel in audio samples per frame and channel */ - void setupFFAttributes(int vid, int pixFmt, int planes, int bitsPerPixel, int bytesPerPixelPerPlane, - int tWd0, int tWd1, int tWd2, int vW, int vH, - int aid, int audioSampleFmt, int audioSampleRate, - int audioChannels, int audioSamplesPerFrameAndChannel) { + void setupFFAttributes(final int vid, final int pixFmt, final int planes, final int bitsPerPixel, final int bytesPerPixelPerPlane, + final int tWd0, final int tWd1, final int tWd2, final int vW, final int vH, + final int aid, final int audioSampleFmt, final int audioSampleRate, + final int audioChannels, final int audioSamplesPerFrameAndChannel) { // defaults .. vPixelFmt = null; vPlanes = 0; @@ -641,8 +642,8 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { * @param tWd1 * @param tWd2 */ - void updateVidAttributes(boolean isInGLOrientation, int pixFmt, int planes, int bitsPerPixel, int bytesPerPixelPerPlane, - int tWd0, int tWd1, int tWd2, int vW, int vH) { + void updateVidAttributes(final boolean isInGLOrientation, final int pixFmt, final int planes, final int bitsPerPixel, final int bytesPerPixelPerPlane, + final int tWd0, final int tWd1, final int tWd2, final int vW, final int vH) { } /** @@ -653,7 +654,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { * Otherwise the call is delegated to it's super class. */ @Override - public final String getTextureLookupFunctionName(String desiredFuncName) throws IllegalStateException { + public final String getTextureLookupFunctionName(final String desiredFuncName) throws IllegalStateException { if( State.Uninitialized == getState() ) { throw new IllegalStateException("Instance not initialized: "+this); } @@ -785,7 +786,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { } @Override - protected final synchronized int seekImpl(int msec) { + protected final synchronized int seekImpl(final int msec) { if(0==moviePtr) { throw new GLException("FFMPEG native instance null"); } @@ -793,18 +794,18 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { } @Override - protected void preNextTextureImpl(GL gl) { + protected void preNextTextureImpl(final GL gl) { psm.setUnpackAlignment(gl, 1); // RGBA ? 4 : 1 gl.glActiveTexture(GL.GL_TEXTURE0+getTextureUnit()); } @Override - protected void postNextTextureImpl(GL gl) { + protected void postNextTextureImpl(final GL gl) { psm.restore(gl); } @Override - protected final int getNextTextureImpl(GL gl, TextureFrame nextFrame) { + protected final int getNextTextureImpl(final GL gl, final TextureFrame nextFrame) { if(0==moviePtr) { throw new GLException("FFMPEG native instance null"); } @@ -825,7 +826,7 @@ public class FFMPEGMediaPlayer extends GLMediaPlayerImpl { return vPTS; } - final void pushSound(ByteBuffer sampleData, int data_size, int audio_pts) { + final void pushSound(final ByteBuffer sampleData, final int data_size, final int audio_pts) { setFirstAudioPTS2SCR( audio_pts ); if( 1.0f == getPlaySpeed() || audioSinkPlaySpeedSet ) { audioSink.enqueueData( audio_pts, sampleData, data_size); diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java index 99e5a805b..8fd439082 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java @@ -33,7 +33,7 @@ import com.jogamp.opengl.util.texture.TextureSequence.TextureFrame; private static final Object mutex_avcodec_openclose_jni = new Object(); - final boolean initSymbols0(long[] symbols, int count) { + final boolean initSymbols0(final long[] symbols, final int count) { return initSymbols0(mutex_avcodec_openclose_jni, symbols, count); } abstract boolean initSymbols0(Object mutex_avcodec_openclose, long[] symbols, int count); diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java index 22a045825..65a7e3618 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGStaticNatives.java @@ -30,7 +30,7 @@ package jogamp.opengl.util.av.impl; import com.jogamp.common.util.VersionNumber; class FFMPEGStaticNatives { - static VersionNumber getAVVersion(int vers) { + static VersionNumber getAVVersion(final int vers) { return new VersionNumber( ( vers >> 16 ) & 0xFF, ( vers >> 8 ) & 0xFF, ( vers >> 0 ) & 0xFF ); diff --git a/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java b/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java index ecf91124e..0eeb54bf6 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/OMXGLMediaPlayer.java @@ -74,19 +74,19 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { } @Override - protected TextureSequence.TextureFrame createTexImage(GL gl, int texName) { + protected TextureSequence.TextureFrame createTexImage(final GL gl, final int texName) { final EGLTextureFrame eglTex = (EGLTextureFrame) super.createTexImage(gl, texName); _setStreamEGLImageTexture2D(moviePtr, texName, eglTex.getImage(), eglTex.getSync()); return eglTex; } @Override - protected void destroyTexFrame(GL gl, TextureSequence.TextureFrame imgTex) { + protected void destroyTexFrame(final GL gl, final TextureSequence.TextureFrame imgTex) { super.destroyTexFrame(gl, imgTex); } @Override - protected void destroyImpl(GL gl) { + protected void destroyImpl(final GL gl) { if (moviePtr != 0) { _stop(moviePtr); _detachVideoRenderer(moviePtr); @@ -96,7 +96,7 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { } @Override - protected void initStreamImpl(int vid, int aid) throws IOException { + protected void initStreamImpl(final int vid, final int aid) throws IOException { if(0==moviePtr) { throw new GLException("OMX native instance null"); } @@ -117,7 +117,7 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { } } @Override - protected final void initGLImpl(GL gl) throws IOException, GLException { + protected final void initGLImpl(final GL gl) throws IOException, GLException { // NOP setIsGLOriented(true); } @@ -128,7 +128,7 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { } @Override - protected boolean setPlaySpeedImpl(float rate) { + protected boolean setPlaySpeedImpl(final float rate) { if(0==moviePtr) { throw new GLException("OMX native instance null"); } @@ -157,7 +157,7 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { /** @return time position after issuing the command */ @Override - protected int seekImpl(int msec) { + protected int seekImpl(final int msec) { if(0==moviePtr) { throw new GLException("OMX native instance null"); } @@ -165,7 +165,7 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { } @Override - protected int getNextTextureImpl(GL gl, TextureFrame nextFrame) { + protected int getNextTextureImpl(final GL gl, final TextureFrame nextFrame) { if(0==moviePtr) { throw new GLException("OMX native instance null"); } @@ -182,8 +182,8 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { return 0; // FIXME: return pts } - private String replaceAll(String orig, String search, String repl) { - StringBuilder dest = new StringBuilder(); + private String replaceAll(final String orig, final String search, final String repl) { + final StringBuilder dest = new StringBuilder(); // In case replaceAll / java.util.regex.* is not supported (-> CVM) int i=0,j; while((j=orig.indexOf(search, i))>=0) { @@ -194,7 +194,7 @@ public class OMXGLMediaPlayer extends EGLMediaPlayerImpl { return dest.append(orig.substring(i, orig.length())).toString(); } - private void errorCheckEGL(String s) { + private void errorCheckEGL(final String s) { int e; if( (e=EGL.eglGetError()) != EGL.EGL_SUCCESS ) { System.out.println("EGL Error: ("+s+"): 0x"+Integer.toHexString(e)); diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java index e9fb91086..5a78f514d 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandler.java @@ -45,22 +45,22 @@ import com.jogamp.opengl.util.glsl.ShaderState; */ public class GLSLArrayHandler extends GLVBOArrayHandler { - public GLSLArrayHandler(GLArrayDataEditable ad) { + public GLSLArrayHandler(final GLArrayDataEditable ad) { super(ad); } @Override - public final void setSubArrayVBOName(int vboName) { + public final void setSubArrayVBOName(final int vboName) { throw new UnsupportedOperationException(); } @Override - public final void addSubHandler(GLArrayHandlerFlat handler) { + public final void addSubHandler(final GLArrayHandlerFlat handler) { throw new UnsupportedOperationException(); } @Override - public final void enableState(GL gl, boolean enable, Object ext) { + public final void enableState(final GL gl, final boolean enable, final Object ext) { final GL2ES2 glsl = gl.getGL2ES2(); if( null != ext ) { enableShaderState(glsl, enable, (ShaderState)ext); @@ -71,7 +71,7 @@ public class GLSLArrayHandler extends GLVBOArrayHandler { private final int[] tempI = new int[1]; - private final void enableShaderState(GL2ES2 glsl, boolean enable, ShaderState st) { + private final void enableShaderState(final GL2ES2 glsl, final boolean enable, final ShaderState st) { if(enable) { /* * This would be the non optimized code path: @@ -118,7 +118,7 @@ public class GLSLArrayHandler extends GLVBOArrayHandler { } } - private final void enableSimple(GL2ES2 glsl, boolean enable) { + private final void enableSimple(final GL2ES2 glsl, final boolean enable) { final int location = ad.getLocation(); if( 0 > location ) { return; diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java index 34a381d7d..85fcabdd9 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerFlat.java @@ -41,9 +41,9 @@ import com.jogamp.opengl.util.glsl.ShaderState; * separately and interleaves many arrays. */ public class GLSLArrayHandlerFlat implements GLArrayHandlerFlat { - private GLArrayDataWrapper ad; + private final GLArrayDataWrapper ad; - public GLSLArrayHandlerFlat(GLArrayDataWrapper ad) { + public GLSLArrayHandlerFlat(final GLArrayDataWrapper ad) { this.ad = ad; } @@ -53,7 +53,7 @@ public class GLSLArrayHandlerFlat implements GLArrayHandlerFlat { } @Override - public final void syncData(GL gl, Object ext) { + public final void syncData(final GL gl, final Object ext) { final GL2ES2 glsl = gl.getGL2ES2(); if( null != ext ) { ((ShaderState)ext).vertexAttribPointer(glsl, ad); @@ -80,7 +80,7 @@ public class GLSLArrayHandlerFlat implements GLArrayHandlerFlat { } @Override - public final void enableState(GL gl, boolean enable, Object ext) { + public final void enableState(final GL gl, final boolean enable, final Object ext) { final GL2ES2 glsl = gl.getGL2ES2(); if( null != ext ) { final ShaderState st = (ShaderState)ext; diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java index e153082e0..0169b0747 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/GLSLArrayHandlerInterleaved.java @@ -45,30 +45,30 @@ import com.jogamp.opengl.util.GLArrayDataEditable; public class GLSLArrayHandlerInterleaved extends GLVBOArrayHandler { private final List subArrays = new ArrayList(); - public GLSLArrayHandlerInterleaved(GLArrayDataEditable ad) { + public GLSLArrayHandlerInterleaved(final GLArrayDataEditable ad) { super(ad); } @Override - public final void setSubArrayVBOName(int vboName) { + public final void setSubArrayVBOName(final int vboName) { for(int i=0; i shaderRootClass, String shaderSrcRoot, String shaderBinRoot, - String vertexColorFile, String vertexColorLightFile, - String fragmentColorFile, String fragmentColorTextureFile) { + public FixedFuncHook(final GL2ES2 gl, final ShaderSelectionMode mode, final PMVMatrix pmvMatrix, + final Class shaderRootClass, final String shaderSrcRoot, final String shaderBinRoot, + final String vertexColorFile, final String vertexColorLightFile, + final String fragmentColorFile, final String fragmentColorTextureFile) { this.gl = gl; if(null != pmvMatrix) { this.ownsPMVMatrix = false; @@ -96,7 +96,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun public boolean verbose() { return fixedFunction.verbose(); } - public void setVerbose(boolean v) { fixedFunction.setVerbose(v); } + public void setVerbose(final boolean v) { fixedFunction.setVerbose(v); } public void destroy() { fixedFunction.destroy(gl); @@ -110,32 +110,32 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun // // FixedFuncHookIf - hooks // - public void glDrawArrays(int mode, int first, int count) { + public void glDrawArrays(final int mode, final int first, final int count) { fixedFunction.glDrawArrays(gl, mode, first, count); } - public void glDrawElements(int mode, int count, int type, java.nio.Buffer indices) { + public void glDrawElements(final int mode, final int count, final int type, final java.nio.Buffer indices) { fixedFunction.glDrawElements(gl, mode, count, type, indices); } - public void glDrawElements(int mode, int count, int type, long indices_buffer_offset) { + public void glDrawElements(final int mode, final int count, final int type, final long indices_buffer_offset) { fixedFunction.glDrawElements(gl, mode, count, type, indices_buffer_offset); } - public void glActiveTexture(int texture) { + public void glActiveTexture(final int texture) { fixedFunction.glActiveTexture(texture); gl.glActiveTexture(texture); } - public void glEnable(int cap) { + public void glEnable(final int cap) { if(fixedFunction.glEnable(cap, true)) { gl.glEnable(cap); } } - public void glDisable(int cap) { + public void glDisable(final int cap) { if(fixedFunction.glEnable(cap, false)) { gl.glDisable(cap); } } @Override - public void glGetFloatv(int pname, java.nio.FloatBuffer params) { + public void glGetFloatv(final int pname, final java.nio.FloatBuffer params) { if(PMVMatrix.isMatrixGetName(pname)) { pmvMatrix.glGetFloatv(pname, params); return; @@ -143,7 +143,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun gl.glGetFloatv(pname, params); } @Override - public void glGetFloatv(int pname, float[] params, int params_offset) { + public void glGetFloatv(final int pname, final float[] params, final int params_offset) { if(PMVMatrix.isMatrixGetName(pname)) { pmvMatrix.glGetFloatv(pname, params, params_offset); return; @@ -151,7 +151,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun gl.glGetFloatv(pname, params, params_offset); } @Override - public void glGetIntegerv(int pname, IntBuffer params) { + public void glGetIntegerv(final int pname, final IntBuffer params) { if(PMVMatrix.isMatrixGetName(pname)) { pmvMatrix.glGetIntegerv(pname, params); return; @@ -159,7 +159,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun gl.glGetIntegerv(pname, params); } @Override - public void glGetIntegerv(int pname, int[] params, int params_offset) { + public void glGetIntegerv(final int pname, final int[] params, final int params_offset) { if(PMVMatrix.isMatrixGetName(pname)) { pmvMatrix.glGetIntegerv(pname, params, params_offset); return; @@ -167,21 +167,21 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun gl.glGetIntegerv(pname, params, params_offset); } - public void glTexEnvi(int target, int pname, int value) { + public void glTexEnvi(final int target, final int pname, final int value) { fixedFunction.glTexEnvi(target, pname, value); } - public void glGetTexEnviv(int target, int pname, IntBuffer params) { + public void glGetTexEnviv(final int target, final int pname, final IntBuffer params) { fixedFunction.glGetTexEnviv(target, pname, params); } - public void glGetTexEnviv(int target, int pname, int[] params, int params_offset) { + public void glGetTexEnviv(final int target, final int pname, final int[] params, final int params_offset) { fixedFunction.glGetTexEnviv(target, pname, params, params_offset); } - public void glBindTexture(int target, int texture) { + public void glBindTexture(final int target, final int texture) { fixedFunction.glBindTexture(target, texture); gl.glBindTexture(target, texture); } - public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, - int format, int type, Buffer pixels) { + public void glTexImage2D(final int target, final int level, int internalformat, final int width, final int height, final int border, + final int format, final int type, final Buffer pixels) { // align internalformat w/ format, an ES2 requirement switch(internalformat) { case 3: internalformat= ( GL.GL_RGBA == format ) ? GL.GL_RGBA : GL.GL_RGB; break; @@ -190,8 +190,8 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun fixedFunction.glTexImage2D(target, /* level, */ internalformat, /*width, height, border, */ format /*, type, pixels*/); gl.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); } - public void glTexImage2D(int target, int level, int internalformat, int width, int height, int border, - int format, int type, long pixels_buffer_offset) { + public void glTexImage2D(final int target, final int level, int internalformat, final int width, final int height, final int border, + final int format, final int type, final long pixels_buffer_offset) { // align internalformat w/ format, an ES2 requirement switch(internalformat) { case 3: internalformat= ( GL.GL_RGBA == format ) ? GL.GL_RGBA : GL.GL_RGB; break; @@ -201,16 +201,16 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun gl.glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels_buffer_offset); } - public void glPointSize(float size) { + public void glPointSize(final float size) { fixedFunction.glPointSize(size); } - public void glPointParameterf(int pname, float param) { + public void glPointParameterf(final int pname, final float param) { fixedFunction.glPointParameterf(pname, param); } - public void glPointParameterfv(int pname, float[] params, int params_offset) { + public void glPointParameterfv(final int pname, final float[] params, final int params_offset) { fixedFunction.glPointParameterfv(pname, params, params_offset); } - public void glPointParameterfv(int pname, java.nio.FloatBuffer params) { + public void glPointParameterfv(final int pname, final java.nio.FloatBuffer params) { fixedFunction.glPointParameterfv(pname, params); } @@ -221,16 +221,16 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun return pmvMatrix.glGetMatrixMode(); } @Override - public void glMatrixMode(int mode) { + public void glMatrixMode(final int mode) { pmvMatrix.glMatrixMode(mode); } @Override - public void glLoadMatrixf(java.nio.FloatBuffer m) { + public void glLoadMatrixf(final java.nio.FloatBuffer m) { pmvMatrix.glLoadMatrixf(m); } @Override - public void glLoadMatrixf(float[] m, int m_offset) { - glLoadMatrixf(GLBuffers.newDirectFloatBuffer(m, m_offset)); + public void glLoadMatrixf(final float[] m, final int m_offset) { + glLoadMatrixf(Buffers.newDirectFloatBuffer(m, m_offset)); } @Override public void glPopMatrix() { @@ -245,37 +245,37 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun pmvMatrix.glLoadIdentity(); } @Override - public void glMultMatrixf(java.nio.FloatBuffer m) { + public void glMultMatrixf(final java.nio.FloatBuffer m) { pmvMatrix.glMultMatrixf(m); } @Override - public void glMultMatrixf(float[] m, int m_offset) { - glMultMatrixf(GLBuffers.newDirectFloatBuffer(m, m_offset)); + public void glMultMatrixf(final float[] m, final int m_offset) { + glMultMatrixf(Buffers.newDirectFloatBuffer(m, m_offset)); } @Override - public void glTranslatef(float x, float y, float z) { + public void glTranslatef(final float x, final float y, final float z) { pmvMatrix.glTranslatef(x, y, z); } @Override - public void glRotatef(float angdeg, float x, float y, float z) { + public void glRotatef(final float angdeg, final float x, final float y, final float z) { pmvMatrix.glRotatef(angdeg, x, y, z); } @Override - public void glScalef(float x, float y, float z) { + public void glScalef(final float x, final float y, final float z) { pmvMatrix.glScalef(x, y, z); } - public void glOrtho(double left, double right, double bottom, double top, double near_val, double far_val) { + public void glOrtho(final double left, final double right, final double bottom, final double top, final double near_val, final double far_val) { glOrthof((float) left, (float) right, (float) bottom, (float) top, (float) near_val, (float) far_val); } @Override - public void glOrthof(float left, float right, float bottom, float top, float zNear, float zFar) { + public void glOrthof(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) { pmvMatrix.glOrthof(left, right, bottom, top, zNear, zFar); } - public void glFrustum(double left, double right, double bottom, double top, double zNear, double zFar) { + public void glFrustum(final double left, final double right, final double bottom, final double top, final double zNear, final double zFar) { glFrustumf((float) left, (float) right, (float) bottom, (float) top, (float) zNear, (float) zFar); } @Override - public void glFrustumf(float left, float right, float bottom, float top, float zNear, float zFar) { + public void glFrustumf(final float left, final float right, final float bottom, final float top, final float zNear, final float zFar) { pmvMatrix.glFrustumf(left, right, bottom, top, zNear, zFar); } @@ -283,45 +283,45 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun // LightingIf // @Override - public void glColor4f(float red, float green, float blue, float alpha) { + public void glColor4f(final float red, final float green, final float blue, final float alpha) { fixedFunction.glColor4f(gl, red, green, blue, alpha); } - public void glColor4ub(byte red, byte green, byte blue, byte alpha) { + public void glColor4ub(final byte red, final byte green, final byte blue, final byte alpha) { glColor4f(ValueConv.byte_to_float(red, false), ValueConv.byte_to_float(green, false), ValueConv.byte_to_float(blue, false), ValueConv.byte_to_float(alpha, false) ); } @Override - public void glLightfv(int light, int pname, java.nio.FloatBuffer params) { + public void glLightfv(final int light, final int pname, final java.nio.FloatBuffer params) { fixedFunction.glLightfv(gl, light, pname, params); } @Override - public void glLightfv(int light, int pname, float[] params, int params_offset) { - glLightfv(light, pname, GLBuffers.newDirectFloatBuffer(params, params_offset)); + public void glLightfv(final int light, final int pname, final float[] params, final int params_offset) { + glLightfv(light, pname, Buffers.newDirectFloatBuffer(params, params_offset)); } @Override - public void glMaterialfv(int face, int pname, java.nio.FloatBuffer params) { + public void glMaterialfv(final int face, final int pname, final java.nio.FloatBuffer params) { fixedFunction.glMaterialfv(gl, face, pname, params); } @Override - public void glMaterialfv(int face, int pname, float[] params, int params_offset) { - glMaterialfv(face, pname, GLBuffers.newDirectFloatBuffer(params, params_offset)); + public void glMaterialfv(final int face, final int pname, final float[] params, final int params_offset) { + glMaterialfv(face, pname, Buffers.newDirectFloatBuffer(params, params_offset)); } @Override - public void glMaterialf(int face, int pname, float param) { - glMaterialfv(face, pname, GLBuffers.newDirectFloatBuffer(new float[] { param })); + public void glMaterialf(final int face, final int pname, final float param) { + glMaterialfv(face, pname, Buffers.newDirectFloatBuffer(new float[] { param })); } // // Misc Simple States // @Override - public void glShadeModel(int mode) { + public void glShadeModel(final int mode) { fixedFunction.glShadeModel(gl, mode); } - public void glAlphaFunc(int func, float ref) { + public void glAlphaFunc(final int func, final float ref) { fixedFunction.glAlphaFunc(func, ref); } @@ -334,20 +334,20 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun // // PointerIf // - public void glClientActiveTexture(int textureUnit) { + public void glClientActiveTexture(final int textureUnit) { fixedFunction.glClientActiveTexture(textureUnit); } @Override - public void glEnableClientState(int glArrayIndex) { + public void glEnableClientState(final int glArrayIndex) { fixedFunction.glEnableClientState(gl, glArrayIndex); } @Override - public void glDisableClientState(int glArrayIndex) { + public void glDisableClientState(final int glArrayIndex) { fixedFunction.glDisableClientState(gl, glArrayIndex); } @Override - public void glVertexPointer(GLArrayData array) { + public void glVertexPointer(final GLArrayData array) { if(array.isVBO()) { if(!gl.isVBOArrayBound()) { throw new GLException("VBO array is not enabled: "+array); @@ -364,13 +364,13 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun } @Override - public void glVertexPointer(int size, int type, int stride, java.nio.Buffer pointer) { + public void glVertexPointer(final int size, final int type, final int stride, final java.nio.Buffer pointer) { glVertexPointer(GLArrayDataWrapper.createFixed(GL_VERTEX_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride, pointer, 0, 0, 0, GL.GL_ARRAY_BUFFER)); } @Override - public void glVertexPointer(int size, int type, int stride, long pointer_buffer_offset) { - int vboName = gl.getBoundBuffer(GL.GL_ARRAY_BUFFER); + public void glVertexPointer(final int size, final int type, final int stride, final long pointer_buffer_offset) { + final int vboName = gl.getBoundBuffer(GL.GL_ARRAY_BUFFER); if(vboName==0) { throw new GLException("no GL_ARRAY_BUFFER VBO bound"); } @@ -379,7 +379,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun } @Override - public void glColorPointer(GLArrayData array) { + public void glColorPointer(final GLArrayData array) { if(array.isVBO()) { if(!gl.isVBOArrayBound()) { throw new GLException("VBO array is not enabled: "+array); @@ -395,13 +395,13 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun fixedFunction.glColorPointer(gl, array); } @Override - public void glColorPointer(int size, int type, int stride, java.nio.Buffer pointer) { + public void glColorPointer(final int size, final int type, final int stride, final java.nio.Buffer pointer) { glColorPointer(GLArrayDataWrapper.createFixed(GL_COLOR_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride, pointer, 0, 0, 0, GL.GL_ARRAY_BUFFER)); } @Override - public void glColorPointer(int size, int type, int stride, long pointer_buffer_offset) { - int vboName = gl.getBoundBuffer(GL.GL_ARRAY_BUFFER); + public void glColorPointer(final int size, final int type, final int stride, final long pointer_buffer_offset) { + final int vboName = gl.getBoundBuffer(GL.GL_ARRAY_BUFFER); if(vboName==0) { throw new GLException("no GL_ARRAY_BUFFER VBO bound"); } @@ -410,7 +410,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun } @Override - public void glNormalPointer(GLArrayData array) { + public void glNormalPointer(final GLArrayData array) { if(array.getComponentCount()!=3) { throw new GLException("Only 3 components per normal allowed"); } @@ -429,13 +429,13 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun fixedFunction.glNormalPointer(gl, array); } @Override - public void glNormalPointer(int type, int stride, java.nio.Buffer pointer) { + public void glNormalPointer(final int type, final int stride, final java.nio.Buffer pointer) { glNormalPointer(GLArrayDataWrapper.createFixed(GL_NORMAL_ARRAY, 3, type, GLBuffers.isGLTypeFixedPoint(type), stride, pointer, 0, 0, 0, GL.GL_ARRAY_BUFFER)); } @Override - public void glNormalPointer(int type, int stride, long pointer_buffer_offset) { - int vboName = gl.getBoundBuffer(GL.GL_ARRAY_BUFFER); + public void glNormalPointer(final int type, final int stride, final long pointer_buffer_offset) { + final int vboName = gl.getBoundBuffer(GL.GL_ARRAY_BUFFER); if(vboName==0) { throw new GLException("no GL_ARRAY_BUFFER VBO bound"); } @@ -444,7 +444,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun } @Override - public void glTexCoordPointer(GLArrayData array) { + public void glTexCoordPointer(final GLArrayData array) { if(array.isVBO()) { if(!gl.isVBOArrayBound()) { throw new GLException("VBO array is not enabled: "+array); @@ -460,14 +460,14 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun fixedFunction.glTexCoordPointer(gl, array); } @Override - public void glTexCoordPointer(int size, int type, int stride, java.nio.Buffer pointer) { + public void glTexCoordPointer(final int size, final int type, final int stride, final java.nio.Buffer pointer) { glTexCoordPointer( GLArrayDataWrapper.createFixed(GL_TEXTURE_COORD_ARRAY, size, type, GLBuffers.isGLTypeFixedPoint(type), stride, pointer, 0, 0, 0, GL.GL_ARRAY_BUFFER)); } @Override - public void glTexCoordPointer(int size, int type, int stride, long pointer_buffer_offset) { - int vboName = gl.getBoundBuffer(GL.GL_ARRAY_BUFFER); + public void glTexCoordPointer(final int size, final int type, final int stride, final long pointer_buffer_offset) { + final int vboName = gl.getBoundBuffer(GL.GL_ARRAY_BUFFER); if(vboName==0) { throw new GLException("no GL_ARRAY_BUFFER VBO bound"); } @@ -478,7 +478,7 @@ public class FixedFuncHook implements GLLightingFunc, GLMatrixFunc, GLPointerFun @Override public final String toString() { - StringBuilder buf = new StringBuilder(); + final StringBuilder buf = new StringBuilder(); buf.append(getClass().getName()+" ("); if(null!=pmvMatrix) { buf.append(", matrixDirty: "+ (0 != pmvMatrix.getModifiedBits(false))); diff --git a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java index 42269588d..c65ed084d 100644 --- a/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java +++ b/src/jogl/classes/jogamp/opengl/util/glsl/fixedfunc/FixedFuncPipeline.java @@ -52,6 +52,7 @@ import jogamp.opengl.Debug; import com.jogamp.common.nio.Buffers; import com.jogamp.common.util.IntIntHashMap; +import com.jogamp.common.util.PropertyAccess; import com.jogamp.opengl.util.PMVMatrix; import com.jogamp.opengl.util.glsl.ShaderCode; import com.jogamp.opengl.util.glsl.ShaderProgram; @@ -71,14 +72,14 @@ public class FixedFuncPipeline { static { Debug.initSingleton(); - DEBUG = Debug.isPropertyDefined("jogl.debug.FixedFuncPipeline", true); + DEBUG = PropertyAccess.isPropertyDefined("jogl.debug.FixedFuncPipeline", true); } /** The maximum texture units which could be used, depending on {@link ShaderSelectionMode}. */ public static final int MAX_TEXTURE_UNITS = 8; public static final int MAX_LIGHTS = 8; - public FixedFuncPipeline(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix) { + public FixedFuncPipeline(final GL2ES2 gl, final ShaderSelectionMode mode, final PMVMatrix pmvMatrix) { shaderRootClass = FixedFuncPipeline.class; shaderSrcRoot = shaderSrcRootDef; shaderBinRoot = shaderBinRootDef; @@ -88,11 +89,11 @@ public class FixedFuncPipeline { fragmentColorTextureFile = fragmentColorTextureFileDef; init(gl, mode, pmvMatrix); } - public FixedFuncPipeline(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix, - Class shaderRootClass, String shaderSrcRoot, - String shaderBinRoot, - String vertexColorFile, String vertexColorLightFile, - String fragmentColorFile, String fragmentColorTextureFile) { + public FixedFuncPipeline(final GL2ES2 gl, final ShaderSelectionMode mode, final PMVMatrix pmvMatrix, + final Class shaderRootClass, final String shaderSrcRoot, + final String shaderBinRoot, + final String vertexColorFile, final String vertexColorLightFile, + final String fragmentColorFile, final String fragmentColorTextureFile) { this.shaderRootClass = shaderRootClass; this.shaderSrcRoot = shaderSrcRoot; this.shaderBinRoot = shaderBinRoot; @@ -104,12 +105,12 @@ public class FixedFuncPipeline { } public ShaderSelectionMode getShaderSelectionMode() { return requestedShaderSelectionMode; } - public void setShaderSelectionMode(ShaderSelectionMode mode) { requestedShaderSelectionMode=mode; } + public void setShaderSelectionMode(final ShaderSelectionMode mode) { requestedShaderSelectionMode=mode; } public ShaderSelectionMode getCurrentShaderSelectionMode() { return currentShaderSelectionMode; } public boolean verbose() { return verbose; } - public void setVerbose(boolean v) { verbose = DEBUG || v; } + public void setVerbose(final boolean v) { verbose = DEBUG || v; } public boolean isValid() { return shaderState.linked(); @@ -123,7 +124,7 @@ public class FixedFuncPipeline { return activeTextureUnit; } - public void destroy(GL2ES2 gl) { + public void destroy(final GL2ES2 gl) { if(null != shaderProgramColor) { shaderProgramColor.release(gl, true); } @@ -148,7 +149,7 @@ public class FixedFuncPipeline { // // Simple Globals // - public void glColor4f(GL2ES2 gl, float red, float green, float blue, float alpha) { + public void glColor4f(final GL2ES2 gl, final float red, final float green, final float blue, final float alpha) { colorStatic.put(0, red); colorStatic.put(1, green); colorStatic.put(2, blue); @@ -168,15 +169,15 @@ public class FixedFuncPipeline { // Arrays / States // - public void glEnableClientState(GL2ES2 gl, int glArrayIndex) { + public void glEnableClientState(final GL2ES2 gl, final int glArrayIndex) { glToggleClientState(gl, glArrayIndex, true); } - public void glDisableClientState(GL2ES2 gl, int glArrayIndex) { + public void glDisableClientState(final GL2ES2 gl, final int glArrayIndex) { glToggleClientState(gl, glArrayIndex, false); } - private void glToggleClientState(GL2ES2 gl, int glArrayIndex, boolean enable) { + private void glToggleClientState(final GL2ES2 gl, final int glArrayIndex, final boolean enable) { final String arrayName = GLPointerFuncUtil.getPredefinedArrayIndexName(glArrayIndex, clientActiveTextureUnit); if(null == arrayName) { throw new GLException("arrayIndex "+toHexString(glArrayIndex)+" unknown"); @@ -203,17 +204,17 @@ public class FixedFuncPipeline { } } - public void glVertexPointer(GL2ES2 gl, GLArrayData data) { + public void glVertexPointer(final GL2ES2 gl, final GLArrayData data) { shaderState.useProgram(gl, true); shaderState.vertexAttribPointer(gl, data); } - public void glColorPointer(GL2ES2 gl, GLArrayData data) { + public void glColorPointer(final GL2ES2 gl, final GLArrayData data) { shaderState.useProgram(gl, true); shaderState.vertexAttribPointer(gl, data); } - public void glNormalPointer(GL2ES2 gl, GLArrayData data) { + public void glNormalPointer(final GL2ES2 gl, final GLArrayData data) { shaderState.useProgram(gl, true); shaderState.vertexAttribPointer(gl, data); } @@ -223,7 +224,7 @@ public class FixedFuncPipeline { // /** Enables/Disables the named texture unit (if changed), returns previous state */ - private boolean glEnableTexture(boolean enable, int unit) { + private boolean glEnableTexture(final boolean enable, final int unit) { final boolean isEnabled = 0 != ( textureEnabledBits & ( 1 << activeTextureUnit ) ); if( isEnabled != enable ) { if(enable) { @@ -256,7 +257,7 @@ public class FixedFuncPipeline { } } - public void glTexCoordPointer(GL2ES2 gl, GLArrayData data) { + public void glTexCoordPointer(final GL2ES2 gl, final GLArrayData data) { if( GLPointerFunc.GL_TEXTURE_COORD_ARRAY != data.getIndex() ) { throw new GLException("Invalid GLArrayData Index "+toHexString(data.getIndex())+", "+data); } @@ -265,7 +266,7 @@ public class FixedFuncPipeline { shaderState.vertexAttribPointer(gl, data); } - public void glBindTexture(int target, int texture) { + public void glBindTexture(final int target, final int texture) { if(GL.GL_TEXTURE_2D == target) { if( texture != boundTextureObject[activeTextureUnit] ) { boundTextureObject[activeTextureUnit] = texture; @@ -276,8 +277,8 @@ public class FixedFuncPipeline { } } - public void glTexImage2D(int target, /* int level, */ int internalformat, /*, int width, int height, int border, */ - int format /*, int type, Buffer pixels */) { + public void glTexImage2D(final int target, /* int level, */ final int internalformat, /*, int width, int height, int border, */ + final int format /*, int type, Buffer pixels */) { final int ifmt; if(GL.GL_TEXTURE_2D == target) { switch(internalformat) { @@ -316,7 +317,7 @@ public class FixedFuncPipeline { textureFormatDirty = true; }*/ - public void glTexEnvi(int target, int pname, int value) { + public void glTexEnvi(final int target, final int pname, final int value) { if(GL2ES1.GL_TEXTURE_ENV == target && GL2ES1.GL_TEXTURE_ENV_MODE == pname) { final int mode; switch( value ) { @@ -329,10 +330,10 @@ public class FixedFuncPipeline { case GL2ES1.GL_DECAL: mode = 3; break; - case GL2ES1.GL_BLEND: + case GL.GL_BLEND: mode = 4; break; - case GL2ES1.GL_REPLACE: + case GL.GL_REPLACE: mode = 5; break; case GL2ES1.GL_COMBINE: @@ -347,27 +348,27 @@ public class FixedFuncPipeline { System.err.println("FixedFuncPipeline: Unimplemented TexEnv: target "+toHexString(target)+", pname "+toHexString(pname)+", mode: "+toHexString(value)); } } - private void setTextureEnvMode(int value) { + private void setTextureEnvMode(final int value) { if( value != textureEnvMode.get(activeTextureUnit) ) { textureEnvMode.put(activeTextureUnit, value); textureEnvModeDirty = true; } } - public void glGetTexEnviv(int target, int pname, IntBuffer params) { // FIXME + public void glGetTexEnviv(final int target, final int pname, final IntBuffer params) { // FIXME System.err.println("FixedFuncPipeline: Unimplemented glGetTexEnviv: target "+toHexString(target)+", pname "+toHexString(pname)); } - public void glGetTexEnviv(int target, int pname, int[] params, int params_offset) { // FIXME + public void glGetTexEnviv(final int target, final int pname, final int[] params, final int params_offset) { // FIXME System.err.println("FixedFuncPipeline: Unimplemented glGetTexEnviv: target "+toHexString(target)+", pname "+toHexString(pname)); } // // Point Sprites // - public void glPointSize(float size) { + public void glPointSize(final float size) { pointParams.put(0, size); pointParamsDirty = true; } - public void glPointParameterf(int pname, float param) { + public void glPointParameterf(final int pname, final float param) { switch(pname) { case GL2ES1.GL_POINT_SIZE_MIN: pointParams.put(2, param); @@ -375,13 +376,13 @@ public class FixedFuncPipeline { case GL2ES1.GL_POINT_SIZE_MAX: pointParams.put(3, param); break; - case GL2ES2.GL_POINT_FADE_THRESHOLD_SIZE: + case GL.GL_POINT_FADE_THRESHOLD_SIZE: pointParams.put(4+3, param); break; } pointParamsDirty = true; } - public void glPointParameterfv(int pname, float[] params, int params_offset) { + public void glPointParameterfv(final int pname, final float[] params, final int params_offset) { switch(pname) { case GL2ES1.GL_POINT_DISTANCE_ATTENUATION: pointParams.put(4+0, params[params_offset + 0]); @@ -391,7 +392,7 @@ public class FixedFuncPipeline { } pointParamsDirty = true; } - public void glPointParameterfv(int pname, java.nio.FloatBuffer params) { + public void glPointParameterfv(final int pname, final java.nio.FloatBuffer params) { final int o = params.position(); switch(pname) { case GL2ES1.GL_POINT_DISTANCE_ATTENUATION: @@ -405,7 +406,7 @@ public class FixedFuncPipeline { // private int[] pointTexObj = new int[] { 0 }; - private void glDrawPoints(GL2ES2 gl, GLRunnable2 glDrawAction, Object args) { + private void glDrawPoints(final GL2ES2 gl, final GLRunnable2 glDrawAction, final Object args) { if(gl.isGL2GL3()) { gl.glEnable(GL2GL3.GL_VERTEX_PROGRAM_POINT_SIZE); } @@ -428,13 +429,13 @@ public class FixedFuncPipeline { } private static final GLRunnable2 glDrawArraysAction = new GLRunnable2() { @Override - public Object run(GL gl, Object args) { - int[] _args = (int[])args; + public Object run(final GL gl, final Object args) { + final int[] _args = (int[])args; gl.glDrawArrays(GL.GL_POINTS, _args[0], _args[1]); return null; } }; - private final void glDrawPointArrays(GL2ES2 gl, int first, int count) { + private final void glDrawPointArrays(final GL2ES2 gl, final int first, final int count) { glDrawPoints(gl, glDrawArraysAction, new int[] { first, count }); } @@ -442,7 +443,7 @@ public class FixedFuncPipeline { // Lighting // - public void glLightfv(GL2ES2 gl, int light, int pname, java.nio.FloatBuffer params) { + public void glLightfv(final GL2ES2 gl, int light, final int pname, final java.nio.FloatBuffer params) { shaderState.useProgram(gl, true); light -=GLLightingFunc.GL_LIGHT0; if(0 <= light && light < MAX_LIGHTS) { @@ -490,7 +491,7 @@ public class FixedFuncPipeline { } } - public void glMaterialfv(GL2ES2 gl, int face, int pname, java.nio.FloatBuffer params) { + public void glMaterialfv(final GL2ES2 gl, final int face, final int pname, final java.nio.FloatBuffer params) { shaderState.useProgram(gl, true); switch (face) { @@ -544,9 +545,9 @@ public class FixedFuncPipeline { // Misc States // - public void glShadeModel(GL2ES2 gl, int mode) { + public void glShadeModel(final GL2ES2 gl, final int mode) { shaderState.useProgram(gl, true); - GLUniformData ud = shaderState.getUniform(mgl_ShadeModel); + final GLUniformData ud = shaderState.getUniform(mgl_ShadeModel); if(null!=ud) { ud.setData(mode); shaderState.uniform(gl, ud); @@ -580,7 +581,7 @@ public class FixedFuncPipeline { } } */ - public void glAlphaFunc(int func, float ref) { + public void glAlphaFunc(final int func, final float ref) { int _func; switch(func) { case GL.GL_NEVER: @@ -627,7 +628,7 @@ public class FixedFuncPipeline { * eg this call must not be passed to an underlying ES2 implementation. * true if this call shall be passed to an underlying GL2ES2/ES2 implementation as well. */ - public boolean glEnable(int cap, boolean enable) { + public boolean glEnable(final int cap, final boolean enable) { switch(cap) { case GL.GL_BLEND: case GL.GL_DEPTH_TEST: @@ -684,7 +685,7 @@ public class FixedFuncPipeline { return false; } - int light = cap - GLLightingFunc.GL_LIGHT0; + final int light = cap - GLLightingFunc.GL_LIGHT0; if(0 <= light && light < MAX_LIGHTS) { if ( (lightsEnabled.get(light)==1) != enable ) { lightsEnabled.put(light, enable?1:0); @@ -700,7 +701,7 @@ public class FixedFuncPipeline { // Draw // - public void glDrawArrays(GL2ES2 gl, int mode, int first, int count) { + public void glDrawArrays(final GL2ES2 gl, int mode, final int first, final int count) { switch(mode) { case GL2.GL_QUAD_STRIP: mode=GL.GL_TRIANGLE_STRIP; @@ -708,12 +709,12 @@ public class FixedFuncPipeline { case GL2.GL_POLYGON: mode=GL.GL_TRIANGLE_FAN; break; - case GL2ES1.GL_POINTS: + case GL.GL_POINTS: glDrawPointArrays(gl, first, count); return; } validate(gl, true); - if ( GL2.GL_QUADS == mode && !gl.isGL2() ) { + if ( GL2GL3.GL_QUADS == mode && !gl.isGL2() ) { for (int j = first; j < count - 3; j += 4) { gl.glDrawArrays(GL.GL_TRIANGLE_FAN, j, 4); } @@ -721,25 +722,25 @@ public class FixedFuncPipeline { gl.glDrawArrays(mode, first, count); } } - public void glDrawElements(GL2ES2 gl, int mode, int count, int type, java.nio.Buffer indices) { + public void glDrawElements(final GL2ES2 gl, final int mode, final int count, final int type, final java.nio.Buffer indices) { validate(gl, true); - if ( GL2.GL_QUADS == mode && !gl.isGL2() ) { + if ( GL2GL3.GL_QUADS == mode && !gl.isGL2() ) { final int idx0 = indices.position(); if( GL.GL_UNSIGNED_BYTE == type ) { final ByteBuffer b = (ByteBuffer) indices; for (int j = 0; j < count; j++) { - gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x000000ff & b.get(idx0+j)), 4); + gl.glDrawArrays(GL.GL_TRIANGLE_FAN, 0x000000ff & b.get(idx0+j), 4); } } else if( GL.GL_UNSIGNED_SHORT == type ){ final ShortBuffer b = (ShortBuffer) indices; for (int j = 0; j < count; j++) { - gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0x0000ffff & b.get(idx0+j)), 4); + gl.glDrawArrays(GL.GL_TRIANGLE_FAN, 0x0000ffff & b.get(idx0+j), 4); } } else { final IntBuffer b = (IntBuffer) indices; for (int j = 0; j < count; j++) { - gl.glDrawArrays(GL.GL_TRIANGLE_FAN, (int)(0xffffffff & b.get(idx0+j)), 4); + gl.glDrawArrays(GL.GL_TRIANGLE_FAN, 0xffffffff & b.get(idx0+j), 4); } } } else { @@ -747,7 +748,7 @@ public class FixedFuncPipeline { if( !gl.getContext().isCPUDataSourcingAvail() ) { throw new GLException("CPU data sourcing n/a w/ "+gl.getContext()); } - if( GL2ES1.GL_POINTS != mode ) { + if( GL.GL_POINTS != mode ) { ((GLES2)gl).glDrawElements(mode, count, type, indices); } else { // FIXME GL_POINTS ! @@ -755,11 +756,11 @@ public class FixedFuncPipeline { } } } - public void glDrawElements(GL2ES2 gl, int mode, int count, int type, long indices_buffer_offset) { + public void glDrawElements(final GL2ES2 gl, final int mode, final int count, final int type, final long indices_buffer_offset) { validate(gl, true); - if ( GL2.GL_QUADS == mode && !gl.isGL2() ) { + if ( GL2GL3.GL_QUADS == mode && !gl.isGL2() ) { throw new GLException("Cannot handle indexed QUADS on !GL2 w/ VBO due to lack of CPU index access"); - } else if( GL2ES1.GL_POINTS != mode ) { + } else if( GL.GL_POINTS != mode ) { // FIXME GL_POINTS ! gl.glDrawElements(mode, count, type, indices_buffer_offset); } else { @@ -777,7 +778,7 @@ public class FixedFuncPipeline { return n; } - public void validate(GL2ES2 gl, boolean selectShader) { + public void validate(final GL2ES2 gl, final boolean selectShader) { if( selectShader ) { if( ShaderSelectionMode.AUTO == requestedShaderSelectionMode) { final ShaderSelectionMode newMode; @@ -832,7 +833,7 @@ public class FixedFuncPipeline { if(colorVAEnabledDirty) { ud = shaderState.getUniform(mgl_ColorEnabled); if(null!=ud) { - int ca = true == shaderState.isVertexAttribArrayEnabled(GLPointerFuncUtil.mgl_Color) ? 1 : 0 ; + final int ca = true == shaderState.isVertexAttribArrayEnabled(GLPointerFuncUtil.mgl_Color) ? 1 : 0 ; if(ca!=ud.intValue()) { ud.setData(ca); shaderState.uniform(gl, ud); @@ -926,7 +927,7 @@ public class FixedFuncPipeline { } } - public StringBuilder toString(StringBuilder sb, boolean alsoUnlocated) { + public StringBuilder toString(StringBuilder sb, final boolean alsoUnlocated) { if(null == sb) { sb = new StringBuilder(); } @@ -956,14 +957,14 @@ public class FixedFuncPipeline { private static final String constMaxTextures4 = "#define MAX_TEXTURE_UNITS 4\n"; private static final String constMaxTextures8 = "#define MAX_TEXTURE_UNITS 8\n"; - private final void customizeShader(GL2ES2 gl, ShaderCode vp, ShaderCode fp, String maxTextureDefine) { - int rsVpPos = vp.defaultShaderCustomization(gl, true, true); - int rsFpPos = fp.defaultShaderCustomization(gl, true, true); + private final void customizeShader(final GL2ES2 gl, final ShaderCode vp, final ShaderCode fp, final String maxTextureDefine) { + final int rsVpPos = vp.defaultShaderCustomization(gl, true, true); + final int rsFpPos = fp.defaultShaderCustomization(gl, true, true); vp.insertShaderSource(0, rsVpPos, maxTextureDefine); fp.insertShaderSource(0, rsFpPos, maxTextureDefine); } - private final void loadShaderPoints(GL2ES2 gl) { + private final void loadShaderPoints(final GL2ES2 gl) { if( null != shaderProgramPoints ) { return; } @@ -981,7 +982,7 @@ public class FixedFuncPipeline { } } - private final void loadShader(GL2ES2 gl, ShaderSelectionMode mode) { + private final void loadShader(final GL2ES2 gl, final ShaderSelectionMode mode) { final boolean loadColor = ShaderSelectionMode.COLOR == mode; final boolean loadColorTexture2 = ShaderSelectionMode.COLOR_TEXTURE2 == mode; final boolean loadColorTexture4 = ShaderSelectionMode.COLOR_TEXTURE4 == mode; @@ -1068,7 +1069,7 @@ public class FixedFuncPipeline { } } - private ShaderProgram selectShaderProgram(GL2ES2 gl, ShaderSelectionMode newMode) { + private ShaderProgram selectShaderProgram(final GL2ES2 gl, ShaderSelectionMode newMode) { if(ShaderSelectionMode.AUTO == newMode) { newMode = ShaderSelectionMode.COLOR; } @@ -1098,7 +1099,7 @@ public class FixedFuncPipeline { return sp; } - private void init(GL2ES2 gl, ShaderSelectionMode mode, PMVMatrix pmvMatrix) { + private void init(final GL2ES2 gl, final ShaderSelectionMode mode, final PMVMatrix pmvMatrix) { if(null==pmvMatrix) { throw new GLException("PMVMatrix is null"); } @@ -1157,7 +1158,7 @@ public class FixedFuncPipeline { } } - private String toHexString(int i) { + private String toHexString(final int i) { return "0x"+Integer.toHexString(i); } diff --git a/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java b/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java index 078965301..f73de75c5 100644 --- a/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java +++ b/src/jogl/classes/jogamp/opengl/util/jpeg/JPEGDecoder.java @@ -200,14 +200,14 @@ public class JPEGDecoder { @SuppressWarnings("serial") public static class CodecException extends RuntimeException { - CodecException(String message) { + CodecException(final String message) { super(message); } } @SuppressWarnings("serial") public static class MarkerException extends CodecException { final int marker; - MarkerException(int marker, String message) { + MarkerException(final int marker, final String message) { super(message+" - Marker "+toHexString(marker)); this.marker = marker; } @@ -312,7 +312,7 @@ public class JPEGDecoder { int mcusPerLine; int mcusPerColumn; - Frame(boolean progressive, int precision, int scanLines, int samplesPerLine, int componentsCount, int[][] qtt) { + Frame(final boolean progressive, final int precision, final int scanLines, final int samplesPerLine, final int componentsCount, final int[][] qtt) { this.progressive = progressive; this.precision = precision; this.scanLines = scanLines; @@ -323,7 +323,7 @@ public class JPEGDecoder { this.qtt = qtt; } - private final void checkBounds(int idx) { + private final void checkBounds(final int idx) { if( 0 > idx || idx >= compCount ) { throw new CodecException("Idx out of bounds "+idx+", "+this); } @@ -343,7 +343,7 @@ public class JPEGDecoder { public final int getCompCount() { return compCount; } public final int getMaxCompID() { return maxCompID; } - public final void putOrdered(int compID, ComponentIn component) { + public final void putOrdered(final int compID, final ComponentIn component) { if( maxCompID < compID ) { maxCompID = compID; } @@ -352,17 +352,17 @@ public class JPEGDecoder { compIDs.add(compID); comps[idx] = component; } - public final ComponentIn getCompByIndex(int i) { + public final ComponentIn getCompByIndex(final int i) { checkBounds(i); return comps[i]; } - public final ComponentIn getCompByID(int componentID) { + public final ComponentIn getCompByID(final int componentID) { return getCompByIndex( compIDs.indexOf(componentID) ); } - public final int getCompID(int idx) { + public final int getCompID(final int idx) { return compIDs.get(idx); } - public final boolean hasCompID(int componentID) { + public final boolean hasCompID(final int componentID) { return compIDs.contains(componentID); } @Override @@ -387,20 +387,20 @@ public class JPEGDecoder { BinObj huffmanTableAC; BinObj huffmanTableDC; - ComponentIn(int h, int v, int qttIdx) { + ComponentIn(final int h, final int v, final int qttIdx) { this.h = h; this.v = v; this.qttIdx = qttIdx; } - public final void allocateBlocks(int blocksPerColumn, int blocksPerColumnForMcu, int blocksPerLine, int blocksPerLineForMcu) { + public final void allocateBlocks(final int blocksPerColumn, final int blocksPerColumnForMcu, final int blocksPerLine, final int blocksPerLineForMcu) { this.blocksPerColumn = blocksPerColumn; this.blocksPerColumnForMcu = blocksPerColumnForMcu; this.blocksPerLine = blocksPerLine; this.blocksPerLineForMcu = blocksPerLineForMcu; this.blocks = new int[blocksPerColumnForMcu][blocksPerLineForMcu][64]; } - public final int[] getBlock(int row, int col) { + public final int[] getBlock(final int row, final int col) { if( row >= blocksPerColumnForMcu || col >= blocksPerLineForMcu ) { throw new CodecException("Out of bounds given ["+row+"]["+col+"] - "+this); } @@ -419,14 +419,14 @@ public class JPEGDecoder { final float scaleX; final float scaleY; - ComponentOut(ArrayList lines, float scaleX, float scaleY) { + ComponentOut(final ArrayList lines, final float scaleX, final float scaleY) { this.lines = lines; this.scaleX = scaleX; this.scaleY = scaleY; } /** Safely returning a line, if index exceeds number of lines, last line is returned. */ - public final byte[] getLine(int i) { + public final byte[] getLine(final int i) { final int sz = lines.size(); return lines.get( i < sz ? i : sz - 1); } @@ -461,10 +461,10 @@ public class JPEGDecoder { public final int getWidth() { return width; } public final int getHeight() { return height; } - private final void setStream(InputStream is) { + private final void setStream(final InputStream is) { try { bstream.setStream(is, false /* outputMode */); - } catch (Exception e) { + } catch (final Exception e) { throw new RuntimeException(e); // should not happen, no flush() } } @@ -488,14 +488,14 @@ public class JPEGDecoder { private final byte[] readDataBlock() throws IOException { int count=0, i=0; final int len=readUInt16(); count+=2; - byte[] data = new byte[len-2]; + final byte[] data = new byte[len-2]; while(count components = new ArrayList(); + final ArrayList components = new ArrayList(); if(DEBUG) { System.err.println("JPG.parse.SOS: selectorCount [0.."+(selectorsCount-1)+"]: "+frame); } for (int i = 0; i < selectorsCount; i++) { final int compID = readUInt8(); count++; @@ -734,7 +734,7 @@ public class JPEGDecoder { return this; } - private void prepareComponents(Frame frame) { + private void prepareComponents(final Frame frame) { int maxH = 0, maxV = 0; // for (componentId in frame.components) { final int compCount = frame.getCompCount(); @@ -743,8 +743,8 @@ public class JPEGDecoder { if (maxH < component.h) maxH = component.h; if (maxV < component.v) maxV = component.v; } - int mcusPerLine = (int) Math.ceil(frame.samplesPerLine / 8f / maxH); - int mcusPerColumn = (int) Math.ceil(frame.scanLines / 8f / maxV); + final int mcusPerLine = (int) Math.ceil(frame.samplesPerLine / 8f / maxH); + final int mcusPerColumn = (int) Math.ceil(frame.scanLines / 8f / maxV); // for (componentId in frame.components) { for (int i=0; i code = new ArrayList(); @@ -832,8 +832,8 @@ public class JPEGDecoder { private int blocksPerColumn; private int samplesPerLine; - private ArrayList buildComponentData(Frame frame, ComponentIn component) { - ArrayList lines = new ArrayList(); + private ArrayList buildComponentData(final Frame frame, final ComponentIn component) { + final ArrayList lines = new ArrayList(); blocksPerLine = component.blocksPerLine; blocksPerColumn = component.blocksPerColumn; samplesPerLine = blocksPerLine << 3; @@ -867,9 +867,9 @@ public class JPEGDecoder { // "Practical Fast 1-D DCT Algorithms with 11 Multiplications", // IEEE Intl. Conf. on Acoustics, Speech & Signal Processing, 1989, // 988-991. - private void quantizeAndInverse(int[] zz, byte[] dataOut, int[] dataIn, int[] qt) { + private void quantizeAndInverse(final int[] zz, final byte[] dataOut, final int[] dataIn, final int[] qt) { int v0, v1, v2, v3, v4, v5, v6, v7, t; - int[] p = dataIn; + final int[] p = dataIn; int i; // dequant @@ -879,7 +879,7 @@ public class JPEGDecoder { // inverse DCT on rows for (i = 0; i < 8; ++i) { - int row = 8 * i; + final int row = 8 * i; // check for all-zero AC coefficients if (p[1 + row] == 0 && p[2 + row] == 0 && p[3 + row] == 0 && @@ -948,7 +948,7 @@ public class JPEGDecoder { // inverse DCT on columns for (i = 0; i < 8; ++i) { - int col = i; + final int col = i; // check for all-zero AC coefficients if (p[1*8 + col] == 0 && p[2*8 + col] == 0 && p[3*8 + col] == 0 && @@ -1017,7 +1017,7 @@ public class JPEGDecoder { // convert to 8-bit integers for (i = 0; i < 64; ++i) { - int sample = 128 + ((p[i] + 8) >> 4); + final int sample = 128 + ((p[i] + 8) >> 4); dataOut[i] = (byte) ( sample < 0 ? 0 : sample > 0xFF ? 0xFF : sample ); } } @@ -1039,8 +1039,8 @@ public class JPEGDecoder { private int eobrun; private int successiveACState, successiveACNextValue; - private int decodeScan(Frame frame, ArrayList components, int resetInterval, - int spectralStart, int spectralEnd, int successivePrev, int successive) throws IOException { + private int decodeScan(final Frame frame, final ArrayList components, int resetInterval, + final int spectralStart, final int spectralEnd, final int successivePrev, final int successive) throws IOException { // this.precision = frame.precision; // this.samplesPerLine = frame.samplesPerLine; // this.scanLines = frame.scanLines; @@ -1110,10 +1110,10 @@ public class JPEGDecoder { mcu++; } } - } catch (MarkerException markerException) { + } catch (final MarkerException markerException) { if(DEBUG) { System.err.println("JPEG.decodeScan: Marker exception: "+markerException.getMessage()); markerException.printStackTrace(); } return markerException.getMarker(); - } catch (CodecException codecException) { + } catch (final CodecException codecException) { if(DEBUG) { System.err.println("JPEG.decodeScan: Codec exception: "+codecException.getMessage()); codecException.printStackTrace(); } bstream.skip( bstream.getBitCount() ); // align to next byte return M_EOI; // force end ! @@ -1159,7 +1159,7 @@ public class JPEGDecoder { return bit; } - private int decodeHuffman(BinObj tree) throws IOException { + private int decodeHuffman(final BinObj tree) throws IOException { BinObj node = tree; int bit; while ( ( bit = readBit() ) != -1 ) { @@ -1182,7 +1182,7 @@ public class JPEGDecoder { } return n; } - private int receiveAndExtend(int length) throws IOException { + private int receiveAndExtend(final int length) throws IOException { final int n = receive(length); if (n >= 1 << (length - 1)) { return n; @@ -1198,7 +1198,7 @@ public class JPEGDecoder { class BaselineDecoder implements DecoderFunction { @Override - public void decode(ComponentIn component, int[] zz) throws IOException { + public void decode(final ComponentIn component, final int[] zz) throws IOException { final int t = decodeHuffman(component.huffmanTableDC); final int diff = ( t == 0 ) ? 0 : receiveAndExtend(t); zz[0] = ( component.pred += diff ); @@ -1222,7 +1222,7 @@ public class JPEGDecoder { } class DCFirstDecoder implements DecoderFunction { @Override - public void decode(ComponentIn component, int[] zz) throws IOException { + public void decode(final ComponentIn component, final int[] zz) throws IOException { final int t = decodeHuffman(component.huffmanTableDC); final int diff = ( t == 0 ) ? 0 : (receiveAndExtend(t) << successive); zz[0] = ( component.pred += diff ); @@ -1230,19 +1230,20 @@ public class JPEGDecoder { } class DCSuccessiveDecoder implements DecoderFunction { @Override - public void decode(ComponentIn component, int[] zz) throws IOException { + public void decode(final ComponentIn component, final int[] zz) throws IOException { zz[0] |= readBit() << successive; } } class ACFirstDecoder implements DecoderFunction { @Override - public void decode(ComponentIn component, int[] zz) throws IOException { + public void decode(final ComponentIn component, final int[] zz) throws IOException { if (eobrun > 0) { eobrun--; return; } - int k = spectralStart, e = spectralEnd; + int k = spectralStart; + final int e = spectralEnd; while (k <= e) { final int rs = decodeHuffman(component.huffmanTableAC); final int s = rs & 15, r = rs >> 4; @@ -1263,8 +1264,10 @@ public class JPEGDecoder { } class ACSuccessiveDecoder implements DecoderFunction { @Override - public void decode(ComponentIn component, int[] zz) throws IOException { - int k = spectralStart, e = spectralEnd, r = 0; + public void decode(final ComponentIn component, final int[] zz) throws IOException { + int k = spectralStart; + final int e = spectralEnd; + int r = 0; while (k <= e) { final int z = dctZigZag[k]; switch (successiveACState) { @@ -1324,14 +1327,14 @@ public class JPEGDecoder { } } } - void decodeMcu(ComponentIn component, DecoderFunction decoder, int mcu, int row, int col) throws IOException { + void decodeMcu(final ComponentIn component, final DecoderFunction decoder, final int mcu, final int row, final int col) throws IOException { final int mcuRow = (mcu / mcusPerLine) | 0; final int mcuCol = mcu % mcusPerLine; final int blockRow = mcuRow * component.v + row; final int blockCol = mcuCol * component.h + col; decoder.decode(component, component.getBlock(blockRow, blockCol)); } - void decodeBlock(ComponentIn component, DecoderFunction decoder, int mcu) throws IOException { + void decodeBlock(final ComponentIn component, final DecoderFunction decoder, final int mcu) throws IOException { final int blockRow = (mcu / component.blocksPerLine) | 0; final int blockCol = mcu % component.blocksPerLine; decoder.decode(component, component.getBlock(blockRow, blockCol)); @@ -1359,7 +1362,7 @@ public class JPEGDecoder { pixelStorage.storeRGB(x, y, (byte)R, (byte)G, (byte)B); } */ - public synchronized void getPixel(JPEGDecoder.ColorSink pixelStorage, int width, int height) { + public synchronized void getPixel(final JPEGDecoder.ColorSink pixelStorage, final int width, final int height) { final int scaleX = this.width / width, scaleY = this.height / height; final int componentCount = this.components.length; @@ -1507,11 +1510,11 @@ public class JPEGDecoder { } } - private static byte clampTo8bit(float a) { + private static byte clampTo8bit(final float a) { return (byte) ( a < 0f ? 0 : a > 255f ? 255 : a ); } - private static String toHexString(int v) { + private static String toHexString(final int v) { return "0x"+Integer.toHexString(v); } } \ No newline at end of file diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java b/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java index 5e177b8c3..c577c4fd5 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/FilterType.java @@ -53,7 +53,7 @@ public enum FilterType { FILTER_UNKNOWN(-100), ; public final int val; - private FilterType(int val) { + private FilterType(final int val) { this.val = val; } @@ -61,12 +61,12 @@ public enum FilterType { static { byVal = new HashMap(); - for (FilterType ft : values()) { + for (final FilterType ft : values()) { byVal.put(ft.val, ft); } } - public static FilterType getByVal(int i) { + public static FilterType getByVal(final int i) { return byVal.get(i); } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/FilterWriteStrategy.java b/src/jogl/classes/jogamp/opengl/util/pngj/FilterWriteStrategy.java index 79eed8f85..63f456347 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/FilterWriteStrategy.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/FilterWriteStrategy.java @@ -11,15 +11,15 @@ class FilterWriteStrategy { private FilterType currentType; // 0-4 private int lastRowTested = -1000000; // performance of each filter (less is better) (can be negative) - private double[] lastSums = new double[5]; + private final double[] lastSums = new double[5]; // performance of each filter (less is better) (can be negative) - private double[] lastEntropies = new double[5]; + private final double[] lastEntropies = new double[5]; // a priori preference (NONE SUB UP AVERAGE PAETH) private double[] preference = new double[] { 1.1, 1.1, 1.1, 1.1, 1.2 }; private int discoverEachLines = -1; - private double[] histogram1 = new double[256]; + private final double[] histogram1 = new double[256]; - FilterWriteStrategy(ImageInfo imgInfo, FilterType configuredType) { + FilterWriteStrategy(final ImageInfo imgInfo, final FilterType configuredType) { this.imgInfo = imgInfo; this.configuredType = configuredType; if (configuredType.val < 0) { // first guess @@ -36,7 +36,7 @@ class FilterWriteStrategy { discoverEachLines = 1; } - boolean shouldTestAll(int rown) { + boolean shouldTestAll(final int rown) { if (discoverEachLines > 0 && lastRowTested + discoverEachLines <= rown) { currentType = null; return true; @@ -44,7 +44,7 @@ class FilterWriteStrategy { return false; } - public void setPreference(double none, double sub, double up, double ave, double paeth) { + public void setPreference(final double none, final double sub, final double up, final double ave, final double paeth) { preference = new double[] { none, sub, up, ave, paeth }; } @@ -52,7 +52,7 @@ class FilterWriteStrategy { return (discoverEachLines > 0); } - void fillResultsForFilter(int rown, FilterType type, double sum, int[] histo, boolean tentative) { + void fillResultsForFilter(final int rown, final FilterType type, final double sum, final int[] histo, final boolean tentative) { lastRowTested = rown; lastSums[type.val] = sum; if (histo != null) { @@ -72,7 +72,7 @@ class FilterWriteStrategy { } } - FilterType gimmeFilterType(int rown, boolean useEntropy) { + FilterType gimmeFilterType(final int rown, final boolean useEntropy) { if (currentType == null) { // get better if (rown == 0) currentType = FilterType.FILTER_SUB; diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java index ac7b858e1..cdd17a291 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageInfo.java @@ -92,7 +92,7 @@ public class ImageInfo { /** * Short constructor: assumes truecolor (RGB/RGBA) */ - public ImageInfo(int cols, int rows, int bitdepth, boolean alpha) { + public ImageInfo(final int cols, final int rows, final int bitdepth, final boolean alpha) { this(cols, rows, bitdepth, alpha, false, false); } @@ -113,7 +113,7 @@ public class ImageInfo { * @param indexed * Flag: has palette */ - public ImageInfo(int cols, int rows, int bitdepth, boolean alpha, boolean grayscale, boolean indexed) { + public ImageInfo(final int cols, final int rows, final int bitdepth, final boolean alpha, final boolean grayscale, final boolean indexed) { this.cols = cols; this.rows = rows; this.alpha = alpha; @@ -176,14 +176,14 @@ public class ImageInfo { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; - ImageInfo other = (ImageInfo) obj; + final ImageInfo other = (ImageInfo) obj; if (alpha != other.alpha) return false; if (bitDepth != other.bitDepth) diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java index e6afd8694..5ad2e4409 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLine.java @@ -69,7 +69,7 @@ public class ImageLine { /** * default mode: INT packed */ - public ImageLine(ImageInfo imgInfo) { + public ImageLine(final ImageInfo imgInfo) { this(imgInfo, SampleType.INT, false); } @@ -86,14 +86,14 @@ public class ImageLine { * images * */ - public ImageLine(ImageInfo imgInfo, SampleType stype, boolean unpackedMode) { + public ImageLine(final ImageInfo imgInfo, final SampleType stype, final boolean unpackedMode) { this(imgInfo, stype, unpackedMode, null, null); } /** * If a preallocated array is passed, the copy is shallow */ - ImageLine(ImageInfo imgInfo, SampleType stype, boolean unpackedMode, int[] sci, byte[] scb) { + ImageLine(final ImageInfo imgInfo, final SampleType stype, final boolean unpackedMode, final int[] sci, final byte[] scb) { this.imgInfo = imgInfo; channels = imgInfo.channels; bitDepth = imgInfo.bitDepth; @@ -118,7 +118,7 @@ public class ImageLine { } /** Sets row number (0 : Rows-1) */ - public void setRown(int n) { + public void setRown(final int n) { this.rown = n; } @@ -274,7 +274,7 @@ public class ImageLine { * The caller must be sure that the original was really packed */ public ImageLine unpackToNewImageLine() { - ImageLine newline = new ImageLine(imgInfo, sampleType, true); + final ImageLine newline = new ImageLine(imgInfo, sampleType, true); if (sampleType == SampleType.INT) unpackInplaceInt(imgInfo, scanline, newline.scanline, false); else @@ -288,7 +288,7 @@ public class ImageLine { * The caller must be sure that the original was really unpacked */ public ImageLine packToNewImageLine() { - ImageLine newline = new ImageLine(imgInfo, sampleType, false); + final ImageLine newline = new ImageLine(imgInfo, sampleType, false); if (sampleType == SampleType.INT) packInplaceInt(imgInfo, scanline, newline.scanline, false); else @@ -300,7 +300,7 @@ public class ImageLine { return filterUsed; } - public void setFilterUsed(FilterType ft) { + public void setFilterUsed(final FilterType ft) { filterUsed = ft; } @@ -323,9 +323,9 @@ public class ImageLine { /** * Prints some statistics - just for debugging */ - public static void showLineInfo(ImageLine line) { + public static void showLineInfo(final ImageLine line) { System.out.println(line); - ImageLineStats stats = new ImageLineHelper.ImageLineStats(line); + final ImageLineStats stats = new ImageLineHelper.ImageLineStats(line); System.out.println(stats); System.out.println(ImageLineHelper.infoFirstLastPixels(line)); } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java index 4636c3955..616ccd560 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLineHelper.java @@ -33,28 +33,28 @@ public class ImageLineHelper { * @return R G B (A), one sample 0-255 per array element. Ready for * pngw.writeRowInt() */ - public static int[] palette2rgb(ImageLine line, PngChunkPLTE pal, PngChunkTRNS trns, int[] buf) { - boolean isalpha = trns != null; - int channels = isalpha ? 4 : 3; - int nsamples = line.imgInfo.cols * channels; + public static int[] palette2rgb(ImageLine line, final PngChunkPLTE pal, final PngChunkTRNS trns, int[] buf) { + final boolean isalpha = trns != null; + final int channels = isalpha ? 4 : 3; + final int nsamples = line.imgInfo.cols * channels; if (buf == null || buf.length < nsamples) buf = new int[nsamples]; if (!line.samplesUnpacked) line = line.unpackToNewImageLine(); - boolean isbyte = line.sampleType == SampleType.BYTE; - int nindexesWithAlpha = trns != null ? trns.getPalletteAlpha().length : 0; + final boolean isbyte = line.sampleType == SampleType.BYTE; + final int nindexesWithAlpha = trns != null ? trns.getPalletteAlpha().length : 0; for (int c = 0; c < line.imgInfo.cols; c++) { - int index = isbyte ? (line.scanlineb[c] & 0xFF) : line.scanline[c]; + final int index = isbyte ? (line.scanlineb[c] & 0xFF) : line.scanline[c]; pal.getEntryRgb(index, buf, c * channels); if (isalpha) { - int alpha = index < nindexesWithAlpha ? trns.getPalletteAlpha()[index] : 255; + final int alpha = index < nindexesWithAlpha ? trns.getPalletteAlpha()[index] : 255; buf[c * channels + 3] = alpha; } } return buf; } - public static int[] palette2rgb(ImageLine line, PngChunkPLTE pal, int[] buf) { + public static int[] palette2rgb(final ImageLine line, final PngChunkPLTE pal, final int[] buf) { return palette2rgb(line, pal, null, buf); } @@ -65,7 +65,7 @@ public class ImageLineHelper { * Just for basic info or debugging. Shows values for first and last pixel. * Does not include alpha */ - public static String infoFirstLastPixels(ImageLine line) { + public static String infoFirstLastPixels(final ImageLine line) { return line.imgInfo.channels == 1 ? String.format("first=(%d) last=(%d)", line.scanline[0], line.scanline[line.scanline.length - 1]) : String.format("first=(%d %d %d) last=(%d %d %d)", line.scanline[0], line.scanline[1], line.scanline[2], line.scanline[line.scanline.length @@ -73,8 +73,8 @@ public class ImageLineHelper { line.scanline[line.scanline.length - line.imgInfo.channels + 2]); } - public static String infoFull(ImageLine line) { - ImageLineStats stats = new ImageLineStats(line); + public static String infoFull(final ImageLine line) { + final ImageLineStats stats = new ImageLineStats(line); return "row=" + line.getRown() + " " + stats.toString() + "\n " + infoFirstLastPixels(line); } @@ -104,7 +104,7 @@ public class ImageLineHelper { + String.format(" maxdif=(%.1f %.1f %.1f %.1f)", maxdif[0], maxdif[1], maxdif[2], maxdif[3]); } - public ImageLineStats(ImageLine line) { + public ImageLineStats(final ImageLine line) { this.channels = line.channels; if (line.channels < 3) throw new PngjException("ImageLineStats only works for RGB - RGBA"); @@ -146,18 +146,18 @@ public class ImageLineHelper { * integer packed R G B only for bitdepth=8! (does not check!) * **/ - public static int getPixelRGB8(ImageLine line, int column) { - int offset = column * line.channels; + public static int getPixelRGB8(final ImageLine line, final int column) { + final int offset = column * line.channels; return (line.scanline[offset] << 16) + (line.scanline[offset + 1] << 8) + (line.scanline[offset + 2]); } - public static int getPixelARGB8(ImageLine line, int column) { - int offset = column * line.channels; + public static int getPixelARGB8(final ImageLine line, final int column) { + final int offset = column * line.channels; return (line.scanline[offset + 3] << 24) + (line.scanline[offset] << 16) + (line.scanline[offset + 1] << 8) + (line.scanline[offset + 2]); } - public static void setPixelsRGB8(ImageLine line, int[] rgb) { + public static void setPixelsRGB8(final ImageLine line, final int[] rgb) { for (int i = 0, j = 0; i < line.imgInfo.cols; i++) { line.scanline[j++] = ((rgb[i] >> 16) & 0xFF); line.scanline[j++] = ((rgb[i] >> 8) & 0xFF); @@ -165,18 +165,18 @@ public class ImageLineHelper { } } - public static void setPixelRGB8(ImageLine line, int col, int r, int g, int b) { + public static void setPixelRGB8(final ImageLine line, int col, final int r, final int g, final int b) { col *= line.channels; line.scanline[col++] = r; line.scanline[col++] = g; line.scanline[col] = b; } - public static void setPixelRGB8(ImageLine line, int col, int rgb) { + public static void setPixelRGB8(final ImageLine line, final int col, final int rgb) { setPixelRGB8(line, col, (rgb >> 16) & 0xFF, (rgb >> 8) & 0xFF, rgb & 0xFF); } - public static void setPixelsRGBA8(ImageLine line, int[] rgb) { + public static void setPixelsRGBA8(final ImageLine line, final int[] rgb) { for (int i = 0, j = 0; i < line.imgInfo.cols; i++) { line.scanline[j++] = ((rgb[i] >> 16) & 0xFF); line.scanline[j++] = ((rgb[i] >> 8) & 0xFF); @@ -185,7 +185,7 @@ public class ImageLineHelper { } } - public static void setPixelRGBA8(ImageLine line, int col, int r, int g, int b, int a) { + public static void setPixelRGBA8(final ImageLine line, int col, final int r, final int g, final int b, final int a) { col *= line.channels; line.scanline[col++] = r; line.scanline[col++] = g; @@ -193,53 +193,53 @@ public class ImageLineHelper { line.scanline[col] = a; } - public static void setPixelRGBA8(ImageLine line, int col, int rgb) { + public static void setPixelRGBA8(final ImageLine line, final int col, final int rgb) { setPixelRGBA8(line, col, (rgb >> 16) & 0xFF, (rgb >> 8) & 0xFF, rgb & 0xFF, (rgb >> 24) & 0xFF); } - public static void setValD(ImageLine line, int i, double d) { + public static void setValD(final ImageLine line, final int i, final double d) { line.scanline[i] = double2int(line, d); } - public static int interpol(int a, int b, int c, int d, double dx, double dy) { + public static int interpol(final int a, final int b, final int c, final int d, final double dx, final double dy) { // a b -> x (0-1) // c d // - double e = a * (1.0 - dx) + b * dx; - double f = c * (1.0 - dx) + d * dx; + final double e = a * (1.0 - dx) + b * dx; + final double f = c * (1.0 - dx) + d * dx; return (int) (e * (1 - dy) + f * dy + 0.5); } - public static double int2double(ImageLine line, int p) { + public static double int2double(final ImageLine line, final int p) { return line.bitDepth == 16 ? p / 65535.0 : p / 255.0; // TODO: replace my multiplication? check for other bitdepths } - public static double int2doubleClamped(ImageLine line, int p) { + public static double int2doubleClamped(final ImageLine line, final int p) { // TODO: replace my multiplication? - double d = line.bitDepth == 16 ? p / 65535.0 : p / 255.0; + final double d = line.bitDepth == 16 ? p / 65535.0 : p / 255.0; return d <= 0.0 ? 0 : (d >= 1.0 ? 1.0 : d); } - public static int double2int(ImageLine line, double d) { + public static int double2int(final ImageLine line, double d) { d = d <= 0.0 ? 0 : (d >= 1.0 ? 1.0 : d); return line.bitDepth == 16 ? (int) (d * 65535.0 + 0.5) : (int) (d * 255.0 + 0.5); // } - public static int double2intClamped(ImageLine line, double d) { + public static int double2intClamped(final ImageLine line, double d) { d = d <= 0.0 ? 0 : (d >= 1.0 ? 1.0 : d); return line.bitDepth == 16 ? (int) (d * 65535.0 + 0.5) : (int) (d * 255.0 + 0.5); // } - public static int clampTo_0_255(int i) { + public static int clampTo_0_255(final int i) { return i > 255 ? 255 : (i < 0 ? 0 : i); } - public static int clampTo_0_65535(int i) { + public static int clampTo_0_65535(final int i) { return i > 65535 ? 65535 : (i < 0 ? 0 : i); } - public static int clampTo_128_127(int x) { + public static int clampTo_128_127(final int x) { return x > 127 ? 127 : (x < -128 ? -128 : x); } @@ -255,9 +255,9 @@ public class ImageLineHelper { * You probably should use {@link ImageLine#unpackToNewImageLine()} * */ - public static int[] unpack(ImageInfo imgInfo, int[] src, int[] dst, boolean scale) { - int len1 = imgInfo.samplesPerRow; - int len0 = imgInfo.samplesPerRowPacked; + public static int[] unpack(final ImageInfo imgInfo, final int[] src, int[] dst, final boolean scale) { + final int len1 = imgInfo.samplesPerRow; + final int len0 = imgInfo.samplesPerRowPacked; if (dst == null || dst.length < len1) dst = new int[len1]; if (imgInfo.packed) @@ -267,9 +267,9 @@ public class ImageLineHelper { return dst; } - public static byte[] unpack(ImageInfo imgInfo, byte[] src, byte[] dst, boolean scale) { - int len1 = imgInfo.samplesPerRow; - int len0 = imgInfo.samplesPerRowPacked; + public static byte[] unpack(final ImageInfo imgInfo, final byte[] src, byte[] dst, final boolean scale) { + final int len1 = imgInfo.samplesPerRow; + final int len0 = imgInfo.samplesPerRowPacked; if (dst == null || dst.length < len1) dst = new byte[len1]; if (imgInfo.packed) @@ -286,8 +286,8 @@ public class ImageLineHelper { * * You probably should use {@link ImageLine#packToNewImageLine()} */ - public static int[] pack(ImageInfo imgInfo, int[] src, int[] dst, boolean scale) { - int len0 = imgInfo.samplesPerRowPacked; + public static int[] pack(final ImageInfo imgInfo, final int[] src, int[] dst, final boolean scale) { + final int len0 = imgInfo.samplesPerRowPacked; if (dst == null || dst.length < len0) dst = new int[len0]; if (imgInfo.packed) @@ -297,8 +297,8 @@ public class ImageLineHelper { return dst; } - public static byte[] pack(ImageInfo imgInfo, byte[] src, byte[] dst, boolean scale) { - int len0 = imgInfo.samplesPerRowPacked; + public static byte[] pack(final ImageInfo imgInfo, final byte[] src, byte[] dst, final boolean scale) { + final int len0 = imgInfo.samplesPerRowPacked; if (dst == null || dst.length < len0) dst = new byte[len0]; if (imgInfo.packed) @@ -308,7 +308,7 @@ public class ImageLineHelper { return dst; } - static int getMaskForPackedFormats(int bitDepth) { // Utility function for pack/unpack + static int getMaskForPackedFormats(final int bitDepth) { // Utility function for pack/unpack if (bitDepth == 4) return 0xf0; else if (bitDepth == 2) @@ -317,7 +317,7 @@ public class ImageLineHelper { return 0x80; // bitDepth == 1 } - static int getMaskForPackedFormatsLs(int bitDepth) { // Utility function for pack/unpack + static int getMaskForPackedFormatsLs(final int bitDepth) { // Utility function for pack/unpack if (bitDepth == 4) return 0x0f; else if (bitDepth == 2) diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java index fb2cf5910..8f6216ab2 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/ImageLines.java @@ -36,7 +36,7 @@ public class ImageLines { * @param nRows * @param rowStep */ - public ImageLines(ImageInfo imgInfo, SampleType stype, boolean unpackedMode, int rowOffset, int nRows, int rowStep) { + public ImageLines(final ImageInfo imgInfo, final SampleType stype, final boolean unpackedMode, final int rowOffset, final int nRows, final int rowStep) { this.imgInfo = imgInfo; channels = imgInfo.channels; bitDepth = imgInfo.bitDepth; @@ -61,8 +61,8 @@ public class ImageLines { * and rounding down) Eg: rowOffset=4,rowStep=2 imageRowToMatrixRow(17) * returns 6 , imageRowToMatrixRow(1) returns 0 */ - public int imageRowToMatrixRow(int imrow) { - int r = (imrow - rowOffset) / rowStep; + public int imageRowToMatrixRow(final int imrow) { + final int r = (imrow - rowOffset) / rowStep; return r < 0 ? 0 : (r < nRows ? r : nRows - 1); } @@ -71,7 +71,7 @@ public class ImageLines { */ public int imageRowToMatrixRowStrict(int imrow) { imrow -= rowOffset; - int mrow = imrow >= 0 && imrow % rowStep == 0 ? imrow / rowStep : -1; + final int mrow = imrow >= 0 && imrow % rowStep == 0 ? imrow / rowStep : -1; return mrow < nRows ? mrow : -1; } @@ -82,7 +82,7 @@ public class ImageLines { * Matrix row number * @return Image row number. Invalid only if mrow is invalid */ - public int matrixRowToImageRow(int mrow) { + public int matrixRowToImageRow(final int mrow) { return mrow * rowStep + rowOffset; } @@ -96,10 +96,10 @@ public class ImageLines { * @return A new ImageLine, backed by the matrix, with the correct ('real') * rownumber */ - public ImageLine getImageLineAtMatrixRow(int mrow) { + public ImageLine getImageLineAtMatrixRow(final int mrow) { if (mrow < 0 || mrow > nRows) throw new PngjException("Bad row " + mrow + ". Should be positive and less than " + nRows); - ImageLine imline = sampleType == SampleType.INT ? new ImageLine(imgInfo, sampleType, samplesUnpacked, + final ImageLine imline = sampleType == SampleType.INT ? new ImageLine(imgInfo, sampleType, samplesUnpacked, scanlines[mrow], null) : new ImageLine(imgInfo, sampleType, samplesUnpacked, null, scanlinesb[mrow]); imline.setRown(matrixRowToImageRow(mrow)); return imline; diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngDeinterlacer.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngDeinterlacer.java index e099c4f6a..436821cf7 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngDeinterlacer.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngDeinterlacer.java @@ -20,7 +20,7 @@ class PngDeinterlacer { private short[][] imageShort; private byte[][] imageByte; - PngDeinterlacer(ImageInfo iminfo) { + PngDeinterlacer(final ImageInfo iminfo) { this.imi = iminfo; pass = 0; if (imi.packed) { @@ -40,14 +40,14 @@ class PngDeinterlacer { } /** this refers to the row currRowSubimg */ - void setRow(int n) { + void setRow(final int n) { currRowSubimg = n; currRowReal = n * dY + oY; if (currRowReal < 0 || currRowReal >= imi.rows) throw new PngjExceptionInternal("bad row - this should not happen"); } - void setPass(int p) { + void setPass(final int p) { if (this.pass == p) return; pass = p; @@ -105,7 +105,7 @@ class PngDeinterlacer { } // notice that this is a "partial" deinterlace, it will be called several times for the same row! - void deinterlaceInt(int[] src, int[] dst, boolean readInPackedFormat) { + void deinterlaceInt(final int[] src, final int[] dst, final boolean readInPackedFormat) { if (!(imi.packed && readInPackedFormat)) for (int i = 0, j = oXsamples; i < cols * imi.channels; i += imi.channels, j += dXsamples) for (int k = 0; k < imi.channels; k++) @@ -115,7 +115,7 @@ class PngDeinterlacer { } // interlaced+packed = monster; this is very clumsy! - private void deinterlaceIntPacked(int[] src, int[] dst) { + private void deinterlaceIntPacked(final int[] src, final int[] dst) { int spos, smod, smask; // source byte position, bits to shift to left (01,2,3,4 int tpos, tmod, p, d; spos = 0; @@ -143,7 +143,7 @@ class PngDeinterlacer { } // yes, duplication of code is evil, normally - void deinterlaceByte(byte[] src, byte[] dst, boolean readInPackedFormat) { + void deinterlaceByte(final byte[] src, final byte[] dst, final boolean readInPackedFormat) { if (!(imi.packed && readInPackedFormat)) for (int i = 0, j = oXsamples; i < cols * imi.channels; i += imi.channels, j += dXsamples) for (int k = 0; k < imi.channels; k++) @@ -152,7 +152,7 @@ class PngDeinterlacer { deinterlacePackedByte(src, dst); } - private void deinterlacePackedByte(byte[] src, byte[] dst) { + private void deinterlacePackedByte(final byte[] src, final byte[] dst) { int spos, smod, smask; // source byte position, bits to shift to left (01,2,3,4 int tpos, tmod, p, d; // what the heck are you reading here? I told you would not enjoy this. Try Dostoyevsky or Simone Weil instead @@ -230,7 +230,7 @@ class PngDeinterlacer { return imageInt; } - void setImageInt(int[][] imageInt) { + void setImageInt(final int[][] imageInt) { this.imageInt = imageInt; } @@ -238,7 +238,7 @@ class PngDeinterlacer { return imageShort; } - void setImageShort(short[][] imageShort) { + void setImageShort(final short[][] imageShort) { this.imageShort = imageShort; } @@ -246,20 +246,20 @@ class PngDeinterlacer { return imageByte; } - void setImageByte(byte[][] imageByte) { + void setImageByte(final byte[][] imageByte) { this.imageByte = imageByte; } static void test() { - Random rand = new Random(); - PngDeinterlacer ih = new PngDeinterlacer(new ImageInfo(rand.nextInt(35) + 1, rand.nextInt(52) + 1, 8, true)); + final Random rand = new Random(); + final PngDeinterlacer ih = new PngDeinterlacer(new ImageInfo(rand.nextInt(35) + 1, rand.nextInt(52) + 1, 8, true)); int np = ih.imi.cols * ih.imi.rows; System.out.println(ih.imi); for (int p = 1; p <= 7; p++) { ih.setPass(p); for (int row = 0; row < ih.getRows(); row++) { ih.setRow(row); - int b = ih.getCols(); + final int b = ih.getCols(); np -= b; System.out.printf("Read %d pixels. Pass:%d Realline:%d cols=%d dX=%d oX=%d last:%b\n", b, ih.pass, ih.currRowReal, ih.cols, ih.dX, ih.oX, ih.isAtLastRow()); @@ -270,7 +270,7 @@ class PngDeinterlacer { throw new PngjExceptionInternal("wtf??" + ih.imi); } - public static void main(String[] args) { + public static void main(final String[] args) { test(); } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java index 9e64c3eb1..f1bee1957 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngHelperInternal.java @@ -31,18 +31,18 @@ public class PngHelperInternal { return new byte[] { -119, 80, 78, 71, 13, 10, 26, 10 }; } - public static int doubleToInt100000(double d) { + public static int doubleToInt100000(final double d) { return (int) (d * 100000.0 + 0.5); } - public static double intToDouble100000(int i) { + public static double intToDouble100000(final int i) { return i / 100000.0; } - public static int readByte(InputStream is) { + public static int readByte(final InputStream is) { try { return is.read(); - } catch (IOException e) { + } catch (final IOException e) { throw new PngjInputException("error reading byte", e); } } @@ -52,14 +52,14 @@ public class PngHelperInternal { * * PNG uses "network byte order" */ - public static int readInt2(InputStream is) { + public static int readInt2(final InputStream is) { try { - int b1 = is.read(); - int b2 = is.read(); + final int b1 = is.read(); + final int b2 = is.read(); if (b1 == -1 || b2 == -1) return -1; return (b1 << 8) + b2; - } catch (IOException e) { + } catch (final IOException e) { throw new PngjInputException("error reading readInt2", e); } } @@ -67,58 +67,58 @@ public class PngHelperInternal { /** * -1 if eof */ - public static int readInt4(InputStream is) { + public static int readInt4(final InputStream is) { try { - int b1 = is.read(); - int b2 = is.read(); - int b3 = is.read(); - int b4 = is.read(); + final int b1 = is.read(); + final int b2 = is.read(); + final int b3 = is.read(); + final int b4 = is.read(); if (b1 == -1 || b2 == -1 || b3 == -1 || b4 == -1) return -1; return (b1 << 24) + (b2 << 16) + (b3 << 8) + b4; - } catch (IOException e) { + } catch (final IOException e) { throw new PngjInputException("error reading readInt4", e); } } - public static int readInt1fromByte(byte[] b, int offset) { + public static int readInt1fromByte(final byte[] b, final int offset) { return (b[offset] & 0xff); } - public static int readInt2fromBytes(byte[] b, int offset) { + public static int readInt2fromBytes(final byte[] b, final int offset) { return ((b[offset] & 0xff) << 16) | ((b[offset + 1] & 0xff)); } - public static int readInt4fromBytes(byte[] b, int offset) { + public static int readInt4fromBytes(final byte[] b, final int offset) { return ((b[offset] & 0xff) << 24) | ((b[offset + 1] & 0xff) << 16) | ((b[offset + 2] & 0xff) << 8) | (b[offset + 3] & 0xff); } - public static void writeByte(OutputStream os, byte b) { + public static void writeByte(final OutputStream os, final byte b) { try { os.write(b); - } catch (IOException e) { + } catch (final IOException e) { throw new PngjOutputException(e); } } - public static void writeInt2(OutputStream os, int n) { - byte[] temp = { (byte) ((n >> 8) & 0xff), (byte) (n & 0xff) }; + public static void writeInt2(final OutputStream os, final int n) { + final byte[] temp = { (byte) ((n >> 8) & 0xff), (byte) (n & 0xff) }; writeBytes(os, temp); } - public static void writeInt4(OutputStream os, int n) { - byte[] temp = new byte[4]; + public static void writeInt4(final OutputStream os, final int n) { + final byte[] temp = new byte[4]; writeInt4tobytes(n, temp, 0); writeBytes(os, temp); } - public static void writeInt2tobytes(int n, byte[] b, int offset) { + public static void writeInt2tobytes(final int n, final byte[] b, final int offset) { b[offset] = (byte) ((n >> 8) & 0xff); b[offset + 1] = (byte) (n & 0xff); } - public static void writeInt4tobytes(int n, byte[] b, int offset) { + public static void writeInt4tobytes(final int n, final byte[] b, final int offset) { b[offset] = (byte) ((n >> 24) & 0xff); b[offset + 1] = (byte) ((n >> 16) & 0xff); b[offset + 2] = (byte) ((n >> 8) & 0xff); @@ -128,26 +128,26 @@ public class PngHelperInternal { /** * guaranteed to read exactly len bytes. throws error if it can't */ - public static void readBytes(InputStream is, byte[] b, int offset, int len) { + public static void readBytes(final InputStream is, final byte[] b, final int offset, final int len) { if (len == 0) return; try { int read = 0; while (read < len) { - int n = is.read(b, offset + read, len - read); + final int n = is.read(b, offset + read, len - read); if (n < 1) throw new PngjInputException("error reading bytes, " + n + " !=" + len); read += n; } - } catch (IOException e) { + } catch (final IOException e) { throw new PngjInputException("error reading", e); } } - public static void skipBytes(InputStream is, long len) { + public static void skipBytes(final InputStream is, long len) { try { while (len > 0) { - long n1 = is.skip(len); + final long n1 = is.skip(len); if (n1 > 0) { len -= n1; } else if (n1 == 0) { // should we retry? lets read one byte @@ -159,28 +159,28 @@ public class PngHelperInternal { // negative? this should never happen but... throw new IOException("skip() returned a negative value ???"); } - } catch (IOException e) { + } catch (final IOException e) { throw new PngjInputException(e); } } - public static void writeBytes(OutputStream os, byte[] b) { + public static void writeBytes(final OutputStream os, final byte[] b) { try { os.write(b); - } catch (IOException e) { + } catch (final IOException e) { throw new PngjOutputException(e); } } - public static void writeBytes(OutputStream os, byte[] b, int offset, int n) { + public static void writeBytes(final OutputStream os, final byte[] b, final int offset, final int n) { try { os.write(b, offset, n); - } catch (IOException e) { + } catch (final IOException e) { throw new PngjOutputException(e); } } - public static void logdebug(String msg) { + public static void logdebug(final String msg) { if (DEBUG) System.out.println(msg); } @@ -198,43 +198,43 @@ public class PngHelperInternal { } // / filters - public static int filterRowNone(int r) { - return (int) (r & 0xFF); + public static int filterRowNone(final int r) { + return r & 0xFF; } - public static int filterRowSub(int r, int left) { - return ((int) (r - left) & 0xFF); + public static int filterRowSub(final int r, final int left) { + return (r - left & 0xFF); } - public static int filterRowUp(int r, int up) { - return ((int) (r - up) & 0xFF); + public static int filterRowUp(final int r, final int up) { + return (r - up & 0xFF); } - public static int filterRowAverage(int r, int left, int up) { + public static int filterRowAverage(final int r, final int left, final int up) { return (r - (left + up) / 2) & 0xFF; } - public static int filterRowPaeth(int r, int left, int up, int upleft) { // a = left, b = above, c = upper left + public static int filterRowPaeth(final int r, final int left, final int up, final int upleft) { // a = left, b = above, c = upper left return (r - filterPaethPredictor(left, up, upleft)) & 0xFF; } - public static int unfilterRowNone(int r) { - return (int) (r & 0xFF); + public static int unfilterRowNone(final int r) { + return r & 0xFF; } - public static int unfilterRowSub(int r, int left) { - return ((int) (r + left) & 0xFF); + public static int unfilterRowSub(final int r, final int left) { + return (r + left & 0xFF); } - public static int unfilterRowUp(int r, int up) { - return ((int) (r + up) & 0xFF); + public static int unfilterRowUp(final int r, final int up) { + return (r + up & 0xFF); } - public static int unfilterRowAverage(int r, int left, int up) { + public static int unfilterRowAverage(final int r, final int left, final int up) { return (r + (left + up) / 2) & 0xFF; } - public static int unfilterRowPaeth(int r, int left, int up, int upleft) { // a = left, b = above, c = upper left + public static int unfilterRowPaeth(final int r, final int left, final int up, final int upleft) { // a = left, b = above, c = upper left return (r + filterPaethPredictor(left, up, upleft)) & 0xFF; } @@ -259,11 +259,11 @@ public class PngHelperInternal { /* * we put this methods here so as to not pollute the public interface of PngReader */ - public final static void initCrcForTests(PngReader pngr) { + public final static void initCrcForTests(final PngReader pngr) { pngr.initCrctest(); } - public final static long getCrctestVal(PngReader pngr) { + public final static long getCrctestVal(final PngReader pngr) { return pngr.getCrctestVal(); } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkInputStream.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkInputStream.java index cdad09809..cde4b517e 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkInputStream.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkInputStream.java @@ -18,7 +18,7 @@ class PngIDatChunkInputStream extends InputStream { private final CRC32 crcEngine; private boolean checkCrc = true; private int lenLastChunk; - private byte[] idLastChunk = new byte[4]; + private final byte[] idLastChunk = new byte[4]; private int toReadThisChunk = 0; private boolean ended = false; private long offset; // offset inside whole inputstream (counting bytes before IDAT) @@ -28,7 +28,7 @@ class PngIDatChunkInputStream extends InputStream { public final int len; public final long offset; - private IdatChunkInfo(int len, long offset) { + private IdatChunkInfo(final int len, final long offset) { this.len = len; this.offset = offset; } @@ -40,7 +40,7 @@ class PngIDatChunkInputStream extends InputStream { * Constructor must be called just after reading length and id of first IDAT * chunk **/ - PngIDatChunkInputStream(InputStream iStream, int lenFirstChunk, long offset) { + PngIDatChunkInputStream(final InputStream iStream, final int lenFirstChunk, final long offset) { this.offset = offset; inputStream = iStream; this.lenLastChunk = lenFirstChunk; @@ -70,10 +70,10 @@ class PngIDatChunkInputStream extends InputStream { // Those values are left in idLastChunk / lenLastChunk // Skips empty IDATS do { - int crc = PngHelperInternal.readInt4(inputStream); // + final int crc = PngHelperInternal.readInt4(inputStream); // offset += 4; if (checkCrc) { - int crccalc = (int) crcEngine.getValue(); + final int crccalc = (int) crcEngine.getValue(); if (lenLastChunk > 0 && crc != crccalc) throw new PngjBadCrcException("error reading idat; offset: " + offset); crcEngine.reset(); @@ -101,7 +101,7 @@ class PngIDatChunkInputStream extends InputStream { */ void forceChunkEnd() { if (!ended) { - byte[] dummy = new byte[toReadThisChunk]; + final byte[] dummy = new byte[toReadThisChunk]; PngHelperInternal.readBytes(inputStream, dummy, 0, toReadThisChunk); if (checkCrc) crcEngine.update(dummy, 0, toReadThisChunk); @@ -114,12 +114,12 @@ class PngIDatChunkInputStream extends InputStream { * ended prematurely. That is our error. */ @Override - public int read(byte[] b, int off, int len) throws IOException { + public int read(final byte[] b, final int off, final int len) throws IOException { if (ended) return -1; // can happen only when raw reading, see Pngreader.readAndSkipsAllRows() if (toReadThisChunk == 0) throw new PngjExceptionInternal("this should not happen"); - int n = inputStream.read(b, off, len >= toReadThisChunk ? toReadThisChunk : len); + final int n = inputStream.read(b, off, len >= toReadThisChunk ? toReadThisChunk : len); if (n > 0) { if (checkCrc) crcEngine.update(b, off, n); @@ -133,7 +133,7 @@ class PngIDatChunkInputStream extends InputStream { } @Override - public int read(byte[] b) throws IOException { + public int read(final byte[] b) throws IOException { return this.read(b, 0, b.length); } @@ -141,8 +141,8 @@ class PngIDatChunkInputStream extends InputStream { public int read() throws IOException { // PngHelper.logdebug("read() should go here"); // inneficient - but this should be used rarely - byte[] b1 = new byte[1]; - int r = this.read(b1, 0, 1); + final byte[] b1 = new byte[1]; + final int r = this.read(b1, 0, 1); return r < 0 ? -1 : (int) b1[0]; } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkOutputStream.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkOutputStream.java index 411d18819..38b500cd3 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkOutputStream.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngIDatChunkOutputStream.java @@ -13,18 +13,18 @@ class PngIDatChunkOutputStream extends ProgressiveOutputStream { private static final int SIZE_DEFAULT = 32768; // 32k private final OutputStream outputStream; - PngIDatChunkOutputStream(OutputStream outputStream) { + PngIDatChunkOutputStream(final OutputStream outputStream) { this(outputStream, 0); } - PngIDatChunkOutputStream(OutputStream outputStream, int size) { + PngIDatChunkOutputStream(final OutputStream outputStream, final int size) { super(size > 0 ? size : SIZE_DEFAULT); this.outputStream = outputStream; } @Override - protected final void flushBuffer(byte[] b, int len) { - ChunkRaw c = new ChunkRaw(len, ChunkHelper.b_IDAT, false); + protected final void flushBuffer(final byte[] b, final int len) { + final ChunkRaw c = new ChunkRaw(len, ChunkHelper.b_IDAT, false); c.data = b; c.writeChunk(outputStream); } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java index 0412beb8c..f77d4f4e0 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngReader.java @@ -100,32 +100,32 @@ public class PngReader { * error/debug messages * */ - public PngReader(InputStream inputStream, String filenameOrDescription) { + public PngReader(final InputStream inputStream, final String filenameOrDescription) { this.filename = filenameOrDescription == null ? "" : filenameOrDescription; this.inputStream = inputStream; this.chunksList = new ChunksList(null); this.metadata = new PngMetadata(chunksList); // starts reading: signature - byte[] pngid = new byte[8]; + final byte[] pngid = new byte[8]; PngHelperInternal.readBytes(inputStream, pngid, 0, pngid.length); offset += pngid.length; if (!Arrays.equals(pngid, PngHelperInternal.getPngIdSignature())) throw new PngjInputException("Bad PNG signature"); // reads first chunk currentChunkGroup = ChunksList.CHUNK_GROUP_0_IDHR; - int clen = PngHelperInternal.readInt4(inputStream); + final int clen = PngHelperInternal.readInt4(inputStream); offset += 4; if (clen != 13) throw new PngjInputException("IDHR chunk len != 13 ?? " + clen); - byte[] chunkid = new byte[4]; + final byte[] chunkid = new byte[4]; PngHelperInternal.readBytes(inputStream, chunkid, 0, 4); if (!Arrays.equals(chunkid, ChunkHelper.b_IHDR)) throw new PngjInputException("IHDR not found as first chunk??? [" + ChunkHelper.toString(chunkid) + "]"); offset += 4; - PngChunkIHDR ihdr = (PngChunkIHDR) readChunk(chunkid, clen, false); - boolean alpha = (ihdr.getColormodel() & 0x04) != 0; - boolean palette = (ihdr.getColormodel() & 0x01) != 0; - boolean grayscale = (ihdr.getColormodel() == 0 || ihdr.getColormodel() == 4); + final PngChunkIHDR ihdr = (PngChunkIHDR) readChunk(chunkid, clen, false); + final boolean alpha = (ihdr.getColormodel() & 0x04) != 0; + final boolean palette = (ihdr.getColormodel() & 0x01) != 0; + final boolean grayscale = (ihdr.getColormodel() == 0 || ihdr.getColormodel() == 4); // creates ImgInfo and imgLine, and allocates buffers imgInfo = new ImageInfo(ihdr.getCols(), ihdr.getRows(), ihdr.getBitspc(), alpha, grayscale, palette); interlaced = ihdr.getInterlaced() == 1; @@ -163,7 +163,7 @@ public class PngReader { if (currentChunkGroup < ChunksList.CHUNK_GROUP_5_AFTERIDAT) { try { idatIstream.close(); - } catch (Exception e) { + } catch (final Exception e) { } readLastChunks(); } @@ -174,23 +174,23 @@ public class PngReader { if (currentChunkGroup < ChunksList.CHUNK_GROUP_6_END) { // this could only happen if forced close try { idatIstream.close(); - } catch (Exception e) { + } catch (final Exception e) { } currentChunkGroup = ChunksList.CHUNK_GROUP_6_END; } if (shouldCloseStream) { try { inputStream.close(); - } catch (Exception e) { + } catch (final Exception e) { throw new PngjInputException("error closing input stream!", e); } } } // nbytes: NOT including the filter byte. leaves result in rowb - private void unfilterRow(int nbytes) { - int ftn = rowbfilter[0]; - FilterType ft = FilterType.getByVal(ftn); + private void unfilterRow(final int nbytes) { + final int ftn = rowbfilter[0]; + final FilterType ft = FilterType.getByVal(ftn); if (ft == null) throw new PngjInputException("Filter type " + ftn + " invalid"); switch (ft) { @@ -226,7 +226,7 @@ public class PngReader { private void unfilterRowNone(final int nbytes) { for (int i = 1; i <= nbytes; i++) { - rowb[i] = (byte) (rowbfilter[i]); + rowb[i] = (rowbfilter[i]); } } @@ -242,7 +242,7 @@ public class PngReader { private void unfilterRowSub(final int nbytes) { int i, j; for (i = 1; i <= imgInfo.bytesPixel; i++) { - rowb[i] = (byte) (rowbfilter[i]); + rowb[i] = (rowbfilter[i]); } for (j = 1, i = imgInfo.bytesPixel + 1; i <= nbytes; i++, j++) { rowb[i] = (byte) (rowbfilter[i] + rowb[j]); @@ -276,7 +276,7 @@ public class PngReader { return; int clen = 0; boolean found = false; - byte[] chunkid = new byte[4]; // it's important to reallocate in each iteration + final byte[] chunkid = new byte[4]; // it's important to reallocate in each iteration currentChunkGroup = ChunksList.CHUNK_GROUP_1_AFTERIDHR; while (!found) { clen = PngHelperInternal.readInt4(inputStream); @@ -300,7 +300,7 @@ public class PngReader { if (Arrays.equals(chunkid, ChunkHelper.b_PLTE)) currentChunkGroup = ChunksList.CHUNK_GROUP_3_AFTERPLTE; } - int idatLen = found ? clen : -1; + final int idatLen = found ? clen : -1; if (idatLen < 0) throw new PngjInputException("first idat chunk not found!"); iIdatCstream = new PngIDatChunkInputStream(inputStream, idatLen, offset); @@ -323,7 +323,7 @@ public class PngReader { if (!iIdatCstream.isEnded()) iIdatCstream.forceChunkEnd(); int clen = iIdatCstream.getLenLastChunk(); - byte[] chunkid = iIdatCstream.getIdLastChunk(); + final byte[] chunkid = iIdatCstream.getIdLastChunk(); boolean endfound = false; boolean first = true; boolean skip = false; @@ -355,14 +355,14 @@ public class PngReader { * Reads chunkd from input stream, adds to ChunksList, and returns it. If * it's skipped, a PngChunkSkipped object is created */ - private PngChunk readChunk(byte[] chunkid, int clen, boolean skipforced) { + private PngChunk readChunk(final byte[] chunkid, final int clen, final boolean skipforced) { if (clen < 0) throw new PngjInputException("invalid chunk lenght: " + clen); // skipChunksByIdSet is created lazyly, if fist IHDR has already been read if (skipChunkIdsSet == null && currentChunkGroup > ChunksList.CHUNK_GROUP_0_IDHR) skipChunkIdsSet = new HashSet(Arrays.asList(skipChunkIds)); - String chunkidstr = ChunkHelper.toString(chunkid); - boolean critical = ChunkHelper.isCritical(chunkidstr); + final String chunkidstr = ChunkHelper.toString(chunkid); + final boolean critical = ChunkHelper.isCritical(chunkidstr); PngChunk pngChunk = null; boolean skip = skipforced; if (maxTotalBytesRead > 0 && clen + offset > maxTotalBytesRead) @@ -379,7 +379,7 @@ public class PngReader { // clen + 4) for risk of overflow pngChunk = new PngChunkSkipped(chunkidstr, imgInfo, clen); } else { - ChunkRaw chunk = new ChunkRaw(clen, chunkid, true); + final ChunkRaw chunk = new ChunkRaw(clen, chunkid, true); chunk.readChunkData(inputStream, crcEnabled || critical); pngChunk = PngChunk.factory(chunk, imgInfo); if (!pngChunk.crit) @@ -398,7 +398,7 @@ public class PngReader { *

* This happens rarely - most errors are fatal. */ - protected void logWarn(String warn) { + protected void logWarn(final String warn) { System.err.println(warn); } @@ -415,7 +415,7 @@ public class PngReader { * @param chunkLoadBehaviour * {@link ChunkLoadBehaviour} */ - public void setChunkLoadBehaviour(ChunkLoadBehaviour chunkLoadBehaviour) { + public void setChunkLoadBehaviour(final ChunkLoadBehaviour chunkLoadBehaviour) { this.chunkLoadBehaviour = chunkLoadBehaviour; } @@ -459,7 +459,7 @@ public class PngReader { * * @see #readRowInt(int) {@link #readRowByte(int)} */ - public ImageLine readRow(int nrow) { + public ImageLine readRow(final int nrow) { if (imgLine == null) imgLine = new ImageLine(imgInfo, SampleType.INT, unpackedMode); return imgLine.sampleType != SampleType.BYTE ? readRowInt(nrow) : readRowByte(nrow); @@ -476,7 +476,7 @@ public class PngReader { * @return ImageLine object, also available as field. Data is in * {@link ImageLine#scanline} (int) field. */ - public ImageLine readRowInt(int nrow) { + public ImageLine readRowInt(final int nrow) { if (imgLine == null) imgLine = new ImageLine(imgInfo, SampleType.INT, unpackedMode); if (imgLine.getRown() == nrow) // already read @@ -499,7 +499,7 @@ public class PngReader { * @return ImageLine object, also available as field. Data is in * {@link ImageLine#scanlineb} (byte) field. */ - public ImageLine readRowByte(int nrow) { + public ImageLine readRowByte(final int nrow) { if (imgLine == null) imgLine = new ImageLine(imgInfo, SampleType.BYTE, unpackedMode); if (imgLine.getRown() == nrow) // already read @@ -513,7 +513,7 @@ public class PngReader { /** * @see #readRowInt(int[], int) */ - public final int[] readRow(int[] buffer, final int nrow) { + public final int[] readRow(final int[] buffer, final int nrow) { return readRowInt(buffer, nrow); } @@ -596,11 +596,11 @@ public class PngReader { * @deprecated Now {@link #readRow(int)} implements the same funcion. This * method will be removed in future releases */ - public ImageLine getRow(int nrow) { + public ImageLine getRow(final int nrow) { return readRow(nrow); } - private void decodeLastReadRowToInt(int[] buffer, int bytesRead) { + private void decodeLastReadRowToInt(final int[] buffer, final int bytesRead) { if (imgInfo.bitDepth <= 8) for (int i = 0, j = 1; i < bytesRead; i++) buffer[i] = (rowb[j++] & 0xFF); // http://www.libpng.org/pub/png/spec/1.2/PNG-DataRep.html @@ -611,7 +611,7 @@ public class PngReader { ImageLine.unpackInplaceInt(imgInfo, buffer, buffer, false); } - private void decodeLastReadRowToByte(byte[] buffer, int bytesRead) { + private void decodeLastReadRowToByte(final byte[] buffer, final int bytesRead) { if (imgInfo.bitDepth <= 8) System.arraycopy(rowb, 1, buffer, 0, bytesRead); else @@ -644,27 +644,27 @@ public class PngReader { * even/odd lines, etc * @return Set of lines as a ImageLines, which wraps a matrix */ - public ImageLines readRowsInt(int rowOffset, int nRows, int rowStep) { + public ImageLines readRowsInt(final int rowOffset, int nRows, final int rowStep) { if (nRows < 0) nRows = (imgInfo.rows - rowOffset) / rowStep; if (rowStep < 1 || rowOffset < 0 || nRows * rowStep + rowOffset > imgInfo.rows) throw new PngjInputException("bad args"); - ImageLines imlines = new ImageLines(imgInfo, SampleType.INT, unpackedMode, rowOffset, nRows, rowStep); + final ImageLines imlines = new ImageLines(imgInfo, SampleType.INT, unpackedMode, rowOffset, nRows, rowStep); if (!interlaced) { for (int j = 0; j < imgInfo.rows; j++) { - int bytesread = readRowRaw(j); // read and perhaps discards - int mrow = imlines.imageRowToMatrixRowStrict(j); + final int bytesread = readRowRaw(j); // read and perhaps discards + final int mrow = imlines.imageRowToMatrixRowStrict(j); if (mrow >= 0) decodeLastReadRowToInt(imlines.scanlines[mrow], bytesread); } } else { // and now, for something completely different (interlaced) - int[] buf = new int[unpackedMode ? imgInfo.samplesPerRow : imgInfo.samplesPerRowPacked]; + final int[] buf = new int[unpackedMode ? imgInfo.samplesPerRow : imgInfo.samplesPerRowPacked]; for (int p = 1; p <= 7; p++) { deinterlacer.setPass(p); for (int i = 0; i < deinterlacer.getRows(); i++) { - int bytesread = readRowRaw(i); - int j = deinterlacer.getCurrRowReal(); - int mrow = imlines.imageRowToMatrixRowStrict(j); + final int bytesread = readRowRaw(i); + final int j = deinterlacer.getCurrRowReal(); + final int mrow = imlines.imageRowToMatrixRowStrict(j); if (mrow >= 0) { decodeLastReadRowToInt(buf, bytesread); deinterlacer.deinterlaceInt(buf, imlines.scanlines[mrow], !unpackedMode); @@ -709,27 +709,27 @@ public class PngReader { * even/odd lines, etc * @return Set of lines as a matrix */ - public ImageLines readRowsByte(int rowOffset, int nRows, int rowStep) { + public ImageLines readRowsByte(final int rowOffset, int nRows, final int rowStep) { if (nRows < 0) nRows = (imgInfo.rows - rowOffset) / rowStep; if (rowStep < 1 || rowOffset < 0 || nRows * rowStep + rowOffset > imgInfo.rows) throw new PngjInputException("bad args"); - ImageLines imlines = new ImageLines(imgInfo, SampleType.BYTE, unpackedMode, rowOffset, nRows, rowStep); + final ImageLines imlines = new ImageLines(imgInfo, SampleType.BYTE, unpackedMode, rowOffset, nRows, rowStep); if (!interlaced) { for (int j = 0; j < imgInfo.rows; j++) { - int bytesread = readRowRaw(j); // read and perhaps discards - int mrow = imlines.imageRowToMatrixRowStrict(j); + final int bytesread = readRowRaw(j); // read and perhaps discards + final int mrow = imlines.imageRowToMatrixRowStrict(j); if (mrow >= 0) decodeLastReadRowToByte(imlines.scanlinesb[mrow], bytesread); } } else { // and now, for something completely different (interlaced) - byte[] buf = new byte[unpackedMode ? imgInfo.samplesPerRow : imgInfo.samplesPerRowPacked]; + final byte[] buf = new byte[unpackedMode ? imgInfo.samplesPerRow : imgInfo.samplesPerRowPacked]; for (int p = 1; p <= 7; p++) { deinterlacer.setPass(p); for (int i = 0; i < deinterlacer.getRows(); i++) { - int bytesread = readRowRaw(i); - int j = deinterlacer.getCurrRowReal(); - int mrow = imlines.imageRowToMatrixRowStrict(j); + final int bytesread = readRowRaw(i); + final int j = deinterlacer.getCurrRowReal(); + final int mrow = imlines.imageRowToMatrixRowStrict(j); if (mrow >= 0) { decodeLastReadRowToByte(buf, bytesread); deinterlacer.deinterlaceByte(buf, imlines.scanlinesb[mrow], !unpackedMode); @@ -784,7 +784,7 @@ public class PngReader { } rowNum = nrow; // swap buffers - byte[] tmp = rowb; + final byte[] tmp = rowb; rowb = rowbprev; rowbprev = tmp; // loads in rowbfilter "raw" bytes, with filter @@ -821,7 +821,7 @@ public class PngReader { do { r = iIdatCstream.read(rowbfilter, 0, buffersLen); } while (r >= 0); - } catch (IOException e) { + } catch (final IOException e) { throw new PngjInputException("error in raw read of IDAT", e); } offset = iIdatCstream.getOffset(); @@ -838,7 +838,7 @@ public class PngReader { * These are the bytes read (not loaded) in the input stream. If exceeded, * an exception will be thrown. */ - public void setMaxTotalBytesRead(long maxTotalBytesToRead) { + public void setMaxTotalBytesRead(final long maxTotalBytesToRead) { this.maxTotalBytesRead = maxTotalBytesToRead; } @@ -854,7 +854,7 @@ public class PngReader { * default: 5Mb).
* If exceeded, some chunks will be skipped */ - public void setMaxBytesMetadata(int maxBytesChunksToLoad) { + public void setMaxBytesMetadata(final int maxBytesChunksToLoad) { this.maxBytesMetadata = maxBytesChunksToLoad; } @@ -872,7 +872,7 @@ public class PngReader { * checked) and the chunk will be saved as a PngChunkSkipped object. See * also setSkipChunkIds */ - public void setSkipChunkMaxSize(int skipChunksBySize) { + public void setSkipChunkMaxSize(final int skipChunksBySize) { this.skipChunkMaxSize = skipChunksBySize; } @@ -888,7 +888,7 @@ public class PngReader { * These chunks will be skipped (the CRC will not be checked) and the chunk * will be saved as a PngChunkSkipped object. See also setSkipChunkMaxSize */ - public void setSkipChunkIds(String[] skipChunksById) { + public void setSkipChunkIds(final String[] skipChunksById) { this.skipChunkIds = skipChunksById == null ? new String[] {} : skipChunksById; } @@ -904,7 +904,7 @@ public class PngReader { *

* default=true */ - public void setShouldCloseStream(boolean shouldCloseStream) { + public void setShouldCloseStream(final boolean shouldCloseStream) { this.shouldCloseStream = shouldCloseStream; } @@ -936,7 +936,7 @@ public class PngReader { * * @param unPackedMode */ - public void setUnpackedMode(boolean unPackedMode) { + public void setUnpackedMode(final boolean unPackedMode) { this.unpackedMode = unPackedMode; } @@ -954,7 +954,7 @@ public class PngReader { * * @param other A PngReader that has already finished reading pixels. Can be null. */ - public void reuseBuffersFrom(PngReader other) { + public void reuseBuffersFrom(final PngReader other) { if(other==null) return; if (other.currentChunkGroup < ChunksList.CHUNK_GROUP_5_AFTERIDAT) throw new PngjInputException("PngReader to be reused have not yet ended reading pixels"); diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java index 2f475aab1..ed5dd7d69 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngWriter.java @@ -64,7 +64,7 @@ public class PngWriter { */ private int deflaterStrategy = Deflater.FILTERED; - private int[] histox = new int[256]; // auxiliar buffer, only used by reportResultsForFilter + private final int[] histox = new int[256]; // auxiliar buffer, only used by reportResultsForFilter private int idatMaxSize = 0; // 0=use default (PngIDatChunkOutputStream 32768) @@ -78,7 +78,7 @@ public class PngWriter { // this only influences the 1-2-4 bitdepth format - and if we pass a ImageLine to writeRow, this is ignored private boolean unpackedMode = false; - public PngWriter(OutputStream outputStream, ImageInfo imgInfo) { + public PngWriter(final OutputStream outputStream, final ImageInfo imgInfo) { this(outputStream, imgInfo, "[NO FILENAME AVAILABLE]"); } @@ -96,7 +96,7 @@ public class PngWriter { * @param filenameOrDescription * Optional, just for error/debug messages */ - public PngWriter(OutputStream outputStream, ImageInfo imgInfo, String filenameOrDescription) { + public PngWriter(final OutputStream outputStream, final ImageInfo imgInfo, final String filenameOrDescription) { this.filename = filenameOrDescription == null ? "" : filenameOrDescription; this.os = outputStream; this.imgInfo = imgInfo; @@ -111,29 +111,29 @@ public class PngWriter { private void init() { datStream = new PngIDatChunkOutputStream(this.os, idatMaxSize); - Deflater def = new Deflater(compLevel); + final Deflater def = new Deflater(compLevel); def.setStrategy(deflaterStrategy); datStreamDeflated = new DeflaterOutputStream(datStream, def); writeSignatureAndIHDR(); writeFirstChunks(); } - private void reportResultsForFilter(int rown, FilterType type, boolean tentative) { + private void reportResultsForFilter(final int rown, final FilterType type, final boolean tentative) { Arrays.fill(histox, 0); int s = 0, v; for (int i = 1; i <= imgInfo.bytesPerRow; i++) { v = rowbfilter[i]; if (v < 0) - s -= (int) v; + s -= v; else - s += (int) v; + s += v; histox[v & 0xFF]++; } filterStrat.fillResultsForFilter(rown, type, s, histox, tentative); } private void writeEndChunk() { - PngChunkIEND c = new PngChunkIEND(imgInfo); + final PngChunkIEND c = new PngChunkIEND(imgInfo); c.createRawChunk().writeChunk(os); } @@ -156,7 +156,7 @@ public class PngWriter { currentChunkGroup = ChunksList.CHUNK_GROUP_5_AFTERIDAT; chunksList.writeChunks(os, currentChunkGroup); // should not be unwriten chunks - List pending = chunksList.getQueuedChunks(); + final List pending = chunksList.getQueuedChunks(); if (!pending.isEmpty()) throw new PngjOutputException(pending.size() + " chunks were not written! Eg: " + pending.get(0).toString()); currentChunkGroup = ChunksList.CHUNK_GROUP_6_END; @@ -169,7 +169,7 @@ public class PngWriter { currentChunkGroup = ChunksList.CHUNK_GROUP_0_IDHR; PngHelperInternal.writeBytes(os, PngHelperInternal.getPngIdSignature()); // signature - PngChunkIHDR ihdr = new PngChunkIHDR(imgInfo); + final PngChunkIHDR ihdr = new PngChunkIHDR(imgInfo); // http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html ihdr.setCols(imgInfo.cols); ihdr.setRows(imgInfo.rows); @@ -189,16 +189,16 @@ public class PngWriter { } - protected void encodeRowFromByte(byte[] row) { + protected void encodeRowFromByte(final byte[] row) { if (row.length == imgInfo.samplesPerRowPacked) { // some duplication of code - because this case is typical and it works faster this way int j = 1; if (imgInfo.bitDepth <= 8) { - for (byte x : row) { // optimized + for (final byte x : row) { // optimized rowb[j++] = x; } } else { // 16 bitspc - for (byte x : row) { // optimized + for (final byte x : row) { // optimized rowb[j] = x; j += 2; } @@ -221,17 +221,17 @@ public class PngWriter { } } - protected void encodeRowFromInt(int[] row) { + protected void encodeRowFromInt(final int[] row) { // http://www.libpng.org/pub/png/spec/1.2/PNG-DataRep.html if (row.length == imgInfo.samplesPerRowPacked) { // some duplication of code - because this case is typical and it works faster this way int j = 1; if (imgInfo.bitDepth <= 8) { - for (int x : row) { // optimized + for (final int x : row) { // optimized rowb[j++] = (byte) x; } } else { // 16 bitspc - for (int x : row) { // optimized + for (final int x : row) { // optimized rowb[j++] = (byte) (x >> 8); rowb[j++] = (byte) (x); } @@ -253,7 +253,7 @@ public class PngWriter { } } - private void filterRow(int rown) { + private void filterRow(final int rown) { // warning: filters operation rely on: "previos row" (rowbprev) is // initialized to 0 the first time if (filterStrat.shouldTestAll(rown)) { @@ -268,7 +268,7 @@ public class PngWriter { filterRowPaeth(); reportResultsForFilter(rown, FilterType.FILTER_PAETH, true); } - FilterType filterType = filterStrat.gimmeFilterType(rown, true); + final FilterType filterType = filterStrat.gimmeFilterType(rown, true); rowbfilter[0] = (byte) filterType.val; switch (filterType) { case FILTER_NONE: @@ -292,23 +292,23 @@ public class PngWriter { reportResultsForFilter(rown, filterType, false); } - private void prepareEncodeRow(int rown) { + private void prepareEncodeRow(final int rown) { if (datStream == null) init(); rowNum++; if (rown >= 0 && rowNum != rown) throw new PngjOutputException("rows must be written in order: expected:" + rowNum + " passed:" + rown); // swap - byte[] tmp = rowb; + final byte[] tmp = rowb; rowb = rowbprev; rowbprev = tmp; } - private void filterAndSend(int rown) { + private void filterAndSend(final int rown) { filterRow(rown); try { datStreamDeflated.write(rowbfilter, 0, imgInfo.bytesPerRow + 1); - } catch (IOException e) { + } catch (final IOException e) { throw new PngjOutputException(e); } } @@ -323,7 +323,7 @@ public class PngWriter { protected void filterRowNone() { for (int i = 1; i <= imgInfo.bytesPerRow; i++) { - rowbfilter[i] = (byte) rowb[i]; + rowbfilter[i] = rowb[i]; } } @@ -341,7 +341,7 @@ public class PngWriter { protected void filterRowSub() { int i, j; for (i = 1; i <= imgInfo.bytesPixel; i++) - rowbfilter[i] = (byte) rowb[i]; + rowbfilter[i] = rowb[i]; for (j = 1, i = imgInfo.bytesPixel + 1; i <= imgInfo.bytesPerRow; i++, j++) { // !!! rowbfilter[i] = (byte) (rowb[i] - rowb[j]); rowbfilter[i] = (byte) PngHelperInternal.filterRowSub(rowb[i], rowb[j]); @@ -359,9 +359,9 @@ public class PngWriter { int s = 0; for (int i = 1; i <= imgInfo.bytesPerRow; i++) if (rowbfilter[i] < 0) - s -= (int) rowbfilter[i]; + s -= rowbfilter[i]; else - s += (int) rowbfilter[i]; + s += rowbfilter[i]; return s; } @@ -372,12 +372,12 @@ public class PngWriter { *

* TODO: this should be more customizable */ - private void copyChunks(PngReader reader, int copy_mask, boolean onlyAfterIdat) { - boolean idatDone = currentChunkGroup >= ChunksList.CHUNK_GROUP_4_IDAT; + private void copyChunks(final PngReader reader, final int copy_mask, final boolean onlyAfterIdat) { + final boolean idatDone = currentChunkGroup >= ChunksList.CHUNK_GROUP_4_IDAT; if (onlyAfterIdat && reader.getCurrentChunkGroup() < ChunksList.CHUNK_GROUP_6_END) throw new PngjExceptionInternal("tried to copy last chunks but reader has not ended"); - for (PngChunk chunk : reader.getChunksList().getChunks()) { - int group = chunk.getChunkGroup(); + for (final PngChunk chunk : reader.getChunksList().getChunks()) { + final int group = chunk.getChunkGroup(); if (group < ChunksList.CHUNK_GROUP_4_IDAT && idatDone) continue; boolean copy = false; @@ -389,8 +389,8 @@ public class PngWriter { copy = true; } } else { // ancillary - boolean text = (chunk instanceof PngChunkTextVar); - boolean safe = chunk.safe; + final boolean text = (chunk instanceof PngChunkTextVar); + final boolean safe = chunk.safe; // notice that these if are not exclusive if (ChunkHelper.maskMatch(copy_mask, ChunkCopyBehaviour.COPY_ALL)) copy = true; @@ -429,7 +429,7 @@ public class PngWriter { * : Mask bit (OR), see ChunksToWrite.COPY_XXX * constants */ - public void copyChunksFirst(PngReader reader, int copy_mask) { + public void copyChunksFirst(final PngReader reader, final int copy_mask) { copyChunks(reader, copy_mask, false); } @@ -446,7 +446,7 @@ public class PngWriter { * : Mask bit (OR), see ChunksToWrite.COPY_XXX * constants */ - public void copyChunksLast(PngReader reader, int copy_mask) { + public void copyChunksLast(final PngReader reader, final int copy_mask) { copyChunks(reader, copy_mask, true); } @@ -461,8 +461,8 @@ public class PngWriter { public double computeCompressionRatio() { if (currentChunkGroup < ChunksList.CHUNK_GROUP_6_END) throw new PngjOutputException("must be called after end()"); - double compressed = (double) datStream.getCountFlushed(); - double raw = (imgInfo.bytesPerRow + 1) * imgInfo.rows; + final double compressed = datStream.getCountFlushed(); + final double raw = (imgInfo.bytesPerRow + 1) * imgInfo.rows; return compressed / raw; } @@ -480,7 +480,7 @@ public class PngWriter { writeEndChunk(); if (shouldCloseStream) os.close(); - } catch (IOException e) { + } catch (final IOException e) { throw new PngjOutputException(e); } } @@ -516,7 +516,7 @@ public class PngWriter { * @param compLevel * between 0 and 9 (default:6 , recommended: 6 or more) */ - public void setCompLevel(int compLevel) { + public void setCompLevel(final int compLevel) { if (compLevel < 0 || compLevel > 9) throw new PngjOutputException("Compression level invalid (" + compLevel + ") Must be 0..9"); this.compLevel = compLevel; @@ -534,7 +534,7 @@ public class PngWriter { * PngFilterType) Recommended values: DEFAULT * (default) or AGGRESIVE */ - public void setFilterType(FilterType filterType) { + public void setFilterType(final FilterType filterType) { filterStrat = new FilterWriteStrategy(imgInfo, filterType); } @@ -546,7 +546,7 @@ public class PngWriter { * @param idatMaxSize * default=0 : use defaultSize (32K) */ - public void setIdatMaxSize(int idatMaxSize) { + public void setIdatMaxSize(final int idatMaxSize) { this.idatMaxSize = idatMaxSize; } @@ -555,7 +555,7 @@ public class PngWriter { *

* default=true */ - public void setShouldCloseStream(boolean shouldCloseStream) { + public void setShouldCloseStream(final boolean shouldCloseStream) { this.shouldCloseStream = shouldCloseStream; } @@ -565,7 +565,7 @@ public class PngWriter { *

* Default: Deflater.FILTERED . This should be changed very rarely. */ - public void setDeflaterStrategy(int deflaterStrategy) { + public void setDeflaterStrategy(final int deflaterStrategy) { this.deflaterStrategy = deflaterStrategy; } @@ -575,7 +575,7 @@ public class PngWriter { * * @deprecated Better use writeRow(ImageLine imgline, int rownumber) */ - public void writeRow(ImageLine imgline) { + public void writeRow(final ImageLine imgline) { writeRow(imgline.scanline, imgline.getRown()); } @@ -586,7 +586,7 @@ public class PngWriter { * * @see #writeRowInt(int[], int) */ - public void writeRow(ImageLine imgline, int rownumber) { + public void writeRow(final ImageLine imgline, final int rownumber) { unpackedMode = imgline.samplesUnpacked; if (imgline.sampleType == SampleType.INT) writeRowInt(imgline.scanline, rownumber); @@ -599,7 +599,7 @@ public class PngWriter { * * @param newrow */ - public void writeRow(int[] newrow) { + public void writeRow(final int[] newrow) { writeRow(newrow, -1); } @@ -608,7 +608,7 @@ public class PngWriter { * * @see #writeRowInt(int[], int) */ - public void writeRow(int[] newrow, int rown) { + public void writeRow(final int[] newrow, final int rown) { writeRowInt(newrow, rown); } @@ -632,7 +632,7 @@ public class PngWriter { * Row number, from 0 (top) to rows-1 (bottom). This is just used * as a check. Pass -1 if you want to autocompute it */ - public void writeRowInt(int[] newrow, int rown) { + public void writeRowInt(final int[] newrow, final int rown) { prepareEncodeRow(rown); encodeRowFromInt(newrow); filterAndSend(rown); @@ -645,7 +645,7 @@ public class PngWriter { * * @see PngWriter#writeRowInt(int[], int) */ - public void writeRowByte(byte[] newrow, int rown) { + public void writeRowByte(final byte[] newrow, final int rown) { prepareEncodeRow(rown); encodeRowFromByte(newrow); filterAndSend(rown); @@ -654,7 +654,7 @@ public class PngWriter { /** * Writes all the pixels, calling writeRowInt() for each image row */ - public void writeRowsInt(int[][] image) { + public void writeRowsInt(final int[][] image) { for (int i = 0; i < imgInfo.rows; i++) writeRowInt(image[i], i); } @@ -662,7 +662,7 @@ public class PngWriter { /** * Writes all the pixels, calling writeRowByte() for each image row */ - public void writeRowsByte(byte[][] image) { + public void writeRowsByte(final byte[][] image) { for (int i = 0; i < imgInfo.rows; i++) writeRowByte(image[i], i); } @@ -682,7 +682,7 @@ public class PngWriter { * packed flag of the ImageLine object overrides (and overwrites!) * this field. */ - public void setUseUnPackedMode(boolean useUnpackedMode) { + public void setUseUnPackedMode(final boolean useUnpackedMode) { this.unpackedMode = useUnpackedMode; } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngjBadCrcException.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngjBadCrcException.java index 3b74f862f..032b2ed3a 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngjBadCrcException.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngjBadCrcException.java @@ -6,15 +6,15 @@ package jogamp.opengl.util.pngj; public class PngjBadCrcException extends PngjInputException { private static final long serialVersionUID = 1L; - public PngjBadCrcException(String message, Throwable cause) { + public PngjBadCrcException(final String message, final Throwable cause) { super(message, cause); } - public PngjBadCrcException(String message) { + public PngjBadCrcException(final String message) { super(message); } - public PngjBadCrcException(Throwable cause) { + public PngjBadCrcException(final Throwable cause) { super(cause); } } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java index 97e24fc73..3d05589b1 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngjException.java @@ -9,15 +9,15 @@ package jogamp.opengl.util.pngj; public class PngjException extends RuntimeException { private static final long serialVersionUID = 1L; - public PngjException(String message, Throwable cause) { + public PngjException(final String message, final Throwable cause) { super(message, cause); } - public PngjException(String message) { + public PngjException(final String message) { super(message); } - public PngjException(Throwable cause) { + public PngjException(final Throwable cause) { super(cause); } } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java index 5da70de7b..9484abf5e 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngjExceptionInternal.java @@ -10,15 +10,15 @@ package jogamp.opengl.util.pngj; public class PngjExceptionInternal extends RuntimeException { private static final long serialVersionUID = 1L; - public PngjExceptionInternal(String message, Throwable cause) { + public PngjExceptionInternal(final String message, final Throwable cause) { super(message, cause); } - public PngjExceptionInternal(String message) { + public PngjExceptionInternal(final String message) { super(message); } - public PngjExceptionInternal(Throwable cause) { + public PngjExceptionInternal(final Throwable cause) { super(cause); } } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngjInputException.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngjInputException.java index 5cc36b99a..c92d80b2c 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngjInputException.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngjInputException.java @@ -6,15 +6,15 @@ package jogamp.opengl.util.pngj; public class PngjInputException extends PngjException { private static final long serialVersionUID = 1L; - public PngjInputException(String message, Throwable cause) { + public PngjInputException(final String message, final Throwable cause) { super(message, cause); } - public PngjInputException(String message) { + public PngjInputException(final String message) { super(message); } - public PngjInputException(Throwable cause) { + public PngjInputException(final Throwable cause) { super(cause); } } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngjOutputException.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngjOutputException.java index c8cd36acb..4e9cdc950 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngjOutputException.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngjOutputException.java @@ -6,15 +6,15 @@ package jogamp.opengl.util.pngj; public class PngjOutputException extends PngjException { private static final long serialVersionUID = 1L; - public PngjOutputException(String message, Throwable cause) { + public PngjOutputException(final String message, final Throwable cause) { super(message, cause); } - public PngjOutputException(String message) { + public PngjOutputException(final String message) { super(message); } - public PngjOutputException(Throwable cause) { + public PngjOutputException(final Throwable cause) { super(cause); } } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/PngjUnsupportedException.java b/src/jogl/classes/jogamp/opengl/util/pngj/PngjUnsupportedException.java index f68458d19..e68b153ac 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/PngjUnsupportedException.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/PngjUnsupportedException.java @@ -11,15 +11,15 @@ public class PngjUnsupportedException extends RuntimeException { super(); } - public PngjUnsupportedException(String message, Throwable cause) { + public PngjUnsupportedException(final String message, final Throwable cause) { super(message, cause); } - public PngjUnsupportedException(String message) { + public PngjUnsupportedException(final String message) { super(message); } - public PngjUnsupportedException(Throwable cause) { + public PngjUnsupportedException(final Throwable cause) { super(cause); } } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/ProgressiveOutputStream.java b/src/jogl/classes/jogamp/opengl/util/pngj/ProgressiveOutputStream.java index 4516a0886..248472298 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/ProgressiveOutputStream.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/ProgressiveOutputStream.java @@ -11,7 +11,7 @@ abstract class ProgressiveOutputStream extends ByteArrayOutputStream { private final int size; private long countFlushed = 0; - public ProgressiveOutputStream(int size) { + public ProgressiveOutputStream(final int size) { this.size = size; } @@ -28,19 +28,19 @@ abstract class ProgressiveOutputStream extends ByteArrayOutputStream { } @Override - public final void write(byte[] b, int off, int len) { + public final void write(final byte[] b, final int off, final int len) { super.write(b, off, len); checkFlushBuffer(false); } @Override - public final void write(byte[] b) throws IOException { + public final void write(final byte[] b) throws IOException { super.write(b); checkFlushBuffer(false); } @Override - public final void write(int arg0) { + public final void write(final int arg0) { super.write(arg0); checkFlushBuffer(false); } @@ -54,7 +54,7 @@ abstract class ProgressiveOutputStream extends ByteArrayOutputStream { * if it's time to flush data (or if forced==true) calls abstract method * flushBuffer() and cleans those bytes from own buffer */ - private final void checkFlushBuffer(boolean forced) { + private final void checkFlushBuffer(final boolean forced) { while (forced || count >= size) { int nb = size; if (nb > count) @@ -63,7 +63,7 @@ abstract class ProgressiveOutputStream extends ByteArrayOutputStream { return; flushBuffer(buf, nb); countFlushed += nb; - int bytesleft = count - nb; + final int bytesleft = count - nb; count = bytesleft; if (bytesleft > 0) System.arraycopy(buf, nb, buf, 0, bytesleft); diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java index 4e8bf5635..b8cfd8691 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkHelper.java @@ -68,63 +68,63 @@ public class ChunkHelper { /** * Converts to bytes using Latin1 (ISO-8859-1) */ - public static byte[] toBytes(String x) { + public static byte[] toBytes(final String x) { return x.getBytes(PngHelperInternal.charsetLatin1); } /** * Converts to String using Latin1 (ISO-8859-1) */ - public static String toString(byte[] x) { + public static String toString(final byte[] x) { return new String(x, PngHelperInternal.charsetLatin1); } /** * Converts to String using Latin1 (ISO-8859-1) */ - public static String toString(byte[] x, int offset, int len) { + public static String toString(final byte[] x, final int offset, final int len) { return new String(x, offset, len, PngHelperInternal.charsetLatin1); } /** * Converts to bytes using UTF-8 */ - public static byte[] toBytesUTF8(String x) { + public static byte[] toBytesUTF8(final String x) { return x.getBytes(PngHelperInternal.charsetUTF8); } /** * Converts to string using UTF-8 */ - public static String toStringUTF8(byte[] x) { + public static String toStringUTF8(final byte[] x) { return new String(x, PngHelperInternal.charsetUTF8); } /** * Converts to string using UTF-8 */ - public static String toStringUTF8(byte[] x, int offset, int len) { + public static String toStringUTF8(final byte[] x, final int offset, final int len) { return new String(x, offset, len, PngHelperInternal.charsetUTF8); } /** * critical chunk : first letter is uppercase */ - public static boolean isCritical(String id) { + public static boolean isCritical(final String id) { return (Character.isUpperCase(id.charAt(0))); } /** * public chunk: second letter is uppercase */ - public static boolean isPublic(String id) { // + public static boolean isPublic(final String id) { // return (Character.isUpperCase(id.charAt(1))); } /** * Safe to copy chunk: fourth letter is lower case */ - public static boolean isSafeToCopy(String id) { + public static boolean isSafeToCopy(final String id) { return (!Character.isUpperCase(id.charAt(3))); } @@ -132,7 +132,7 @@ public class ChunkHelper { * "Unknown" just means that our chunk factory (even when it has been * augmented by client code) did not recognize its id */ - public static boolean isUnknown(PngChunk c) { + public static boolean isUnknown(final PngChunk c) { return c instanceof PngChunkUNKNOWN; } @@ -142,7 +142,7 @@ public class ChunkHelper { * @param b * @return -1 if not found */ - public static int posNullByte(byte[] b) { + public static int posNullByte(final byte[] b) { for (int i = 0; i < b.length; i++) if (b[i] == 0) return i; @@ -156,10 +156,10 @@ public class ChunkHelper { * @param behav * @return true/false */ - public static boolean shouldLoad(String id, ChunkLoadBehaviour behav) { + public static boolean shouldLoad(final String id, final ChunkLoadBehaviour behav) { if (isCritical(id)) return true; - boolean kwown = PngChunk.isKnown(id); + final boolean kwown = PngChunk.isKnown(id); switch (behav) { case LOAD_CHUNK_ALWAYS: return true; @@ -173,21 +173,21 @@ public class ChunkHelper { return false; // should not reach here } - public final static byte[] compressBytes(byte[] ori, boolean compress) { + public final static byte[] compressBytes(final byte[] ori, final boolean compress) { return compressBytes(ori, 0, ori.length, compress); } - public static byte[] compressBytes(byte[] ori, int offset, int len, boolean compress) { + public static byte[] compressBytes(final byte[] ori, final int offset, final int len, final boolean compress) { try { - ByteArrayInputStream inb = new ByteArrayInputStream(ori, offset, len); - InputStream in = compress ? inb : new InflaterInputStream(inb, getInflater()); - ByteArrayOutputStream outb = new ByteArrayOutputStream(); - OutputStream out = compress ? new DeflaterOutputStream(outb) : outb; + final ByteArrayInputStream inb = new ByteArrayInputStream(ori, offset, len); + final InputStream in = compress ? inb : new InflaterInputStream(inb, getInflater()); + final ByteArrayOutputStream outb = new ByteArrayOutputStream(); + final OutputStream out = compress ? new DeflaterOutputStream(outb) : outb; shovelInToOut(in, out); in.close(); out.close(); return outb.toByteArray(); - } catch (Exception e) { + } catch (final Exception e) { throw new PngjException(e); } } @@ -195,7 +195,7 @@ public class ChunkHelper { /** * Shovels all data from an input stream to an output stream. */ - private static void shovelInToOut(InputStream in, OutputStream out) throws IOException { + private static void shovelInToOut(final InputStream in, final OutputStream out) throws IOException { synchronized (tmpbuffer) { int len; while ((len = in.read(tmpbuffer)) > 0) { @@ -204,7 +204,7 @@ public class ChunkHelper { } } - public static boolean maskMatch(int v, int mask) { + public static boolean maskMatch(final int v, final int mask) { return (v & mask) != 0; } @@ -213,9 +213,9 @@ public class ChunkHelper { * * See also trimList() */ - public static List filterList(List target, ChunkPredicate predicateKeep) { - List result = new ArrayList(); - for (PngChunk element : target) { + public static List filterList(final List target, final ChunkPredicate predicateKeep) { + final List result = new ArrayList(); + for (final PngChunk element : target) { if (predicateKeep.match(element)) { result.add(element); } @@ -228,11 +228,11 @@ public class ChunkHelper { * * See also filterList */ - public static int trimList(List target, ChunkPredicate predicateRemove) { - Iterator it = target.iterator(); + public static int trimList(final List target, final ChunkPredicate predicateRemove) { + final Iterator it = target.iterator(); int cont = 0; while (it.hasNext()) { - PngChunk c = it.next(); + final PngChunk c = it.next(); if (predicateRemove.match(c)) { it.remove(); cont++; @@ -252,7 +252,7 @@ public class ChunkHelper { * * @return true if "equivalent" */ - public static final boolean equivalent(PngChunk c1, PngChunk c2) { + public static final boolean equivalent(final PngChunk c1, final PngChunk c2) { if (c1 == c2) return true; if (c1 == null || c2 == null || !c1.id.equals(c2.id)) @@ -272,7 +272,7 @@ public class ChunkHelper { return false; } - public static boolean isText(PngChunk c) { + public static boolean isText(final PngChunk c) { return c instanceof PngChunkTextVar; } @@ -281,7 +281,7 @@ public class ChunkHelper { * individual chunks compression */ public static Inflater getInflater() { - Inflater inflater = inflaterProvider.get(); + final Inflater inflater = inflaterProvider.get(); inflater.reset(); return inflater; } @@ -291,7 +291,7 @@ public class ChunkHelper { * individual chunks decompression */ public static Deflater getDeflater() { - Deflater deflater = deflaterProvider.get(); + final Deflater deflater = deflaterProvider.get(); deflater.reset(); return deflater; } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java index dcb1958df..0ac2dc6a0 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunkRaw.java @@ -50,7 +50,7 @@ public class ChunkRaw { * @param alloc * : it true, the data array will be allocced */ - public ChunkRaw(int len, byte[] idbytes, boolean alloc) { + public ChunkRaw(final int len, final byte[] idbytes, final boolean alloc) { this.len = len; System.arraycopy(idbytes, 0, this.idbytes, 0, 4); if (alloc) @@ -66,7 +66,7 @@ public class ChunkRaw { * this is called after setting data, before writing to os */ private int computeCrc() { - CRC32 crcengine = PngHelperInternal.getCRC(); + final CRC32 crcengine = PngHelperInternal.getCRC(); crcengine.reset(); crcengine.update(idbytes, 0, 4); if (len > 0) @@ -78,7 +78,7 @@ public class ChunkRaw { * Computes the CRC and writes to the stream. If error, a * PngjOutputException is thrown */ - public void writeChunk(OutputStream os) { + public void writeChunk(final OutputStream os) { if (idbytes.length != 4) throw new PngjOutputException("bad chunkid [" + ChunkHelper.toString(idbytes) + "]"); crcval = computeCrc(); @@ -93,11 +93,11 @@ public class ChunkRaw { * position before: just after chunk id. positon after: after crc Data * should be already allocated. Checks CRC Return number of byte read. */ - public int readChunkData(InputStream is, boolean checkCrc) { + public int readChunkData(final InputStream is, final boolean checkCrc) { PngHelperInternal.readBytes(is, data, 0, len); crcval = PngHelperInternal.readInt4(is); if (checkCrc) { - int crc = computeCrc(); + final int crc = computeCrc(); if (crc != crcval) throw new PngjBadCrcException("chunk: " + this + " crc calc=" + crc + " read=" + crcval); } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java index 75107d761..f5a920e73 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksList.java @@ -31,7 +31,7 @@ public class ChunksList { final ImageInfo imageInfo; // only required for writing - public ChunksList(ImageInfo imfinfo) { + public ChunksList(final ImageInfo imfinfo) { this.imageInfo = imfinfo; } @@ -41,8 +41,8 @@ public class ChunksList { * @return key:chunk id, val: number of occurrences */ public HashMap getChunksKeys() { - HashMap ck = new HashMap(); - for (PngChunk c : chunks) { + final HashMap ck = new HashMap(); + for (final PngChunk c : chunks) { ck.put(c.id, ck.containsKey(c.id) ? ck.get(c.id) + 1 : 1); } return ck; @@ -60,14 +60,14 @@ public class ChunksList { if (innerid == null) return ChunkHelper.filterList(list, new ChunkPredicate() { @Override - public boolean match(PngChunk c) { + public boolean match(final PngChunk c) { return c.id.equals(id); } }); else return ChunkHelper.filterList(list, new ChunkPredicate() { @Override - public boolean match(PngChunk c) { + public boolean match(final PngChunk c) { if (!c.id.equals(id)) return false; if (c instanceof PngChunkTextVar && !((PngChunkTextVar) c).getKey().equals(innerid)) @@ -82,7 +82,7 @@ public class ChunksList { /** * Adds chunk in next position. This is used onyl by the pngReader */ - public void appendReadChunk(PngChunk chunk, int chunkGroup) { + public void appendReadChunk(final PngChunk chunk, final int chunkGroup) { chunk.setChunkGroup(chunkGroup); chunks.add(chunk); } @@ -138,7 +138,7 @@ public class ChunksList { * one is returned (failifMultiple=false) **/ public PngChunk getById1(final String id, final String innerid, final boolean failIfMultiple) { - List list = getById(id, innerid); + final List list = getById(id, innerid); if (list.isEmpty()) return null; if (list.size() > 1 && (failIfMultiple || !list.get(0).allowsMultiple())) @@ -155,7 +155,7 @@ public class ChunksList { public List getEquivalent(final PngChunk c2) { return ChunkHelper.filterList(chunks, new ChunkPredicate() { @Override - public boolean match(PngChunk c) { + public boolean match(final PngChunk c) { return ChunkHelper.equivalent(c, c2); } }); @@ -170,9 +170,9 @@ public class ChunksList { * for debugging */ public String toStringFull() { - StringBuilder sb = new StringBuilder(toString()); + final StringBuilder sb = new StringBuilder(toString()); sb.append("\n Read:\n"); - for (PngChunk chunk : chunks) { + for (final PngChunk chunk : chunks) { sb.append(chunk).append(" G=" + chunk.getChunkGroup() + "\n"); } return sb.toString(); diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java index c502e9071..6ad61f8e2 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/ChunksListForWrite.java @@ -19,9 +19,9 @@ public class ChunksListForWrite extends ChunksList { private final List queuedChunks = new ArrayList(); // redundant, just for eficciency - private HashMap alreadyWrittenKeys = new HashMap(); + private final HashMap alreadyWrittenKeys = new HashMap(); - public ChunksListForWrite(ImageInfo imfinfo) { + public ChunksListForWrite(final ImageInfo imfinfo) { super(imfinfo); } @@ -43,7 +43,7 @@ public class ChunksListForWrite extends ChunksList { * Same as getById1(), but looking in the queued chunks **/ public PngChunk getQueuedById1(final String id, final String innerid, final boolean failIfMultiple) { - List list = getQueuedById(id, innerid); + final List list = getQueuedById(id, innerid); if (list.isEmpty()) return null; if (list.size() > 1 && (failIfMultiple || !list.get(0).allowsMultiple())) @@ -72,7 +72,7 @@ public class ChunksListForWrite extends ChunksList { * straightforward for SingleChunks. For MultipleChunks, it will normally * check for reference equality! */ - public boolean removeChunk(PngChunk c) { + public boolean removeChunk(final PngChunk c) { return queuedChunks.remove(c); } @@ -83,7 +83,7 @@ public class ChunksListForWrite extends ChunksList { * * @param c */ - public boolean queue(PngChunk c) { + public boolean queue(final PngChunk c) { queuedChunks.add(c); return true; } @@ -92,7 +92,7 @@ public class ChunksListForWrite extends ChunksList { * this should be called only for ancillary chunks and PLTE (groups 1 - 3 - * 5) **/ - private static boolean shouldWrite(PngChunk c, int currentGroup) { + private static boolean shouldWrite(final PngChunk c, final int currentGroup) { if (currentGroup == CHUNK_GROUP_2_PLTE) return c.id.equals(ChunkHelper.PLTE); if (currentGroup % 2 == 0) @@ -121,11 +121,11 @@ public class ChunksListForWrite extends ChunksList { return false; } - public int writeChunks(OutputStream os, int currentGroup) { + public int writeChunks(final OutputStream os, final int currentGroup) { int cont = 0; - Iterator it = queuedChunks.iterator(); + final Iterator it = queuedChunks.iterator(); while (it.hasNext()) { - PngChunk c = it.next(); + final PngChunk c = it.next(); if (!shouldWrite(c, currentGroup)) continue; if (ChunkHelper.isCritical(c.id) && !c.id.equals(ChunkHelper.PLTE)) @@ -159,14 +159,14 @@ public class ChunksListForWrite extends ChunksList { */ @Override public String toStringFull() { - StringBuilder sb = new StringBuilder(toString()); + final StringBuilder sb = new StringBuilder(toString()); sb.append("\n Written:\n"); - for (PngChunk chunk : chunks) { + for (final PngChunk chunk : chunks) { sb.append(chunk).append(" G=" + chunk.getChunkGroup() + "\n"); } if (!queuedChunks.isEmpty()) { sb.append(" Queued:\n"); - for (PngChunk chunk : queuedChunks) { + for (final PngChunk chunk : queuedChunks) { sb.append(chunk).append("\n"); } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java index 6cd86eb98..eba218fe3 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunk.java @@ -122,7 +122,7 @@ public abstract class PngChunk { * (not implmemented in this library) to the factory, so that the PngReader * knows about it. */ - public static void factoryRegister(String chunkId, Class chunkClass) { + public static void factoryRegister(final String chunkId, final Class chunkClass) { factoryMap.put(chunkId, chunkClass); } @@ -137,11 +137,11 @@ public abstract class PngChunk { *

* Unknown chunks will be parsed as instances of {@link PngChunkUNKNOWN} */ - public static boolean isKnown(String id) { + public static boolean isKnown(final String id) { return factoryMap.containsKey(id); } - protected PngChunk(String id, ImageInfo imgInfo) { + protected PngChunk(final String id, final ImageInfo imgInfo) { this.id = id; this.imgInfo = imgInfo; this.crit = ChunkHelper.isCritical(id); @@ -153,8 +153,8 @@ public abstract class PngChunk { * This factory creates the corresponding chunk and parses the raw chunk. * This is used when reading. */ - public static PngChunk factory(ChunkRaw chunk, ImageInfo info) { - PngChunk c = factoryFromId(ChunkHelper.toString(chunk.idbytes), info); + public static PngChunk factory(final ChunkRaw chunk, final ImageInfo info) { + final PngChunk c = factoryFromId(ChunkHelper.toString(chunk.idbytes), info); c.length = chunk.len; c.parseFromRaw(chunk); return c; @@ -164,15 +164,15 @@ public abstract class PngChunk { * Creates one new blank chunk of the corresponding type, according to * factoryMap (PngChunkUNKNOWN if not known) */ - public static PngChunk factoryFromId(String cid, ImageInfo info) { + public static PngChunk factoryFromId(final String cid, final ImageInfo info) { PngChunk chunk = null; try { - Class cla = factoryMap.get(cid); + final Class cla = factoryMap.get(cid); if (cla != null) { - Constructor constr = cla.getConstructor(ImageInfo.class); + final Constructor constr = cla.getConstructor(ImageInfo.class); chunk = constr.newInstance(info); } - } catch (Exception e) { + } catch (final Exception e) { // this can happen for unkown chunks } if (chunk == null) @@ -180,8 +180,8 @@ public abstract class PngChunk { return chunk; } - protected final ChunkRaw createEmptyChunk(int len, boolean alloc) { - ChunkRaw c = new ChunkRaw(len, ChunkHelper.toBytes(id), alloc); + protected final ChunkRaw createEmptyChunk(final int len, final boolean alloc) { + final ChunkRaw c = new ChunkRaw(len, ChunkHelper.toBytes(id), alloc); return c; } @@ -189,8 +189,8 @@ public abstract class PngChunk { * Makes a clone (deep copy) calling {@link #cloneDataFromRead(PngChunk)} */ @SuppressWarnings("unchecked") - public static T cloneChunk(T chunk, ImageInfo info) { - PngChunk cn = factoryFromId(chunk.id, info); + public static T cloneChunk(final T chunk, final ImageInfo info) { + final PngChunk cn = factoryFromId(chunk.id, info); if (cn.getClass() != chunk.getClass()) throw new PngjExceptionInternal("bad class cloning chunk: " + cn.getClass() + " " + chunk.getClass()); cn.cloneDataFromRead(chunk); @@ -210,7 +210,7 @@ public abstract class PngChunk { /** * @see #getChunkGroup() */ - final public void setChunkGroup(int chunkGroup) { + final public void setChunkGroup(final int chunkGroup) { this.chunkGroup = chunkGroup; } @@ -218,12 +218,12 @@ public abstract class PngChunk { return priority; } - public void setPriority(boolean priority) { + public void setPriority(final boolean priority) { this.priority = priority; } - final void write(OutputStream os) { - ChunkRaw c = createRawChunk(); + final void write(final OutputStream os) { + final ChunkRaw c = createRawChunk(); if (c == null) throw new PngjExceptionInternal("null chunk ! creation failed for " + this); c.writeChunk(os); @@ -241,7 +241,7 @@ public abstract class PngChunk { return offset; } - public void setOffset(long offset) { + public void setOffset(final long offset) { this.offset = offset; } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java index ea6235432..191278dbc 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkBKGD.java @@ -18,7 +18,7 @@ public class PngChunkBKGD extends PngChunkSingle { private int red, green, blue; private int paletteIndex; - public PngChunkBKGD(ImageInfo info) { + public PngChunkBKGD(final ImageInfo info) { super(ChunkHelper.bKGD, info); } @@ -46,11 +46,11 @@ public class PngChunkBKGD extends PngChunkSingle { } @Override - public void parseFromRaw(ChunkRaw c) { + public void parseFromRaw(final ChunkRaw c) { if (imgInfo.greyscale) { gray = PngHelperInternal.readInt2fromBytes(c.data, 0); } else if (imgInfo.indexed) { - paletteIndex = (int) (c.data[0] & 0xff); + paletteIndex = c.data[0] & 0xff; } else { red = PngHelperInternal.readInt2fromBytes(c.data, 0); green = PngHelperInternal.readInt2fromBytes(c.data, 2); @@ -59,8 +59,8 @@ public class PngChunkBKGD extends PngChunkSingle { } @Override - public void cloneDataFromRead(PngChunk other) { - PngChunkBKGD otherx = (PngChunkBKGD) other; + public void cloneDataFromRead(final PngChunk other) { + final PngChunkBKGD otherx = (PngChunkBKGD) other; gray = otherx.gray; red = otherx.red; green = otherx.red; @@ -73,7 +73,7 @@ public class PngChunkBKGD extends PngChunkSingle { * * @param gray */ - public void setGray(int gray) { + public void setGray(final int gray) { if (!imgInfo.greyscale) throw new PngjException("only gray images support this"); this.gray = gray; @@ -89,7 +89,7 @@ public class PngChunkBKGD extends PngChunkSingle { * Set pallette index * */ - public void setPaletteIndex(int i) { + public void setPaletteIndex(final int i) { if (!imgInfo.indexed) throw new PngjException("only indexed (pallete) images support this"); this.paletteIndex = i; @@ -105,7 +105,7 @@ public class PngChunkBKGD extends PngChunkSingle { * Set rgb values * */ - public void setRGB(int r, int g, int b) { + public void setRGB(final int r, final int g, final int b) { if (imgInfo.greyscale || imgInfo.indexed) throw new PngjException("only rgb or rgba images support this"); red = r; diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkCHRM.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkCHRM.java index 25a4bf2d6..8bdd7b4c0 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkCHRM.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkCHRM.java @@ -18,7 +18,7 @@ public class PngChunkCHRM extends PngChunkSingle { private double greenx, greeny; private double bluex, bluey; - public PngChunkCHRM(ImageInfo info) { + public PngChunkCHRM(final ImageInfo info) { super(ID, info); } @@ -43,7 +43,7 @@ public class PngChunkCHRM extends PngChunkSingle { } @Override - public void parseFromRaw(ChunkRaw c) { + public void parseFromRaw(final ChunkRaw c) { if (c.len != 32) throw new PngjException("bad chunk " + c); whitex = PngHelperInternal.intToDouble100000(PngHelperInternal.readInt4fromBytes(c.data, 0)); @@ -57,8 +57,8 @@ public class PngChunkCHRM extends PngChunkSingle { } @Override - public void cloneDataFromRead(PngChunk other) { - PngChunkCHRM otherx = (PngChunkCHRM) other; + public void cloneDataFromRead(final PngChunk other) { + final PngChunkCHRM otherx = (PngChunkCHRM) other; whitex = otherx.whitex; whitey = otherx.whitex; redx = otherx.redx; @@ -69,8 +69,8 @@ public class PngChunkCHRM extends PngChunkSingle { bluey = otherx.bluey; } - public void setChromaticities(double whitex, double whitey, double redx, double redy, double greenx, double greeny, - double bluex, double bluey) { + public void setChromaticities(final double whitex, final double whitey, final double redx, final double redy, final double greenx, final double greeny, + final double bluex, final double bluey) { this.whitex = whitex; this.redx = redx; this.greenx = greenx; diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkGAMA.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkGAMA.java index 74640746e..6b627326c 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkGAMA.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkGAMA.java @@ -15,7 +15,7 @@ public class PngChunkGAMA extends PngChunkSingle { // http://www.w3.org/TR/PNG/#11gAMA private double gamma; - public PngChunkGAMA(ImageInfo info) { + public PngChunkGAMA(final ImageInfo info) { super(ID, info); } @@ -26,22 +26,22 @@ public class PngChunkGAMA extends PngChunkSingle { @Override public ChunkRaw createRawChunk() { - ChunkRaw c = createEmptyChunk(4, true); - int g = (int) (gamma * 100000 + 0.5); + final ChunkRaw c = createEmptyChunk(4, true); + final int g = (int) (gamma * 100000 + 0.5); PngHelperInternal.writeInt4tobytes(g, c.data, 0); return c; } @Override - public void parseFromRaw(ChunkRaw chunk) { + public void parseFromRaw(final ChunkRaw chunk) { if (chunk.len != 4) throw new PngjException("bad chunk " + chunk); - int g = PngHelperInternal.readInt4fromBytes(chunk.data, 0); - gamma = ((double) g) / 100000.0; + final int g = PngHelperInternal.readInt4fromBytes(chunk.data, 0); + gamma = (g) / 100000.0; } @Override - public void cloneDataFromRead(PngChunk other) { + public void cloneDataFromRead(final PngChunk other) { gamma = ((PngChunkGAMA) other).gamma; } @@ -49,7 +49,7 @@ public class PngChunkGAMA extends PngChunkSingle { return gamma; } - public void setGamma(double gamma) { + public void setGamma(final double gamma) { this.gamma = gamma; } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkHIST.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkHIST.java index 6dc3fd9ec..4a4832d3b 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkHIST.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkHIST.java @@ -15,7 +15,7 @@ public class PngChunkHIST extends PngChunkSingle { private int[] hist = new int[0]; // should have same lenght as palette - public PngChunkHIST(ImageInfo info) { + public PngChunkHIST(final ImageInfo info) { super(ID, info); } @@ -25,10 +25,10 @@ public class PngChunkHIST extends PngChunkSingle { } @Override - public void parseFromRaw(ChunkRaw c) { + public void parseFromRaw(final ChunkRaw c) { if (!imgInfo.indexed) throw new PngjException("only indexed images accept a HIST chunk"); - int nentries = c.data.length / 2; + final int nentries = c.data.length / 2; hist = new int[nentries]; for (int i = 0; i < hist.length; i++) { hist[i] = PngHelperInternal.readInt2fromBytes(c.data, i * 2); @@ -48,8 +48,8 @@ public class PngChunkHIST extends PngChunkSingle { } @Override - public void cloneDataFromRead(PngChunk other) { - PngChunkHIST otherx = (PngChunkHIST) other; + public void cloneDataFromRead(final PngChunk other) { + final PngChunkHIST otherx = (PngChunkHIST) other; hist = new int[otherx.hist.length]; System.arraycopy(otherx.hist, 0, hist, 0, otherx.hist.length); } @@ -58,7 +58,7 @@ public class PngChunkHIST extends PngChunkSingle { return hist; } - public void setHist(int[] hist) { + public void setHist(final int[] hist) { this.hist = hist; } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkICCP.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkICCP.java index 399577d72..17f69861c 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkICCP.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkICCP.java @@ -16,7 +16,7 @@ public class PngChunkICCP extends PngChunkSingle { private String profileName; private byte[] compressedProfile; // copmression/decopmresion is done in getter/setter - public PngChunkICCP(ImageInfo info) { + public PngChunkICCP(final ImageInfo info) { super(ID, info); } @@ -27,7 +27,7 @@ public class PngChunkICCP extends PngChunkSingle { @Override public ChunkRaw createRawChunk() { - ChunkRaw c = createEmptyChunk(profileName.length() + compressedProfile.length + 2, true); + final ChunkRaw c = createEmptyChunk(profileName.length() + compressedProfile.length + 2, true); System.arraycopy(ChunkHelper.toBytes(profileName), 0, c.data, 0, profileName.length()); c.data[profileName.length()] = 0; c.data[profileName.length() + 1] = 0; @@ -36,20 +36,20 @@ public class PngChunkICCP extends PngChunkSingle { } @Override - public void parseFromRaw(ChunkRaw chunk) { - int pos0 = ChunkHelper.posNullByte(chunk.data); + public void parseFromRaw(final ChunkRaw chunk) { + final int pos0 = ChunkHelper.posNullByte(chunk.data); profileName = new String(chunk.data, 0, pos0, PngHelperInternal.charsetLatin1); - int comp = (chunk.data[pos0 + 1] & 0xff); + final int comp = (chunk.data[pos0 + 1] & 0xff); if (comp != 0) throw new PngjException("bad compression for ChunkTypeICCP"); - int compdatasize = chunk.data.length - (pos0 + 2); + final int compdatasize = chunk.data.length - (pos0 + 2); compressedProfile = new byte[compdatasize]; System.arraycopy(chunk.data, pos0 + 2, compressedProfile, 0, compdatasize); } @Override - public void cloneDataFromRead(PngChunk other) { - PngChunkICCP otherx = (PngChunkICCP) other; + public void cloneDataFromRead(final PngChunk other) { + final PngChunkICCP otherx = (PngChunkICCP) other; profileName = otherx.profileName; compressedProfile = new byte[otherx.compressedProfile.length]; System.arraycopy(otherx.compressedProfile, 0, compressedProfile, 0, otherx.compressedProfile.length); // deep @@ -59,12 +59,12 @@ public class PngChunkICCP extends PngChunkSingle { /** * The profile should be uncompressed bytes */ - public void setProfileNameAndContent(String name, byte[] profile) { + public void setProfileNameAndContent(final String name, final byte[] profile) { profileName = name; compressedProfile = ChunkHelper.compressBytes(profile, true); } - public void setProfileNameAndContent(String name, String profile) { + public void setProfileNameAndContent(final String name, final String profile) { setProfileNameAndContent(name, profile.getBytes(PngHelperInternal.charsetLatin1)); } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIDAT.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIDAT.java index 911513c0d..f7bee4b11 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIDAT.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIDAT.java @@ -14,7 +14,7 @@ public class PngChunkIDAT extends PngChunkMultiple { public final static String ID = ChunkHelper.IDAT; // http://www.w3.org/TR/PNG/#11IDAT - public PngChunkIDAT(ImageInfo i, int len, long offset) { + public PngChunkIDAT(final ImageInfo i, final int len, final long offset) { super(ID, i); this.length = len; this.offset = offset; @@ -31,10 +31,10 @@ public class PngChunkIDAT extends PngChunkMultiple { } @Override - public void parseFromRaw(ChunkRaw c) { // does nothing + public void parseFromRaw(final ChunkRaw c) { // does nothing } @Override - public void cloneDataFromRead(PngChunk other) { + public void cloneDataFromRead(final PngChunk other) { } } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIEND.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIEND.java index fbec564d8..3f6e47b09 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIEND.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIEND.java @@ -12,7 +12,7 @@ public class PngChunkIEND extends PngChunkSingle { // http://www.w3.org/TR/PNG/#11IEND // this is a dummy placeholder - public PngChunkIEND(ImageInfo info) { + public PngChunkIEND(final ImageInfo info) { super(ID, info); } @@ -23,16 +23,16 @@ public class PngChunkIEND extends PngChunkSingle { @Override public ChunkRaw createRawChunk() { - ChunkRaw c = new ChunkRaw(0, ChunkHelper.b_IEND, false); + final ChunkRaw c = new ChunkRaw(0, ChunkHelper.b_IEND, false); return c; } @Override - public void parseFromRaw(ChunkRaw c) { + public void parseFromRaw(final ChunkRaw c) { // this is not used } @Override - public void cloneDataFromRead(PngChunk other) { + public void cloneDataFromRead(final PngChunk other) { } } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIHDR.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIHDR.java index 94bfedd38..71e0ec90e 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIHDR.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkIHDR.java @@ -27,7 +27,7 @@ public class PngChunkIHDR extends PngChunkSingle { // http://www.w3.org/TR/PNG/#11IHDR // - public PngChunkIHDR(ImageInfo info) { + public PngChunkIHDR(final ImageInfo info) { super(ID, info); } @@ -38,7 +38,7 @@ public class PngChunkIHDR extends PngChunkSingle { @Override public ChunkRaw createRawChunk() { - ChunkRaw c = new ChunkRaw(13, ChunkHelper.b_IHDR, true); + final ChunkRaw c = new ChunkRaw(13, ChunkHelper.b_IHDR, true); int offset = 0; PngHelperInternal.writeInt4tobytes(cols, c.data, offset); offset += 4; @@ -53,10 +53,10 @@ public class PngChunkIHDR extends PngChunkSingle { } @Override - public void parseFromRaw(ChunkRaw c) { + public void parseFromRaw(final ChunkRaw c) { if (c.len != 13) throw new PngjException("Bad IDHR len " + c.len); - ByteArrayInputStream st = c.getAsByteStream(); + final ByteArrayInputStream st = c.getAsByteStream(); cols = PngHelperInternal.readInt4(st); rows = PngHelperInternal.readInt4(st); // bit depth: number of bits per channel @@ -68,8 +68,8 @@ public class PngChunkIHDR extends PngChunkSingle { } @Override - public void cloneDataFromRead(PngChunk other) { - PngChunkIHDR otherx = (PngChunkIHDR) other; + public void cloneDataFromRead(final PngChunk other) { + final PngChunkIHDR otherx = (PngChunkIHDR) other; cols = otherx.cols; rows = otherx.rows; bitspc = otherx.bitspc; @@ -83,7 +83,7 @@ public class PngChunkIHDR extends PngChunkSingle { return cols; } - public void setCols(int cols) { + public void setCols(final int cols) { this.cols = cols; } @@ -91,7 +91,7 @@ public class PngChunkIHDR extends PngChunkSingle { return rows; } - public void setRows(int rows) { + public void setRows(final int rows) { this.rows = rows; } @@ -99,7 +99,7 @@ public class PngChunkIHDR extends PngChunkSingle { return bitspc; } - public void setBitspc(int bitspc) { + public void setBitspc(final int bitspc) { this.bitspc = bitspc; } @@ -107,7 +107,7 @@ public class PngChunkIHDR extends PngChunkSingle { return colormodel; } - public void setColormodel(int colormodel) { + public void setColormodel(final int colormodel) { this.colormodel = colormodel; } @@ -115,7 +115,7 @@ public class PngChunkIHDR extends PngChunkSingle { return compmeth; } - public void setCompmeth(int compmeth) { + public void setCompmeth(final int compmeth) { this.compmeth = compmeth; } @@ -123,7 +123,7 @@ public class PngChunkIHDR extends PngChunkSingle { return filmeth; } - public void setFilmeth(int filmeth) { + public void setFilmeth(final int filmeth) { this.filmeth = filmeth; } @@ -131,7 +131,7 @@ public class PngChunkIHDR extends PngChunkSingle { return interlaced; } - public void setInterlaced(int interlaced) { + public void setInterlaced(final int interlaced) { this.interlaced = interlaced; } } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkITXT.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkITXT.java index ab52d7c90..738f92471 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkITXT.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkITXT.java @@ -21,7 +21,7 @@ public class PngChunkITXT extends PngChunkTextVar { private String translatedTag = ""; // http://www.w3.org/TR/PNG/#11iTXt - public PngChunkITXT(ImageInfo info) { + public PngChunkITXT(final ImageInfo info) { super(ID, info); } @@ -30,7 +30,7 @@ public class PngChunkITXT extends PngChunkTextVar { if (key.isEmpty()) throw new PngjException("Text chunk key must be non empty"); try { - ByteArrayOutputStream ba = new ByteArrayOutputStream(); + final ByteArrayOutputStream ba = new ByteArrayOutputStream(); ba.write(ChunkHelper.toBytes(key)); ba.write(0); // separator ba.write(compressed ? 1 : 0); @@ -44,19 +44,19 @@ public class PngChunkITXT extends PngChunkTextVar { textbytes = ChunkHelper.compressBytes(textbytes, true); } ba.write(textbytes); - byte[] b = ba.toByteArray(); - ChunkRaw chunk = createEmptyChunk(b.length, false); + final byte[] b = ba.toByteArray(); + final ChunkRaw chunk = createEmptyChunk(b.length, false); chunk.data = b; return chunk; - } catch (IOException e) { + } catch (final IOException e) { throw new PngjException(e); } } @Override - public void parseFromRaw(ChunkRaw c) { + public void parseFromRaw(final ChunkRaw c) { int nullsFound = 0; - int[] nullsIdx = new int[3]; + final int[] nullsIdx = new int[3]; for (int i = 0; i < c.data.length; i++) { if (c.data[i] != 0) continue; @@ -80,7 +80,7 @@ public class PngChunkITXT extends PngChunkTextVar { PngHelperInternal.charsetUTF8); i = nullsIdx[2] + 1; if (compressed) { - byte[] bytes = ChunkHelper.compressBytes(c.data, i, c.data.length - i, false); + final byte[] bytes = ChunkHelper.compressBytes(c.data, i, c.data.length - i, false); val = ChunkHelper.toStringUTF8(bytes); } else { val = ChunkHelper.toStringUTF8(c.data, i, c.data.length - i); @@ -88,8 +88,8 @@ public class PngChunkITXT extends PngChunkTextVar { } @Override - public void cloneDataFromRead(PngChunk other) { - PngChunkITXT otherx = (PngChunkITXT) other; + public void cloneDataFromRead(final PngChunk other) { + final PngChunkITXT otherx = (PngChunkITXT) other; key = otherx.key; val = otherx.val; compressed = otherx.compressed; @@ -101,7 +101,7 @@ public class PngChunkITXT extends PngChunkTextVar { return compressed; } - public void setCompressed(boolean compressed) { + public void setCompressed(final boolean compressed) { this.compressed = compressed; } @@ -109,7 +109,7 @@ public class PngChunkITXT extends PngChunkTextVar { return langTag; } - public void setLangtag(String langtag) { + public void setLangtag(final String langtag) { this.langTag = langtag; } @@ -117,7 +117,7 @@ public class PngChunkITXT extends PngChunkTextVar { return translatedTag; } - public void setTranslatedTag(String translatedTag) { + public void setTranslatedTag(final String translatedTag) { this.translatedTag = translatedTag; } } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java index 057f6c25e..5a7bee98c 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkMultiple.java @@ -7,7 +7,7 @@ import jogamp.opengl.util.pngj.ImageInfo; */ public abstract class PngChunkMultiple extends PngChunk { - protected PngChunkMultiple(String id, ImageInfo imgInfo) { + protected PngChunkMultiple(final String id, final ImageInfo imgInfo) { super(id, imgInfo); } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkOFFS.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkOFFS.java index a3bab4995..2217a59b4 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkOFFS.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkOFFS.java @@ -17,7 +17,7 @@ public class PngChunkOFFS extends PngChunkSingle { private long posY; private int units; // 0: pixel 1:micrometer - public PngChunkOFFS(ImageInfo info) { + public PngChunkOFFS(final ImageInfo info) { super(ID, info); } @@ -28,7 +28,7 @@ public class PngChunkOFFS extends PngChunkSingle { @Override public ChunkRaw createRawChunk() { - ChunkRaw c = createEmptyChunk(9, true); + final ChunkRaw c = createEmptyChunk(9, true); PngHelperInternal.writeInt4tobytes((int) posX, c.data, 0); PngHelperInternal.writeInt4tobytes((int) posY, c.data, 4); c.data[8] = (byte) units; @@ -36,7 +36,7 @@ public class PngChunkOFFS extends PngChunkSingle { } @Override - public void parseFromRaw(ChunkRaw chunk) { + public void parseFromRaw(final ChunkRaw chunk) { if (chunk.len != 9) throw new PngjException("bad chunk length " + chunk); posX = PngHelperInternal.readInt4fromBytes(chunk.data, 0); @@ -49,8 +49,8 @@ public class PngChunkOFFS extends PngChunkSingle { } @Override - public void cloneDataFromRead(PngChunk other) { - PngChunkOFFS otherx = (PngChunkOFFS) other; + public void cloneDataFromRead(final PngChunk other) { + final PngChunkOFFS otherx = (PngChunkOFFS) other; this.posX = otherx.posX; this.posY = otherx.posY; this.units = otherx.units; @@ -66,7 +66,7 @@ public class PngChunkOFFS extends PngChunkSingle { /** * 0: pixel, 1:micrometer */ - public void setUnits(int units) { + public void setUnits(final int units) { this.units = units; } @@ -74,7 +74,7 @@ public class PngChunkOFFS extends PngChunkSingle { return posX; } - public void setPosX(long posX) { + public void setPosX(final long posX) { this.posX = posX; } @@ -82,7 +82,7 @@ public class PngChunkOFFS extends PngChunkSingle { return posY; } - public void setPosY(long posY) { + public void setPosY(final long posY) { this.posY = posY; } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkPHYS.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkPHYS.java index b0a1bb898..fc647273e 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkPHYS.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkPHYS.java @@ -16,7 +16,7 @@ public class PngChunkPHYS extends PngChunkSingle { private long pixelsxUnitY; private int units; // 0: unknown 1:metre - public PngChunkPHYS(ImageInfo info) { + public PngChunkPHYS(final ImageInfo info) { super(ID, info); } @@ -27,7 +27,7 @@ public class PngChunkPHYS extends PngChunkSingle { @Override public ChunkRaw createRawChunk() { - ChunkRaw c = createEmptyChunk(9, true); + final ChunkRaw c = createEmptyChunk(9, true); PngHelperInternal.writeInt4tobytes((int) pixelsxUnitX, c.data, 0); PngHelperInternal.writeInt4tobytes((int) pixelsxUnitY, c.data, 4); c.data[8] = (byte) units; @@ -35,7 +35,7 @@ public class PngChunkPHYS extends PngChunkSingle { } @Override - public void parseFromRaw(ChunkRaw chunk) { + public void parseFromRaw(final ChunkRaw chunk) { if (chunk.len != 9) throw new PngjException("bad chunk length " + chunk); pixelsxUnitX = PngHelperInternal.readInt4fromBytes(chunk.data, 0); @@ -48,8 +48,8 @@ public class PngChunkPHYS extends PngChunkSingle { } @Override - public void cloneDataFromRead(PngChunk other) { - PngChunkPHYS otherx = (PngChunkPHYS) other; + public void cloneDataFromRead(final PngChunk other) { + final PngChunkPHYS otherx = (PngChunkPHYS) other; this.pixelsxUnitX = otherx.pixelsxUnitX; this.pixelsxUnitY = otherx.pixelsxUnitY; this.units = otherx.units; @@ -59,7 +59,7 @@ public class PngChunkPHYS extends PngChunkSingle { return pixelsxUnitX; } - public void setPixelsxUnitX(long pixelsxUnitX) { + public void setPixelsxUnitX(final long pixelsxUnitX) { this.pixelsxUnitX = pixelsxUnitX; } @@ -67,7 +67,7 @@ public class PngChunkPHYS extends PngChunkSingle { return pixelsxUnitY; } - public void setPixelsxUnitY(long pixelsxUnitY) { + public void setPixelsxUnitY(final long pixelsxUnitY) { this.pixelsxUnitY = pixelsxUnitY; } @@ -75,7 +75,7 @@ public class PngChunkPHYS extends PngChunkSingle { return units; } - public void setUnits(int units) { + public void setUnits(final int units) { this.units = units; } @@ -87,7 +87,7 @@ public class PngChunkPHYS extends PngChunkSingle { public double getAsDpi() { if (units != 1 || pixelsxUnitX != pixelsxUnitY) return -1; - return ((double) pixelsxUnitX) * 0.0254; + return (pixelsxUnitX) * 0.0254; } /** @@ -96,16 +96,16 @@ public class PngChunkPHYS extends PngChunkSingle { public double[] getAsDpi2() { if (units != 1) return new double[] { -1, -1 }; - return new double[] { ((double) pixelsxUnitX) * 0.0254, ((double) pixelsxUnitY) * 0.0254 }; + return new double[] { (pixelsxUnitX) * 0.0254, (pixelsxUnitY) * 0.0254 }; } - public void setAsDpi(double dpi) { + public void setAsDpi(final double dpi) { units = 1; pixelsxUnitX = (long) (dpi / 0.0254 + 0.5); pixelsxUnitY = pixelsxUnitX; } - public void setAsDpi2(double dpix, double dpiy) { + public void setAsDpi2(final double dpix, final double dpiy) { units = 1; pixelsxUnitX = (long) (dpix / 0.0254 + 0.5); pixelsxUnitY = (long) (dpiy / 0.0254 + 0.5); diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkPLTE.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkPLTE.java index dbf5e53c0..0f135d1ed 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkPLTE.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkPLTE.java @@ -20,7 +20,7 @@ public class PngChunkPLTE extends PngChunkSingle { */ private int[] entries; - public PngChunkPLTE(ImageInfo info) { + public PngChunkPLTE(final ImageInfo info) { super(ID, info); } @@ -31,9 +31,9 @@ public class PngChunkPLTE extends PngChunkSingle { @Override public ChunkRaw createRawChunk() { - int len = 3 * nentries; - int[] rgb = new int[3]; - ChunkRaw c = createEmptyChunk(len, true); + final int len = 3 * nentries; + final int[] rgb = new int[3]; + final ChunkRaw c = createEmptyChunk(len, true); for (int n = 0, i = 0; n < nentries; n++) { getEntryRgb(n, rgb); c.data[i++] = (byte) rgb[0]; @@ -44,21 +44,21 @@ public class PngChunkPLTE extends PngChunkSingle { } @Override - public void parseFromRaw(ChunkRaw chunk) { + public void parseFromRaw(final ChunkRaw chunk) { setNentries(chunk.len / 3); for (int n = 0, i = 0; n < nentries; n++) { - setEntry(n, (int) (chunk.data[i++] & 0xff), (int) (chunk.data[i++] & 0xff), (int) (chunk.data[i++] & 0xff)); + setEntry(n, chunk.data[i++] & 0xff, chunk.data[i++] & 0xff, chunk.data[i++] & 0xff); } } @Override - public void cloneDataFromRead(PngChunk other) { - PngChunkPLTE otherx = (PngChunkPLTE) other; + public void cloneDataFromRead(final PngChunk other) { + final PngChunkPLTE otherx = (PngChunkPLTE) other; this.setNentries(otherx.getNentries()); System.arraycopy(otherx.entries, 0, entries, 0, nentries); } - public void setNentries(int n) { + public void setNentries(final int n) { nentries = n; if (nentries < 1 || nentries > 256) throw new PngjException("invalid pallette - nentries=" + nentries); @@ -71,20 +71,20 @@ public class PngChunkPLTE extends PngChunkSingle { return nentries; } - public void setEntry(int n, int r, int g, int b) { + public void setEntry(final int n, final int r, final int g, final int b) { entries[n] = ((r << 16) | (g << 8) | b); } - public int getEntry(int n) { + public int getEntry(final int n) { return entries[n]; } - public void getEntryRgb(int n, int[] rgb) { + public void getEntryRgb(final int n, final int[] rgb) { getEntryRgb(n, rgb, 0); } - public void getEntryRgb(int n, int[] rgb, int offset) { - int v = entries[n]; + public void getEntryRgb(final int n, final int[] rgb, final int offset) { + final int v = entries[n]; rgb[offset + 0] = ((v & 0xff0000) >> 16); rgb[offset + 1] = ((v & 0xff00) >> 8); rgb[offset + 2] = (v & 0xff); diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java index 3a490654a..53858da83 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSBIT.java @@ -19,7 +19,7 @@ public class PngChunkSBIT extends PngChunkSingle { private int graysb, alphasb; private int redsb, greensb, bluesb; - public PngChunkSBIT(ImageInfo info) { + public PngChunkSBIT(final ImageInfo info) { super(ID, info); } @@ -36,7 +36,7 @@ public class PngChunkSBIT extends PngChunkSingle { } @Override - public void parseFromRaw(ChunkRaw c) { + public void parseFromRaw(final ChunkRaw c) { if (c.len != getLen()) throw new PngjException("bad chunk length " + c); if (imgInfo.greyscale) { @@ -71,8 +71,8 @@ public class PngChunkSBIT extends PngChunkSingle { } @Override - public void cloneDataFromRead(PngChunk other) { - PngChunkSBIT otherx = (PngChunkSBIT) other; + public void cloneDataFromRead(final PngChunk other) { + final PngChunkSBIT otherx = (PngChunkSBIT) other; graysb = otherx.graysb; redsb = otherx.redsb; greensb = otherx.greensb; @@ -80,7 +80,7 @@ public class PngChunkSBIT extends PngChunkSingle { alphasb = otherx.alphasb; } - public void setGraysb(int gray) { + public void setGraysb(final int gray) { if (!imgInfo.greyscale) throw new PngjException("only greyscale images support this"); graysb = gray; @@ -92,7 +92,7 @@ public class PngChunkSBIT extends PngChunkSingle { return graysb; } - public void setAlphasb(int a) { + public void setAlphasb(final int a) { if (!imgInfo.alpha) throw new PngjException("only images with alpha support this"); alphasb = a; @@ -108,7 +108,7 @@ public class PngChunkSBIT extends PngChunkSingle { * Set rgb values * */ - public void setRGB(int r, int g, int b) { + public void setRGB(final int r, final int g, final int b) { if (imgInfo.greyscale || imgInfo.indexed) throw new PngjException("only rgb or rgba images support this"); redsb = r; diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSPLT.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSPLT.java index 2ff65834d..44ff249ac 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSPLT.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSPLT.java @@ -21,7 +21,7 @@ public class PngChunkSPLT extends PngChunkMultiple { private int sampledepth; // 8/16 private int[] palette; // 5 elements per entry - public PngChunkSPLT(ImageInfo info) { + public PngChunkSPLT(final ImageInfo info) { super(ID, info); } @@ -33,11 +33,11 @@ public class PngChunkSPLT extends PngChunkMultiple { @Override public ChunkRaw createRawChunk() { try { - ByteArrayOutputStream ba = new ByteArrayOutputStream(); + final ByteArrayOutputStream ba = new ByteArrayOutputStream(); ba.write(palName.getBytes(PngHelperInternal.charsetLatin1)); ba.write(0); // separator ba.write((byte) sampledepth); - int nentries = getNentries(); + final int nentries = getNentries(); for (int n = 0; n < nentries; n++) { for (int i = 0; i < 4; i++) { if (sampledepth == 8) @@ -47,17 +47,17 @@ public class PngChunkSPLT extends PngChunkMultiple { } PngHelperInternal.writeInt2(ba, palette[n * 5 + 4]); } - byte[] b = ba.toByteArray(); - ChunkRaw chunk = createEmptyChunk(b.length, false); + final byte[] b = ba.toByteArray(); + final ChunkRaw chunk = createEmptyChunk(b.length, false); chunk.data = b; return chunk; - } catch (IOException e) { + } catch (final IOException e) { throw new PngjException(e); } } @Override - public void parseFromRaw(ChunkRaw c) { + public void parseFromRaw(final ChunkRaw c) { int t = -1; for (int i = 0; i < c.data.length; i++) { // look for first zero if (c.data[i] == 0) { @@ -70,7 +70,7 @@ public class PngChunkSPLT extends PngChunkMultiple { palName = new String(c.data, 0, t, PngHelperInternal.charsetLatin1); sampledepth = PngHelperInternal.readInt1fromByte(c.data, t + 1); t += 2; - int nentries = (c.data.length - t) / (sampledepth == 8 ? 6 : 10); + final int nentries = (c.data.length - t) / (sampledepth == 8 ? 6 : 10); palette = new int[nentries * 5]; int r, g, b, a, f, ne; ne = 0; @@ -101,8 +101,8 @@ public class PngChunkSPLT extends PngChunkMultiple { } @Override - public void cloneDataFromRead(PngChunk other) { - PngChunkSPLT otherx = (PngChunkSPLT) other; + public void cloneDataFromRead(final PngChunk other) { + final PngChunkSPLT otherx = (PngChunkSPLT) other; palName = otherx.palName; sampledepth = otherx.sampledepth; palette = new int[otherx.palette.length]; @@ -117,7 +117,7 @@ public class PngChunkSPLT extends PngChunkMultiple { return palName; } - public void setPalName(String palName) { + public void setPalName(final String palName) { this.palName = palName; } @@ -125,7 +125,7 @@ public class PngChunkSPLT extends PngChunkMultiple { return sampledepth; } - public void setSampledepth(int sampledepth) { + public void setSampledepth(final int sampledepth) { this.sampledepth = sampledepth; } @@ -133,7 +133,7 @@ public class PngChunkSPLT extends PngChunkMultiple { return palette; } - public void setPalette(int[] palette) { + public void setPalette(final int[] palette) { this.palette = palette; } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSRGB.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSRGB.java index e4d77d40a..19504b917 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSRGB.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSRGB.java @@ -21,7 +21,7 @@ public class PngChunkSRGB extends PngChunkSingle { private int intent; - public PngChunkSRGB(ImageInfo info) { + public PngChunkSRGB(final ImageInfo info) { super(ID, info); } @@ -31,7 +31,7 @@ public class PngChunkSRGB extends PngChunkSingle { } @Override - public void parseFromRaw(ChunkRaw c) { + public void parseFromRaw(final ChunkRaw c) { if (c.len != 1) throw new PngjException("bad chunk length " + c); intent = PngHelperInternal.readInt1fromByte(c.data, 0); @@ -46,8 +46,8 @@ public class PngChunkSRGB extends PngChunkSingle { } @Override - public void cloneDataFromRead(PngChunk other) { - PngChunkSRGB otherx = (PngChunkSRGB) other; + public void cloneDataFromRead(final PngChunk other) { + final PngChunkSRGB otherx = (PngChunkSRGB) other; intent = otherx.intent; } @@ -55,7 +55,7 @@ public class PngChunkSRGB extends PngChunkSingle { return intent; } - public void setIntent(int intent) { + public void setIntent(final int intent) { this.intent = intent; } } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSTER.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSTER.java index 4dc5edec5..52037b396 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSTER.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSTER.java @@ -14,7 +14,7 @@ public class PngChunkSTER extends PngChunkSingle { // http://www.libpng.org/pub/png/spec/register/pngext-1.3.0-pdg.html#C.sTER private byte mode; // 0: cross-fuse layout 1: diverging-fuse layout - public PngChunkSTER(ImageInfo info) { + public PngChunkSTER(final ImageInfo info) { super(ID, info); } @@ -25,21 +25,21 @@ public class PngChunkSTER extends PngChunkSingle { @Override public ChunkRaw createRawChunk() { - ChunkRaw c = createEmptyChunk(1, true); - c.data[0] = (byte) mode; + final ChunkRaw c = createEmptyChunk(1, true); + c.data[0] = mode; return c; } @Override - public void parseFromRaw(ChunkRaw chunk) { + public void parseFromRaw(final ChunkRaw chunk) { if (chunk.len != 1) throw new PngjException("bad chunk length " + chunk); mode = chunk.data[0]; } @Override - public void cloneDataFromRead(PngChunk other) { - PngChunkSTER otherx = (PngChunkSTER) other; + public void cloneDataFromRead(final PngChunk other) { + final PngChunkSTER otherx = (PngChunkSTER) other; this.mode = otherx.mode; } @@ -53,7 +53,7 @@ public class PngChunkSTER extends PngChunkSingle { /** * 0: cross-fuse layout 1: diverging-fuse layout */ - public void setMode(byte mode) { + public void setMode(final byte mode) { this.mode = mode; } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java index 7df5ba021..c5e9407b1 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSingle.java @@ -8,7 +8,7 @@ import jogamp.opengl.util.pngj.ImageInfo; */ public abstract class PngChunkSingle extends PngChunk { - protected PngChunkSingle(String id, ImageInfo imgInfo) { + protected PngChunkSingle(final String id, final ImageInfo imgInfo) { super(id, imgInfo); } @@ -26,14 +26,14 @@ public abstract class PngChunkSingle extends PngChunk { } @Override - public boolean equals(Object obj) { + public boolean equals(final Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; - PngChunkSingle other = (PngChunkSingle) obj; + final PngChunkSingle other = (PngChunkSingle) obj; if (id == null) { if (other.id != null) return false; diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSkipped.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSkipped.java index f4c77b4e1..02a18816b 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSkipped.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkSkipped.java @@ -8,7 +8,7 @@ import jogamp.opengl.util.pngj.PngjException; */ public class PngChunkSkipped extends PngChunk { - public PngChunkSkipped(String id, ImageInfo info, int clen) { + public PngChunkSkipped(final String id, final ImageInfo info, final int clen) { super(id, info); this.length = clen; } @@ -24,12 +24,12 @@ public class PngChunkSkipped extends PngChunk { } @Override - public void parseFromRaw(ChunkRaw c) { + public void parseFromRaw(final ChunkRaw c) { throw new PngjException("Non supported for a skipped chunk"); } @Override - public void cloneDataFromRead(PngChunk other) { + public void cloneDataFromRead(final PngChunk other) { throw new PngjException("Non supported for a skipped chunk"); } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTEXT.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTEXT.java index d97cd63c5..634d0cd12 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTEXT.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTEXT.java @@ -12,7 +12,7 @@ import jogamp.opengl.util.pngj.PngjException; public class PngChunkTEXT extends PngChunkTextVar { public final static String ID = ChunkHelper.tEXt; - public PngChunkTEXT(ImageInfo info) { + public PngChunkTEXT(final ImageInfo info) { super(ID, info); } @@ -20,14 +20,14 @@ public class PngChunkTEXT extends PngChunkTextVar { public ChunkRaw createRawChunk() { if (key.isEmpty()) throw new PngjException("Text chunk key must be non empty"); - byte[] b = (key + "\0" + val).getBytes(PngHelperInternal.charsetLatin1); - ChunkRaw chunk = createEmptyChunk(b.length, false); + final byte[] b = (key + "\0" + val).getBytes(PngHelperInternal.charsetLatin1); + final ChunkRaw chunk = createEmptyChunk(b.length, false); chunk.data = b; return chunk; } @Override - public void parseFromRaw(ChunkRaw c) { + public void parseFromRaw(final ChunkRaw c) { int i; for (i = 0; i < c.data.length; i++) if (c.data[i] == 0) @@ -38,8 +38,8 @@ public class PngChunkTEXT extends PngChunkTextVar { } @Override - public void cloneDataFromRead(PngChunk other) { - PngChunkTEXT otherx = (PngChunkTEXT) other; + public void cloneDataFromRead(final PngChunk other) { + final PngChunkTEXT otherx = (PngChunkTEXT) other; key = otherx.key; val = otherx.val; } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTIME.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTIME.java index 8f34c78fe..850fb649f 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTIME.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTIME.java @@ -17,7 +17,7 @@ public class PngChunkTIME extends PngChunkSingle { // http://www.w3.org/TR/PNG/#11tIME private int year, mon, day, hour, min, sec; - public PngChunkTIME(ImageInfo info) { + public PngChunkTIME(final ImageInfo info) { super(ID, info); } @@ -28,7 +28,7 @@ public class PngChunkTIME extends PngChunkSingle { @Override public ChunkRaw createRawChunk() { - ChunkRaw c = createEmptyChunk(7, true); + final ChunkRaw c = createEmptyChunk(7, true); PngHelperInternal.writeInt2tobytes(year, c.data, 0); c.data[2] = (byte) mon; c.data[3] = (byte) day; @@ -39,7 +39,7 @@ public class PngChunkTIME extends PngChunkSingle { } @Override - public void parseFromRaw(ChunkRaw chunk) { + public void parseFromRaw(final ChunkRaw chunk) { if (chunk.len != 7) throw new PngjException("bad chunk " + chunk); year = PngHelperInternal.readInt2fromBytes(chunk.data, 0); @@ -51,8 +51,8 @@ public class PngChunkTIME extends PngChunkSingle { } @Override - public void cloneDataFromRead(PngChunk other) { - PngChunkTIME x = (PngChunkTIME) other; + public void cloneDataFromRead(final PngChunk other) { + final PngChunkTIME x = (PngChunkTIME) other; year = x.year; mon = x.mon; day = x.day; @@ -61,8 +61,8 @@ public class PngChunkTIME extends PngChunkSingle { sec = x.sec; } - public void setNow(int secsAgo) { - Calendar d = Calendar.getInstance(); + public void setNow(final int secsAgo) { + final Calendar d = Calendar.getInstance(); d.setTimeInMillis(System.currentTimeMillis() - 1000 * (long) secsAgo); year = d.get(Calendar.YEAR); mon = d.get(Calendar.MONTH) + 1; @@ -72,7 +72,7 @@ public class PngChunkTIME extends PngChunkSingle { sec = d.get(Calendar.SECOND); } - public void setYMDHMS(int yearx, int monx, int dayx, int hourx, int minx, int secx) { + public void setYMDHMS(final int yearx, final int monx, final int dayx, final int hourx, final int minx, final int secx) { year = yearx; mon = monx; day = dayx; diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java index 867e34861..5e10c041b 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTRNS.java @@ -21,7 +21,7 @@ public class PngChunkTRNS extends PngChunkSingle { private int red, green, blue; private int[] paletteAlpha = new int[] {}; - public PngChunkTRNS(ImageInfo info) { + public PngChunkTRNS(final ImageInfo info) { super(ID, info); } @@ -51,14 +51,14 @@ public class PngChunkTRNS extends PngChunkSingle { } @Override - public void parseFromRaw(ChunkRaw c) { + public void parseFromRaw(final ChunkRaw c) { if (imgInfo.greyscale) { gray = PngHelperInternal.readInt2fromBytes(c.data, 0); } else if (imgInfo.indexed) { - int nentries = c.data.length; + final int nentries = c.data.length; paletteAlpha = new int[nentries]; for (int n = 0; n < nentries; n++) { - paletteAlpha[n] = (int) (c.data[n] & 0xff); + paletteAlpha[n] = c.data[n] & 0xff; } } else { red = PngHelperInternal.readInt2fromBytes(c.data, 0); @@ -68,8 +68,8 @@ public class PngChunkTRNS extends PngChunkSingle { } @Override - public void cloneDataFromRead(PngChunk other) { - PngChunkTRNS otherx = (PngChunkTRNS) other; + public void cloneDataFromRead(final PngChunk other) { + final PngChunkTRNS otherx = (PngChunkTRNS) other; gray = otherx.gray; red = otherx.red; green = otherx.green; @@ -84,7 +84,7 @@ public class PngChunkTRNS extends PngChunkSingle { * Set rgb values * */ - public void setRGB(int r, int g, int b) { + public void setRGB(final int r, final int g, final int b) { if (imgInfo.greyscale || imgInfo.indexed) throw new PngjException("only rgb or rgba images support this"); red = r; @@ -98,7 +98,7 @@ public class PngChunkTRNS extends PngChunkSingle { return new int[] { red, green, blue }; } - public void setGray(int g) { + public void setGray(final int g) { if (!imgInfo.greyscale) throw new PngjException("only grayscale images support this"); gray = g; @@ -113,7 +113,7 @@ public class PngChunkTRNS extends PngChunkSingle { /** * WARNING: non deep copy */ - public void setPalletteAlpha(int[] palAlpha) { + public void setPalletteAlpha(final int[] palAlpha) { if (!imgInfo.indexed) throw new PngjException("only indexed images support this"); paletteAlpha = palAlpha; @@ -122,7 +122,7 @@ public class PngChunkTRNS extends PngChunkSingle { /** * to use when only one pallete index is set as totally transparent */ - public void setIndexEntryAsTransparent(int palAlphaIndex) { + public void setIndexEntryAsTransparent(final int palAlphaIndex) { if (!imgInfo.indexed) throw new PngjException("only indexed images support this"); paletteAlpha = new int[] { palAlphaIndex + 1 }; diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTextVar.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTextVar.java index ba3ffc30c..d00c29971 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTextVar.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkTextVar.java @@ -21,7 +21,7 @@ public abstract class PngChunkTextVar extends PngChunkMultiple { public final static String KEY_Source = "Source"; // Device used to create the image public final static String KEY_Comment = "Comment"; // Miscellaneous comment - protected PngChunkTextVar(String id, ImageInfo info) { + protected PngChunkTextVar(final String id, final ImageInfo info) { super(id, info); } @@ -51,7 +51,7 @@ public abstract class PngChunkTextVar extends PngChunkMultiple { return val; } - public void setKeyVal(String key, String val) { + public void setKeyVal(final String key, final String val) { this.key = key; this.val = val; } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkUNKNOWN.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkUNKNOWN.java index 3803428e6..693729e9b 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkUNKNOWN.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkUNKNOWN.java @@ -11,11 +11,11 @@ public class PngChunkUNKNOWN extends PngChunkMultiple { // unkown, custom or not private byte[] data; - public PngChunkUNKNOWN(String id, ImageInfo info) { + public PngChunkUNKNOWN(final String id, final ImageInfo info) { super(id, info); } - private PngChunkUNKNOWN(PngChunkUNKNOWN c, ImageInfo info) { + private PngChunkUNKNOWN(final PngChunkUNKNOWN c, final ImageInfo info) { super(c.id, info); System.arraycopy(c.data, 0, data, 0, c.data.length); } @@ -27,13 +27,13 @@ public class PngChunkUNKNOWN extends PngChunkMultiple { // unkown, custom or not @Override public ChunkRaw createRawChunk() { - ChunkRaw p = createEmptyChunk(data.length, false); + final ChunkRaw p = createEmptyChunk(data.length, false); p.data = this.data; return p; } @Override - public void parseFromRaw(ChunkRaw c) { + public void parseFromRaw(final ChunkRaw c) { data = c.data; } @@ -43,14 +43,14 @@ public class PngChunkUNKNOWN extends PngChunkMultiple { // unkown, custom or not } /* does not copy! */ - public void setData(byte[] data) { + public void setData(final byte[] data) { this.data = data; } @Override - public void cloneDataFromRead(PngChunk other) { + public void cloneDataFromRead(final PngChunk other) { // THIS SHOULD NOT BE CALLED IF ALREADY CLONED WITH COPY CONSTRUCTOR - PngChunkUNKNOWN c = (PngChunkUNKNOWN) other; + final PngChunkUNKNOWN c = (PngChunkUNKNOWN) other; data = c.data; // not deep copy } } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkZTXT.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkZTXT.java index 64593eae4..c1dfdeb33 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkZTXT.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngChunkZTXT.java @@ -16,7 +16,7 @@ public class PngChunkZTXT extends PngChunkTextVar { public final static String ID = ChunkHelper.zTXt; // http://www.w3.org/TR/PNG/#11zTXt - public PngChunkZTXT(ImageInfo info) { + public PngChunkZTXT(final ImageInfo info) { super(ID, info); } @@ -25,23 +25,23 @@ public class PngChunkZTXT extends PngChunkTextVar { if (key.isEmpty()) throw new PngjException("Text chunk key must be non empty"); try { - ByteArrayOutputStream ba = new ByteArrayOutputStream(); + final ByteArrayOutputStream ba = new ByteArrayOutputStream(); ba.write(key.getBytes(PngHelperInternal.charsetLatin1)); ba.write(0); // separator ba.write(0); // compression method: 0 - byte[] textbytes = ChunkHelper.compressBytes(val.getBytes(PngHelperInternal.charsetLatin1), true); + final byte[] textbytes = ChunkHelper.compressBytes(val.getBytes(PngHelperInternal.charsetLatin1), true); ba.write(textbytes); - byte[] b = ba.toByteArray(); - ChunkRaw chunk = createEmptyChunk(b.length, false); + final byte[] b = ba.toByteArray(); + final ChunkRaw chunk = createEmptyChunk(b.length, false); chunk.data = b; return chunk; - } catch (IOException e) { + } catch (final IOException e) { throw new PngjException(e); } } @Override - public void parseFromRaw(ChunkRaw c) { + public void parseFromRaw(final ChunkRaw c) { int nullsep = -1; for (int i = 0; i < c.data.length; i++) { // look for first zero if (c.data[i] != 0) @@ -52,16 +52,16 @@ public class PngChunkZTXT extends PngChunkTextVar { if (nullsep < 0 || nullsep > c.data.length - 2) throw new PngjException("bad zTXt chunk: no separator found"); key = new String(c.data, 0, nullsep, PngHelperInternal.charsetLatin1); - int compmet = (int) c.data[nullsep + 1]; + final int compmet = c.data[nullsep + 1]; if (compmet != 0) throw new PngjException("bad zTXt chunk: unknown compression method"); - byte[] uncomp = ChunkHelper.compressBytes(c.data, nullsep + 2, c.data.length - nullsep - 2, false); // uncompress + final byte[] uncomp = ChunkHelper.compressBytes(c.data, nullsep + 2, c.data.length - nullsep - 2, false); // uncompress val = new String(uncomp, PngHelperInternal.charsetLatin1); } @Override - public void cloneDataFromRead(PngChunk other) { - PngChunkZTXT otherx = (PngChunkZTXT) other; + public void cloneDataFromRead(final PngChunk other) { + final PngChunkZTXT otherx = (PngChunkZTXT) other; key = otherx.key; val = otherx.val; } diff --git a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java index 139603448..bba2b3e7c 100644 --- a/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java +++ b/src/jogl/classes/jogamp/opengl/util/pngj/chunks/PngMetadata.java @@ -19,7 +19,7 @@ public class PngMetadata { private final ChunksList chunkList; private final boolean readonly; - public PngMetadata(ChunksList chunks) { + public PngMetadata(final ChunksList chunks) { this.chunkList = chunks; if (chunks instanceof ChunksListForWrite) { this.readonly = false; @@ -35,14 +35,14 @@ public class PngMetadata { * and if so, overwrites it. However if that not check for already written * chunks. */ - public void queueChunk(final PngChunk c, boolean lazyOverwrite) { - ChunksListForWrite cl = getChunkListW(); + public void queueChunk(final PngChunk c, final boolean lazyOverwrite) { + final ChunksListForWrite cl = getChunkListW(); if (readonly) throw new PngjException("cannot set chunk : readonly metadata"); if (lazyOverwrite) { ChunkHelper.trimList(cl.getQueuedChunks(), new ChunkPredicate() { @Override - public boolean match(PngChunk c2) { + public boolean match(final PngChunk c2) { return ChunkHelper.equivalent(c, c2); } }); @@ -66,19 +66,19 @@ public class PngMetadata { * returns -1 if not found or dimension unknown */ public double[] getDpi() { - PngChunk c = chunkList.getById1(ChunkHelper.pHYs, true); + final PngChunk c = chunkList.getById1(ChunkHelper.pHYs, true); if (c == null) return new double[] { -1, -1 }; else return ((PngChunkPHYS) c).getAsDpi2(); } - public void setDpi(double x) { + public void setDpi(final double x) { setDpi(x, x); } - public void setDpi(double x, double y) { - PngChunkPHYS c = new PngChunkPHYS(chunkList.imageInfo); + public void setDpi(final double x, final double y) { + final PngChunkPHYS c = new PngChunkPHYS(chunkList.imageInfo); c.setAsDpi2(x, y); queueChunk(c); } @@ -92,8 +92,8 @@ public class PngMetadata { * @return Returns the created-queued chunk, just in case you want to * examine or modify it */ - public PngChunkTIME setTimeNow(int secsAgo) { - PngChunkTIME c = new PngChunkTIME(chunkList.imageInfo); + public PngChunkTIME setTimeNow(final int secsAgo) { + final PngChunkTIME c = new PngChunkTIME(chunkList.imageInfo); c.setNow(secsAgo); queueChunk(c); return c; @@ -110,8 +110,8 @@ public class PngMetadata { * @return Returns the created-queued chunk, just in case you want to * examine or modify it */ - public PngChunkTIME setTimeYMDHMS(int yearx, int monx, int dayx, int hourx, int minx, int secx) { - PngChunkTIME c = new PngChunkTIME(chunkList.imageInfo); + public PngChunkTIME setTimeYMDHMS(final int yearx, final int monx, final int dayx, final int hourx, final int minx, final int secx) { + final PngChunkTIME c = new PngChunkTIME(chunkList.imageInfo); c.setYMDHMS(yearx, monx, dayx, hourx, minx, secx); queueChunk(c, true); return c; @@ -125,7 +125,7 @@ public class PngMetadata { } public String getTimeAsString() { - PngChunkTIME c = getTime(); + final PngChunkTIME c = getTime(); return c == null ? "" : c.getAsString(); } @@ -144,7 +144,7 @@ public class PngMetadata { * @return Returns the created-queued chunks, just in case you want to * examine, touch it */ - public PngChunkTextVar setText(String k, String val, boolean useLatin1, boolean compress) { + public PngChunkTextVar setText(final String k, final String val, final boolean useLatin1, final boolean compress) { if (compress && !useLatin1) throw new PngjException("cannot compress non latin text"); PngChunkTextVar c; @@ -163,7 +163,7 @@ public class PngMetadata { return c; } - public PngChunkTextVar setText(String k, String val) { + public PngChunkTextVar setText(final String k, final String val) { return setText(k, val, false, false); } @@ -175,8 +175,9 @@ public class PngMetadata { * Warning: this does not check the "lang" key of iTxt */ @SuppressWarnings("unchecked") - public List getTxtsForKey(String k) { + public List getTxtsForKey(final String k) { @SuppressWarnings("rawtypes") + final List c = new ArrayList(); c.addAll(chunkList.getById(ChunkHelper.tEXt, k)); c.addAll(chunkList.getById(ChunkHelper.zTXt, k)); @@ -190,12 +191,12 @@ public class PngMetadata { *

* Use getTxtsForKey() if you don't want this behaviour */ - public String getTxtForKey(String k) { - List li = getTxtsForKey(k); + public String getTxtForKey(final String k) { + final List li = getTxtsForKey(k); if (li.isEmpty()) return ""; - StringBuilder t = new StringBuilder(); - for (PngChunkTextVar c : li) + final StringBuilder t = new StringBuilder(); + for (final PngChunkTextVar c : li) t.append(c.getVal()).append("\n"); return t.toString().trim(); } @@ -214,7 +215,7 @@ public class PngMetadata { * the caller, who should fill its entries */ public PngChunkPLTE createPLTEChunk() { - PngChunkPLTE plte = new PngChunkPLTE(chunkList.imageInfo); + final PngChunkPLTE plte = new PngChunkPLTE(chunkList.imageInfo); queueChunk(plte); return plte; } @@ -233,7 +234,7 @@ public class PngMetadata { * caller, who should fill its entries */ public PngChunkTRNS createTRNSChunk() { - PngChunkTRNS trns = new PngChunkTRNS(chunkList.imageInfo); + final PngChunkTRNS trns = new PngChunkTRNS(chunkList.imageInfo); queueChunk(trns); return trns; } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java index feacdb951..25b73a2a6 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLGLCapabilities.java @@ -44,7 +44,7 @@ public class WGLGLCapabilities extends GLCapabilities { final private int pfdID; private int arb_pixelformat; // -1 PFD, 0 NOP, 1 ARB - public WGLGLCapabilities(PIXELFORMATDESCRIPTOR pfd, int pfdID, GLProfile glp) { + public WGLGLCapabilities(final PIXELFORMATDESCRIPTOR pfd, final int pfdID, final GLProfile glp) { super(glp); this.pfd = pfd; this.pfdID = pfdID; @@ -78,9 +78,9 @@ public class WGLGLCapabilities extends GLCapabilities { return true; } - public static final String PFD2String(PIXELFORMATDESCRIPTOR pfd, int pfdID) { + public static final String PFD2String(final PIXELFORMATDESCRIPTOR pfd, final int pfdID) { final int dwFlags = pfd.getDwFlags(); - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); boolean sep = false; if( 0 != (GDI.PFD_DRAW_TO_WINDOW & dwFlags ) ) { @@ -224,7 +224,7 @@ public class WGLGLCapabilities extends GLCapabilities { public Object clone() { try { return super.clone(); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { throw new GLException(e); } } @@ -237,7 +237,7 @@ public class WGLGLCapabilities extends GLCapabilities { final public boolean isSet() { return 0 != arb_pixelformat; } @Override - final public int getVisualID(VIDType type) throws NativeWindowException { + final public int getVisualID(final VIDType type) throws NativeWindowException { switch(type) { case INTRINSIC: case NATIVE: diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLUtil.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLUtil.java index 6454a34b5..08ff0e05b 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WGLUtil.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WGLUtil.java @@ -27,6 +27,8 @@ */ package jogamp.opengl.windows.wgl; +import com.jogamp.common.util.PropertyAccess; + import jogamp.nativewindow.windows.GDI; import jogamp.nativewindow.windows.PIXELFORMATDESCRIPTOR; import jogamp.opengl.Debug; @@ -52,41 +54,41 @@ public class WGLUtil { static { Debug.initSingleton(); - USE_WGLVersion_Of_5WGLGDIFuncSet = Debug.isPropertyDefined("jogl.windows.useWGLVersionOf5WGLGDIFuncSet", true); + USE_WGLVersion_Of_5WGLGDIFuncSet = PropertyAccess.isPropertyDefined("jogl.windows.useWGLVersionOf5WGLGDIFuncSet", true); if(USE_WGLVersion_Of_5WGLGDIFuncSet) { System.err.println("Use WGL version of 5 WGL/GDI functions."); } } - public static int ChoosePixelFormat(long hdc, PIXELFORMATDESCRIPTOR pfd) { + public static int ChoosePixelFormat(final long hdc, final PIXELFORMATDESCRIPTOR pfd) { if(USE_WGLVersion_Of_5WGLGDIFuncSet) { return WGL.wglChoosePixelFormat(hdc, pfd); } else { return GDI.ChoosePixelFormat(hdc, pfd); } } - public static int DescribePixelFormat(long hdc, int pfdid, int pfdSize, PIXELFORMATDESCRIPTOR pfd) { + public static int DescribePixelFormat(final long hdc, final int pfdid, final int pfdSize, final PIXELFORMATDESCRIPTOR pfd) { if(USE_WGLVersion_Of_5WGLGDIFuncSet) { return WGL.wglDescribePixelFormat(hdc, pfdid, pfdSize, pfd); } else { return GDI.DescribePixelFormat(hdc, pfdid, pfdSize, pfd); } } - public static int GetPixelFormat(long hdc) { + public static int GetPixelFormat(final long hdc) { if(USE_WGLVersion_Of_5WGLGDIFuncSet) { return WGL.wglGetPixelFormat(hdc); } else { return GDI.GetPixelFormat(hdc); } } - public static boolean SetPixelFormat(long hdc, int pfdid, PIXELFORMATDESCRIPTOR pfd) { + public static boolean SetPixelFormat(final long hdc, final int pfdid, final PIXELFORMATDESCRIPTOR pfd) { if(USE_WGLVersion_Of_5WGLGDIFuncSet) { return WGL.wglSetPixelFormat(hdc, pfdid, pfd); } else { return GDI.SetPixelFormat(hdc, pfdid, pfd); } } - public static boolean SwapBuffers(long hdc) { + public static boolean SwapBuffers(final long hdc) { if(USE_WGLVersion_Of_5WGLGDIFuncSet) { return WGL.wglSwapBuffers(hdc); } else { diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java index 1ad3fed8d..0878f186c 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java @@ -60,11 +60,11 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable { private long origbitmap; private long hbitmap; - private WindowsBitmapWGLDrawable(GLDrawableFactory factory, NativeSurface comp) { + private WindowsBitmapWGLDrawable(final GLDrawableFactory factory, final NativeSurface comp) { super(factory, comp, false); } - protected static WindowsBitmapWGLDrawable create(GLDrawableFactory factory, NativeSurface comp) { + protected static WindowsBitmapWGLDrawable create(final GLDrawableFactory factory, final NativeSurface comp) { final WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)comp.getGraphicsConfiguration(); final AbstractGraphicsDevice aDevice = config.getScreen().getDevice(); if( !GLProfile.isAvailable(aDevice, GLProfile.GL2) ) { @@ -94,7 +94,7 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable { } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new WindowsWGLContext(this, shareWith); } @@ -146,7 +146,7 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable { hbitmap = GDI.CreateDIBSection(0, info, GDI.DIB_RGB_COLORS, pb, 0, 0); werr = GDI.GetLastError(); if(DEBUG) { - long p = ( pb.capacity() > 0 ) ? pb.get(0) : 0; + final long p = ( pb.capacity() > 0 ) ? pb.get(0) : 0; System.err.println("WindowsBitmapWGLDrawable: pb sz/ptr "+pb.capacity() + ", "+toHexString(p)); System.err.println("WindowsBitmapWGLDrawable: " + width+"x"+height + ", bpp " + bitsPerPixelIn + " -> " + bitsPerPixel + @@ -187,7 +187,7 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable { } protected void destroyBitmap() { - NativeSurface ns = getNativeSurface(); + final NativeSurface ns = getNativeSurface(); if (ns.getSurfaceHandle() != 0) { // Must destroy bitmap and device context GDI.SelectObject(ns.getSurfaceHandle(), origbitmap); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java index 2047a91b5..4cebc6357 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java @@ -56,7 +56,7 @@ import jogamp.opengl.GLContextShareSet; public class WindowsExternalWGLContext extends WindowsWGLContext { - private WindowsExternalWGLContext(Drawable drawable, long ctx, WindowsWGLGraphicsConfiguration cfg) { + private WindowsExternalWGLContext(final Drawable drawable, final long ctx, final WindowsWGLGraphicsConfiguration cfg) { super(drawable, null); this.contextHandle = ctx; if (DEBUG) { @@ -69,7 +69,7 @@ public class WindowsExternalWGLContext extends WindowsWGLContext { getGLStateTracker().setEnabled(false); // external context usage can't track state in Java } - protected static WindowsExternalWGLContext create(GLDrawableFactory factory, GLProfile glp) { + protected static WindowsExternalWGLContext create(final GLDrawableFactory factory, final GLProfile glp) { if(DEBUG) { System.err.println("WindowsExternalWGLContext 0: werr: " + GDI.GetLastError()); } @@ -83,7 +83,7 @@ public class WindowsExternalWGLContext extends WindowsWGLContext { if (0 == hdc) { throw new GLException("Error: attempted to make an external GLDrawable without a drawable current, werr " + GDI.GetLastError()); } - AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS); + final AbstractGraphicsScreen aScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS); WindowsWGLGraphicsConfiguration cfg; final int pfdID = WGLUtil.GetPixelFormat(hdc); if (0 == pfdID) { @@ -119,12 +119,12 @@ public class WindowsExternalWGLContext extends WindowsWGLContext { // Need to provide the display connection to extension querying APIs static class Drawable extends WindowsWGLDrawable { - Drawable(GLDrawableFactory factory, NativeSurface comp) { + Drawable(final GLDrawableFactory factory, final NativeSurface comp) { super(factory, comp, true); } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { throw new GLException("Should not call this"); } @@ -138,7 +138,7 @@ public class WindowsExternalWGLContext extends WindowsWGLContext { throw new GLException("Should not call this"); } - public void setSize(int width, int height) { + public void setSize(final int width, final int height) { throw new GLException("Should not call this"); } } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java index 11e0202fd..1378bcf3e 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java @@ -55,16 +55,16 @@ import jogamp.nativewindow.windows.GDI; public class WindowsExternalWGLDrawable extends WindowsWGLDrawable { - private WindowsExternalWGLDrawable(GLDrawableFactory factory, NativeSurface component) { + private WindowsExternalWGLDrawable(final GLDrawableFactory factory, final NativeSurface component) { super(factory, component, true); } - protected static WindowsExternalWGLDrawable create(GLDrawableFactory factory, GLProfile glp) { - long hdc = WGL.wglGetCurrentDC(); + protected static WindowsExternalWGLDrawable create(final GLDrawableFactory factory, final GLProfile glp) { + final long hdc = WGL.wglGetCurrentDC(); if (0==hdc) { throw new GLException("Error: attempted to make an external GLDrawable without a drawable current, werr " + GDI.GetLastError()); } - int pfdID = WGLUtil.GetPixelFormat(hdc); + final int pfdID = WGLUtil.GetPixelFormat(hdc); if (pfdID == 0) { throw new GLException("Error: attempted to make an external GLContext without a valid pixelformat, werr " + GDI.GetLastError()); } @@ -76,11 +76,11 @@ public class WindowsExternalWGLDrawable extends WindowsWGLDrawable { @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new WindowsWGLContext(this, shareWith); } - public void setSize(int newWidth, int newHeight) { + public void setSize(final int newWidth, final int newHeight) { throw new GLException("Should not call this"); } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java index 61fb787c6..0d0681df9 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsOnscreenWGLDrawable.java @@ -45,12 +45,12 @@ import javax.media.opengl.GLContext; import javax.media.opengl.GLDrawableFactory; public class WindowsOnscreenWGLDrawable extends WindowsWGLDrawable { - protected WindowsOnscreenWGLDrawable(GLDrawableFactory factory, NativeSurface component) { + protected WindowsOnscreenWGLDrawable(final GLDrawableFactory factory, final NativeSurface component) { super(factory, component, false); } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new WindowsWGLContext(this, shareWith); } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java index e0bf1f50b..597f51178 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java @@ -65,7 +65,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { // needed to destroy pbuffer private long buffer; // pbuffer handle - protected WindowsPbufferWGLDrawable(GLDrawableFactory factory, NativeSurface target) { + protected WindowsPbufferWGLDrawable(final GLDrawableFactory factory, final NativeSurface target) { super(factory, target, false); } @@ -79,14 +79,14 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new WindowsWGLContext(this, shareWith); } protected void destroyPbuffer() { - NativeSurface ns = getNativeSurface(); + final NativeSurface ns = getNativeSurface(); if(0!=buffer) { - WGLExt wglExt = cachedWGLExt; + final WGLExt wglExt = cachedWGLExt; if (ns.getSurfaceHandle() != 0) { // Must release DC and pbuffer // NOTE that since the context is not current, glGetError() can @@ -112,15 +112,15 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { } private void createPbuffer() { - WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) getNativeSurface().getGraphicsConfiguration(); - SharedResource sharedResource = ((WindowsWGLDrawableFactory)factory).getOrCreateSharedResourceImpl(config.getScreen().getDevice()); - NativeSurface sharedSurface = sharedResource.getDrawable().getNativeSurface(); + final WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) getNativeSurface().getGraphicsConfiguration(); + final SharedResource sharedResource = ((WindowsWGLDrawableFactory)factory).getOrCreateSharedResourceImpl(config.getScreen().getDevice()); + final NativeSurface sharedSurface = sharedResource.getDrawable().getNativeSurface(); if (NativeSurface.LOCK_SURFACE_NOT_READY >= sharedSurface.lockSurface()) { throw new NativeWindowException("Could not lock (sharedSurface): "+this); } try { - long sharedHdc = sharedSurface.getSurfaceHandle(); - WGLExt wglExt = ((WindowsWGLContext)sharedResource.getContext()).getWGLExt(); + final long sharedHdc = sharedSurface.getSurfaceHandle(); + final WGLExt wglExt = ((WindowsWGLContext)sharedResource.getContext()).getWGLExt(); if (DEBUG) { System.out.println(getThreadName()+": Pbuffer config: " + config); @@ -130,7 +130,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { final IntBuffer iattributes = Buffers.newDirectIntBuffer(2*WindowsWGLGraphicsConfiguration.MAX_ATTRIBS); final FloatBuffer fattributes = Buffers.newDirectFloatBuffer(1); - int[] floatModeTmp = new int[1]; + final int[] floatModeTmp = new int[1]; int niattribs = 0; final GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable)config.getChosenCapabilities(); @@ -162,7 +162,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { if (DEBUG) { System.err.println("" + nformats + " suitable pixel formats found"); for (int i = 0; i < nformats; i++) { - WGLGLCapabilities dbgCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedResource, device, glProfile, + final WGLGLCapabilities dbgCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedResource, device, glProfile, sharedHdc, pformats.get(i), winattrPbuffer); System.err.println("pixel format " + pformats.get(i) + " (index " + i + "): " + dbgCaps); } @@ -174,7 +174,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { int whichFormat; // Loop is a workaround for bugs in NVidia's recent drivers for (whichFormat = 0; whichFormat < nformats; whichFormat++) { - int format = pformats.get(whichFormat); + final int format = pformats.get(whichFormat); // Create the p-buffer. niattribs = 0; @@ -196,12 +196,12 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { } // Get the device context. - long tmpHdc = wglExt.wglGetPbufferDCARB(tmpBuffer); + final long tmpHdc = wglExt.wglGetPbufferDCARB(tmpBuffer); if (tmpHdc == 0) { throw new GLException("pbuffer creation error: wglGetPbufferDC() failed"); } - NativeSurface ns = getNativeSurface(); + final NativeSurface ns = getNativeSurface(); // Set up instance variables buffer = tmpBuffer; ((MutableSurface)ns).setSurfaceHandle(tmpHdc); @@ -209,7 +209,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { // Re-query chosen pixel format { - WGLGLCapabilities newCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedResource, device, glProfile, + final WGLGLCapabilities newCaps = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities(sharedResource, device, glProfile, sharedHdc, pfdid, winattrPbuffer); if(null == newCaps) { throw new GLException("pbuffer creation error: unable to re-query chosen PFD ID: " + pfdid + ", hdc " + GLDrawableImpl.toHexString(tmpHdc)); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java index 0df986f77..9c5a5b272 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLContext.java @@ -87,13 +87,13 @@ public class WindowsWGLContext extends GLContextImpl { } // FIXME: figure out how to hook back in the Java 2D / JOGL bridge - WindowsWGLContext(GLDrawableImpl drawable, - GLContext shareWith) { + WindowsWGLContext(final GLDrawableImpl drawable, + final GLContext shareWith) { super(drawable, shareWith); } @Override - protected void resetStates(boolean isInit) { + protected void resetStates(final boolean isInit) { wglGetExtensionsStringEXTInitialized=false; wglGetExtensionsStringEXTAvailable=false; wglGLReadDrawableAvailableSet=false; @@ -123,9 +123,9 @@ public class WindowsWGLContext extends GLContextImpl { @Override public final boolean isGLReadDrawableAvailable() { if(!wglGLReadDrawableAvailableSet && null != getWGLExtProcAddressTable()) { - WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory)drawable.getFactoryImpl(); - AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration(); - AbstractGraphicsDevice device = config.getScreen().getDevice(); + final WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory)drawable.getFactoryImpl(); + final AbstractGraphicsConfiguration config = drawable.getNativeSurface().getGraphicsConfiguration(); + final AbstractGraphicsDevice device = config.getScreen().getDevice(); switch( factory.isReadDrawableAvailable(device) ) { case 1: wglGLReadDrawableAvailable = true; @@ -140,7 +140,7 @@ public class WindowsWGLContext extends GLContextImpl { return wglGLReadDrawableAvailable; } - private final boolean wglMakeContextCurrent(long hDrawDC, long hReadDC, long ctx) { + private final boolean wglMakeContextCurrent(final long hDrawDC, final long hReadDC, final long ctx) { boolean ok = false; if(wglGLReadDrawableAvailable) { // needs initilized WGL ProcAddress table @@ -151,9 +151,9 @@ public class WindowsWGLContext extends GLContextImpl { // should not happen due to 'isGLReadDrawableAvailable()' query in GLContextImpl throw new InternalError("Given readDrawable but no driver support"); } - int werr = ( !ok ) ? GDI.GetLastError() : GDI.ERROR_SUCCESS; + final int werr = ( !ok ) ? GDI.GetLastError() : GDI.ERROR_SUCCESS; if(DEBUG && !ok) { - Throwable t = new Throwable ("Info: wglMakeContextCurrent draw "+ + final Throwable t = new Throwable ("Info: wglMakeContextCurrent draw "+ GLContext.toHexString(hDrawDC) + ", read " + GLContext.toHexString(hReadDC) + ", ctx " + GLContext.toHexString(ctx) + ", werr " + werr); t.printStackTrace(); @@ -182,26 +182,26 @@ public class WindowsWGLContext extends GLContextImpl { protected Map getExtensionNameMap() { return extensionNameMap; } @Override - protected void destroyContextARBImpl(long context) { + protected void destroyContextARBImpl(final long context) { WGL.wglMakeCurrent(0, 0); WGL.wglDeleteContext(context); } @Override - protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) { + protected long createContextARBImpl(final long share, final boolean direct, final int ctp, final int major, final int minor) { if( null == getWGLExtProcAddressTable()) { updateGLXProcAddressTable(); } - WGLExt _wglExt = getWGLExt(); + final WGLExt _wglExt = getWGLExt(); if(DEBUG) { System.err.println(getThreadName()+" - WindowWGLContext.createContextARBImpl: "+getGLVersion(major, minor, ctp, "@creation") + ", handle "+toHexString(drawable.getHandle()) + ", share "+toHexString(share)+", direct "+direct+ ", wglCreateContextAttribsARB: "+toHexString(wglExtProcAddressTable._addressof_wglCreateContextAttribsARB)); } - boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ; - boolean ctFwdCompat = 0 != ( CTX_OPTION_FORWARD & ctp ) ; - boolean ctDebug = 0 != ( CTX_OPTION_DEBUG & ctp ) ; + final boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ; + final boolean ctFwdCompat = 0 != ( CTX_OPTION_FORWARD & ctp ) ; + final boolean ctDebug = 0 != ( CTX_OPTION_DEBUG & ctp ) ; long ctx=0; @@ -210,7 +210,7 @@ public class WindowsWGLContext extends GLContextImpl { /* WGLExt.WGL_CONTEXT_LAYER_PLANE_ARB, WGLExt.WGL_CONTEXT_LAYER_PLANE_ARB, */ - int attribs[] = { + final int attribs[] = { /* 0 */ WGLExt.WGL_CONTEXT_MAJOR_VERSION_ARB, major, /* 2 */ WGLExt.WGL_CONTEXT_MINOR_VERSION_ARB, minor, /* 4 */ WGLExt.WGL_CONTEXT_FLAGS_ARB, 0, @@ -239,9 +239,9 @@ public class WindowsWGLContext extends GLContextImpl { try { final IntBuffer attribsNIO = Buffers.newDirectIntBuffer(attribs); ctx = _wglExt.wglCreateContextAttribsARB(drawable.getHandle(), share, attribsNIO); - } catch (RuntimeException re) { + } catch (final RuntimeException re) { if(DEBUG) { - Throwable t = new Throwable("Info: WindowWGLContext.createContextARBImpl wglCreateContextAttribsARB failed with "+getGLVersion(major, minor, ctp, "@creation"), re); + final Throwable t = new Throwable("Info: WindowWGLContext.createContextARBImpl wglCreateContextAttribsARB failed with "+getGLVersion(major, minor, ctp, "@creation"), re); t.printStackTrace(); } } @@ -422,7 +422,7 @@ public class WindowsWGLContext extends GLContextImpl { } @Override - protected void copyImpl(GLContext source, int mask) throws GLException { + protected void copyImpl(final GLContext source, final int mask) throws GLException { if (!WGL.wglCopyContext(source.getHandle(), getHandle(), mask)) { throw new GLException("wglCopyContext failed"); } @@ -464,7 +464,7 @@ public class WindowsWGLContext extends GLContextImpl { @Override protected final StringBuilder getPlatformExtensionsStringImpl() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); if (!wglGetExtensionsStringEXTInitialized) { wglGetExtensionsStringEXTAvailable = (WGL.wglGetProcAddress("wglGetExtensionsStringEXT") != 0); @@ -477,26 +477,26 @@ public class WindowsWGLContext extends GLContextImpl { } @Override - protected boolean setSwapIntervalImpl(int interval) { - WGLExt wglExt = getWGLExt(); + protected boolean setSwapIntervalImpl(final int interval) { + final WGLExt wglExt = getWGLExt(); if(0==hasSwapIntervalSGI) { try { hasSwapIntervalSGI = wglExt.isExtensionAvailable("WGL_EXT_swap_control")?1:-1; - } catch (Throwable t) { hasSwapIntervalSGI=1; } + } catch (final Throwable t) { hasSwapIntervalSGI=1; } } if (hasSwapIntervalSGI>0) { try { return wglExt.wglSwapIntervalEXT(interval); - } catch (Throwable t) { hasSwapIntervalSGI=-1; } + } catch (final Throwable t) { hasSwapIntervalSGI=-1; } } return false; } - private final int initSwapGroupImpl(WGLExt wglExt) { + private final int initSwapGroupImpl(final WGLExt wglExt) { if(0==hasSwapGroupNV) { try { hasSwapGroupNV = wglExt.isExtensionAvailable("WGL_NV_swap_group")?1:-1; - } catch (Throwable t) { hasSwapGroupNV=1; } + } catch (final Throwable t) { hasSwapGroupNV=1; } if(DEBUG) { System.err.println("initSwapGroupImpl: hasSwapGroupNV: "+hasSwapGroupNV); } @@ -505,10 +505,10 @@ public class WindowsWGLContext extends GLContextImpl { } @Override - protected final boolean queryMaxSwapGroupsImpl(int[] maxGroups, int maxGroups_offset, - int[] maxBarriers, int maxBarriers_offset) { + protected final boolean queryMaxSwapGroupsImpl(final int[] maxGroups, final int maxGroups_offset, + final int[] maxBarriers, final int maxBarriers_offset) { boolean res = false; - WGLExt wglExt = getWGLExt(); + final WGLExt wglExt = getWGLExt(); if (initSwapGroupImpl(wglExt)>0) { final NativeSurface ns = drawable.getNativeSurface(); try { @@ -520,47 +520,47 @@ public class WindowsWGLContext extends GLContextImpl { maxBarriersNIO.get(maxGroups, maxGroups_offset, maxBarriersNIO.remaining()); res = true; } - } catch (Throwable t) { hasSwapGroupNV=-1; } + } catch (final Throwable t) { hasSwapGroupNV=-1; } } return res; } @Override - protected final boolean joinSwapGroupImpl(int group) { + protected final boolean joinSwapGroupImpl(final int group) { boolean res = false; - WGLExt wglExt = getWGLExt(); + final WGLExt wglExt = getWGLExt(); if (initSwapGroupImpl(wglExt)>0) { try { if( wglExt.wglJoinSwapGroupNV(drawable.getHandle(), group) ) { currentSwapGroup = group; res = true; } - } catch (Throwable t) { hasSwapGroupNV=-1; } + } catch (final Throwable t) { hasSwapGroupNV=-1; } } return res; } @Override - protected final boolean bindSwapBarrierImpl(int group, int barrier) { + protected final boolean bindSwapBarrierImpl(final int group, final int barrier) { boolean res = false; - WGLExt wglExt = getWGLExt(); + final WGLExt wglExt = getWGLExt(); if (initSwapGroupImpl(wglExt)>0) { try { if( wglExt.wglBindSwapBarrierNV(group, barrier) ) { res = true; } - } catch (Throwable t) { hasSwapGroupNV=-1; } + } catch (final Throwable t) { hasSwapGroupNV=-1; } } return res; } @Override - public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) { + public final ByteBuffer glAllocateMemoryNV(final int size, final float readFrequency, final float writeFrequency, final float priority) { return getWGLExt().wglAllocateMemoryNV(size, readFrequency, writeFrequency, priority); } @Override - public final void glFreeMemoryNV(ByteBuffer pointer) { + public final void glFreeMemoryNV(final ByteBuffer pointer) { getWGLExt().wglFreeMemoryNV(pointer); } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java index 66071cbe1..00b048e38 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawable.java @@ -44,6 +44,8 @@ import javax.media.nativewindow.NativeSurface; import javax.media.opengl.GLDrawableFactory; import javax.media.opengl.GLException; +import com.jogamp.common.util.PropertyAccess; + import jogamp.nativewindow.windows.GDI; import jogamp.opengl.Debug; import jogamp.opengl.GLDrawableImpl; @@ -55,22 +57,22 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { static { Debug.initSingleton(); - PROFILING = Debug.isPropertyDefined("jogl.debug.GLDrawable.profiling", true); + PROFILING = PropertyAccess.isPropertyDefined("jogl.debug.GLDrawable.profiling", true); } private static final int PROFILING_TICKS = 200; private int profilingSwapBuffersTicks; private long profilingSwapBuffersTime; - public WindowsWGLDrawable(GLDrawableFactory factory, NativeSurface comp, boolean realized) { + public WindowsWGLDrawable(final GLDrawableFactory factory, final NativeSurface comp, final boolean realized) { super(factory, comp, realized); } @Override protected void setRealizedImpl() { if(realized) { - NativeSurface ns = getNativeSurface(); - WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)ns.getGraphicsConfiguration(); + final NativeSurface ns = getNativeSurface(); + final WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)ns.getGraphicsConfiguration(); config.updateGraphicsConfiguration(getFactory(), ns, null); if (DEBUG) { System.err.println(getThreadName()+": WindowsWGLDrawable.setRealized(true): "+config); @@ -79,7 +81,7 @@ public abstract class WindowsWGLDrawable extends GLDrawableImpl { } @Override - protected final void swapBuffersImpl(boolean doubleBuffered) { + protected final void swapBuffersImpl(final boolean doubleBuffered) { if(doubleBuffered) { final long t0; if (PROFILING) { diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java index 7fa8775cf..4d8c85137 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDrawableFactory.java @@ -99,7 +99,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { if(null!=tmp && tmp.isLibComplete()) { WGL.getWGLProcAddressTable().reset(tmp); } - } catch (Exception ex) { + } catch (final Exception ex) { tmp = null; if(DEBUG) { ex.printStackTrace(); @@ -121,7 +121,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { try { ReflectionUtil.callStaticMethod("jogamp.opengl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory", "registerFactory", null, null, getClass().getClassLoader()); - } catch (Exception jre) { /* n/a .. */ } + } catch (final Exception jre) { /* n/a .. */ } } sharedMap = new HashMap(); @@ -164,7 +164,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public GLDynamicLookupHelper getGLDynamicLookupHelper(int profile) { + public GLDynamicLookupHelper getGLDynamicLookupHelper(final int profile) { return windowsWGLDynamicLookupHelper; } @@ -180,7 +180,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { protected void enterThreadCriticalZone() { synchronized (sysMask) { if( 0 == processAffinityChanges) { - long pid = GDI.GetCurrentProcess(); + final long pid = GDI.GetCurrentProcess(); if ( GDI.GetProcessAffinityMask(pid, procMask, sysMask) ) { if(DEBUG) { System.err.println("WindowsWGLDrawableFactory.enterThreadCriticalZone() - 0x" + Long.toHexString(pid) + " - " + getThreadName()); @@ -197,7 +197,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { protected void leaveThreadCriticalZone() { synchronized (sysMask) { if( 0 != processAffinityChanges) { - long pid = GDI.GetCurrentProcess(); + final long pid = GDI.GetCurrentProcess(); if( pid != processAffinityChanges) { throw new GLException("PID doesn't match: set PID 0x" + Long.toHexString(processAffinityChanges) + " this PID 0x" + Long.toHexString(pid) ); @@ -220,8 +220,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { private GLDrawableImpl drawable; private GLContextImpl context; - SharedResource(WindowsGraphicsDevice dev, AbstractGraphicsScreen scrn, GLDrawableImpl draw, GLContextImpl ctx, - boolean arbPixelFormat, boolean arbMultisample, boolean arbPBuffer, boolean arbReadDrawable) { + SharedResource(final WindowsGraphicsDevice dev, final AbstractGraphicsScreen scrn, final GLDrawableImpl draw, final GLContextImpl ctx, + final boolean arbPixelFormat, final boolean arbMultisample, final boolean arbPBuffer, final boolean arbReadDrawable) { device = dev; screen = scrn; drawable = draw; @@ -261,11 +261,11 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { sharedMap.clear(); } @Override - public SharedResourceRunner.Resource mapPut(String connection, SharedResourceRunner.Resource resource) { + public SharedResourceRunner.Resource mapPut(final String connection, final SharedResourceRunner.Resource resource) { return sharedMap.put(connection, resource); } @Override - public SharedResourceRunner.Resource mapGet(String connection) { + public SharedResourceRunner.Resource mapGet(final String connection) { return sharedMap.get(connection); } @Override @@ -276,12 +276,12 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public boolean isDeviceSupported(String connection) { + public boolean isDeviceSupported(final String connection) { return true; } @Override - public SharedResourceRunner.Resource createSharedResource(String connection) { + public SharedResourceRunner.Resource createSharedResource(final String connection) { final WindowsGraphicsDevice sharedDevice = new WindowsGraphicsDevice(connection, AbstractGraphicsDevice.DEFAULT_UNIT); sharedDevice.lock(); try { @@ -324,7 +324,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { return new SharedResource(sharedDevice, absScreen, sharedDrawable, sharedContext, hasARBPixelFormat, hasARBMultisample, hasARBPBuffer, hasARBReadDrawableAvailable); - } catch (Throwable t) { + } catch (final Throwable t) { throw new GLException("WindowsWGLDrawableFactory - Could not initialize shared resources for "+connection, t); } finally { sharedDevice.unlock(); @@ -332,8 +332,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public void releaseSharedResource(SharedResourceRunner.Resource shared) { - SharedResource sr = (SharedResource) shared; + public void releaseSharedResource(final SharedResourceRunner.Resource shared) { + final SharedResource sr = (SharedResource) shared; if (DEBUG) { System.err.println("Shutdown Shared:"); System.err.println("Device : " + sr.device); @@ -369,7 +369,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) { + public final boolean getIsDeviceCompatible(final AbstractGraphicsDevice device) { if(null!=windowsWGLDynamicLookupHelper && device instanceof WindowsGraphicsDevice) { return true; } @@ -389,12 +389,12 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final SharedResource getOrCreateSharedResourceImpl(AbstractGraphicsDevice device) { + protected final SharedResource getOrCreateSharedResourceImpl(final AbstractGraphicsDevice device) { return (SharedResource) sharedResourceRunner.getOrCreateShared(device); } - protected final WindowsWGLDrawable getOrCreateSharedDrawable(AbstractGraphicsDevice device) { - SharedResourceRunner.Resource sr = getOrCreateSharedResourceImpl(device); + protected final WindowsWGLDrawable getOrCreateSharedDrawable(final AbstractGraphicsDevice device) { + final SharedResourceRunner.Resource sr = getOrCreateSharedResourceImpl(device); if(null!=sr) { return (WindowsWGLDrawable) sr.getDrawable(); } @@ -402,12 +402,12 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected List getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { + protected List getAvailableCapabilitiesImpl(final AbstractGraphicsDevice device) { return WindowsWGLGraphicsConfigurationFactory.getAvailableCapabilities(this, device); } @Override - protected final GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) { + protected final GLDrawableImpl createOnscreenDrawableImpl(final NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } @@ -419,8 +419,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { if (target == null) { throw new IllegalArgumentException("Null target"); } - AbstractGraphicsConfiguration config = target.getGraphicsConfiguration(); - GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); + final AbstractGraphicsConfiguration config = target.getGraphicsConfiguration(); + final GLCapabilitiesImmutable chosenCaps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); if(!chosenCaps.isPBuffer()) { return WindowsBitmapWGLDrawable.create(this, target); } @@ -435,7 +435,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { */ final SharedResource sr = getOrCreateSharedResourceImpl(device); if(null!=sr) { - GLContext lastContext = GLContext.getCurrent(); + final GLContext lastContext = GLContext.getCurrent(); if (lastContext != null) { lastContext.release(); } @@ -458,8 +458,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { * @return 1 if read drawable extension is available, 0 if not * and -1 if undefined yet, ie no shared device exist at this point. */ - public final int isReadDrawableAvailable(AbstractGraphicsDevice device) { - SharedResource sr = getOrCreateSharedResourceImpl( ( null != device ) ? device : defaultDevice ); + public final int isReadDrawableAvailable(final AbstractGraphicsDevice device) { + final SharedResource sr = getOrCreateSharedResourceImpl( ( null != device ) ? device : defaultDevice ); if(null!=sr) { return sr.hasReadDrawable() ? 1 : 0 ; } @@ -467,8 +467,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp) { - SharedResource sr = getOrCreateSharedResourceImpl( ( null != device ) ? device : defaultDevice ); + public final boolean canCreateGLPbuffer(final AbstractGraphicsDevice device, final GLProfile glp) { + final SharedResource sr = getOrCreateSharedResourceImpl( ( null != device ) ? device : defaultDevice ); if(null!=sr) { return sr.hasARBPBuffer(); } @@ -476,9 +476,9 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) { + protected final ProxySurface createMutableSurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstreamHook) { final WindowsGraphicsDevice device; if(createNewDevice || !(deviceReq instanceof WindowsGraphicsDevice)) { device = new WindowsGraphicsDevice(deviceReq.getConnection(), deviceReq.getUnitID()); @@ -494,8 +494,8 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) { + public final ProxySurface createDummySurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) { final WindowsGraphicsDevice device; if( createNewDevice || !(deviceReq instanceof WindowsGraphicsDevice) ) { device = new WindowsGraphicsDevice(deviceReq.getConnection(), deviceReq.getUnitID()); @@ -512,7 +512,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) { + protected final ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstream) { final WindowsGraphicsDevice device = new WindowsGraphicsDevice(deviceReq.getConnection(), deviceReq.getUnitID()); final AbstractGraphicsScreen screen = new DefaultGraphicsScreen(device, screenIdx); final WindowsWGLGraphicsConfiguration cfg = WindowsWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(capsRequested, capsRequested, chooser, screen); @@ -525,7 +525,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) { + public final boolean canCreateExternalGLDrawable(final AbstractGraphicsDevice device) { return true; } @@ -535,7 +535,7 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } static String wglGetLastError() { - long err = GDI.GetLastError(); + final long err = GDI.GetLastError(); String detail = null; switch ((int) err) { case GDI.ERROR_SUCCESS: detail = "ERROR_SUCCESS"; break; @@ -561,26 +561,26 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final boolean setGammaRamp(float[] ramp) { - short[] rampData = new short[3 * GAMMA_RAMP_LENGTH]; + protected final boolean setGammaRamp(final float[] ramp) { + final short[] rampData = new short[3 * GAMMA_RAMP_LENGTH]; for (int i = 0; i < GAMMA_RAMP_LENGTH; i++) { - short scaledValue = (short) (ramp[i] * 65535); + final short scaledValue = (short) (ramp[i] * 65535); rampData[i] = scaledValue; rampData[i + GAMMA_RAMP_LENGTH] = scaledValue; rampData[i + 2 * GAMMA_RAMP_LENGTH] = scaledValue; } - long screenDC = GDI.GetDC(0); - boolean res = GDI.SetDeviceGammaRamp(screenDC, ShortBuffer.wrap(rampData)); + final long screenDC = GDI.GetDC(0); + final boolean res = GDI.SetDeviceGammaRamp(screenDC, ShortBuffer.wrap(rampData)); GDI.ReleaseDC(0, screenDC); return res; } @Override protected final Buffer getGammaRamp() { - ShortBuffer rampData = ShortBuffer.wrap(new short[3 * GAMMA_RAMP_LENGTH]); - long screenDC = GDI.GetDC(0); - boolean res = GDI.GetDeviceGammaRamp(screenDC, rampData); + final ShortBuffer rampData = ShortBuffer.wrap(new short[3 * GAMMA_RAMP_LENGTH]); + final long screenDC = GDI.GetDC(0); + final boolean res = GDI.GetDeviceGammaRamp(screenDC, rampData); GDI.ReleaseDC(0, screenDC); if (!res) { return null; @@ -589,12 +589,12 @@ public class WindowsWGLDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final void resetGammaRamp(Buffer originalGammaRamp) { + protected final void resetGammaRamp(final Buffer originalGammaRamp) { if (originalGammaRamp == null) { // getGammaRamp failed earlier return; } - long screenDC = GDI.GetDC(0); + final long screenDC = GDI.GetDC(0); GDI.SetDeviceGammaRamp(screenDC, originalGammaRamp); GDI.ReleaseDC(0, screenDC); } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java index 6098cde7f..2285ae996 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLDynamicLibraryBundleInfo.java @@ -47,13 +47,13 @@ public final class WindowsWGLDynamicLibraryBundleInfo extends DesktopGLDynamicLi @Override public final List getToolGetProcAddressFuncNameList() { - List res = new ArrayList(); + final List res = new ArrayList(); res.add("wglGetProcAddress"); return res; } @Override - public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) { + public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { return WGL.wglGetProcAddress(toolGetProcAddressHandle, funcName); } } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java index 5dd9f88b2..465b5f560 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfiguration.java @@ -66,24 +66,24 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio private boolean isDetermined = false; private boolean isExternal = false; - WindowsWGLGraphicsConfiguration(AbstractGraphicsScreen screen, - GLCapabilitiesImmutable capsChosen, GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser) { + WindowsWGLGraphicsConfiguration(final AbstractGraphicsScreen screen, + final GLCapabilitiesImmutable capsChosen, final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser) { super(screen, capsChosen, capsRequested); this.chooser=chooser; this.isDetermined = false; } - WindowsWGLGraphicsConfiguration(AbstractGraphicsScreen screen, - WGLGLCapabilities capsChosen, GLCapabilitiesImmutable capsRequested) { + WindowsWGLGraphicsConfiguration(final AbstractGraphicsScreen screen, + final WGLGLCapabilities capsChosen, final GLCapabilitiesImmutable capsRequested) { super(screen, capsChosen, capsRequested); setCapsPFD(capsChosen); this.chooser=null; } - static WindowsWGLGraphicsConfiguration createFromExternal(GLDrawableFactory _factory, long hdc, int pfdID, - GLProfile glp, AbstractGraphicsScreen screen, boolean onscreen) + static WindowsWGLGraphicsConfiguration createFromExternal(final GLDrawableFactory _factory, final long hdc, final int pfdID, + GLProfile glp, final AbstractGraphicsScreen screen, final boolean onscreen) { if(_factory==null) { throw new GLException("Null factory"); @@ -97,10 +97,10 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio if(null==glp) { glp = GLProfile.getDefault(screen.getDevice()); } - WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory) _factory; - AbstractGraphicsDevice device = screen.getDevice(); - WindowsWGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); - boolean hasARB = null != sharedResource && sharedResource.hasARBPixelFormat(); + final WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory) _factory; + final AbstractGraphicsDevice device = screen.getDevice(); + final WindowsWGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); + final boolean hasARB = null != sharedResource && sharedResource.hasARBPixelFormat(); WGLGLCapabilities caps = null; @@ -114,7 +114,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio ", pfdID "+pfdID+", onscreen "+onscreen+", hasARB "+hasARB); } - WindowsWGLGraphicsConfiguration cfg = new WindowsWGLGraphicsConfiguration(screen, caps, caps); + final WindowsWGLGraphicsConfiguration cfg = new WindowsWGLGraphicsConfiguration(screen, caps, caps); cfg.markExternal(); return cfg; } @@ -136,7 +136,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio * @see #isDetermined() * @see #isExternal() */ - public final void updateGraphicsConfiguration(GLDrawableFactory factory, NativeSurface ns, int[] pfIDs) { + public final void updateGraphicsConfiguration(final GLDrawableFactory factory, final NativeSurface ns, final int[] pfIDs) { WindowsWGLGraphicsConfigurationFactory.updateGraphicsConfiguration(chooser, factory, ns, pfIDs); } @@ -150,15 +150,15 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio * * @see #isDetermined() */ - public final void preselectGraphicsConfiguration(GLDrawableFactory factory, int[] pfdIDs) { - AbstractGraphicsDevice device = getScreen().getDevice(); + public final void preselectGraphicsConfiguration(final GLDrawableFactory factory, final int[] pfdIDs) { + final AbstractGraphicsDevice device = getScreen().getDevice(); WindowsWGLGraphicsConfigurationFactory.preselectGraphicsConfiguration(chooser, factory, device, this, pfdIDs); } /** * Sets the hdc's PixelFormat, this configuration's capabilities and marks it as determined. */ - final void setPixelFormat(long hdc, WGLGLCapabilities caps) { + final void setPixelFormat(final long hdc, final WGLGLCapabilities caps) { if (0 == hdc) { throw new GLException("Error: HDC is null"); } @@ -170,12 +170,12 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio } if( !caps.isBackgroundOpaque() ) { final long hwnd = GDI.WindowFromDC(hdc); - DWM_BLURBEHIND bb = DWM_BLURBEHIND.create(); + final DWM_BLURBEHIND bb = DWM_BLURBEHIND.create(); bb.setDwFlags(GDI.DWM_BB_ENABLE| GDI.DWM_BB_TRANSITIONONMAXIMIZED); bb.setFEnable( 1 ); boolean ok = GDI.DwmEnableBlurBehindWindow(hwnd, bb); if( ok ) { - MARGINS m = MARGINS.create(); + final MARGINS m = MARGINS.create(); m.setCxLeftWidth(-1); m.setCxRightWidth(-1); m.setCyBottomHeight(-1); @@ -198,7 +198,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio * Only sets this configuration's capabilities and marks it as determined, * the actual pixelformat is not set. */ - final void setCapsPFD(WGLGLCapabilities caps) { + final void setCapsPFD(final WGLGLCapabilities caps) { setChosenCapabilities(caps); this.isDetermined = true; if (DEBUG) { @@ -228,7 +228,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio public final int getPixelFormatID() { return isDetermined ? ((WGLGLCapabilities)capabilitiesChosen).getPFDID() : 0; } public final boolean isChoosenByARB() { return isDetermined ? ((WGLGLCapabilities)capabilitiesChosen).isSetByARB() : false; } - static int fillAttribsForGeneralWGLARBQuery(WindowsWGLDrawableFactory.SharedResource sharedResource, IntBuffer iattributes) { + static int fillAttribsForGeneralWGLARBQuery(final WindowsWGLDrawableFactory.SharedResource sharedResource, final IntBuffer iattributes) { int niattribs = 0; iattributes.put(niattribs++, WGLExt.WGL_DRAW_TO_WINDOW_ARB); if(sharedResource.hasARBPBuffer()) { @@ -257,7 +257,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return niattribs; } - static boolean wglARBPFIDValid(WindowsWGLContext sharedCtx, long hdc, int pfdID) { + static boolean wglARBPFIDValid(final WindowsWGLContext sharedCtx, final long hdc, final int pfdID) { final IntBuffer out = Buffers.newDirectIntBuffer(1); final IntBuffer in = Buffers.newDirectIntBuffer(1); in.put(0, WGLExt.WGL_COLOR_BITS_ARB); @@ -268,12 +268,12 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return true; } - static int wglARBPFDIDCount(WindowsWGLContext sharedCtx, long hdc) { + static int wglARBPFDIDCount(final WindowsWGLContext sharedCtx, final long hdc) { final IntBuffer iresults = Buffers.newDirectIntBuffer(1); final IntBuffer iattributes = Buffers.newDirectIntBuffer(1); iattributes.put(0, WGLExt.WGL_NUMBER_PIXEL_FORMATS_ARB); - WGLExt wglExt = sharedCtx.getWGLExt(); + final WGLExt wglExt = sharedCtx.getWGLExt(); // pfdID shall be ignored here (spec), however, pass a valid pdf index '1' below (possible driver bug) if (!wglExt.wglGetPixelFormatAttribivARB(hdc, 1 /* pfdID */, 0, 1, iattributes, iresults)) { if(DEBUG) { @@ -295,17 +295,17 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return pfdIDCount; } - static int[] wglAllARBPFDIDs(int pfdIDCount) { - int[] pfdIDs = new int[pfdIDCount]; + static int[] wglAllARBPFDIDs(final int pfdIDCount) { + final int[] pfdIDs = new int[pfdIDCount]; for (int i = 0; i < pfdIDCount; i++) { pfdIDs[i] = 1 + i; } return pfdIDs; } - static WGLGLCapabilities wglARBPFID2GLCapabilities(WindowsWGLDrawableFactory.SharedResource sharedResource, - AbstractGraphicsDevice device, GLProfile glp, - long hdc, int pfdID, int winattrbits) { + static WGLGLCapabilities wglARBPFID2GLCapabilities(final WindowsWGLDrawableFactory.SharedResource sharedResource, + final AbstractGraphicsDevice device, final GLProfile glp, + final long hdc, final int pfdID, final int winattrbits) { if (!sharedResource.hasARBPixelFormat()) { return null; } @@ -321,9 +321,9 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return AttribList2GLCapabilities(device, glp, hdc, pfdID, iattributes, niattribs, iresults, winattrbits); } - static int[] wglChoosePixelFormatARB(WindowsWGLDrawableFactory.SharedResource sharedResource, AbstractGraphicsDevice device, - GLCapabilitiesImmutable capabilities, - long hdc, IntBuffer iattributes, int accelerationMode, FloatBuffer fattributes) + static int[] wglChoosePixelFormatARB(final WindowsWGLDrawableFactory.SharedResource sharedResource, final AbstractGraphicsDevice device, + final GLCapabilitiesImmutable capabilities, + final long hdc, final IntBuffer iattributes, final int accelerationMode, final FloatBuffer fattributes) { if ( !WindowsWGLGraphicsConfiguration.GLCapabilities2AttribList(capabilities, @@ -361,7 +361,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio System.err.println("wglChoosePixelFormatARB: NumFormats (wglChoosePixelFormatARB) accelMode 0x" + Integer.toHexString(accelerationMode) + ": " + numFormats); for (int i = 0; i < numFormats; i++) { - WGLGLCapabilities dbgCaps0 = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities( + final WGLGLCapabilities dbgCaps0 = WindowsWGLGraphicsConfiguration.wglARBPFID2GLCapabilities( sharedResource, device, capabilities.getGLProfile(), hdc, pformats[i], GLGraphicsConfigurationUtil.ALL_BITS); System.err.println("pixel format " + pformats[i] + " (index " + i + "): " + dbgCaps0); } @@ -369,8 +369,8 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return pformats; } - static List wglARBPFIDs2GLCapabilities(WindowsWGLDrawableFactory.SharedResource sharedResource, - AbstractGraphicsDevice device, GLProfile glp, long hdc, int[] pfdIDs, int winattrbits, boolean onlyFirstValid) { + static List wglARBPFIDs2GLCapabilities(final WindowsWGLDrawableFactory.SharedResource sharedResource, + final AbstractGraphicsDevice device, final GLProfile glp, final long hdc, final int[] pfdIDs, final int winattrbits, final boolean onlyFirstValid) { if (!sharedResource.hasARBPixelFormat()) { return null; } @@ -380,7 +380,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio final IntBuffer iresults = Buffers.newDirectIntBuffer(2*MAX_ATTRIBS); final int niattribs = fillAttribsForGeneralWGLARBQuery(sharedResource, iattributes); - ArrayList bucket = new ArrayList(); + final ArrayList bucket = new ArrayList(); for(int i = 0; i= 1 && @@ -396,7 +396,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio break; } } else if(DEBUG) { - GLCapabilitiesImmutable skipped = AttribList2GLCapabilities(device, glp, hdc, pfdIDs[i], iattributes, niattribs, iresults, GLGraphicsConfigurationUtil.ALL_BITS); + final GLCapabilitiesImmutable skipped = AttribList2GLCapabilities(device, glp, hdc, pfdIDs[i], iattributes, niattribs, iresults, GLGraphicsConfigurationUtil.ALL_BITS); System.err.println("wglARBPFIDs2GLCapabilities: bucket["+i+" -> skip]: pfdID "+pfdIDs[i]+", "+skipped+", winattr "+GLGraphicsConfigurationUtil.winAttributeBits2String(null, winattrbits).toString()); } } else if (DEBUG) { @@ -411,11 +411,11 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return bucket; } - static boolean GLCapabilities2AttribList(GLCapabilitiesImmutable caps, - IntBuffer iattributes, - WindowsWGLDrawableFactory.SharedResource sharedResource, - int accelerationValue, - int[] floatMode) throws GLException { + static boolean GLCapabilities2AttribList(final GLCapabilitiesImmutable caps, + final IntBuffer iattributes, + final WindowsWGLDrawableFactory.SharedResource sharedResource, + final int accelerationValue, + final int[] floatMode) throws GLException { if (!sharedResource.hasARBPixelFormat()) { return false; } @@ -539,14 +539,14 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio static WGLGLCapabilities AttribList2GLCapabilities(final AbstractGraphicsDevice device, final GLProfile glp, final long hdc, final int pfdID, - final IntBuffer iattribs, final int niattribs, IntBuffer iresults, final int winattrmask) { + final IntBuffer iattribs, final int niattribs, final IntBuffer iresults, final int winattrmask) { final int allDrawableTypeBits = AttribList2DrawableTypeBits(iattribs, niattribs, iresults); int drawableTypeBits = winattrmask & allDrawableTypeBits; if( 0 == drawableTypeBits ) { return null; } - PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(); + final PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(); if (WGLUtil.DescribePixelFormat(hdc, pfdID, PIXELFORMATDESCRIPTOR.size(), pfd) == 0) { // remove displayable bits, since pfdID is non displayable @@ -565,23 +565,23 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio // GDI PIXELFORMAT // - static int[] wglAllGDIPFIDs(long hdc) { - int numFormats = WGLUtil.DescribePixelFormat(hdc, 1, 0, null); + static int[] wglAllGDIPFIDs(final long hdc) { + final int numFormats = WGLUtil.DescribePixelFormat(hdc, 1, 0, null); if (numFormats == 0) { throw new GLException("DescribePixelFormat: No formats - HDC 0x" + Long.toHexString(hdc) + ", LastError: " + GDI.GetLastError()); } - int[] pfdIDs = new int[numFormats]; + final int[] pfdIDs = new int[numFormats]; for (int i = 0; i < numFormats; i++) { pfdIDs[i] = 1 + i; } return pfdIDs; } - static int PFD2DrawableTypeBits(PIXELFORMATDESCRIPTOR pfd) { + static int PFD2DrawableTypeBits(final PIXELFORMATDESCRIPTOR pfd) { int val = 0; - int dwFlags = pfd.getDwFlags(); + final int dwFlags = pfd.getDwFlags(); if( 0 != (GDI.PFD_DRAW_TO_WINDOW & dwFlags ) ) { val |= GLGraphicsConfigurationUtil.WINDOW_BIT | @@ -593,8 +593,8 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return val; } - static WGLGLCapabilities PFD2GLCapabilities(AbstractGraphicsDevice device, final GLProfile glp, final long hdc, final int pfdID, final int winattrmask) { - PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(hdc, pfdID); + static WGLGLCapabilities PFD2GLCapabilities(final AbstractGraphicsDevice device, final GLProfile glp, final long hdc, final int pfdID, final int winattrmask) { + final PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(hdc, pfdID); if(null == pfd) { return null; } @@ -626,12 +626,12 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return (WGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res); } - static WGLGLCapabilities PFD2GLCapabilitiesNoCheck(AbstractGraphicsDevice device, final GLProfile glp, final long hdc, final int pfdID) { - PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(hdc, pfdID); + static WGLGLCapabilities PFD2GLCapabilitiesNoCheck(final AbstractGraphicsDevice device, final GLProfile glp, final long hdc, final int pfdID) { + final PIXELFORMATDESCRIPTOR pfd = createPixelFormatDescriptor(hdc, pfdID); return PFD2GLCapabilitiesNoCheck(device, glp, pfd, pfdID); } - static WGLGLCapabilities PFD2GLCapabilitiesNoCheck(AbstractGraphicsDevice device, GLProfile glp, PIXELFORMATDESCRIPTOR pfd, int pfdID) { + static WGLGLCapabilities PFD2GLCapabilitiesNoCheck(final AbstractGraphicsDevice device, final GLProfile glp, final PIXELFORMATDESCRIPTOR pfd, final int pfdID) { if(null == pfd) { return null; } @@ -641,8 +641,8 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return (WGLGLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, PFD2DrawableTypeBits(pfd), res); } - static PIXELFORMATDESCRIPTOR GLCapabilities2PFD(GLCapabilitiesImmutable caps, PIXELFORMATDESCRIPTOR pfd) { - int colorDepth = (caps.getRedBits() + + static PIXELFORMATDESCRIPTOR GLCapabilities2PFD(final GLCapabilitiesImmutable caps, final PIXELFORMATDESCRIPTOR pfd) { + final int colorDepth = (caps.getRedBits() + caps.getGreenBits() + caps.getBlueBits()); if (colorDepth < 15) { @@ -680,7 +680,7 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio pfd.setCGreenBits((byte) caps.getGreenBits()); pfd.setCBlueBits ((byte) caps.getBlueBits()); pfd.setCAlphaBits((byte) caps.getAlphaBits()); - int accumDepth = (caps.getAccumRedBits() + + final int accumDepth = (caps.getAccumRedBits() + caps.getAccumGreenBits() + caps.getAccumBlueBits()); pfd.setCAccumBits ((byte) accumDepth); @@ -699,8 +699,8 @@ public class WindowsWGLGraphicsConfiguration extends MutableGraphicsConfiguratio return pfd; } - static PIXELFORMATDESCRIPTOR createPixelFormatDescriptor(long hdc, int pfdID) { - PIXELFORMATDESCRIPTOR pfd = PIXELFORMATDESCRIPTOR.create(); + static PIXELFORMATDESCRIPTOR createPixelFormatDescriptor(final long hdc, final int pfdID) { + final PIXELFORMATDESCRIPTOR pfd = PIXELFORMATDESCRIPTOR.create(); pfd.setNSize((short) PIXELFORMATDESCRIPTOR.size()); pfd.setNVersion((short) 1); if(0 != hdc && 1 <= pfdID) { diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java index 969e45ed8..ea92b38fd 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsWGLGraphicsConfigurationFactory.java @@ -81,7 +81,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat @Override protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, final CapabilitiesChooser chooser, final AbstractGraphicsScreen absScreen, final int nativeVisualID) { if (! (capsChosen instanceof GLCapabilitiesImmutable) ) { throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilities objects - chosen"); @@ -98,14 +98,14 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat return chooseGraphicsConfigurationStatic((GLCapabilitiesImmutable)capsChosen, (GLCapabilitiesImmutable)capsRequested, (GLCapabilitiesChooser)chooser, absScreen); } - static WindowsWGLGraphicsConfiguration createDefaultGraphicsConfiguration(GLCapabilitiesImmutable caps, - AbstractGraphicsScreen absScreen) { + static WindowsWGLGraphicsConfiguration createDefaultGraphicsConfiguration(final GLCapabilitiesImmutable caps, + final AbstractGraphicsScreen absScreen) { return chooseGraphicsConfigurationStatic(caps, caps, null, absScreen); } static WindowsWGLGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilitiesImmutable capsChosen, - GLCapabilitiesImmutable capsReq, - GLCapabilitiesChooser chooser, + final GLCapabilitiesImmutable capsReq, + final GLCapabilitiesChooser chooser, AbstractGraphicsScreen absScreen) { if(null==absScreen) { absScreen = DefaultGraphicsScreen.createDefault(NativeWindowFactory.TYPE_WINDOWS); @@ -115,7 +115,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat return new WindowsWGLGraphicsConfiguration( absScreen, capsChosen, capsReq, chooser ); } - protected static List getAvailableCapabilities(WindowsWGLDrawableFactory factory, AbstractGraphicsDevice device) { + protected static List getAvailableCapabilities(final WindowsWGLDrawableFactory factory, final AbstractGraphicsDevice device) { final WindowsWGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); if(null == sharedResource) { throw new GLException("Shared resource for device n/a: "+device); @@ -136,7 +136,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat sharedDrawable.lockSurface(); } try { - long hdc = sharedDrawable.getHandle(); + final long hdc = sharedDrawable.getHandle(); if (0 == hdc) { throw new GLException("Error: HDC is null"); } @@ -164,17 +164,17 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat return availableCaps; } - private static List getAvailableGLCapabilitiesARB(WindowsWGLDrawableFactory.SharedResource sharedResource, AbstractGraphicsDevice device, GLProfile glProfile, long hdc) { + private static List getAvailableGLCapabilitiesARB(final WindowsWGLDrawableFactory.SharedResource sharedResource, final AbstractGraphicsDevice device, final GLProfile glProfile, final long hdc) { final int pfdIDCount = WindowsWGLGraphicsConfiguration.wglARBPFDIDCount((WindowsWGLContext)sharedResource.getContext(), hdc); final int[] pformats = WindowsWGLGraphicsConfiguration.wglAllARBPFDIDs(pfdIDCount); return WindowsWGLGraphicsConfiguration.wglARBPFIDs2GLCapabilities(sharedResource, device, glProfile, hdc, pformats, GLGraphicsConfigurationUtil.ALL_BITS & ~GLGraphicsConfigurationUtil.BITMAP_BIT, false); // w/o BITMAP } - private static List getAvailableGLCapabilitiesGDI(AbstractGraphicsDevice device, GLProfile glProfile, long hdc, boolean bitmapOnly) { - int[] pformats = WindowsWGLGraphicsConfiguration.wglAllGDIPFIDs(hdc); - int numFormats = pformats.length; - List bucket = new ArrayList(numFormats); + private static List getAvailableGLCapabilitiesGDI(final AbstractGraphicsDevice device, final GLProfile glProfile, final long hdc, final boolean bitmapOnly) { + final int[] pformats = WindowsWGLGraphicsConfiguration.wglAllGDIPFIDs(hdc); + final int numFormats = pformats.length; + final List bucket = new ArrayList(numFormats); for (int i = 0; i < numFormats; i++) { final GLCapabilitiesImmutable caps = WindowsWGLGraphicsConfiguration.PFD2GLCapabilities(device, glProfile, hdc, pformats[i], bitmapOnly ? GLGraphicsConfigurationUtil.BITMAP_BIT : GLGraphicsConfigurationUtil.ALL_BITS ); @@ -192,8 +192,8 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat * @param ns * @param pfIDs optional pool of preselected PixelFormat IDs, maybe null for unrestricted selection */ - static void updateGraphicsConfiguration(CapabilitiesChooser chooser, - GLDrawableFactory factory, NativeSurface ns, int[] pfdIDs) { + static void updateGraphicsConfiguration(final CapabilitiesChooser chooser, + final GLDrawableFactory factory, final NativeSurface ns, final int[] pfdIDs) { if (chooser != null && !(chooser instanceof GLCapabilitiesChooser)) { throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects"); } @@ -208,11 +208,11 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat throw new GLException("Surface not ready (lockSurface)"); } try { - long hdc = ns.getSurfaceHandle(); + final long hdc = ns.getSurfaceHandle(); if (0 == hdc) { throw new GLException("Error: HDC is null"); } - WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) ns.getGraphicsConfiguration(); + final WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration) ns.getGraphicsConfiguration(); if( !config.isExternal() ) { if( !config.isDetermined() ) { @@ -239,9 +239,9 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat } } - static void preselectGraphicsConfiguration(CapabilitiesChooser chooser, - GLDrawableFactory _factory, AbstractGraphicsDevice device, - WindowsWGLGraphicsConfiguration config, int[] pfdIDs) { + static void preselectGraphicsConfiguration(final CapabilitiesChooser chooser, + final GLDrawableFactory _factory, final AbstractGraphicsDevice device, + final WindowsWGLGraphicsConfiguration config, final int[] pfdIDs) { if (chooser != null && !(chooser instanceof GLCapabilitiesChooser)) { throw new IllegalArgumentException("This NativeWindowFactory accepts only GLCapabilitiesChooser objects"); } @@ -254,8 +254,8 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat if ( !(_factory instanceof WindowsWGLDrawableFactory) ) { throw new GLException("GLDrawableFactory is not a WindowsWGLDrawableFactory, but: "+_factory.getClass().getSimpleName()); } - WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory) _factory; - WindowsWGLDrawable sharedDrawable = factory.getOrCreateSharedDrawable(device); + final WindowsWGLDrawableFactory factory = (WindowsWGLDrawableFactory) _factory; + final WindowsWGLDrawable sharedDrawable = factory.getOrCreateSharedDrawable(device); if(null == sharedDrawable) { throw new IllegalArgumentException("Shared Drawable is null"); } @@ -264,7 +264,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat throw new GLException("Shared Surface not ready (lockSurface): "+device+" -> "+sharedDrawable); } try { - long hdc = sharedDrawable.getHandle(); + final long hdc = sharedDrawable.getHandle(); if (0 == hdc) { throw new GLException("Error: HDC is null"); } @@ -274,8 +274,8 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat } } - private static void updateGraphicsConfiguration(WindowsWGLGraphicsConfiguration config, CapabilitiesChooser chooser, - GLDrawableFactory factory, long hdc, boolean extHDC, int[] pfdIDs) { + private static void updateGraphicsConfiguration(final WindowsWGLGraphicsConfiguration config, final CapabilitiesChooser chooser, + final GLDrawableFactory factory, final long hdc, final boolean extHDC, final int[] pfdIDs) { if (DEBUG) { if(extHDC) { System.err.println("updateGraphicsConfiguration(using shared): hdc "+toHexString(hdc)); @@ -284,8 +284,8 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat } System.err.println("user chosen caps " + config.getChosenCapabilities()); } - AbstractGraphicsDevice device = config.getScreen().getDevice(); - WindowsWGLDrawableFactory.SharedResource sharedResource = ((WindowsWGLDrawableFactory)factory).getOrCreateSharedResourceImpl(device); + final AbstractGraphicsDevice device = config.getScreen().getDevice(); + final WindowsWGLDrawableFactory.SharedResource sharedResource = ((WindowsWGLDrawableFactory)factory).getOrCreateSharedResourceImpl(device); final GLContext sharedContext; if ( factory.hasRendererQuirk(device, GLRendererQuirks.NeedCurrCtx4ARBPixFmtQueries) ) { sharedContext = sharedResource.getContext(); @@ -311,8 +311,8 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat } } - private static boolean updateGraphicsConfigurationARB(WindowsWGLDrawableFactory factory, WindowsWGLGraphicsConfiguration config, CapabilitiesChooser chooser, - long hdc, boolean extHDC, int[] pformats) { + private static boolean updateGraphicsConfigurationARB(final WindowsWGLDrawableFactory factory, final WindowsWGLGraphicsConfiguration config, final CapabilitiesChooser chooser, + final long hdc, final boolean extHDC, int[] pformats) { final AbstractGraphicsDevice device = config.getScreen().getDevice(); final WindowsWGLDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); @@ -462,8 +462,8 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat return true; } - private static boolean updateGraphicsConfigurationGDI(WindowsWGLGraphicsConfiguration config, CapabilitiesChooser chooser, long hdc, - boolean extHDC, int[] pformats) { + private static boolean updateGraphicsConfigurationGDI(final WindowsWGLGraphicsConfiguration config, final CapabilitiesChooser chooser, final long hdc, + final boolean extHDC, int[] pformats) { final GLCapabilitiesImmutable capsChosen = (GLCapabilitiesImmutable) config.getChosenCapabilities(); if( !capsChosen.isOnscreen() && capsChosen.isPBuffer() ) { if (DEBUG) { @@ -557,7 +557,7 @@ public class WindowsWGLGraphicsConfigurationFactory extends GLGraphicsConfigurat System.err.println("updateGraphicsConfigurationGDI: availableCaps["+i+" -> "+j+"]: "+caps); } } else if(DEBUG) { - GLCapabilitiesImmutable skipped = WindowsWGLGraphicsConfiguration.PFD2GLCapabilitiesNoCheck(device, glProfile, hdc, pformats[i]); + final GLCapabilitiesImmutable skipped = WindowsWGLGraphicsConfiguration.PFD2GLCapabilitiesNoCheck(device, glProfile, hdc, pformats[i]); System.err.println("updateGraphicsConfigurationGDI: availableCaps["+i+" -> skip]: pfdID "+pformats[i]+", "+skipped); } } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java index 96bd0bdd0..66d3018fc 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/awt/WindowsAWTWGLGraphicsConfigurationFactory.java @@ -70,8 +70,8 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu @Override protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, - CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, + final CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, final int nativeVisualID) { GraphicsDevice device = null; if (absScreen != null && !(absScreen instanceof AWTGraphicsScreen)) { @@ -84,7 +84,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu System.err.println("WindowsAWTWGLGraphicsConfigurationFactory: creating default device: "+absScreen); } } - AWTGraphicsScreen awtScreen = (AWTGraphicsScreen) absScreen; + final AWTGraphicsScreen awtScreen = (AWTGraphicsScreen) absScreen; device = ((AWTGraphicsDevice)awtScreen.getDevice()).getGraphicsDevice(); if ( !(capsChosen instanceof GLCapabilitiesImmutable) ) { @@ -104,10 +104,10 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu System.err.println("WindowsAWTWGLGraphicsConfigurationFactory: got "+absScreen); } - WindowsGraphicsDevice winDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); - DefaultGraphicsScreen winScreen = new DefaultGraphicsScreen(winDevice, awtScreen.getIndex()); - GraphicsConfigurationFactory configFactory = GraphicsConfigurationFactory.getFactory(winDevice, capsChosen); - WindowsWGLGraphicsConfiguration winConfig = (WindowsWGLGraphicsConfiguration) + final WindowsGraphicsDevice winDevice = new WindowsGraphicsDevice(AbstractGraphicsDevice.DEFAULT_UNIT); + final DefaultGraphicsScreen winScreen = new DefaultGraphicsScreen(winDevice, awtScreen.getIndex()); + final GraphicsConfigurationFactory configFactory = GraphicsConfigurationFactory.getFactory(winDevice, capsChosen); + final WindowsWGLGraphicsConfiguration winConfig = (WindowsWGLGraphicsConfiguration) configFactory.chooseGraphicsConfiguration(capsChosen, capsRequested, chooser, winScreen, nativeVisualID); @@ -115,7 +115,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu throw new GLException("Unable to choose a GraphicsConfiguration: "+capsChosen+",\n\t"+chooser+"\n\t"+winScreen); } - GLDrawableFactory drawableFactory = GLDrawableFactory.getFactory(((GLCapabilitiesImmutable)capsChosen).getGLProfile()); + final GLDrawableFactory drawableFactory = GLDrawableFactory.getFactory(((GLCapabilitiesImmutable)capsChosen).getGLProfile()); GraphicsConfiguration chosenGC = null; if ( drawableFactory instanceof WindowsWGLDrawableFactory ) { @@ -133,7 +133,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu System.err.println("WindowsAWTWGLGraphicsConfigurationFactory: Found new AWT PFD ID "+winConfig.getPixelFormatID()+" -> "+winConfig); } } - } catch (GLException gle0) { + } catch (final GLException gle0) { if(DEBUG) { gle0.printStackTrace(); } @@ -150,11 +150,11 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu // // collect all available PFD IDs - GraphicsConfiguration[] configs = device.getConfigurations(); - int[] pfdIDs = new int[configs.length]; - ArrayHashSet pfdIDOSet = new ArrayHashSet(); + final GraphicsConfiguration[] configs = device.getConfigurations(); + final int[] pfdIDs = new int[configs.length]; + final ArrayHashSet pfdIDOSet = new ArrayHashSet(); for (int i = 0; i < configs.length; i++) { - GraphicsConfiguration gc = configs[i]; + final GraphicsConfiguration gc = configs[i]; pfdIDs[i] = Win32SunJDKReflection.graphicsConfigurationGetPixelFormatID(gc); pfdIDOSet.add(new Integer(pfdIDs[i])); if(DEBUG) { @@ -165,7 +165,7 @@ public class WindowsAWTWGLGraphicsConfigurationFactory extends GLGraphicsConfigu System.err.println("WindowsAWTWGLGraphicsConfigurationFactory: PFD IDs: "+pfdIDs.length+", unique: "+pfdIDOSet.size()); } winConfig.preselectGraphicsConfiguration(drawableFactory, pfdIDs); - int gcIdx = pfdIDOSet.indexOf(new Integer(winConfig.getPixelFormatID())); + final int gcIdx = pfdIDOSet.indexOf(new Integer(winConfig.getPixelFormatID())); if( 0 > gcIdx ) { chosenGC = configs[gcIdx]; if(DEBUG) { diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java index 12e3db3bd..e32177b3d 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/GLXUtil.java @@ -46,7 +46,7 @@ import com.jogamp.nativewindow.x11.X11GraphicsDevice; public class GLXUtil { public static final boolean DEBUG = Debug.debug("GLXUtil"); - public static synchronized boolean isGLXAvailableOnServer(X11GraphicsDevice x11Device) { + public static synchronized boolean isGLXAvailableOnServer(final X11GraphicsDevice x11Device) { if(null == x11Device) { throw new IllegalArgumentException("null X11GraphicsDevice"); } @@ -57,14 +57,14 @@ public class GLXUtil { x11Device.lock(); try { glXAvailable = GLX.glXQueryExtension(x11Device.getHandle(), null, null); - } catch (Throwable t) { /* n/a */ + } catch (final Throwable t) { /* n/a */ } finally { x11Device.unlock(); } return glXAvailable; } - public static String getGLXClientString(X11GraphicsDevice x11Device, int name) { + public static String getGLXClientString(final X11GraphicsDevice x11Device, final int name) { x11Device.lock(); try { return GLX.glXGetClientString(x11Device.getHandle(), name); @@ -72,7 +72,7 @@ public class GLXUtil { x11Device.unlock(); } } - public static String queryGLXServerString(X11GraphicsDevice x11Device, int screen_idx, int name) { + public static String queryGLXServerString(final X11GraphicsDevice x11Device, final int screen_idx, final int name) { x11Device.lock(); try { return GLX.glXQueryServerString(x11Device.getHandle(), screen_idx, name); @@ -80,7 +80,7 @@ public class GLXUtil { x11Device.unlock(); } } - public static String queryGLXExtensionsString(X11GraphicsDevice x11Device, int screen_idx) { + public static String queryGLXExtensionsString(final X11GraphicsDevice x11Device, final int screen_idx) { x11Device.lock(); try { return GLX.glXQueryExtensionsString(x11Device.getHandle(), screen_idx); @@ -89,7 +89,7 @@ public class GLXUtil { } } - public static VersionNumber getGLXServerVersionNumber(X11GraphicsDevice x11Device) { + public static VersionNumber getGLXServerVersionNumber(final X11GraphicsDevice x11Device) { final IntBuffer major = Buffers.newDirectIntBuffer(1); final IntBuffer minor = Buffers.newDirectIntBuffer(1); @@ -102,12 +102,12 @@ public class GLXUtil { // Work around bugs in ATI's Linux drivers where they report they // only implement GLX version 1.2 on the server side if (major.get(0) == 1 && minor.get(0) == 2) { - String str = GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_VERSION); + final String str = GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_VERSION); try { // e.g. "1.3" major.put(0, Integer.valueOf(str.substring(0, 1)).intValue()); minor.put(0, Integer.valueOf(str.substring(2, 3)).intValue()); - } catch (Exception e) { + } catch (final Exception e) { major.put(0, 1); minor.put(0, 2); } @@ -118,18 +118,18 @@ public class GLXUtil { return new VersionNumber(major.get(0), minor.get(0), 0); } - public static boolean isMultisampleAvailable(String extensions) { + public static boolean isMultisampleAvailable(final String extensions) { if (extensions != null) { return (extensions.indexOf("GLX_ARB_multisample") >= 0); } return false; } - public static boolean isVendorNVIDIA(String vendor) { + public static boolean isVendorNVIDIA(final String vendor) { return vendor != null && vendor.startsWith("NVIDIA") ; } - public static boolean isVendorATI(String vendor) { + public static boolean isVendorATI(final String vendor) { return vendor != null && vendor.startsWith("ATI") ; } @@ -143,7 +143,7 @@ public class GLXUtil { return clientVersionNumber; } - public static synchronized void initGLXClientDataSingleton(X11GraphicsDevice x11Device) { + public static synchronized void initGLXClientDataSingleton(final X11GraphicsDevice x11Device) { if(null != clientVendorName) { return; // already initialized } @@ -156,14 +156,14 @@ public class GLXUtil { clientMultisampleAvailable = isMultisampleAvailable(GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_EXTENSIONS)); clientVendorName = GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_VENDOR); - int[] major = new int[1]; - int[] minor = new int[1]; + final int[] major = new int[1]; + final int[] minor = new int[1]; final String str = GLX.glXGetClientString(x11Device.getHandle(), GLX.GLX_VERSION); try { // e.g. "1.3" major[0] = Integer.valueOf(str.substring(0, 1)).intValue(); minor[0] = Integer.valueOf(str.substring(2, 3)).intValue(); - } catch (Exception e) { + } catch (final Exception e) { major[0] = 1; minor[0] = 2; } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java index 45c666230..7040621be 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java @@ -58,7 +58,7 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen; public class X11ExternalGLXContext extends X11GLXContext { - private X11ExternalGLXContext(Drawable drawable, long ctx) { + private X11ExternalGLXContext(final Drawable drawable, final long ctx) { super(drawable, null); this.contextHandle = ctx; GLContextShareSet.contextCreated(this); @@ -68,20 +68,20 @@ public class X11ExternalGLXContext extends X11GLXContext { getGLStateTracker().setEnabled(false); // external context usage can't track state in Java } - protected static X11ExternalGLXContext create(GLDrawableFactory factory, GLProfile glp) { - long ctx = GLX.glXGetCurrentContext(); + protected static X11ExternalGLXContext create(final GLDrawableFactory factory, final GLProfile glp) { + final long ctx = GLX.glXGetCurrentContext(); if (ctx == 0) { throw new GLException("Error: current context null"); } - long display = GLX.glXGetCurrentDisplay(); + final long display = GLX.glXGetCurrentDisplay(); if (display == 0) { throw new GLException("Error: current display null"); } - long drawable = GLX.glXGetCurrentDrawable(); + final long drawable = GLX.glXGetCurrentDrawable(); if (drawable == 0) { throw new GLException("Error: attempted to make an external GLDrawable without a drawable/context current"); } - IntBuffer val = Buffers.newDirectIntBuffer(1); + final IntBuffer val = Buffers.newDirectIntBuffer(1); int w, h; GLX.glXQueryDrawable(display, drawable, GLX.GLX_WIDTH, val); @@ -90,7 +90,7 @@ public class X11ExternalGLXContext extends X11GLXContext { h=val.get(0); GLX.glXQueryContext(display, ctx, GLX.GLX_SCREEN, val); - X11GraphicsScreen x11Screen = (X11GraphicsScreen) X11GraphicsScreen.createScreenDevice(display, val.get(0), false); + final X11GraphicsScreen x11Screen = (X11GraphicsScreen) X11GraphicsScreen.createScreenDevice(display, val.get(0), false); GLX.glXQueryContext(display, ctx, GLX.GLX_FBCONFIG_ID, val); X11GLXGraphicsConfiguration cfg = null; @@ -99,7 +99,7 @@ public class X11ExternalGLXContext extends X11GLXContext { // create and use a default config (this has been observed when running on CentOS 5.5 inside // of VMWare Server 2.0 with the Mesa 6.5.1 drivers) if( VisualIDHolder.VID_UNDEFINED == val.get(0) || !X11GLXGraphicsConfiguration.GLXFBConfigIDValid(display, x11Screen.getIndex(), val.get(0)) ) { - GLCapabilities glcapsDefault = new GLCapabilities(GLProfile.getDefault()); + final GLCapabilities glcapsDefault = new GLCapabilities(GLProfile.getDefault()); cfg = X11GLXGraphicsConfigurationFactory.chooseGraphicsConfigurationStatic(glcapsDefault, glcapsDefault, null, x11Screen, VisualIDHolder.VID_UNDEFINED); if(DEBUG) { System.err.println("X11ExternalGLXContext invalid FBCONFIG_ID "+val.get(0)+", using default cfg: " + cfg); @@ -131,12 +131,12 @@ public class X11ExternalGLXContext extends X11GLXContext { // Need to provide the display connection to extension querying APIs static class Drawable extends X11GLXDrawable { - Drawable(GLDrawableFactory factory, NativeSurface comp) { + Drawable(final GLDrawableFactory factory, final NativeSurface comp) { super(factory, comp, true); } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { throw new GLException("Should not call this"); } @@ -150,7 +150,7 @@ public class X11ExternalGLXContext extends X11GLXContext { throw new GLException("Should not call this"); } - public void setSize(int width, int height) { + public void setSize(final int width, final int height) { throw new GLException("Should not call this"); } } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java index 650fd31d3..2076ce454 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXDrawable.java @@ -55,30 +55,30 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen; public class X11ExternalGLXDrawable extends X11GLXDrawable { - private X11ExternalGLXDrawable(GLDrawableFactory factory, NativeSurface surface) { + private X11ExternalGLXDrawable(final GLDrawableFactory factory, final NativeSurface surface) { super(factory, surface, true); } - protected static X11ExternalGLXDrawable create(GLDrawableFactory factory, GLProfile glp) { - long context = GLX.glXGetCurrentContext(); + protected static X11ExternalGLXDrawable create(final GLDrawableFactory factory, final GLProfile glp) { + final long context = GLX.glXGetCurrentContext(); if (context == 0) { throw new GLException("Error: current context null"); } - long display = GLX.glXGetCurrentDisplay(); + final long display = GLX.glXGetCurrentDisplay(); if (display == 0) { throw new GLException("Error: current display null"); } - long drawable = GLX.glXGetCurrentDrawable(); + final long drawable = GLX.glXGetCurrentDrawable(); if (drawable == 0) { throw new GLException("Error: attempted to make an external GLDrawable without a drawable current"); } - IntBuffer val = Buffers.newDirectIntBuffer(1); + final IntBuffer val = Buffers.newDirectIntBuffer(1); GLX.glXQueryContext(display, context, GLX.GLX_SCREEN, val); - X11GraphicsScreen x11Screen = (X11GraphicsScreen) X11GraphicsScreen.createScreenDevice(display, val.get(0), false); + final X11GraphicsScreen x11Screen = (X11GraphicsScreen) X11GraphicsScreen.createScreenDevice(display, val.get(0), false); GLX.glXQueryContext(display, context, GLX.GLX_FBCONFIG_ID, val); - X11GLXGraphicsConfiguration cfg = X11GLXGraphicsConfiguration.create(glp, x11Screen, val.get(0)); + final X11GLXGraphicsConfiguration cfg = X11GLXGraphicsConfiguration.create(glp, x11Screen, val.get(0)); int w, h; GLX.glXQueryDrawable(display, drawable, GLX.GLX_WIDTH, val); @@ -96,16 +96,16 @@ public class X11ExternalGLXDrawable extends X11GLXDrawable { } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new Context(this, shareWith); } - public void setSize(int newWidth, int newHeight) { + public void setSize(final int newWidth, final int newHeight) { throw new GLException("Should not call this"); } class Context extends X11GLXContext { - Context(X11GLXDrawable drawable, GLContext shareWith) { + Context(final X11GLXDrawable drawable, final GLContext shareWith) { super(drawable, shareWith); } } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java index e0b69ffd4..36e791641 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLCapabilities.java @@ -41,14 +41,14 @@ public class X11GLCapabilities extends GLCapabilities { final private long fbcfg; final private int fbcfgid; - public X11GLCapabilities(XVisualInfo xVisualInfo, long fbcfg, int fbcfgid, GLProfile glp) { + public X11GLCapabilities(final XVisualInfo xVisualInfo, final long fbcfg, final int fbcfgid, final GLProfile glp) { super(glp); this.xVisualInfo = xVisualInfo; this.fbcfg = fbcfg; this.fbcfgid = fbcfgid; } - public X11GLCapabilities(XVisualInfo xVisualInfo, GLProfile glp) { + public X11GLCapabilities(final XVisualInfo xVisualInfo, final GLProfile glp) { super(glp); this.xVisualInfo = xVisualInfo; this.fbcfg = 0; @@ -64,7 +64,7 @@ public class X11GLCapabilities extends GLCapabilities { public Object clone() { try { return super.clone(); - } catch (RuntimeException e) { + } catch (final RuntimeException e) { throw new GLException(e); } } @@ -78,7 +78,7 @@ public class X11GLCapabilities extends GLCapabilities { final public boolean hasFBConfig() { return 0!=fbcfg && fbcfgid!=VisualIDHolder.VID_UNDEFINED; } @Override - final public int getVisualID(VIDType type) throws NativeWindowException { + final public int getVisualID(final VIDType type) throws NativeWindowException { switch(type) { case INTRINSIC: case NATIVE: diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java index 57d39d533..d4c3abc49 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXContext.java @@ -94,13 +94,13 @@ public class X11GLXContext extends GLContextImpl { extensionNameMap.put(GLExtensions.ARB_pixel_format, X11GLXDrawableFactory.GLX_SGIX_pbuffer); // good enough } - X11GLXContext(GLDrawableImpl drawable, - GLContext shareWith) { + X11GLXContext(final GLDrawableImpl drawable, + final GLContext shareWith) { super(drawable, shareWith); } @Override - protected void resetStates(boolean isInit) { + protected void resetStates(final boolean isInit) { // no inner state _glXExt=null; glXExtProcAddressTable = null; hasSwapInterval = 0; @@ -159,7 +159,7 @@ public class X11GLXContext extends GLContextImpl { return isGLXVersionGreaterEqualOneThree(); } - private final boolean glXMakeContextCurrent(long dpy, long writeDrawable, long readDrawable, long ctx) { + private final boolean glXMakeContextCurrent(final long dpy, final long writeDrawable, final long readDrawable, final long ctx) { boolean res = false; try { @@ -173,7 +173,7 @@ public class X11GLXContext extends GLContextImpl { // should not happen due to 'isGLReadDrawableAvailable()' query in GLContextImpl throw new InternalError("Given readDrawable but no driver support"); } - } catch (RuntimeException re) { + } catch (final RuntimeException re) { if( DEBUG_TRACE_SWITCH ) { System.err.println(getThreadName()+": Warning: X11GLXContext.glXMakeContextCurrent failed: "+re+", with "+ "dpy "+toHexString(dpy)+ @@ -187,7 +187,7 @@ public class X11GLXContext extends GLContextImpl { } @Override - protected void destroyContextARBImpl(long ctx) { + protected void destroyContextARBImpl(final long ctx) { final long display = drawable.getNativeSurface().getDisplayHandle(); glXMakeContextCurrent(display, 0, 0, 0); @@ -207,22 +207,22 @@ public class X11GLXContext extends GLContextImpl { }; @Override - protected long createContextARBImpl(long share, boolean direct, int ctp, int major, int minor) { + protected long createContextARBImpl(final long share, final boolean direct, final int ctp, final int major, final int minor) { updateGLXProcAddressTable(); - GLXExt _glXExt = getGLXExt(); + final GLXExt _glXExt = getGLXExt(); if(DEBUG) { System.err.println(getThreadName()+": X11GLXContext.createContextARBImpl: "+getGLVersion(major, minor, ctp, "@creation") + ", handle "+toHexString(drawable.getHandle()) + ", share "+toHexString(share)+", direct "+direct+ ", glXCreateContextAttribsARB: "+toHexString(glXExtProcAddressTable._addressof_glXCreateContextAttribsARB)); } - boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ; - boolean ctFwdCompat = 0 != ( CTX_OPTION_FORWARD & ctp ) ; - boolean ctDebug = 0 != ( CTX_OPTION_DEBUG & ctp ) ; + final boolean ctBwdCompat = 0 != ( CTX_PROFILE_COMPAT & ctp ) ; + final boolean ctFwdCompat = 0 != ( CTX_OPTION_FORWARD & ctp ) ; + final boolean ctDebug = 0 != ( CTX_OPTION_DEBUG & ctp ) ; long ctx=0; - IntBuffer attribs = Buffers.newDirectIntBuffer(ctx_arb_attribs_rom); + final IntBuffer attribs = Buffers.newDirectIntBuffer(ctx_arb_attribs_rom); attribs.put(ctx_arb_attribs_idx_major + 1, major); attribs.put(ctx_arb_attribs_idx_minor + 1, minor); @@ -246,8 +246,8 @@ public class X11GLXContext extends GLContextImpl { attribs.put(ctx_arb_attribs_idx_flags + 1, flags); } - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration(); - AbstractGraphicsDevice device = config.getScreen().getDevice(); + final X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration(); + final AbstractGraphicsDevice device = config.getScreen().getDevice(); final long display = device.getHandle(); try { @@ -256,9 +256,9 @@ public class X11GLXContext extends GLContextImpl { X11Util.setX11ErrorHandler(true, DEBUG ? false : true); // make sure X11 error handler is set X11Lib.XSync(display, false); ctx = _glXExt.glXCreateContextAttribsARB(display, config.getFBConfig(), share, direct, attribs); - } catch (RuntimeException re) { + } catch (final RuntimeException re) { if(DEBUG) { - Throwable t = new Throwable(getThreadName()+": Info: X11GLXContext.createContextARBImpl glXCreateContextAttribsARB failed with "+getGLVersion(major, minor, ctp, "@creation"), re); + final Throwable t = new Throwable(getThreadName()+": Info: X11GLXContext.createContextARBImpl glXCreateContextAttribsARB failed with "+getGLVersion(major, minor, ctp, "@creation"), re); t.printStackTrace(); } } @@ -291,7 +291,7 @@ public class X11GLXContext extends GLContextImpl { final X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)drawable.getNativeSurface().getGraphicsConfiguration(); final AbstractGraphicsDevice device = config.getScreen().getDevice(); final X11GLXContext sharedContext = (X11GLXContext) factory.getOrCreateSharedContext(device); - long display = device.getHandle(); + final long display = device.getHandle(); if ( 0 != shareWithHandle ) { direct = GLX.glXIsDirect(display, shareWithHandle); @@ -410,7 +410,7 @@ public class X11GLXContext extends GLContextImpl { @Override protected void makeCurrentImpl() throws GLException { - long dpy = drawable.getNativeSurface().getDisplayHandle(); + final long dpy = drawable.getNativeSurface().getDisplayHandle(); if (GLX.glXGetCurrentContext() != contextHandle) { if (!glXMakeContextCurrent(dpy, drawable.getHandle(), drawableRead.getHandle(), contextHandle)) { @@ -426,7 +426,7 @@ public class X11GLXContext extends GLContextImpl { @Override protected void releaseImpl() throws GLException { - long display = drawable.getNativeSurface().getDisplayHandle(); + final long display = drawable.getNativeSurface().getDisplayHandle(); if (!glXMakeContextCurrent(display, 0, 0, 0)) { throw new GLException(getThreadName()+": Error freeing OpenGL context"); } @@ -438,10 +438,10 @@ public class X11GLXContext extends GLContextImpl { } @Override - protected void copyImpl(GLContext source, int mask) throws GLException { - long dst = getHandle(); - long src = source.getHandle(); - long display = drawable.getNativeSurface().getDisplayHandle(); + protected void copyImpl(final GLContext source, final int mask) throws GLException { + final long dst = getHandle(); + final long src = source.getHandle(); + final long display = drawable.getNativeSurface().getDisplayHandle(); if (0 == display) { throw new GLException(getThreadName()+": Connection to X display not yet set up"); } @@ -482,7 +482,7 @@ public class X11GLXContext extends GLContextImpl { protected final StringBuilder getPlatformExtensionsStringImpl() { final NativeSurface ns = drawable.getNativeSurface(); final X11GraphicsDevice x11Device = (X11GraphicsDevice) ns.getGraphicsConfiguration().getScreen().getDevice(); - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); x11Device.lock(); try{ if (DEBUG) { @@ -519,7 +519,7 @@ public class X11GLXContext extends GLContextImpl { } @Override - protected boolean setSwapIntervalImpl(int interval) { + protected boolean setSwapIntervalImpl(final int interval) { if( !drawable.getChosenGLCapabilities().isOnscreen() ) { return false; } final GLXExt glXExt = getGLXExt(); @@ -536,7 +536,7 @@ public class X11GLXContext extends GLContextImpl { } else { hasSwapInterval = -1; } - } catch (Throwable t) { hasSwapInterval=-1; } + } catch (final Throwable t) { hasSwapInterval=-1; } } /* try { switch( hasSwapInterval ) { @@ -549,16 +549,16 @@ public class X11GLXContext extends GLContextImpl { if (2 == hasSwapInterval) { try { return 0 == glXExt.glXSwapIntervalSGI(interval); - } catch (Throwable t) { hasSwapInterval=-1; } + } catch (final Throwable t) { hasSwapInterval=-1; } } return false; } - private final int initSwapGroupImpl(GLXExt glXExt) { + private final int initSwapGroupImpl(final GLXExt glXExt) { if(0==hasSwapGroupNV) { try { hasSwapGroupNV = glXExt.isExtensionAvailable(GLXExtensions.GLX_NV_swap_group)?1:-1; - } catch (Throwable t) { hasSwapGroupNV=1; } + } catch (final Throwable t) { hasSwapGroupNV=1; } if(DEBUG) { System.err.println("initSwapGroupImpl: "+GLXExtensions.GLX_NV_swap_group+": "+hasSwapGroupNV); } @@ -567,10 +567,10 @@ public class X11GLXContext extends GLContextImpl { } @Override - protected final boolean queryMaxSwapGroupsImpl(int[] maxGroups, int maxGroups_offset, - int[] maxBarriers, int maxBarriers_offset) { + protected final boolean queryMaxSwapGroupsImpl(final int[] maxGroups, final int maxGroups_offset, + final int[] maxBarriers, final int maxBarriers_offset) { boolean res = false; - GLXExt glXExt = getGLXExt(); + final GLXExt glXExt = getGLXExt(); if (initSwapGroupImpl(glXExt)>0) { final NativeSurface ns = drawable.getNativeSurface(); try { @@ -583,53 +583,53 @@ public class X11GLXContext extends GLContextImpl { maxBarriersNIO.get(maxGroups, maxGroups_offset, maxBarriersNIO.remaining()); res = true; } - } catch (Throwable t) { hasSwapGroupNV=-1; } + } catch (final Throwable t) { hasSwapGroupNV=-1; } } return res; } @Override - protected final boolean joinSwapGroupImpl(int group) { + protected final boolean joinSwapGroupImpl(final int group) { boolean res = false; - GLXExt glXExt = getGLXExt(); + final GLXExt glXExt = getGLXExt(); if (initSwapGroupImpl(glXExt)>0) { try { if( glXExt.glXJoinSwapGroupNV(drawable.getNativeSurface().getDisplayHandle(), drawable.getHandle(), group) ) { currentSwapGroup = group; res = true; } - } catch (Throwable t) { hasSwapGroupNV=-1; } + } catch (final Throwable t) { hasSwapGroupNV=-1; } } return res; } @Override - protected final boolean bindSwapBarrierImpl(int group, int barrier) { + protected final boolean bindSwapBarrierImpl(final int group, final int barrier) { boolean res = false; - GLXExt glXExt = getGLXExt(); + final GLXExt glXExt = getGLXExt(); if (initSwapGroupImpl(glXExt)>0) { try { if( glXExt.glXBindSwapBarrierNV(drawable.getNativeSurface().getDisplayHandle(), group, barrier) ) { res = true; } - } catch (Throwable t) { hasSwapGroupNV=-1; } + } catch (final Throwable t) { hasSwapGroupNV=-1; } } return res; } @Override - public final ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority) { + public final ByteBuffer glAllocateMemoryNV(final int size, final float readFrequency, final float writeFrequency, final float priority) { return getGLXExt().glXAllocateMemoryNV(size, readFrequency, writeFrequency, priority); } @Override - public final void glFreeMemoryNV(ByteBuffer pointer) { + public final void glFreeMemoryNV(final ByteBuffer pointer) { getGLXExt().glXFreeMemoryNV(pointer); } @Override public String toString() { - StringBuilder sb = new StringBuilder(); + final StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); super.append(sb); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java index 155c00c4c..c29bc3bc3 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawable.java @@ -47,7 +47,7 @@ import jogamp.opengl.GLDrawableImpl; import jogamp.opengl.GLDynamicLookupHelper; public abstract class X11GLXDrawable extends GLDrawableImpl { - protected X11GLXDrawable(GLDrawableFactory factory, NativeSurface comp, boolean realized) { + protected X11GLXDrawable(final GLDrawableFactory factory, final NativeSurface comp, final boolean realized) { super(factory, comp, realized); } @@ -59,7 +59,7 @@ public abstract class X11GLXDrawable extends GLDrawableImpl { @Override protected void setRealizedImpl() { if(realized) { - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration(); + final X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration(); config.updateGraphicsConfiguration(); if (DEBUG) { @@ -69,7 +69,7 @@ public abstract class X11GLXDrawable extends GLDrawableImpl { } @Override - protected final void swapBuffersImpl(boolean doubleBuffered) { + protected final void swapBuffersImpl(final boolean doubleBuffered) { if(doubleBuffered) { GLX.glXSwapBuffers(getNativeSurface().getDisplayHandle(), getHandle()); } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java index f7938f463..fbab32963 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDrawableFactory.java @@ -103,7 +103,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { if(null!=tmp && tmp.isLibComplete()) { GLX.getGLXProcAddressTable().reset(tmp); } - } catch (Exception ex) { + } catch (final Exception ex) { tmp = null; if(DEBUG) { ex.printStackTrace(); @@ -159,7 +159,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final GLDynamicLookupHelper getGLDynamicLookupHelper(int profile) { + public final GLDynamicLookupHelper getGLDynamicLookupHelper(final int profile) { return x11GLXDynamicLookupHelper; } @@ -180,9 +180,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { GLDrawableImpl drawable; GLContextImpl context; - SharedResource(X11GraphicsDevice dev, X11GraphicsScreen scrn, - GLDrawableImpl draw, GLContextImpl ctx, - VersionNumber glXServerVer, String glXServerVendor, boolean glXServerMultisampleAvail) { + SharedResource(final X11GraphicsDevice dev, final X11GraphicsScreen scrn, + final GLDrawableImpl draw, final GLContextImpl ctx, + final VersionNumber glXServerVer, final String glXServerVendor, final boolean glXServerMultisampleAvail) { device = dev; screen = scrn; drawable = draw; @@ -227,11 +227,11 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { sharedMap.clear(); } @Override - public SharedResourceRunner.Resource mapPut(String connection, SharedResourceRunner.Resource resource) { + public SharedResourceRunner.Resource mapPut(final String connection, final SharedResourceRunner.Resource resource) { return sharedMap.put(connection, resource); } @Override - public SharedResourceRunner.Resource mapGet(String connection) { + public SharedResourceRunner.Resource mapGet(final String connection) { return sharedMap.get(connection); } @Override @@ -240,7 +240,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public boolean isDeviceSupported(String connection) { + public boolean isDeviceSupported(final String connection) { final boolean res; final X11GraphicsDevice x11Device = new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */); x11Device.lock(); @@ -257,7 +257,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public SharedResourceRunner.Resource createSharedResource(String connection) { + public SharedResourceRunner.Resource createSharedResource(final String connection) { final X11GraphicsDevice sharedDevice = new X11GraphicsDevice(X11Util.openDisplay(connection), AbstractGraphicsDevice.DEFAULT_UNIT, true /* owner */); sharedDevice.lock(); try { @@ -312,7 +312,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return new SharedResource(sharedDevice, sharedScreen, sharedDrawable, sharedContext, glXServerVersion, glXServerVendorName, glXServerMultisampleAvailable && GLXUtil.isClientMultisampleAvailable()); - } catch (Throwable t) { + } catch (final Throwable t) { throw new GLException("X11GLXDrawableFactory - Could not initialize shared resources for "+connection, t); } finally { sharedDevice.unlock(); @@ -320,8 +320,8 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public void releaseSharedResource(SharedResourceRunner.Resource shared) { - SharedResource sr = (SharedResource) shared; + public void releaseSharedResource(final SharedResourceRunner.Resource shared) { + final SharedResource sr = (SharedResource) shared; if (DEBUG) { System.err.println("Shutdown Shared:"); System.err.println("Device : " + sr.device); @@ -361,7 +361,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean getIsDeviceCompatible(AbstractGraphicsDevice device) { + public final boolean getIsDeviceCompatible(final AbstractGraphicsDevice device) { if(null != x11GLXDynamicLookupHelper && device instanceof X11GraphicsDevice) { return true; } @@ -374,11 +374,11 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final SharedResource getOrCreateSharedResourceImpl(AbstractGraphicsDevice device) { + protected final SharedResource getOrCreateSharedResourceImpl(final AbstractGraphicsDevice device) { return (SharedResource) sharedResourceRunner.getOrCreateShared(device); } - protected final long getOrCreateSharedDpy(AbstractGraphicsDevice device) { + protected final long getOrCreateSharedDpy(final AbstractGraphicsDevice device) { final SharedResourceRunner.Resource sr = getOrCreateSharedResource( device ); if(null!=sr) { return sr.getDevice().getHandle(); @@ -387,12 +387,12 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected List getAvailableCapabilitiesImpl(AbstractGraphicsDevice device) { + protected List getAvailableCapabilitiesImpl(final AbstractGraphicsDevice device) { return X11GLXGraphicsConfigurationFactory.getAvailableCapabilities(this, device); } @Override - protected final GLDrawableImpl createOnscreenDrawableImpl(NativeSurface target) { + protected final GLDrawableImpl createOnscreenDrawableImpl(final NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } @@ -400,19 +400,19 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final GLDrawableImpl createOffscreenDrawableImpl(NativeSurface target) { + protected final GLDrawableImpl createOffscreenDrawableImpl(final NativeSurface target) { if (target == null) { throw new IllegalArgumentException("Null target"); } - AbstractGraphicsConfiguration config = target.getGraphicsConfiguration(); - GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); + final AbstractGraphicsConfiguration config = target.getGraphicsConfiguration(); + final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) config.getChosenCapabilities(); if(!caps.isPBuffer()) { return new X11PixmapGLXDrawable(this, target); } // PBuffer GLDrawable Creation GLDrawableImpl pbufferDrawable; - AbstractGraphicsDevice device = config.getScreen().getDevice(); + final AbstractGraphicsDevice device = config.getScreen().getDevice(); /** * Due to the ATI Bug https://bugzilla.mozilla.org/show_bug.cgi?id=486277, @@ -420,7 +420,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { * The dummy context shall also use the same Display, * since switching Display in this regard is another ATI bug. */ - SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); + final SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); if( null!=sr && sr.isGLXVendorATI() && null == GLContext.getCurrent() ) { sr.getContext().makeCurrent(); try { @@ -434,9 +434,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return pbufferDrawable; } - public final boolean isGLXMultisampleAvailable(AbstractGraphicsDevice device) { + public final boolean isGLXMultisampleAvailable(final AbstractGraphicsDevice device) { if(null != device) { - SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); + final SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); if(null!=sr) { return sr.isGLXMultisampleAvailable(); } @@ -444,9 +444,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return false; } - public final VersionNumber getGLXVersionNumber(AbstractGraphicsDevice device) { + public final VersionNumber getGLXVersionNumber(final AbstractGraphicsDevice device) { if(null != device) { - SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); + final SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); if(null!=sr) { return sr.getGLXVersion(); } @@ -457,9 +457,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return null; } - public final boolean isGLXVersionGreaterEqualOneOne(AbstractGraphicsDevice device) { + public final boolean isGLXVersionGreaterEqualOneOne(final AbstractGraphicsDevice device) { if(null != device) { - SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); + final SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); if(null!=sr) { return sr.isGLXVersionGreaterEqualOneOne(); } @@ -471,9 +471,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return false; } - public final boolean isGLXVersionGreaterEqualOneThree(AbstractGraphicsDevice device) { + public final boolean isGLXVersionGreaterEqualOneThree(final AbstractGraphicsDevice device) { if(null != device) { - SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); + final SharedResource sr = (SharedResource) sharedResourceRunner.getOrCreateShared(device); if(null!=sr) { return sr.isGLXVersionGreaterEqualOneThree(); } @@ -486,9 +486,9 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean canCreateGLPbuffer(AbstractGraphicsDevice device, GLProfile glp) { + public final boolean canCreateGLPbuffer(AbstractGraphicsDevice device, final GLProfile glp) { if(null == device) { - SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(defaultDevice); + final SharedResourceRunner.Resource sr = sharedResourceRunner.getOrCreateShared(defaultDevice); if(null!=sr) { device = sr.getDevice(); } @@ -497,10 +497,10 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final ProxySurface createMutableSurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable capsChosen, - GLCapabilitiesImmutable capsRequested, - GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstreamHook) { + protected final ProxySurface createMutableSurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + final GLCapabilitiesImmutable capsChosen, + final GLCapabilitiesImmutable capsRequested, + final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstreamHook) { final X11GraphicsDevice device; if( createNewDevice || !(deviceReq instanceof X11GraphicsDevice) ) { device = new X11GraphicsDevice(X11Util.openDisplay(deviceReq.getConnection()), deviceReq.getUnitID(), true /* owner */); @@ -516,14 +516,14 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final ProxySurface createDummySurfaceImpl(AbstractGraphicsDevice deviceReq, boolean createNewDevice, - GLCapabilitiesImmutable chosenCaps, GLCapabilitiesImmutable requestedCaps, GLCapabilitiesChooser chooser, int width, int height) { + public final ProxySurface createDummySurfaceImpl(final AbstractGraphicsDevice deviceReq, final boolean createNewDevice, + GLCapabilitiesImmutable chosenCaps, final GLCapabilitiesImmutable requestedCaps, final GLCapabilitiesChooser chooser, final int width, final int height) { chosenCaps = GLGraphicsConfigurationUtil.fixOnscreenGLCapabilities(chosenCaps); return createMutableSurfaceImpl(deviceReq, createNewDevice, chosenCaps, requestedCaps, chooser, new X11DummyUpstreamSurfaceHook(width, height)); } @Override - protected final ProxySurface createProxySurfaceImpl(AbstractGraphicsDevice deviceReq, int screenIdx, long windowHandle, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser, UpstreamSurfaceHook upstream) { + protected final ProxySurface createProxySurfaceImpl(final AbstractGraphicsDevice deviceReq, final int screenIdx, final long windowHandle, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser, final UpstreamSurfaceHook upstream) { final X11GraphicsDevice device = new X11GraphicsDevice(X11Util.openDisplay(deviceReq.getConnection()), deviceReq.getUnitID(), true /* owner */); final X11GraphicsScreen screen = new X11GraphicsScreen(device, screenIdx); final int xvisualID = X11Lib.GetVisualIDFromWindow(device.getHandle(), windowHandle); @@ -546,7 +546,7 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - public final boolean canCreateExternalGLDrawable(AbstractGraphicsDevice device) { + public final boolean canCreateExternalGLDrawable(final AbstractGraphicsDevice device) { return canCreateGLPbuffer(device, null /* GLProfile not used for query on X11 */); } @@ -567,13 +567,13 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { return gammaRampLength; } - long display = getOrCreateSharedDpy(defaultDevice); + final long display = getOrCreateSharedDpy(defaultDevice); if(0 == display) { return 0; } - int[] size = new int[1]; - boolean res = X11Lib.XF86VidModeGetGammaRampSize(display, + final int[] size = new int[1]; + final boolean res = X11Lib.XF86VidModeGetGammaRampSize(display, X11Lib.DefaultScreen(display), size, 0); if (!res) { @@ -585,19 +585,19 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final boolean setGammaRamp(float[] ramp) { - long display = getOrCreateSharedDpy(defaultDevice); + protected final boolean setGammaRamp(final float[] ramp) { + final long display = getOrCreateSharedDpy(defaultDevice); if(0 == display) { return false; } - int len = ramp.length; - short[] rampData = new short[len]; + final int len = ramp.length; + final short[] rampData = new short[len]; for (int i = 0; i < len; i++) { rampData[i] = (short) (ramp[i] * 65535); } - boolean res = X11Lib.XF86VidModeSetGammaRamp(display, + final boolean res = X11Lib.XF86VidModeSetGammaRamp(display, X11Lib.DefaultScreen(display), rampData.length, rampData, 0, @@ -608,24 +608,24 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { @Override protected final Buffer getGammaRamp() { - long display = getOrCreateSharedDpy(defaultDevice); + final long display = getOrCreateSharedDpy(defaultDevice); if(0 == display) { return null; } - int size = getGammaRampLength(); - ShortBuffer rampData = ShortBuffer.wrap(new short[3 * size]); + final int size = getGammaRampLength(); + final ShortBuffer rampData = ShortBuffer.wrap(new short[3 * size]); rampData.position(0); rampData.limit(size); - ShortBuffer redRampData = rampData.slice(); + final ShortBuffer redRampData = rampData.slice(); rampData.position(size); rampData.limit(2 * size); - ShortBuffer greenRampData = rampData.slice(); + final ShortBuffer greenRampData = rampData.slice(); rampData.position(2 * size); rampData.limit(3 * size); - ShortBuffer blueRampData = rampData.slice(); + final ShortBuffer blueRampData = rampData.slice(); - boolean res = X11Lib.XF86VidModeGetGammaRamp(display, + final boolean res = X11Lib.XF86VidModeGetGammaRamp(display, X11Lib.DefaultScreen(display), size, redRampData, @@ -638,30 +638,30 @@ public class X11GLXDrawableFactory extends GLDrawableFactoryImpl { } @Override - protected final void resetGammaRamp(Buffer originalGammaRamp) { + protected final void resetGammaRamp(final Buffer originalGammaRamp) { if (originalGammaRamp == null) { return; // getGammaRamp failed originally } - long display = getOrCreateSharedDpy(defaultDevice); + final long display = getOrCreateSharedDpy(defaultDevice); if(0 == display) { return; } - ShortBuffer rampData = (ShortBuffer) originalGammaRamp; - int capacity = rampData.capacity(); + final ShortBuffer rampData = (ShortBuffer) originalGammaRamp; + final int capacity = rampData.capacity(); if ((capacity % 3) != 0) { throw new IllegalArgumentException("Must not be the original gamma ramp"); } - int size = capacity / 3; + final int size = capacity / 3; rampData.position(0); rampData.limit(size); - ShortBuffer redRampData = rampData.slice(); + final ShortBuffer redRampData = rampData.slice(); rampData.position(size); rampData.limit(2 * size); - ShortBuffer greenRampData = rampData.slice(); + final ShortBuffer greenRampData = rampData.slice(); rampData.position(2 * size); rampData.limit(3 * size); - ShortBuffer blueRampData = rampData.slice(); + final ShortBuffer blueRampData = rampData.slice(); X11Lib.XF86VidModeSetGammaRamp(display, X11Lib.DefaultScreen(display), diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java index 951174f71..0e91a6a65 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXDynamicLibraryBundleInfo.java @@ -62,14 +62,14 @@ public final class X11GLXDynamicLibraryBundleInfo extends DesktopGLDynamicLibrar @Override public final List getToolGetProcAddressFuncNameList() { - List res = new ArrayList(); + final List res = new ArrayList(); res.add("glXGetProcAddressARB"); res.add("glXGetProcAddress"); return res; } @Override - public final long toolGetProcAddress(long toolGetProcAddressHandle, String funcName) { + public final long toolGetProcAddress(final long toolGetProcAddressHandle, final String funcName) { return GLX.glXGetProcAddress(toolGetProcAddressHandle, funcName); } } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java index c0a3b46df..5f6a6b344 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfiguration.java @@ -65,8 +65,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem public static final int MAX_ATTRIBS = 128; private final GLCapabilitiesChooser chooser; - X11GLXGraphicsConfiguration(X11GraphicsScreen screen, - X11GLCapabilities capsChosen, GLCapabilitiesImmutable capsRequested, GLCapabilitiesChooser chooser) { + X11GLXGraphicsConfiguration(final X11GraphicsScreen screen, + final X11GLCapabilities capsChosen, final GLCapabilitiesImmutable capsRequested, final GLCapabilitiesChooser chooser) { super(screen, capsChosen, capsRequested, capsChosen.getXVisualInfo()); this.chooser=chooser; } @@ -109,7 +109,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem } } - static X11GLXGraphicsConfiguration create(GLProfile glp, X11GraphicsScreen x11Screen, int fbcfgID) { + static X11GLXGraphicsConfiguration create(GLProfile glp, final X11GraphicsScreen x11Screen, final int fbcfgID) { final X11GraphicsDevice device = (X11GraphicsDevice) x11Screen.getDevice(); final long display = device.getHandle(); if(0==display) { @@ -131,11 +131,11 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return new X11GLXGraphicsConfiguration(x11Screen, caps, caps, new DefaultGLCapabilitiesChooser()); } - static IntBuffer GLCapabilities2AttribList(GLCapabilitiesImmutable caps, - boolean forFBAttr, boolean isMultisampleAvailable, - long display, int screen) + static IntBuffer GLCapabilities2AttribList(final GLCapabilitiesImmutable caps, + final boolean forFBAttr, final boolean isMultisampleAvailable, + final long display, final int screen) { - int colorDepth = (caps.getRedBits() + + final int colorDepth = (caps.getRedBits() + caps.getGreenBits() + caps.getBlueBits()); if (colorDepth < 15) { @@ -237,12 +237,12 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem // FBConfig - static boolean GLXFBConfigIDValid(long display, int screen, int fbcfgid) { - long fbcfg = X11GLXGraphicsConfiguration.glXFBConfigID2FBConfig(display, screen, fbcfgid); + static boolean GLXFBConfigIDValid(final long display, final int screen, final int fbcfgid) { + final long fbcfg = X11GLXGraphicsConfiguration.glXFBConfigID2FBConfig(display, screen, fbcfgid); return (0 != fbcfg) ? X11GLXGraphicsConfiguration.GLXFBConfigValid( display, fbcfg ) : false ; } - static boolean GLXFBConfigValid(long display, long fbcfg) { + static boolean GLXFBConfigValid(final long display, final long fbcfg) { final IntBuffer tmp = Buffers.newDirectIntBuffer(1); if(GLX.GLX_BAD_ATTRIBUTE == GLX.glXGetFBConfigAttrib(display, fbcfg, GLX.GLX_RENDER_TYPE, tmp)) { return false; @@ -275,14 +275,14 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return val; } - static XRenderDirectFormat XVisual2XRenderMask(long dpy, long visual) { - XRenderPictFormat renderPictFmt = X11Lib.XRenderFindVisualFormat(dpy, visual); + static XRenderDirectFormat XVisual2XRenderMask(final long dpy, final long visual) { + final XRenderPictFormat renderPictFmt = X11Lib.XRenderFindVisualFormat(dpy, visual); if(null == renderPictFmt) { return null; } return renderPictFmt.getDirect(); } - static XRenderDirectFormat XVisual2XRenderMask(long dpy, long visual, XRenderPictFormat dest) { + static XRenderDirectFormat XVisual2XRenderMask(final long dpy, final long visual, final XRenderPictFormat dest) { if( !X11Lib.XRenderFindVisualFormat(dpy, visual, dest) ) { return null; } else { @@ -298,7 +298,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem } static List GLXFBConfig2GLCapabilities(final X11GraphicsDevice device, final GLProfile glp, final PointerBuffer fbcfgsL, - final int winattrmask, final boolean isMultisampleAvailable, boolean onlyFirstValid) { + final int winattrmask, final boolean isMultisampleAvailable, final boolean onlyFirstValid) { final IntBuffer tmp = Buffers.newDirectIntBuffer(1); final XRenderPictFormat xRenderPictFormat= XRenderPictFormat.create(); final List result = new ArrayList(); @@ -424,7 +424,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, caps); } - private static String glXGetFBConfigErrorCode(int err) { + private static String glXGetFBConfigErrorCode(final int err) { switch (err) { case GLX.GLX_NO_EXTENSION: return "GLX_NO_EXTENSION"; case GLX.GLX_BAD_ATTRIBUTE: return "GLX_BAD_ATTRIBUTE"; @@ -432,7 +432,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem } } - static boolean glXGetFBConfig(long display, long cfg, int attrib, IntBuffer tmp) { + static boolean glXGetFBConfig(final long display, final long cfg, final int attrib, final IntBuffer tmp) { if (display == 0) { throw new GLException("No display connection"); } @@ -445,7 +445,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return res; } - static int glXFBConfig2FBConfigID(long display, long cfg) { + static int glXFBConfig2FBConfigID(final long display, final long cfg) { final IntBuffer tmpID = Buffers.newDirectIntBuffer(1); if( glXGetFBConfig(display, cfg, GLX.GLX_FBCONFIG_ID, tmpID) ) { return tmpID.get(0); @@ -454,11 +454,11 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem } } - static long glXFBConfigID2FBConfig(long display, int screen, int id) { + static long glXFBConfigID2FBConfig(final long display, final int screen, final int id) { final IntBuffer attribs = Buffers.newDirectIntBuffer(new int[] { GLX.GLX_FBCONFIG_ID, id, 0 }); final IntBuffer count = Buffers.newDirectIntBuffer(1); count.put(0, -1); - PointerBuffer fbcfgsL = GLX.glXChooseFBConfig(display, screen, attribs, count); + final PointerBuffer fbcfgsL = GLX.glXChooseFBConfig(display, screen, attribs, count); if (fbcfgsL == null || fbcfgsL.limit()<1) { return 0; } @@ -467,15 +467,15 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem // Visual Info - static XVisualInfo XVisualID2XVisualInfo(long display, long visualID) { - int[] count = new int[1]; - XVisualInfo template = XVisualInfo.create(); + static XVisualInfo XVisualID2XVisualInfo(final long display, final long visualID) { + final int[] count = new int[1]; + final XVisualInfo template = XVisualInfo.create(); template.setVisualid(visualID); - XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualIDMask, template, count, 0); + final XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualIDMask, template, count, 0); if (infos == null || infos.length == 0) { return null; } - XVisualInfo res = XVisualInfo.create(infos[0]); + final XVisualInfo res = XVisualInfo.create(infos[0]); if (DEBUG) { System.err.println("Fetched XVisualInfo for visual ID " + toHexString(visualID)); System.err.println("Resulting XVisualInfo: visualid = " + toHexString(res.getVisualid())); @@ -483,8 +483,8 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return res; } - static X11GLCapabilities XVisualInfo2GLCapabilities(final X11GraphicsDevice device, GLProfile glp, XVisualInfo info, - final int winattrmask, boolean isMultisampleEnabled) { + static X11GLCapabilities XVisualInfo2GLCapabilities(final X11GraphicsDevice device, final GLProfile glp, final XVisualInfo info, + final int winattrmask, final boolean isMultisampleEnabled) { final int allDrawableTypeBits = GLGraphicsConfigurationUtil.WINDOW_BIT | GLGraphicsConfigurationUtil.BITMAP_BIT | GLGraphicsConfigurationUtil.FBO_BIT ; @@ -512,7 +512,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return null; } - GLCapabilities res = new X11GLCapabilities(info, glp); + final GLCapabilities res = new X11GLCapabilities(info, glp); res.setDoubleBuffered(glXGetConfig(display, info, GLX.GLX_DOUBLEBUFFER, tmp) != 0); res.setStereo (glXGetConfig(display, info, GLX.GLX_STEREO, tmp) != 0); @@ -551,7 +551,7 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem return (X11GLCapabilities) GLGraphicsConfigurationUtil.fixWinAttribBitsAndHwAccel(device, drawableTypeBits, res); } - private static String glXGetConfigErrorCode(int err) { + private static String glXGetConfigErrorCode(final int err) { switch (err) { case GLX.GLX_NO_EXTENSION: return "GLX_NO_EXTENSION"; case GLX.GLX_BAD_SCREEN: return "GLX_BAD_SCREEN"; @@ -561,11 +561,11 @@ public class X11GLXGraphicsConfiguration extends X11GraphicsConfiguration implem } } - static int glXGetConfig(long display, XVisualInfo info, int attrib, IntBuffer tmp) { + static int glXGetConfig(final long display, final XVisualInfo info, final int attrib, final IntBuffer tmp) { if (display == 0) { throw new GLException("No display connection"); } - int res = GLX.glXGetConfig(display, info, attrib, tmp); + final int res = GLX.glXGetConfig(display, info, attrib, tmp); if (res != 0) { throw new GLException("glXGetConfig("+toHexString(attrib)+") failed: error code " + glXGetConfigErrorCode(res)); } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java index 75771f884..44479acc0 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11GLXGraphicsConfigurationFactory.java @@ -94,7 +94,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF @Override protected AbstractGraphicsConfiguration chooseGraphicsConfigurationImpl( - CapabilitiesImmutable capsChosen, CapabilitiesImmutable capsRequested, CapabilitiesChooser chooser, AbstractGraphicsScreen absScreen, int nativeVisualID) { + final CapabilitiesImmutable capsChosen, final CapabilitiesImmutable capsRequested, final CapabilitiesChooser chooser, final AbstractGraphicsScreen absScreen, final int nativeVisualID) { if (!(absScreen instanceof X11GraphicsScreen)) { throw new IllegalArgumentException("Only X11GraphicsScreen are allowed here"); } @@ -124,8 +124,8 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF (GLCapabilitiesChooser)chooser, (X11GraphicsScreen)absScreen, nativeVisualID); } - protected static List getAvailableCapabilities(X11GLXDrawableFactory factory, AbstractGraphicsDevice device) { - X11GLXDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); + protected static List getAvailableCapabilities(final X11GLXDrawableFactory factory, final AbstractGraphicsDevice device) { + final X11GLXDrawableFactory.SharedResource sharedResource = factory.getOrCreateSharedResourceImpl(device); if(null == sharedResource) { throw new GLException("Shared resource for device n/a: "+device); } @@ -153,7 +153,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF return availableCaps; } - static List getAvailableGLCapabilitiesFBConfig(X11GraphicsScreen x11Screen, GLProfile glProfile, boolean isMultisampleAvailable) { + static List getAvailableGLCapabilitiesFBConfig(final X11GraphicsScreen x11Screen, final GLProfile glProfile, final boolean isMultisampleAvailable) { PointerBuffer fbcfgsL = null; // Utilizing FBConfig @@ -184,20 +184,20 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF return availableCaps; } - static List getAvailableGLCapabilitiesXVisual(X11GraphicsScreen x11Screen, GLProfile glProfile, boolean isMultisampleAvailable) { + static List getAvailableGLCapabilitiesXVisual(final X11GraphicsScreen x11Screen, final GLProfile glProfile, final boolean isMultisampleAvailable) { final X11GraphicsDevice absDevice = (X11GraphicsDevice) x11Screen.getDevice(); final long display = absDevice.getHandle(); - int screen = x11Screen.getIndex(); + final int screen = x11Screen.getIndex(); - int[] count = new int[1]; - XVisualInfo template = XVisualInfo.create(); + final int[] count = new int[1]; + final XVisualInfo template = XVisualInfo.create(); template.setScreen(screen); - XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualScreenMask, template, count, 0); + final XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualScreenMask, template, count, 0); if (infos == null || infos.length<1) { throw new GLException("Error while enumerating available XVisualInfos"); } - ArrayList availableCaps = new ArrayList(); + final ArrayList availableCaps = new ArrayList(); for (int i = 0; i < infos.length; i++) { final GLCapabilitiesImmutable caps = X11GLXGraphicsConfiguration.XVisualInfo2GLCapabilities(absDevice, glProfile, infos[i], GLGraphicsConfigurationUtil.ALL_BITS, isMultisampleAvailable); if(null != caps) { @@ -211,17 +211,17 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF static X11GLXGraphicsConfiguration chooseGraphicsConfigurationStatic(GLCapabilitiesImmutable capsChosen, - GLCapabilitiesImmutable capsReq, - GLCapabilitiesChooser chooser, - X11GraphicsScreen x11Screen, int xvisualID) { + final GLCapabilitiesImmutable capsReq, + final GLCapabilitiesChooser chooser, + final X11GraphicsScreen x11Screen, final int xvisualID) { if (x11Screen == null) { throw new IllegalArgumentException("AbstractGraphicsScreen is null"); } if (capsChosen == null) { capsChosen = new GLCapabilities(null); } - X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice(); - X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory(); + final X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice(); + final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory(); capsChosen = GLGraphicsConfigurationUtil.fixGLCapabilities( capsChosen, factory, x11Device); final boolean usePBuffer = !capsChosen.isOnscreen() && capsChosen.isPBuffer(); @@ -250,7 +250,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF return res; } - static X11GLXGraphicsConfiguration fetchGraphicsConfigurationFBConfig(X11GraphicsScreen x11Screen, int fbID, GLProfile glp) { + static X11GLXGraphicsConfiguration fetchGraphicsConfigurationFBConfig(final X11GraphicsScreen x11Screen, final int fbID, final GLProfile glp) { final X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice(); final long display = x11Device.getHandle(); final int screen = x11Screen.getIndex(); @@ -274,19 +274,19 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF return new X11GLXGraphicsConfiguration(x11Screen, caps, caps, new DefaultGLCapabilitiesChooser()); } - private static X11GLXGraphicsConfiguration chooseGraphicsConfigurationFBConfig(GLCapabilitiesImmutable capsChosen, - GLCapabilitiesImmutable capsReq, - GLCapabilitiesChooser chooser, - X11GraphicsScreen x11Screen, int xvisualID) { + private static X11GLXGraphicsConfiguration chooseGraphicsConfigurationFBConfig(final GLCapabilitiesImmutable capsChosen, + final GLCapabilitiesImmutable capsReq, + final GLCapabilitiesChooser chooser, + final X11GraphicsScreen x11Screen, final int xvisualID) { int recommendedIndex = -1; PointerBuffer fbcfgsL = null; - GLProfile glProfile = capsChosen.getGLProfile(); + final GLProfile glProfile = capsChosen.getGLProfile(); // Utilizing FBConfig // - X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice(); - long display = x11Device.getHandle(); - int screen = x11Screen.getIndex(); + final X11GraphicsDevice x11Device = (X11GraphicsDevice) x11Screen.getDevice(); + final long display = x11Device.getHandle(); + final int screen = x11Screen.getIndex(); final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory(); final boolean isMultisampleAvailable = factory.isGLXMultisampleAvailable(x11Device); @@ -379,27 +379,27 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF } return null; } - X11GLCapabilities chosenCaps = (X11GLCapabilities) availableCaps.get(chosenIndex); + final X11GLCapabilities chosenCaps = (X11GLCapabilities) availableCaps.get(chosenIndex); return new X11GLXGraphicsConfiguration(x11Screen, chosenCaps, capsReq, chooser); } - private static X11GLXGraphicsConfiguration chooseGraphicsConfigurationXVisual(GLCapabilitiesImmutable capsChosen, - GLCapabilitiesImmutable capsReq, + private static X11GLXGraphicsConfiguration chooseGraphicsConfigurationXVisual(final GLCapabilitiesImmutable capsChosen, + final GLCapabilitiesImmutable capsReq, GLCapabilitiesChooser chooser, - X11GraphicsScreen x11Screen, int xvisualID) { + final X11GraphicsScreen x11Screen, final int xvisualID) { if (chooser == null) { chooser = new DefaultGLCapabilitiesChooser(); } - GLProfile glProfile = capsChosen.getGLProfile(); + final GLProfile glProfile = capsChosen.getGLProfile(); final int winattrmask = GLGraphicsConfigurationUtil.getExclusiveWinAttributeBits(capsChosen.isOnscreen(), capsChosen.isFBO(), false /* pbuffer */, capsChosen.isBitmap()); - List availableCaps = new ArrayList(); + final List availableCaps = new ArrayList(); int recommendedIndex = -1; - X11GraphicsDevice absDevice = (X11GraphicsDevice) x11Screen.getDevice(); - long display = absDevice.getHandle(); - int screen = x11Screen.getIndex(); + final X11GraphicsDevice absDevice = (X11GraphicsDevice) x11Screen.getDevice(); + final long display = absDevice.getHandle(); + final int screen = x11Screen.getIndex(); final X11GLXDrawableFactory factory = (X11GLXDrawableFactory) GLDrawableFactory.getDesktopFactory(); final boolean isMultisampleAvailable = factory.isGLXMultisampleAvailable(absDevice); @@ -421,10 +421,10 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF } // 2nd choice: get all GLCapabilities available, preferred recommendedIndex might be available if 1st choice was successful - int[] count = new int[1]; - XVisualInfo template = XVisualInfo.create(); + final int[] count = new int[1]; + final XVisualInfo template = XVisualInfo.create(); template.setScreen(screen); - XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualScreenMask, template, count, 0); + final XVisualInfo[] infos = X11Lib.XGetVisualInfo(display, X11Lib.VisualScreenMask, template, count, 0); if (infos == null || infos.length<1) { throw new GLException("Error while enumerating available XVisualInfos"); } @@ -451,7 +451,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF if( VisualIDHolder.VID_UNDEFINED != xvisualID ) { for(int i=0; i chosenIndex ) { if (DEBUG) { System.err.println("X11GLXGraphicsConfiguration.chooseGraphicsConfigurationXVisual: failed, return null"); @@ -476,7 +476,7 @@ public class X11GLXGraphicsConfigurationFactory extends GLGraphicsConfigurationF } return null; } - X11GLCapabilities chosenCaps = (X11GLCapabilities) availableCaps.get(chosenIndex); + final X11GLCapabilities chosenCaps = (X11GLCapabilities) availableCaps.get(chosenIndex); return new X11GLXGraphicsConfiguration(x11Screen, chosenCaps, capsReq, chooser); } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java index 9da189290..866662950 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11OnscreenGLXDrawable.java @@ -51,7 +51,7 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable { long glXWindow; // GLXWindow, a GLXDrawable representation boolean useGLXWindow; - protected X11OnscreenGLXDrawable(GLDrawableFactory factory, NativeSurface component, boolean realized) { + protected X11OnscreenGLXDrawable(final GLDrawableFactory factory, final NativeSurface component, final boolean realized) { super(factory, component, realized); glXWindow=0; useGLXWindow=false; @@ -84,10 +84,10 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable { @Override protected final void createHandle() { if(USE_GLXWINDOW) { - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration(); + final X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration)getNativeSurface().getGraphicsConfiguration(); if(config.getFBConfig()>=0) { useGLXWindow=true; - long dpy = getNativeSurface().getDisplayHandle(); + final long dpy = getNativeSurface().getDisplayHandle(); if(0!=glXWindow) { GLX.glXDestroyWindow(dpy, glXWindow); } @@ -103,7 +103,7 @@ public class X11OnscreenGLXDrawable extends X11GLXDrawable { } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new X11GLXContext(this, shareWith); } } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java index ae2982269..21ad06020 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java @@ -53,7 +53,7 @@ import javax.media.opengl.GLException; import com.jogamp.common.nio.Buffers; public class X11PbufferGLXDrawable extends X11GLXDrawable { - protected X11PbufferGLXDrawable(GLDrawableFactory factory, NativeSurface target) { + protected X11PbufferGLXDrawable(final GLDrawableFactory factory, final NativeSurface target) { /* GLCapabilities caps, GLCapabilitiesChooser chooser, int width, int height */ @@ -70,12 +70,12 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new X11GLXContext(this, shareWith); } protected void destroyPbuffer() { - NativeSurface ns = getNativeSurface(); + final NativeSurface ns = getNativeSurface(); if (ns.getSurfaceHandle() != 0) { GLX.glXDestroyPbuffer(ns.getDisplayHandle(), ns.getSurfaceHandle()); } @@ -102,7 +102,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { // Create the p-buffer. int niattribs = 0; - IntBuffer iattributes = Buffers.newDirectIntBuffer(7); + final IntBuffer iattributes = Buffers.newDirectIntBuffer(7); iattributes.put(niattribs++, GLX.GLX_PBUFFER_WIDTH); iattributes.put(niattribs++, ms.getSurfaceWidth()); @@ -112,7 +112,7 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { iattributes.put(niattribs++, 0); iattributes.put(niattribs++, 0); - long pbuffer = GLX.glXCreatePbuffer(display, config.getFBConfig(), iattributes); + final long pbuffer = GLX.glXCreatePbuffer(display, config.getFBConfig(), iattributes); if (pbuffer == 0) { // FIXME: query X error code for detail error message throw new GLException("pbuffer creation error: glXCreatePbuffer() failed"); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java index 42d76097c..e217e1c2a 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java @@ -54,7 +54,7 @@ import jogamp.nativewindow.x11.XVisualInfo; public class X11PixmapGLXDrawable extends X11GLXDrawable { private long pixmap; - protected X11PixmapGLXDrawable(GLDrawableFactory factory, NativeSurface target) { + protected X11PixmapGLXDrawable(final GLDrawableFactory factory, final NativeSurface target) { super(factory, target, false); } @@ -68,26 +68,26 @@ public class X11PixmapGLXDrawable extends X11GLXDrawable { } @Override - public GLContext createContext(GLContext shareWith) { + public GLContext createContext(final GLContext shareWith) { return new X11GLXContext(this, shareWith); } private void createPixmap() { - NativeSurface ns = getNativeSurface(); - X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration) ns.getGraphicsConfiguration(); - XVisualInfo vis = config.getXVisualInfo(); - int bitsPerPixel = vis.getDepth(); - AbstractGraphicsScreen aScreen = config.getScreen(); - AbstractGraphicsDevice aDevice = aScreen.getDevice(); - long dpy = aDevice.getHandle(); - int screen = aScreen.getIndex(); + final NativeSurface ns = getNativeSurface(); + final X11GLXGraphicsConfiguration config = (X11GLXGraphicsConfiguration) ns.getGraphicsConfiguration(); + final XVisualInfo vis = config.getXVisualInfo(); + final int bitsPerPixel = vis.getDepth(); + final AbstractGraphicsScreen aScreen = config.getScreen(); + final AbstractGraphicsDevice aDevice = aScreen.getDevice(); + final long dpy = aDevice.getHandle(); + final int screen = aScreen.getIndex(); pixmap = X11Lib.XCreatePixmap(dpy, X11Lib.RootWindow(dpy, screen), surface.getSurfaceWidth(), surface.getSurfaceHeight(), bitsPerPixel); if (pixmap == 0) { throw new GLException("XCreatePixmap failed"); } - long drawable = GLX.glXCreateGLXPixmap(dpy, vis, pixmap); + final long drawable = GLX.glXCreateGLXPixmap(dpy, vis, pixmap); if (drawable == 0) { X11Lib.XFreePixmap(dpy, pixmap); pixmap = 0; @@ -104,7 +104,7 @@ public class X11PixmapGLXDrawable extends X11GLXDrawable { protected void destroyPixmap() { if (pixmap == 0) return; - NativeSurface ns = getNativeSurface(); + final NativeSurface ns = getNativeSurface(); long display = ns.getDisplayHandle(); long drawable = ns.getSurfaceHandle(); @@ -117,7 +117,7 @@ public class X11PixmapGLXDrawable extends X11GLXDrawable { // Must destroy pixmap and GLXPixmap if (DEBUG) { - long cur = GLX.glXGetCurrentContext(); + final long cur = GLX.glXGetCurrentContext(); if (cur != 0) { System.err.println("WARNING: found context " + toHexString(cur) + " current during pixmap destruction"); } -- cgit v1.2.3