• 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
Pure Quartz vs. Cocoa-Objects ... why is Quartz slower?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pure Quartz vs. Cocoa-Objects ... why is Quartz slower?


  • Subject: Pure Quartz vs. Cocoa-Objects ... why is Quartz slower?
  • From: Michael Becker <email@hidden>
  • Date: Fri, 11 Feb 2005 02:06:19 +0100

Hi!

I must admit, I am totally new to Quartz 2D, but I am trying to use it to speed up my application (basically the iPhoto-like multi-thumbnail view). In my views drawRect: method, I traverse an array of images and draw them one by one.
I did this at first with the simple NSBitmapImageRep's drawInRect: method. Now I was trying to replace that with direct Quartz calls. However, my Quartz-version is noticeably slower than the Cocoa one.


Here is the Cocoa version:

for (i=startingIndex; i<endingIndex; i++) {
. . .
NSBitmapImageRep *currentImage = [images objectAtIndex:i];
[ (NSBitmapImageRep *) currentImage drawInRect:NSMakeRect(x,y,newImageSize.width,newImageSize.height)];
. . .
}



I turned that into this Quartz2D-version:

CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];

for (i=startingIndex; i<endingIndex; i++) {
. . .
CGImageRef image = (CGImageRef)[ images objectAtIndex:i];


// NSRectToCGRect is just a #define to convert the one into the other
CGRect myContextRect = NSRectToCGRect( NSMakeRect(x, y, newImageSize.width, newImageSize.height) );

CGContextDrawImage (context, myContextRect, image);
. . .
}


Why is the second one so much slower than the first one? Am I missing a basic fact? Do I need to enable stuff like caching etc. on my own? I thought that most of Cocoa's Imaging Classes were just wrappers for the Quartz ones...

Any help greatly appreciated!

Regards,
Michael

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


  • Prev by Date: Re: Translate into ObjectiveC
  • Next by Date: Re: Translate into ObjectiveC
  • Previous by thread: Re: Threads and C functions
  • Next by thread: Pure Quartz vs. Cocoa-Objects ... why is Quartz slower?
  • Index(es):
    • Date
    • Thread