code: protected Rectangle pushScissorState (int x, int y, int width, int height) {
        // grow the scissors buffer if necessary
        if (scissorDepth == scissors.size()) {
          scissors.add(new Rectangle());
        }
  
        Rectangle r = scissors.get(scissorDepth);
        if (scissorDepth == 0) {
          r.setBounds(x, y, width, height);
        } else {
          // intersect current with previous
          Rectangle pr = scissors.get(scissorDepth - 1);
          r.setLocation(Math.max(pr.x, x), Math.max(pr.y, y));
          r.setSize(Math.min(pr.maxX(), x + width - 1) - r.x,
              Math.min(pr.maxY(), y + height - 1) - r.y);
        }
        scissorDepth++;
        return r;
    }
docs: Adds the given rectangle to the scissors stack, intersecting with the previous one if it
  exists. Intended for use by subclasses to implement {@link #startClipped} and {@link
  #endClipped}.
  
  <p>NOTE: calls to this method <b>must</b> be matched by a corresponding call {@link
  #popScissorState}, or all hell will break loose.</p>
  
  @return the new clipping rectangle to use