I am new to this mailing list and to Quartz in general. I have taken on
the big task of trying to recreate (as much as possible of) iPhoto's
main thumbnail view. Up until now, I've been working with
NSBitmapImageRep's under Cocoa. Even though that already yielded nice
results in speed, I am sure that it can still be improved.
I tried to change my drawing parts to Quartz 2D. However, this produced
a noticeably SLOWER execution. I used Shark on both versions and
realized that obviously my Quartz version constantly re-loads the JPEG
data. Here is the complete Quartz-part:
/* Adding an image */
CGImageRef image;
CGDataProviderRef provider;
CFStringRef path;
CFURLRef url;
path = CFStringCreateWithCString (NULL, [theImagePath UTF8String],
kCFStringEncodingUTF8);
url = CFURLCreateWithFileSystemPath (NULL, path,
kCFURLPOSIXPathStyle, NULL);
CFRelease(path);
provider = CGDataProviderCreateWithURL (url);
CFRelease (url);
image = CGImageCreateWithJPEGDataProvider (provider,
NULL,
true,
kCGRenderingIntentDefault);
CGDataProviderRelease (provider);
// Is this a good idea? It works, nevertheless...
[images addObject:(NSObject*)image];
CGImageRelease (image);
Here is the part inside the drawRect: method of my custom view:
for (i=startingIndex; i<endingIndex; i++) {
. . .
CGImageRef currentImage = (CGImageRef)[images objectAtIndex:i];
// the following function is a #define for the conversion
CGRect re = NSRectToCGRect(NSMakeRect(x, y, xSize, ySize));
CGContextDrawImage (currentContext, re , currentImage);
. . .
}
And finally, here is an excerpt of what Shark tells me:
What am I doing wrong? Any help/hints/pointers to (good & thorough)
documentation is greatly appreciated!
Cheers,
Michael
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartz-dev/email@hidden