pushScissor method

void pushScissor(
  1. Rectangle clip
)

Pushes a scissor clip rectangle onto the clipping stack.

Each pushed rectangle is intersected with the current active scissor and clamped to buffer bounds. Empty clips are retained so that matching pops restore prior clipping behavior.

Implementation

void pushScissor(Rectangle clip) {
  final bufferBounds = bounds();
  final clamped = bufferBounds.intersect(clip);
  final active = _scissorStack.isEmpty ? bufferBounds : _scissorStack.last;
  _scissorStack.add(active.intersect(clamped));
}