Re: Smooth scrolling in NSScrollView
Re: Smooth scrolling in NSScrollView
- Subject: Re: Smooth scrolling in NSScrollView
- From: Gideon King <email@hidden>
- Date: Sat, 16 Oct 2010 07:40:00 +1000
Both copiesOnScroll and drawsBackground are turned on.
I tried another little experiment and turned the layer backing for the subviews off, and the only times that the drawing code for the subviews was called is when they are coming on to the visible rect - when they are already there, the drawing code is not called. Then when I went back to layer backing, the drawing code was being called even when the entire subview is on screen. Therefore, scrolling a view that is completely on screen is less efficient if it has layer backing than if it doesn't.
Interestingly, if I use the setLayerContentsRedrawPolicy:NSViewLayerContentsRedrawNever, it doesn't cause a redraw at all, but my animations still seem to work OK. The issue with that is that this option is a 10.6 only one, and the only time this particular code needs to be run is in 10.5. So from that, I would deduce that Apple found this redraw problem in 10.5 and allowed this workaround in 10.6.
I think I'll just leave my investigations there for the moment (unless someone suggests a quick fix) - we only have 14% of our users (and decreasing) using 10.5, and we are going to be adding a number of features that will be 10.6+ only, so people will be encouraged to make the move. And with it the way it is, it still works on 10.5 - it's just faster the way we do it in 10.6.
Gideon
On 16/10/2010, at 1:09 AM, Keary Suska wrote:
> On Oct 15, 2010, at 8:50 AM, Gideon King wrote:
>
>>
>> But I also found that the subviews are getting redrawn whenever the scroll is done and that view is on the screen. So in my animation, it redraws every frame. This is rather disturbing since I would have expected the layer to cache the image of the view and for that to be used when scrolling. If anyone can shed light on that, it'd be greatly appreciated.
>
> What is the NSClipView's -copiesOnScroll value?
>
_______________________________________________
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