File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
core/src/processing/opengl Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -882,6 +882,7 @@ public void disposeSourceBuffer() {
882
882
}
883
883
884
884
public void getBufferPixels (int [] pixels ) {
885
+ boolean addToUsed = false ;
885
886
BufferData data = null ;
886
887
if (usedBuffers != null && 0 < usedBuffers .size ()) {
887
888
// the last used buffer is the one currently stored in the opengl
@@ -890,12 +891,24 @@ public void getBufferPixels(int[] pixels) {
890
891
} else if (bufferCache != null && 0 < bufferCache .size ()) {
891
892
// The first buffer in the cache will be uploaded to the opengl texture
892
893
// the next time it is rendered
893
- data = bufferCache .getFirst ();
894
+ data = bufferCache .remove (0 );
895
+ addToUsed = true ;
894
896
}
895
897
if (data != null ) {
898
+ if ((data .w != width ) || (data .h != height )) {
899
+ init (data .w , data .h );
900
+ }
901
+
896
902
data .rgbBuf .rewind ();
897
903
data .rgbBuf .get (pixels );
898
904
convertToARGB (pixels );
905
+
906
+ if (addToUsed ) {
907
+ if (usedBuffers == null ) {
908
+ usedBuffers = new LinkedList <BufferData >();
909
+ }
910
+ usedBuffers .add (data );
911
+ }
899
912
}
900
913
}
901
914
You can’t perform that action at this time.
0 commit comments