(Object natRef, ByteBuffer byteBuf,
int w, int h)
| 813 | |
| 814 | |
| 815 | public void copyBufferFromSource(Object natRef, ByteBuffer byteBuf, |
| 816 | int w, int h) { |
| 817 | if (bufferCache == null) { |
| 818 | bufferCache = new LinkedList<BufferData>(); |
| 819 | } |
| 820 | |
| 821 | if (bufferCache.size() + 1 <= MAX_BUFFER_CACHE_SIZE) { |
| 822 | bufferCache.add(new BufferData(natRef, byteBuf.asIntBuffer(), w, h)); |
| 823 | } else { |
| 824 | // The buffer cache reached the maximum size, so we just dispose |
| 825 | // the new buffer by adding it to the list of used buffers. |
| 826 | try { |
| 827 | usedBuffers.add(new BufferData(natRef, byteBuf.asIntBuffer(), w, h)); |
| 828 | } catch (Exception e) { |
| 829 | e.printStackTrace(); |
| 830 | } |
| 831 | } |
| 832 | } |
| 833 | |
| 834 | |
| 835 | public void disposeSourceBuffer() { |
nothing calls this directly
no test coverage detected