Fix transforms in clip() by using shape system for primitives using manual method by VANSH3104 · Pull Request #8236 · processing/p5.js
Looks like you're now forcing the geometry with negative transformations to make it positive. If the user actually wanted to mirror the orientation, it will actually cause problem to the geometry. I still think the problem is that our transformation is applied twice.
I just tested code, and it looks like:
When I apply scale(3) , the expected result is:
The current behavior in the changes of this PR:
function setup() { createCanvas(500, 500); background(240); clip(()=>{ scale(3); ellipse(20, 40, 40, 40); }) fill(255, 80, 80); rect(0, 0, 500, 500); }
this is the code I am using, Please ignore the calculations, I was just testing scale() and other transformations behaviour.
scale(2) is equivalent to scale(4), scale(3) is equivalent to scale(9) and I think this is the problem with the negetive stuff as well.
As I was mentioning on previous comments,
I think you're storing inverse of initial clip transform into beginClip(), and multiplying with currentTransform , inside endClip() clip() is running with the current transform, and it's applying again i think. I am totally not sure with this but

