• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Multithreaded drawing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Multithreaded drawing


  • Subject: Multithreaded drawing
  • From: Shaun Wexler <email@hidden>
  • Date: Mon, 27 Jan 2003 16:37:29 -0800

I seem to be throwing a cerebral exception.

I have an application which uses background threads to draw into one or more NSViews within a window using CG calls exclusively. I do not use lockFocus in the background threads, but rather use the drawing thread's CGContext and perform my own Translate and Clip for each view, and this works fine...if I CGContextFlush after drawing in each view BEFORE restoring the gState prior to the translation. I had previously used a separate thread and CGContext for each view, but was unable to coordinate the window flushing behavior; it became choppy with more than two views, locking within CoreGraphics, even though the views did not overlap. I have now gone to a single thread per window, which draws for all views in the window using a FIFO queue. I am currently flushing the CGContext after each view draws itself (the actual sequence is undefined), and do not manually flush nor disable flushing of the window. I tried to flush the drawing in other places, but couldn't get ANY results from CGContextSynchronize (how and where is this used?), nor the NSGraphicsContext flushGraphics call. Quartz Debug "confirms" that I'm only drawing the necessary bits, and there is no redundant flushing, but I need to know if there is any more performance I can squeeze out of Quartz...

Can someone describe how flushing and synchronization actually works in Cocoa, specifically with CoreGraphics and the window server? Thanks!
--
Shaun Wexler
MacFOH
http://www.macfoh.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Prev by Date: Re: NSDrawer delegate function mis-described?
  • Next by Date: Repost: Summary row for scrolled TableView
  • Previous by thread: Re: Loading fonts from bundles (again!)
  • Next by thread: Repost: Summary row for scrolled TableView
  • Index(es):
    • Date
    • Thread