• 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
Faster drawing NSButtons
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Faster drawing NSButtons


  • Subject: Faster drawing NSButtons
  • From: Steve Gehrman <email@hidden>
  • Date: Sat, 19 Oct 2002 15:32:59 -0700

Drawing NSButtons is way too slow. Drawing the background image and
the text takes too long.

I would like to subclass NSButton and do something like...

- (void)drawRect:(NSRect)rect;
{
if (!_cachedImage)
{
_cachedImage = [[NSImage alloc] initWithSize:rect.size];

[_cachedImage lockFocus];

// draw the NSButton in the NSImage
[super drawRect:rect];

[_cachedImage unlockFocus];
}

[_cachedImage compositeToPoint:rect.origin
operation:NSCompositeSourceOver];
}

This almost works, but the image doesn't look right. I've tried all
the obvious solutions and couldn't make this work.

When I resize my window, 10% of the time is spent redrawing simple
NSButtons!

-steve
_______________________________________________
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.

  • Prev by Date: Re: Could it really move? (Carbon Memory Manager)
  • Next by Date: Receiving all Key Events
  • Previous by thread: Re: Could it really move? (Carbon Memory Manager)
  • Next by thread: Receiving all Key Events
  • Index(es):
    • Date
    • Thread