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

Method updateShortBuffer

core/src/processing/opengl/PGL.java:2471–2493  ·  view source on GitHub ↗
(ShortBuffer buf, short[] arr,
                                                 boolean wrap)

Source from the content-addressed store, hash-verified

2469
2470
2471 protected static ShortBuffer updateShortBuffer(ShortBuffer buf, short[] arr,
2472 boolean wrap) {
2473 if (USE_DIRECT_BUFFERS || (buf != null && buf.isDirect())) {
2474 if (buf == null || buf.capacity() < arr.length) {
2475 buf = allocateDirectShortBuffer(arr.length);
2476 }
2477 buf.position(0);
2478 buf.put(arr);
2479 buf.rewind();
2480 } else {
2481 if (wrap) {
2482 buf = ShortBuffer.wrap(arr);
2483 } else {
2484 if (buf == null || buf.capacity() < arr.length) {
2485 buf = ShortBuffer.allocate(arr.length);
2486 }
2487 buf.position(0);
2488 buf.put(arr);
2489 buf.rewind();
2490 }
2491 }
2492 return buf;
2493 }
2494
2495
2496 protected static void updateShortBuffer(ShortBuffer buf, short[] arr,

Callers 3

Calls 5

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

Tested by

no test coverage detected