Re: Re-Sizing an AU window from within the AU view.
Re: Re-Sizing an AU window from within the AU view.
- Subject: Re: Re-Sizing an AU window from within the AU view.
- From: Marc Poirier <email@hidden>
- Date: Tue, 20 May 2003 21:32:36 +0200 (CEST)
>
BTW, I've just moved away from using PNG's for AU graphic objects and
>
now use WIN BMP's with pre-calculated alpha (again cross-platform
>
reasons). The difference in re-draw speed is amazing (thanks to the
>
pre-calculation). If anyone needs any hints on this then I'd be glad to
>
help - definitely worth the extra effort.
Ah ha, I had been having major drawing performance with
PNGDataProvider-created CGImages with an AU this weekend and so I posted
for some insight to the Carbon dev list, and got this response from Eric
Schlegel at Apple:
>
The image was created using the PNGDataProvider.
This is just a random guess, but we recently found and fixed a
similar-sounding performance problem in HIToolbox. When a CGImage is
created using a data provider, it turns out that CG doesn't read the
full image into memory; it keeps a reference to the disk file
containing the image, and decompresses the image from disk each time
you draw it. That can cause performance problems, so we changed our
code to first create a CGImage using the PNG data provider, and then
render the image into a bitmap context and create a CGImage from the
bitmap. This forces the entire image to be read into memory,
uncompressed, and gave us a nice performance boost. Perhaps the same
thing would help for you.
The code to create the uncompressed image is basically:
- get the original image's width and height
- malloc enough memory to hold the image
- create a bitmap context with CGBitmapContextCreate
- draw the original image into the bitmap context
- create a data provider with the bitmap context's data
- create a new CGImage using the data provider, DisplayRGB as the color
space, and kCGImageAlphaPremultipliedFirst as the data type
- release the original CGImage and return the new CGImage
So this allows another solution that does not require converting your
image files from PNG to BMP (which I like)...
Marc
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.