Contents

translateRectsNeedingDisplay(in:by:)

Translates the display rectangles by the specified delta.

Declaration

func translateRectsNeedingDisplay(in clipRect: NSRect, by delta: NSSize)

Parameters

  • clipRect:

    A rectangle defining the region of the view, typically the view’s bounds.

  • delta:

    A NSSize structure that specifies an offset from aRect’s origin.

Discussion

This method performs the shifting of dirty rectangles that an equivalent scroll(_:by:) operation would cause, without performing the actual scroll operation. It is only useful in very rare cases where a view implements its own low-level scrolling mechanics.

This method:

  1. Collects the receiving view’s dirty rectangles.

  2. Clears all dirty rectangles in the intersection of clipRect and the view’s bounds.

  3. Shifts the retrieved rectangles by the delta offset.

  4. Clips the result to the intersection of clipRect and the view’s bounds

  5. Marks the resultant rectangles as needing display.

The developer must ensure that clipRect and delta are pixel-aligned in order to guarantee correct drawing.

See Also

Invalidating the View’s Content