• 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
NSWindow subclass VERY slow to resize
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSWindow subclass VERY slow to resize


  • Subject: NSWindow subclass VERY slow to resize
  • From: Daniel Weber <email@hidden>
  • Date: Fri, 26 Mar 2010 03:36:12 -0700

Ok, I finally managed to get all the drawing/event-handling code
working for my borderless window subclass. The only problem I have
left now is performance. I have a basic formula in the mouseDown
method that does a little arithmetic and sets the window's new frame.
It works fine when the window is < 400 x 400, more or less. However,
when the window starts to get bigger, around 800x800 maybe, there is
very noticeable slowdown as the window is redrawn. I find this odd
because my drawing code is not complicated at all (I'm drawing a
rounded rect with a little arrow pointing up):

- (void)drawRect:(NSRect)rect
{
roundedRect.size.height = roundedRect.size.height - window.arrowHeight;
NSBezierPath *roundRectPath = [NSBezierPath
bezierPathWithRoundedRect:roundedRect xRadius:10.0 yRadius:10.0];

if (window.drawsArrow) {
      NSPoint p1 = NSMakePoint(NSMidX(rect) - window.arrowWidth / 2.0,
NSMaxY(roundedRect));
      NSPoint p2 = NSMakePoint(NSMidX(rect), NSMaxY(rect));
      NSPoint p3 = NSMakePoint(NSMidX(rect) + window.arrowWidth / 2.0,
NSMaxY(roundedRect));
      NSBezierPath *trianglePath = [NSBezierPath bezierPath];
      [trianglePath moveToPoint:p1];
      [trianglePath lineToPoint:p2];
      [trianglePath lineToPoint:p3];
      [trianglePath closePath];
      [roundRectPath appendBezierPath:trianglePath];
}
}

Is there some way to speed this up? Could something else be going on?

Thanks.
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSWindow subclass VERY slow to resize
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Previous ShutDown Message : 3 received
  • Next by Date: Re: Determining an inter-application drag source
  • Previous by thread: Previous ShutDown Message : 3 received
  • Next by thread: Re: NSWindow subclass VERY slow to resize
  • Index(es):
    • Date
    • Thread