• 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
Re: Drawing over a transparent background
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Drawing over a transparent background


  • Subject: Re: Drawing over a transparent background
  • From: Dave Keck <email@hidden>
  • Date: Tue, 1 Sep 2009 02:47:40 -1000

> Probably wherever you do the -setNeedsDisplay: for the view would be about right... ;-)

Unfortunately that's not a good place either - the window's shadow
needs to be invalidated after the drawing actually occurs, not just
when the dirty flag is set.

Instead of -setNeedsDisplay:, I think your best bet is:

    [[cView window] display];
    [[cView window] invalidateShadow];

Or if you can target Snow Leopard, I remember seeing some 'NSView did
draw' delegate methods...

> I see that the end of drawRect: is indeed a bad place to do it.  The app's
> CPU % use jumps from ~1% to 2%~3%.  I'll have a play/think about where to do
> it.  Maybe in the custom window class or the app delegate.

I don't think you're going to be able to avoid the increased CPU
usage. Invalidating the window's shadow forces it to redraw, which
inevitably will cost some CPU cycles - there's no way around that; it
doesn't matter where you actually tell it to invalidate the shadow.
_______________________________________________

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: Drawing over a transparent background
      • From: Ron Fleckner <email@hidden>
References: 
 >Re: Drawing over a transparent background (From: Ron Fleckner <email@hidden>)
 >Re: Drawing over a transparent background (From: Dave Keck <email@hidden>)
 >Re: Drawing over a transparent background (From: Ron Fleckner <email@hidden>)
 >Re: Drawing over a transparent background (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Drawing over a transparent background
  • Next by Date: Re: Drawing over a transparent background
  • Previous by thread: Re: Drawing over a transparent background
  • Next by thread: Re: Drawing over a transparent background
  • Index(es):
    • Date
    • Thread