From 2439db5574e518dbe865ccb0a8c1280b856e8fa3 Mon Sep 17 00:00:00 2001 From: Jakub Valtar Date: Thu, 29 Dec 2016 14:15:06 +0100 Subject: [PATCH] FX: Reset transform to identity before drawing background --- core/src/processing/javafx/PGraphicsFX2D.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/src/processing/javafx/PGraphicsFX2D.java b/core/src/processing/javafx/PGraphicsFX2D.java index d2f4fdb0a..f73d22102 100644 --- a/core/src/processing/javafx/PGraphicsFX2D.java +++ b/core/src/processing/javafx/PGraphicsFX2D.java @@ -2012,15 +2012,20 @@ public class PGraphicsFX2D extends PGraphics { modified = false; loaded = false; + // Save drawing context (transform, fill, blend mode, etc.) + context.save(); + + // Reset transform to identity + context.setTransform(new Affine()); + // This only takes into account cases where this is the primary surface. // Not sure what we do with offscreen anyway. - Paint savedFill = context.getFill(); - BlendMode savedBlend = context.getGlobalBlendMode(); context.setFill(new Color(backgroundR, backgroundG, backgroundB, backgroundA)); context.setGlobalBlendMode(BlendMode.SRC_OVER); context.fillRect(0, 0, width, height); - context.setFill(savedFill); - context.setGlobalBlendMode(savedBlend); + + // Restore drawing context (transform, fill, blend mode, etc.) + context.restore(); }