From b2899c63ceaa1acf9db6853baff2cd7fa0dc41d5 Mon Sep 17 00:00:00 2001 From: Jakub Valtar Date: Tue, 22 Jul 2014 16:40:09 +0200 Subject: [PATCH] Moved pixels invalidation to endShape Moved to account for a possibility that user uses get(), set() or loadPixels() inside of beginShape()/endShape() block. --- core/src/processing/opengl/PGraphicsOpenGL.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index 643e63343..38d11e2c3 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -2133,9 +2133,6 @@ public class PGraphicsOpenGL extends PGraphics { shape = kind; inGeo.clear(); - // We are going to draw, pixels won't be up-to-date anymore. - setgetPixels = false; - curveVertexCount = 0; breakShape = false; defaultEdges = true; @@ -2154,6 +2151,9 @@ public class PGraphicsOpenGL extends PGraphics { if ((flushMode == FLUSH_CONTINUOUSLY) || (flushMode == FLUSH_WHEN_FULL && tessGeo.isFull())) { flush(); + } else { + // pixels array is not up-to-date anymore + setgetPixels = false; } } @@ -2169,6 +2169,9 @@ public class PGraphicsOpenGL extends PGraphics { if (flushMode == FLUSH_CONTINUOUSLY || (flushMode == FLUSH_WHEN_FULL && tessGeo.isFull())) { flush(); + } else { + // pixels array is not up-to-date anymore + setgetPixels = false; } }