Re: Call NSView's -drawRect method manually
Re: Call NSView's -drawRect method manually
- Subject: Re: Call NSView's -drawRect method manually
- From: Nick <email@hidden>
- Date: Tue, 10 May 2011 19:45:03 +0300
Thank you
But there is no way to call "drawRect" manually? Maybe to call it
manually and then tell NSView that it had processed that method?
I just found out why in Apple sample code CIVideoDemoGL drawRect could
be called directly - because the drawing job was delegated to the
OpenGL, and drawn by OpenGL. When it's done using Quartz2D, the direct
call of drawRect doesn't work.
I needed that just to simplify code - that would allow me to avoid
synchronization (im getting a frame, calling drawRect and waiting till
it finishes - and can safely "reload" this buffer with a new picture).
Also i wanted to ask, if that is a wrong thing to do - to call [myView
display] from the displaylink, instead of waiting for its turn in
Event Loop's queue.
2011/5/10 koko <email@hidden>:
> [myCustomView display]
>
> will call drawRect outside of normal run loop processing, i.e. it happens right now.
>
>
>
>
> On May 10, 2011, at 10:26 AM, Nick wrote:
>
>> helloo. Can someone explain please, when an NSView's call -drawRect
>> (being called manually - not by a framework) actually initiates
>> redrawing of the frame and displaying everything that it had drawn,
>> and when this call "doesn't initiate a thing"?
>>
>> in some Apple samples is see that often to display a movie (a set of
>> frames) onto the view this method is being called manually from the
>> display link that is a part of NSView.
>>
>> When i am calling [myCustomView drawRect:NSZeroRect] from somewhere
>> else than NSView's subclass' implementation code (a display link is
>> not located inside NSView's subclass implementation) it doesn't work.
>> I am obliged to use [myCustomView setNeedsDisplay:YES] which requires
>> adding synchronization and the code becomes kind of messy.
>>
>> Is there a way to call drawRect and make sure the view actually redraws itself?
>> Thanks.
>> _______________________________________________
>>
>> 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
>>
>
>
_______________________________________________
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