diff options
author | Sven Gothel <[email protected]> | 2014-12-06 21:12:18 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-12-06 21:12:18 +0100 |
commit | a53e87a84c92444e8a3173f25ce86dcfd536d6a8 (patch) | |
tree | bd19e9f40e4c67203d579c28b3775a5c17adc106 /src/newt/classes/jogamp | |
parent | 241d505749b7d2bd383673a378fdca268989d2fd (diff) |
Bug 1107 - Refine PixelFormat, GLPixelBuffer and DirectDataBufferInt/BufferedImageInt
- PixelFormat
Refine definition allowing complete format conversion by its attributes
instead of static 'knowledge'.
- PixelFormat has_a *new* PixelFormat.Composition
- PixelFormat.Composition contains all pixel component layout
information as required for inspection and conversion.
Component names are enumerated via PixelFormat.CType.
- PixelFormatUtil.convert(..) utilizes generic conversion
based on PixelFormat.Composition rather static type mapping.
However, a int32 RGBA static conversion is still supported for performance.
Utilizes Bitstream for varying pixel component bit-width.
- Complete w/ hashCode() and equals(..)
- GLPixelBuffer
- Take 'pack' mode into account when determine GLPixelAttributes,
i.e. on GLES pack=true (e.g. glReadPixel) only RGBA is guaranteed to work.
Hence querying GLPixelAttributes requires the GLProfile, PixelFormat and pack mode.
- Complete GLPixelAttributes conversions from PixelFormat or GL format/data-type,
while taking GL data-type into account, as well as pack-mode.
- Complete w/ hashCode() and equals(..)
- SingletonGLPixelBufferProvider queries singleton GLPixelBuffer via
- PixelFormat.Composition hostPixelComp,
- GLPixelAttributes pixelAttributes,
- boolean pack
which comprise a unique key, allowing the implementation to utilize
a hash map. This is implemented in AWTSingletonGLPixelBufferProvider.
This allows distinct singleton GLPixelBuffer for different
host PixelFormat (conversion) and GLPixelAttributes (depending on GLProfile).
- Removes field 'componentCount' which was 'hacked in' to pass
information about an optional host memory layout.
Implementations utilizing conversion, e.g. AWTGLPixelBuffer,
can implement GLPixelBufferProvider's
'PixelFormat.Composition getHostPixelComp(final GLProfile glp, final int componentCount)'
and manage such implementation details, see use-case GLJPanel.
- DirectDataBufferInt/BufferedImageInt: Expose underlying NIO ByteBuffer
- AWTMisc.createCursor(..) uses DirectDataBufferInt.BufferedImageInt exposed
NIO ByteBuffer, allowing to use generic PixelFormatUtil.convert(..).
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r-- | src/newt/classes/jogamp/newt/DisplayImpl.java | 2 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/PointerIconImpl.java | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/newt/classes/jogamp/newt/DisplayImpl.java b/src/newt/classes/jogamp/newt/DisplayImpl.java index 5f67c95c1..c94d7d40e 100644 --- a/src/newt/classes/jogamp/newt/DisplayImpl.java +++ b/src/newt/classes/jogamp/newt/DisplayImpl.java @@ -165,7 +165,7 @@ public abstract class DisplayImpl extends Display { final PixelRectangle fpixelrect; if( getNativePointerIconPixelFormat() != pixelrect.getPixelformat() || pixelrect.isGLOriented() ) { // conversion ! - fpixelrect = PixelFormatUtil.convert32(pixelrect, getNativePointerIconPixelFormat(), + fpixelrect = PixelFormatUtil.convert(pixelrect, getNativePointerIconPixelFormat(), 0 /* ddestStride */, false /* isGLOriented */, getNativePointerIconForceDirectNIO() ); if( DEBUG_POINTER_ICON ) { System.err.println("createPointerIconRES.0: Conversion-FMT "+pixelrect+" -> "+fpixelrect); diff --git a/src/newt/classes/jogamp/newt/PointerIconImpl.java b/src/newt/classes/jogamp/newt/PointerIconImpl.java index 546a463de..f2b24a3b3 100644 --- a/src/newt/classes/jogamp/newt/PointerIconImpl.java +++ b/src/newt/classes/jogamp/newt/PointerIconImpl.java @@ -154,7 +154,7 @@ public class PointerIconImpl implements PointerIcon { } @Override public final int getStride() { - return size.getWidth() * pixelformat.bytesPerPixel(); + return size.getWidth() * pixelformat.comp.bytesPerPixel(); } @Override public final boolean isGLOriented() { |