fix: stack clip regions so nested clips restore the parent rect#85
fix: stack clip regions so nested clips restore the parent rect#85natemoo-re wants to merge 5 commits into
Conversation
commit: |
|
Size Increased — +0.5 KB 108.0 KB unpacked |
Clip state was a single rect, so closing an inner clip turned clipping off entirely and later siblings leaked past the outer bounds. Replace it with a fixed-depth stack: SCISSOR_START pushes intersect(parent, child) and SCISSOR_END pops, restoring the parent rect while the stack is non-empty. The active top mirrors into the existing clipx/clipy/clipw/cliph scalars, so setcell is unchanged. Fixes #77
4300a52 to
4b35dc4
Compare
Merging this PR will degrade performance by 54.46%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
|
@natemoo-re This is a great addition. I've made a few tweaks:
As for feedback, This seems like a very necessary addittion. The thing that I added to the spec that isn't currently present in the implementation is the behavior when we overflow the clip stack. Right now, it will silently corrupt every command that comes after the overflow. I've specified the behavior to add the constraint that even in overflow, the stack must be balanced, and also that in the event of overflow, it must be signaled back via the error channel that overflow occurred so that the front end can issue a warning. In practice, I have no idea what kind of UI that would in any way be usable would also have a clip stack of 16, but hey 🤷🏻 Lemme know what you think! |
Highly suspicious since this is an input parser benchmark, and the only code changes were to the render pipeline |
SCISSOR_STARTpushesintersect(parent, child),SCISSOR_ENDpops and restores the parent rect while the stack is non-emptyclipx/clipy/clipw/cliphscalars, sosetcellis untouched; depth-1 nesting reduces to the previous behavior; stack depth resets each frametest/clip.test.tsunderdescribe("clip")rather than a standalone filedeno testgreen (8 passed);deno lint+deno fmt --checkclean