diff options
author | Sven Gothel <[email protected]> | 2013-10-17 05:25:59 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-10-17 05:25:59 +0200 |
commit | 40863632d1428de015099b5967e5136425e99f25 (patch) | |
tree | 33dc7b82204280294d9faa266d75c6c01702cab9 /src/jogl/classes/jogamp/opengl/util | |
parent | 56322e1cf41bbb5bcc097164fb3ddcc0061c1c73 (diff) |
Int -> Enum using EnumClass.values()[ordinal] instead of for-loop - FFMPEGNatives's Enums and new MouseEvent.PointerType.valueOf(int)
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util')
-rw-r--r-- | src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java | 16 |
1 files changed, 8 insertions, 8 deletions
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 77cf4ff77..89c15b905 100644 --- a/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java +++ b/src/jogl/classes/jogamp/opengl/util/av/impl/FFMPEGNatives.java @@ -93,10 +93,10 @@ interface FFMPEGNatives { COUNT; ///< Number of sample formats. public static SampleFormat valueOf(int i) { - for (SampleFormat fmt : SampleFormat.values()) { - if(fmt.ordinal() == i) { - return fmt; - } + // ordinal = enumValue.ordinal(), reverse: enumValue = EnumClass.values()[ordinal] + final SampleFormat[] all = SampleFormat.values(); + if( 0 <= i && i < all.length ) { + return all[i]; } return null; } @@ -247,10 +247,10 @@ interface FFMPEGNatives { COUNT ///< number of pixel formats in this list ; public static PixelFormat valueOf(int i) { - for (PixelFormat fmt : PixelFormat.values()) { - if(fmt.ordinal() == i) { - return fmt; - } + // ordinal = enumValue.ordinal(), reverse: enumValue = EnumClass.values()[ordinal] + final PixelFormat[] all = PixelFormat.values(); + if( 0 <= i && i < all.length ) { + return all[i]; } return null; } |