diff options
author | Sven Gothel <[email protected]> | 2015-08-31 08:41:07 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-08-31 08:41:07 +0200 |
commit | cf9e2f2cb8ead7efd7751dcbfaecb36ed06cf9d6 (patch) | |
tree | 5b0879c7146983221074ed9c687be2fba7db779d /make/config/nativewindow/x11-CustomJavaCode.java | |
parent | cc00d9b6c5a5c6b71ba14311fc6b17ce932d9a1e (diff) |
Bug 1210 - Use manual impl. XRenderFindVisualFormat instead of buggy generated version
- XRenderDirectFormat XVisual2XRenderMask(..):
- Move from JOGL's X11GLXGraphicsConfiguration -> Nativewindow X11GraphicsConfiguration
- Always use manual impl. of XRenderFindVisualFormat
Additionally:
- Add X11GraphicsConfiguration.XVisualInfo2X11Capabilities(..)
allowing to properly setup the resulting Capabilities instance
as used in X11GraphicsConfigurationFactory.chooseGraphicsConfigurationImpl(..)
- XVisualInfo:
- Add 'String toString()'
- 'XVisualInfo create(XVisualInfo s)' uses source buffer size!
- XGetVisualInfo: Use returned buffer-capacity/count for element-size
and also bail out if count<=0
Diffstat (limited to 'make/config/nativewindow/x11-CustomJavaCode.java')
-rw-r--r-- | make/config/nativewindow/x11-CustomJavaCode.java | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/make/config/nativewindow/x11-CustomJavaCode.java b/make/config/nativewindow/x11-CustomJavaCode.java index d1e011184..7b5d617b5 100644 --- a/make/config/nativewindow/x11-CustomJavaCode.java +++ b/make/config/nativewindow/x11-CustomJavaCode.java @@ -24,14 +24,20 @@ if (_res == null) return null; Buffers.nativeOrder(_res); - XVisualInfo[] _retarray = new XVisualInfo[getFirstElement(arg3, arg3_offset)]; - for (int _count = 0; _count < getFirstElement(arg3, arg3_offset); _count++) { - _res.position(_count * XVisualInfo.size()); - _res.limit ((1 + _count) * XVisualInfo.size()); + final int count = getFirstElement(arg3, arg3_offset); + if (count <= 0) return null; + final int esize = _res.capacity() / count; + if( esize < XVisualInfo.size() ) { + throw new RuntimeException("element-size "+_res.capacity()+"/"+count+"="+esize+" < "+XVisualInfo.size()); + } + XVisualInfo[] _retarray = new XVisualInfo[count]; + for (int i = 0; i < count; i++) { + _res.position(i * esize); // XVisualInfo.size()); + _res.limit ((1 + i) * esize); // XVisualInfo.size()); java.nio.ByteBuffer _tmp = _res.slice(); _res.position(0); _res.limit(_res.capacity()); - _retarray[_count] = XVisualInfo.create(_tmp); + _retarray[i] = XVisualInfo.create(_tmp); } return _retarray; } |