diff options
author | Michael Bien <[email protected]> | 2011-02-22 02:03:54 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2011-02-22 02:03:54 +0100 |
commit | b4d3f5fc0d846c3b302e99846610e52955ec826b (patch) | |
tree | a53e35805f851237eaf0c7d669987858f0a9b70c /src/java/com/jogamp/common/nio | |
parent | ac681d76d9445618aa8d44abfdfa9efeccc16673 (diff) |
- ensure slice uses the buffers original byteorder.
- create new buffers only if size > capacity not if >= capacity
Diffstat (limited to 'src/java/com/jogamp/common/nio')
-rw-r--r-- | src/java/com/jogamp/common/nio/CachedBufferFactory.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/java/com/jogamp/common/nio/CachedBufferFactory.java b/src/java/com/jogamp/common/nio/CachedBufferFactory.java index 36bac13..dbeed2d 100644 --- a/src/java/com/jogamp/common/nio/CachedBufferFactory.java +++ b/src/java/com/jogamp/common/nio/CachedBufferFactory.java @@ -168,7 +168,7 @@ public class CachedBufferFactory { public ByteBuffer newDirectByteBuffer(int size) { // if large enough... just create it - if (size >= currentBuffer.capacity()) { + if (size > currentBuffer.capacity()) { checkIfFixed(); return Buffers.newDirectByteBuffer(size); } @@ -180,7 +180,7 @@ public class CachedBufferFactory { } currentBuffer.limit(currentBuffer.position() + size); - ByteBuffer result = currentBuffer.slice(); + ByteBuffer result = currentBuffer.slice().order(currentBuffer.order()); currentBuffer.position(currentBuffer.limit()); currentBuffer.limit(currentBuffer.capacity()); return result; |