Instance Method


Returns by indirection a list of nonoverlapping rectangles that define the area the view is being asked to draw in drawRect:.


- (void)getRectsBeingDrawn:(const NSRect * _Nullable *)rects count:(NSInteger *)count;



On return, contains a list of nonoverlapping rectangles defining areas to be drawn in. The rectangles returned in rects are in the coordinate space of the view.


On return, the number of rectangles in the rects list.


An implementation of drawRect: can use this information to test whether objects or regions within the view intersect with the rectangles in the list, and thereby avoid unnecessary drawing that would be completely clipped away.

The needsToDrawRect: method gives you a convenient way to test individual objects for intersection with the area being drawn in drawRect:. However, you may want to retrieve and directly inspect the rectangle list if this is a more efficient way to perform intersection testing.

You should send this message only from within a drawRect: implementation. The aRect parameter of drawRect: is the rectangle enclosing the returned list of rectangles; you can use it in an initial pass to reject objects that are clearly outside the area to be drawn.

See Also


- updateLayer

Updates the view’s content by modifying its underlying layer.

- drawRect:

Overridden by subclasses to draw the view’s image within the specified rectangle.


A Boolean value indicating whether drawing commands will produce any results.


A Boolean value indicating whether the view can draw its contents on a background thread.


The portion of the view that is not clipped by its superviews.

- needsToDrawRect:

Returns a Boolean value indicating whether the specified rectangle intersects any part of the area that the view is being asked to draw.


A Boolean value indicating whether AppKit’s default clipping behavior is in effect.

- bitmapImageRepForCachingDisplayInRect:

Returns a bitmap-representation object suitable for caching the specified portion of the view.

- cacheDisplayInRect:toBitmapImageRep:

Draws the specified area of the view, and its descendants, into a provided bitmap-representation object.