don't reapply blendMode() if it's unset

This commit is contained in:
Ben Fry
2018-03-23 16:33:06 -04:00
parent 4e13ae5404
commit b97cd4f34b

View File

@@ -227,7 +227,7 @@ public class PGraphics extends PImage implements PConstants {
* images go out of scope, they will be properly garbage collected.
*/
protected WeakHashMap<PImage, Object> cacheMap =
new WeakHashMap<PImage, Object>();
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<String, Object>();
warnings = new HashMap<>();
}
if (!warnings.containsKey(msg)) {
System.err.println(msg);