Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Optimizing CGContextDrawImage performance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Optimizing CGContextDrawImage performance



I was watching John Stauffer's presentation from WWDC03 on DVD last night.

One of his suggestions was to build on an OpenGL context and use the
CGGLContextCreate call to draw from Quartz into a GL context.

From what I understand, GLContexts don't go through the window backing buffer,
and the byte swizzling you are seeing in shark is probably a result of a non-OpenGL
native pixel format underneath the quartz context.


Also, I'm not sure how Quartz works, but double-buffering in QuickDraw results
in triple-buffering. I got a big boost in speed by writing directly into the port backing
buffer in my application. I'm just getting my toe into Quartz so I don't know if the
same thing holds true.


Gen

On Apr 14, 2005, at 3:26 AM, Frederik Slijkerman wrote:

Hi all,

I am working on an Audio Units plugin for OS X. The user interface
is composited in an off-screen bitmap that I draw to the screen
with CGContextDrawImage. I create a CGImage to encapsulate the
off-screen buffer, like this:

CGImageRef image = CGImageCreate(getWidth(), getHeight(), 8, 32, getWidth() * sizeof(Pixel), fColorSpace, kCGImageAlphaNoneSkipLast, provider, 0, false, kCGRenderingIntentDefault);

I've written a simple direct data provider that just returns a pointer to the off-screen buffer.

Now, when I profile the plugin with Shark, I see the following in
the UI thread:

32% CoreGraphics decode_data
13% CoreGraphics vecCGSConvertRGB888toXRGB8888

These are by far the most time-consuming operations, and both are
called indirectly by HIViewDrawCGImage (and CGContextDrawImage). Could someone familiar with CoreGraphics tell me what I can do to avoid these or to speed them up? Maybe I should use a different format of the bitmap that I draw?


Thanks a lot!
Frederik Slijkerman

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Quartz-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: Mysterious "ats-font.c:357: failed assertion `!CFSetContainsValue(fonts, a)'" (From: Felix Schwarz <email@hidden>)
 >Optimizing CGContextDrawImage performance (From: "Frederik Slijkerman" <email@hidden>)



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.