fix problem with defaults reset and base renderer

This commit is contained in:
benfry
2007-10-20 11:49:57 +00:00
parent 6ab24f5e59
commit a0731ccfc1
2 changed files with 9 additions and 7 deletions

View File

@@ -977,6 +977,9 @@ in */
String currentRenderer = g.getClass().getName();
if (currentRenderer.equals(irenderer)) {
// println("calling setRendererSize from size() " + iwidth + " " + iheight);
// Avoid infinite loop of throwing exception to reset renderer
if (width == iwidth && height == iheight) return;
setRendererSize(iwidth, iheight);
setSize(iwidth, iheight);
// if ((iwidth != g.width) || (iheight != g.height)) {
@@ -1006,13 +1009,12 @@ in */
// this is the function that will run if the user does their own
// size() command inside setup, so set defaultSize to false.
defaultSize = false;
// throw an exception so that setup() is called again
// but with a properly sized render
// this is for opengl, which needs a valid, properly sized
// display before calling anything inside setup().
throw new RuntimeException(NEW_RENDERER);
}
// throw an exception so that setup() is called again
// but with a properly sized render
// this is for opengl, which needs a valid, properly sized
// display before calling anything inside setup().
throw new RuntimeException(NEW_RENDERER);
}
}

View File

@@ -774,7 +774,7 @@ public abstract class PGraphics extends PImage implements PConstants {
// is what's desired).
// this background() call is for the Java 2D and OpenGL renderers.
if (mainDrawingSurface) {
//System.out.println("main drawing surface " + getClass().getName());
//System.out.println("main drawing surface bg " + getClass().getName());
background(backgroundColor);
}