Re: Tracking visibleRect changes using Autolayout
Re: Tracking visibleRect changes using Autolayout
- Subject: Re: Tracking visibleRect changes using Autolayout
- From: Kyle Sluder <email@hidden>
- Date: Sun, 17 Feb 2013 23:07:02 -0800
On Sun, Feb 17, 2013, at 05:12 PM, iain wrote:
>
> Does anyone have any hints of something I may have missed, or something
> I'm
> going about the wrong way?
Unless there's something you haven't told us, you shouldn't need to keep
track of your visible rect at all.
It sounds like you're trying to be really smart and only cache the
drawing necessary for your visible rect rather than the more naive
approach of drawing a cache for your entire view whenever its bounds
change. Is this really a performance boost for you? You say that the
drawing is complicated; if by this you mean that you spend a lot of time
doing things other than blitting pixels, you are doing yourself a
disservice by drawing minimally. It would be faster for you to cache the
entire view at once.
If it really is an advantage for you to cache only the pixels that are
going to be in your visible rect, you can override -viewWillDraw to call
-getRectsBeingDrawn:… and be super-smart about your caching.
But I suggest you do some profiling and see whether you gain time by
overriding -setFrameSize: to set a flag that you pick up in an override
of -viewWillDraw to render a cache for the entire bounds of your view.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden