MCPcopy Index your code
hub / github.com/benfry/processing4 / updateByteBuffer

Method updateByteBuffer

core/src/processing/opengl/PGL.java:2379–2401  ·  view source on GitHub ↗
(ByteBuffer buf, byte[] arr,
                                               boolean wrap)

Source from the content-addressed store, hash-verified

2377
2378
2379 protected static ByteBuffer updateByteBuffer(ByteBuffer buf, byte[] arr,
2380 boolean wrap) {
2381 if (USE_DIRECT_BUFFERS || (buf != null && buf.isDirect())) {
2382 if (buf == null || buf.capacity() < arr.length) {
2383 buf = allocateDirectByteBuffer(arr.length);
2384 }
2385 buf.position(0);
2386 buf.put(arr);
2387 buf.rewind();
2388 } else {
2389 if (wrap) {
2390 buf = ByteBuffer.wrap(arr);
2391 } else {
2392 if (buf == null || buf.capacity() < arr.length) {
2393 buf = ByteBuffer.allocate(arr.length);
2394 }
2395 buf.position(0);
2396 buf.put(arr);
2397 buf.rewind();
2398 }
2399 }
2400 return buf;
2401 }
2402
2403
2404 protected static void updateByteBuffer(ByteBuffer buf, byte[] arr,

Callers 1

updateAttribBufferMethod · 0.95

Calls 5

wrapMethod · 0.80
putMethod · 0.45
allocateMethod · 0.45
arrayMethod · 0.45

Tested by

no test coverage detected