Re: lockFocusIfCanDraw behavior in layer-backed mode
Re: lockFocusIfCanDraw behavior in layer-backed mode
- Subject: Re: lockFocusIfCanDraw behavior in layer-backed mode
- From: Richard Charles <email@hidden>
- Date: Sat, 15 Dec 2018 10:49:23 -0700
> On Dec 15, 2018, at 8:07 AM, Tor Arne Vestbø <email@hidden> wrote:
>
> Piggy-backing on this thread, what does lockFocusIfCanDraw actually do in
> layer-backed mode?
I have a layer-hosting view running under macOS 10.12.6 and lockFocus is called
by the system frameworks.
#0 0x00000001000748f4 in -[MyView lockFocus]
#1 0x00007fffc0544e7b in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
#2 0x00007fffc05456d1 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
#3 0x00007fffc05456d1 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
#4 0x00007fffc05456d1 in -[NSView
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
#5 0x00007fffc05442af in -[NSThemeFrame
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:]
#6 0x00007fffc05426d8 in -[NSView
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
#7 0x00007fffc053dfca in -[NSView displayIfNeeded]
#8 0x00007fffc053d8db in -[NSWindow displayIfNeeded]
WWDC 2018 Session 209 states the following.
"With our changes to layer backing, there's a few patterns I want to call out
that aren't going to work in macOS 10.14 anymore. If you're using NSView
lockFocus and unlockFocus, or trying to access the window's graphics contents
directly, there's a better way of doing that. You should just subclass NSView
and implement draw rect. Both of those methods have been kind of finicky for a
while. So, you'll be saving yourself some trouble."
Note that all of the NSView focus methods are now depreciated.
--Richard Charles
_______________________________________________
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