Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Quartz from a thread



On 27/01/2005 08:04 Pm, George Warner wrote:

> on 1/27/05 3:35 AM, Mike Kluev at <email@hidden> wrote:
> 
>> On Wed, 26 Jan 2005 09:26:42, George Warner <email@hidden> wrote:
>> 
>>> Actually, you can do this. As long as the area's being drawn to by the
>>> different thread don't overlap then Quartz can handle the same context being
>>> used my multiple threads. Internally it serializes accesses to the context.
>> 
>> George, I am curious if such internal serialization is really needed
>> if areas being drawn don't overlap.
> 
> Absolutely. One thread could call:
> 
> CGContextScaleCTM(context, 1.0f, -1.0f);
> 
> And the other:
> 
> CGContextScaleCTM(context, 3.0f, 1.0f);
> 
> If they're both using the same context then which ever one executes last
> will effect drawing in the other thread. Something isn't going to look
> right.
> 
> Note however that the internal serialization doesn't prevent messed up
> drawing in that other thread. But it does prevent crashes caused by
> non-reentrant code.
> 
> Assuming that both threads are using the same Scale, transform, etc. then
> one thread drawing a square and another a circle should still work as
> expected. At the API level all operations can be assumed to be atomic.

Oops, I misread what you wrote before and was thinking about drawing
to one canvas via different contexts.

Mike

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: Quartz from a thread (From: George Warner <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.