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: Airy André <email@hidden>
- Date: Tue, 20 May 2003 21:52:32 +0200
Le mardi, 20 mai 2003, ` 21:32 Europe/Paris, Marc Poirier a icrit :
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
Nice to know : we noticed the same problem with Chris, and implemented
the same solution ;-)
Airy
_______________________________________________
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.