On Dec 30, 2014, at 9:57 PM, Jerry Krinock <je...@ieee.org> wrote:

> Just to clarify on the guidelines for using -lockFocus in the Resolution 
> Independent world…
> 
> Apple’s advice to avoid -lockFocus [1] only applies to drawing into NSImage 
> objects, which is called “off-screen drawing”.  Using -lockFocus in -[NSView 
> drawRect] is, I suppose, “on-screen drawing”, and this is still OK.
> 
> Am I correct?

Um, maybe.  Why are you using -lockFocus inside of -drawRect:?  When -drawRect: 
is called, the focus is already locked on the view which is being asked to draw 
itself.  It should not be necessary to lock the focus again.

The intent of the guideline is that drawing that is done once and then reused 
over time is prone to becoming mismatched to the ultimate on-screen 
destination.  A screen, window, or view may change from high-resolution to 
standard-resolution or vice versa.  Views and windows will redraw themselves in 
response to that, so the drawing will be appropriate to the destination.  
However, if you draw images at one point in time and then reuse them, they will 
be cached at a particular resolution and won't be re-rendered for the new 
resolution of the destination when drawn.  They may end up looking blocky or 
blurry as a result.  So, you are encouraged to use a technique that allows them 
to be re-rendered as necessary.

Regards,
Ken


_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to