On Jul 13, 2011, at 4:06 PM, Takashi Mochizuki wrote: > I have noticed -setNeedsDisplay seems to breaks contentsGravity like > kCAGravityResizeAspect. > BackBuffer rect seems to control contentsGravity behavior. > > - How can I make "kCAGravity compatible" CAOpenGLLayer?
The CAOpenGLLayer should respect the contents gravity just like any other layer, however when you call -setNeedsDisplay or -display on the layer, it will resize its back buffers to the current size of the layer. Afterwards (and until you call -setNeedsDisplay or -display again) it will continue to respect the contents gravity with the "current" size of the back buffer. > To make contentsGravity property work property , I think CAOpenGLLayer should > keep content as fixed rect. > But layer.contentsRect property seems to be not suitable. > (contentsRect default is unit rect {0,0,1,1}, not in pixel) The contentsRect property is for selecting a portion of the existing content as the full content to be displayed. Setting the contentsRect to any value other than the default will cause the layer to use a portion of the assigned content for display, but has no effect on the size of that content (but the content should be fitted to the layer according to its contentsGravity). > > Takashi Mochizuki > > On 2011/07/13, at 0:34, David Duncan wrote: > >> On Jul 8, 2011, at 11:33 PM, Takashi Mochizuki wrote: >> >>> Default CAOpenGLLayer keeps initial buffer size when addSubLayer: is >>> called. And it does not update back buffer size even when layer is resized >>> like: >>> >>> 1. addSubLayer to 200x200 >>> 2. resize layer to 400x400 >>> 3. layer only shows 200x200 area (keep low resolution) >> >> >> Call -setNeedsDisplay on the layer. >> -- >> David Duncan >> > -- David Duncan _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com