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:
Collects the receiving view’s dirty rectangles.
Clears all dirty rectangles in the intersection of
clipRectand the view’s bounds.Shifts the retrieved rectangles by the
deltaoffset.Clips the result to the intersection of
clipRectand the view’s boundsMarks the resultant rectangles as needing display.
The developer must ensure that clipRect and delta are pixel-aligned in order to guarantee correct drawing. See Transforming View Coordinates To and From Base Space for a description of how to pixel-align view coordinates.