From 205b67a5292a18dc9cef13fcf863655f522daabb Mon Sep 17 00:00:00 2001 From: codeanticode Date: Sat, 28 Jul 2012 22:57:12 +0000 Subject: [PATCH] better condition to catch offscreen-within-offscreen drawing --- android/core/src/processing/opengl/PGraphicsOpenGL.java | 9 +++------ core/src/processing/opengl/PGraphicsOpenGL.java | 9 +++------ 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/android/core/src/processing/opengl/PGraphicsOpenGL.java b/android/core/src/processing/opengl/PGraphicsOpenGL.java index 6be51caff..57528c092 100644 --- a/android/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/android/core/src/processing/opengl/PGraphicsOpenGL.java @@ -1451,12 +1451,9 @@ public class PGraphicsOpenGL extends PGraphics { return; } - if (pgCurrent != pgPrimary && this != pgPrimary) { - // It seems that the user is trying to start - // another beginDraw()/endDraw() block for an - // offscreen surface, still drawing on another - // offscreen surface. This situation is not - // catched by the drawing check above. + if (pgCurrent != null && !pgCurrent.primarySurface && !this.primarySurface) { + // It seems that the user is trying to start another beginDraw()/endDraw() block for an + // offscreen surface, still drawing on another offscreen surface. showWarning("Already called beginDraw() for another PGraphicsOpenGL object."); return; } diff --git a/core/src/processing/opengl/PGraphicsOpenGL.java b/core/src/processing/opengl/PGraphicsOpenGL.java index 6be51caff..57528c092 100644 --- a/core/src/processing/opengl/PGraphicsOpenGL.java +++ b/core/src/processing/opengl/PGraphicsOpenGL.java @@ -1451,12 +1451,9 @@ public class PGraphicsOpenGL extends PGraphics { return; } - if (pgCurrent != pgPrimary && this != pgPrimary) { - // It seems that the user is trying to start - // another beginDraw()/endDraw() block for an - // offscreen surface, still drawing on another - // offscreen surface. This situation is not - // catched by the drawing check above. + if (pgCurrent != null && !pgCurrent.primarySurface && !this.primarySurface) { + // It seems that the user is trying to start another beginDraw()/endDraw() block for an + // offscreen surface, still drawing on another offscreen surface. showWarning("Already called beginDraw() for another PGraphicsOpenGL object."); return; }