Skip to content

Commit 0ea9320

Browse files
committed
FX: Reset transform to identity before drawing background
1 parent 5c219a3 commit 0ea9320

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

core/src/processing/javafx/PGraphicsFX2D.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,15 +2012,20 @@ public void backgroundImpl() {
20122012
modified = false;
20132013
loaded = false;
20142014

2015+
// Save drawing context (transform, fill, blend mode, etc.)
2016+
context.save();
2017+
2018+
// Reset transform to identity
2019+
context.setTransform(new Affine());
2020+
20152021
// This only takes into account cases where this is the primary surface.
20162022
// Not sure what we do with offscreen anyway.
2017-
Paint savedFill = context.getFill();
2018-
BlendMode savedBlend = context.getGlobalBlendMode();
20192023
context.setFill(new Color(backgroundR, backgroundG, backgroundB, backgroundA));
20202024
context.setGlobalBlendMode(BlendMode.SRC_OVER);
20212025
context.fillRect(0, 0, width, height);
2022-
context.setFill(savedFill);
2023-
context.setGlobalBlendMode(savedBlend);
2026+
2027+
// Restore drawing context (transform, fill, blend mode, etc.)
2028+
context.restore();
20242029
}
20252030

20262031

0 commit comments

Comments
 (0)