BufferUtils : ensureLargeEnough now set the limit to the buffer capacity if it exists to avoid creating a new buffer instead of reusing the previous one.
see http://jmonkeyengine.org/groups/development-discussion-jme3/forum/topic/bugbufferleak-in-ensurelargeenoughbitmaptextpage/?#post-188976 git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9730 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
This commit is contained in:
parent
d2e6648eb3
commit
2577485727
@ -1105,6 +1105,9 @@ public final class BufferUtils {
|
||||
* the input buffer, not null
|
||||
*/
|
||||
public static FloatBuffer ensureLargeEnough(FloatBuffer buffer, int required) {
|
||||
if (buffer != null) {
|
||||
buffer.limit(buffer.capacity());
|
||||
}
|
||||
if (buffer == null || (buffer.remaining() < required)) {
|
||||
int position = (buffer != null ? buffer.position() : 0);
|
||||
FloatBuffer newVerts = createFloatBuffer(position + required);
|
||||
@ -1119,6 +1122,9 @@ public final class BufferUtils {
|
||||
}
|
||||
|
||||
public static ShortBuffer ensureLargeEnough(ShortBuffer buffer, int required) {
|
||||
if (buffer != null) {
|
||||
buffer.limit(buffer.capacity());
|
||||
}
|
||||
if (buffer == null || (buffer.remaining() < required)) {
|
||||
int position = (buffer != null ? buffer.position() : 0);
|
||||
ShortBuffer newVerts = createShortBuffer(position + required);
|
||||
@ -1133,6 +1139,9 @@ public final class BufferUtils {
|
||||
}
|
||||
|
||||
public static ByteBuffer ensureLargeEnough(ByteBuffer buffer, int required) {
|
||||
if (buffer != null) {
|
||||
buffer.limit(buffer.capacity());
|
||||
}
|
||||
if (buffer == null || (buffer.remaining() < required)) {
|
||||
int position = (buffer != null ? buffer.position() : 0);
|
||||
ByteBuffer newVerts = createByteBuffer(position + required);
|
||||
|
Loading…
x
Reference in New Issue
Block a user