From b97cd4f34b2c0c6da64b7d4e5c61924fb2b6e76a Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Fri, 23 Mar 2018 16:33:06 -0400 Subject: [PATCH] don't reapply blendMode() if it's unset --- core/src/processing/core/PGraphics.java | 28 ++++++++++++++----------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/core/src/processing/core/PGraphics.java b/core/src/processing/core/PGraphics.java index 3bc19fef5..fbb63aeb1 100644 --- a/core/src/processing/core/PGraphics.java +++ b/core/src/processing/core/PGraphics.java @@ -227,7 +227,7 @@ public class PGraphics extends PImage implements PConstants { * images go out of scope, they will be properly garbage collected. */ protected WeakHashMap cacheMap = - new WeakHashMap(); + new WeakHashMap<>(); //////////////////////////////////////////////////////////// @@ -334,7 +334,7 @@ public class PGraphics extends PImage implements PConstants { /** True if colors are not in the range 0..1 */ boolean colorModeScale; // = true; - /** + /** * True if colorMode(RGB, 255). Defaults to true so that color() * used as part of a field declaration will properly assign values. */ @@ -2016,6 +2016,7 @@ public class PGraphics extends PImage implements PConstants { showMissingWarning("clip"); } + /** * ( begin auto-generated from noClip.xml ) * @@ -2269,9 +2270,9 @@ public class PGraphics extends PImage implements PConstants { */ public void curveVertex(float x, float y) { curveVertexCheck(); - float[] vertex = curveVertices[curveVertexCount]; - vertex[X] = x; - vertex[Y] = y; + float[] v = curveVertices[curveVertexCount]; + v[X] = x; + v[Y] = y; curveVertexCount++; // draw a segment if there are enough points @@ -2292,10 +2293,10 @@ public class PGraphics extends PImage implements PConstants { */ public void curveVertex(float x, float y, float z) { curveVertexCheck(); - float[] vertex = curveVertices[curveVertexCount]; - vertex[X] = x; - vertex[Y] = y; - vertex[Z] = z; + float[] v = curveVertices[curveVertexCount]; + v[X] = x; + v[Y] = y; + v[Z] = z; curveVertexCount++; // draw a segment if there are enough points @@ -3904,6 +3905,7 @@ public class PGraphics extends PImage implements PConstants { } + ////////////////////////////////////////////////////////////// // SHAPE @@ -3957,7 +3959,6 @@ public class PGraphics extends PImage implements PConstants { } - /** * ( begin auto-generated from shape.xml ) * @@ -4055,6 +4056,7 @@ public class PGraphics extends PImage implements PConstants { } + ////////////////////////////////////////////////////////////// // TEXT/FONTS @@ -6169,7 +6171,9 @@ public class PGraphics extends PImage implements PConstants { ellipseMode(s.ellipseMode); shapeMode(s.shapeMode); - blendMode(s.blendMode); + if (blendMode != 0) { + blendMode(s.blendMode); + } if (s.tint) { tint(s.tintColor); @@ -8128,7 +8132,7 @@ public class PGraphics extends PImage implements PConstants { */ static public void showWarning(String msg) { // ignore if (warnings == null) { - warnings = new HashMap(); + warnings = new HashMap<>(); } if (!warnings.containsKey(msg)) { System.err.println(msg);