Pixel cracks and scrolling performance in CALayer-Backed view
Pixel cracks and scrolling performance in CALayer-Backed view
- Subject: Pixel cracks and scrolling performance in CALayer-Backed view
- From: Dave Fernandes <email@hidden>
- Date: Fri, 15 Apr 2011 16:46:10 -0400
I would like to use some CA features with a custom (data visualization) NSView. This view is inside an NSScrollView, and does not have any sub-views. A portion of the view contains an NSImage that is drawn in the view's drawRect method.
My first experiment was to check the Core Animation Layer checkbox in IB for my custom view (but not for the scrollview or any other enclosing views) - and then see what happens.
What happens is that I get a vertical pixel crack (fine white line) at intervals of 256 screen pixels in the NSImage portion of the view. I assume this has something to do with tiling, but I'm not sure how to fix it. Any ideas?
Another problem is that when I zoom my custom view within the scrollview, scrolling gets very bogged down and the beachball cursor appears for seconds at a time. Any way to optimize this?
As a second experiment, I tried creating a layer-hosting view with a CGImage created from the NSImage. I set the contents property of a CALayer (also tried a CATiledLayer) to be my CGImage, and put that layer into a root CALayer for my view (no checkboxes checked in IB; and no more drawRect method in the hosting NSView). Now there are no pixel cracks, and scrolling works, but there is another problem. If my image is > 8000 pixels in either width or height, then video memory seems to get corrupted if I move another layer or even a window over top of the image. By corrupted, I mean that the pixel color has changed when the layer or window moves off the image again. Is there some hard limit to the allowed size of an image in a layer? If so, how do I compute it?
I'm not sure what other information to post about this problem. I'm on 10.6.7 with an old MBP (GeForce 8600M GT with 128 MB VRAM).
Thanks,
Dave_______________________________________________
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