• 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
Can I get AppKit to draw this faster ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can I get AppKit to draw this faster ?


  • Subject: Can I get AppKit to draw this faster ?
  • From: Nat! <email@hidden>
  • Date: Tue, 8 Oct 2002 02:21:23 +0200

For a little animation I am calling NSImage's

[self drawInRect:dstRect
fromRect:srcRect
operation:NSCompositeSourceOver
fraction:1.0];

repeatedly over the same image, dstRect and srcRect have always a width of 1.0 and srcRect has also a fixed height (the image height), but dstRect has varying heights, but always smaller than srcRect's height.

When I do this with a 60x60 image (drawing 60 lines), I can keep up with my 30 Hz animation, but if I use a 128x128 image (drawing 128 lines), my fps count drops to 15 Hz, which means I max out at around 2000 of these calls per second on my 400 Mhz cube - which I think is pretty sad.

Any hints ? The only solution I can come up with is to write my own "drawRect." method that blits into a NSBitmapImageRep.

Thanks in advance
Nat!


Looking in Sample.app I see that indeed most of the time is spent in drawInRect:.

524 -[MulleLameEffectView animate:]
512 -[NSView displayIfNeeded]
512 -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
424 -[NSNextStepFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible RectForView:topView:]
424 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisible RectForView:topView:]
424 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:]
417 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:]
415 -[NSView _drawRect:clip:]
415 -[MulleLameEffectView drawRect:]
305 -[NSImage(MulleLamePixelScaler) vScaleToX:offsets:nPoints:topPoints:bottomPoints:]
297 -[NSImage drawInRect:fromRect:operation:fraction:]
259 -[NSBitmapImageRep _drawFromRect:toRect:operation:alpha:compositing:flipped:ignoreContext:]
151 CGContextDrawImage
149 ripc_DrawImage
138 ripc_RenderImage
79 ripl_BltImage
35 ARGB32_image
31 ARGB32_image_mark
23 ARGB32_image_RGB24
23 ARGB32_image_RGB24 [STACK TOP]

Jedenfalls sind zehn Fehlstarts hintereinander [E. Fuchs]
ein sehr interessanter Beweis
fuer unsere Theorie
von der natuerlichen Ueberlegenheit des Dezimalsystems
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Can I get AppKit to draw this faster ?
      • From: Ali Ozer <email@hidden>
  • Prev by Date: Re: NSDragOperationDelete
  • Next by Date: Re: NSDisclosureButtonCell
  • Previous by thread: Re: NSDisclosureButtonCell
  • Next by thread: Re: Can I get AppKit to draw this faster ?
  • Index(es):
    • Date
    • Thread