• 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: Coalesced updates = pain
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coalesced updates = pain


  • Subject: Re: Coalesced updates = pain
  • From: John Stiles <email@hidden>
  • Date: Fri, 22 Jul 2005 19:01:59 -0700

On Jul 22, 2005, at 6:47 PM, John Stiles wrote:


On Jul 22, 2005, at 5:36 PM, Corbin Dunn wrote:


Hmm, that didn't exist when I wrote the code back on OS X 10.2 :)
I guess I will use that technique on 10.3+ and use displayRect on 10.2.





Yes; it came about to address this very problem!


But it's not helping! :(
I can't use this. If any rectangles overlap, it breaks them up into multiple little sub-rectangles which confuse my rendering code. I can see what it's trying to accomplish, but my rendering code doesn't work well with these arbitrary rectangles. I just want the rectangles that I originally passed in.
I think I am going to try an alternate approach. Thanks for the help, though. It got me thinking.

For the benefit of the list, my (pseudocode) solution was as follows. It might not be ideal but it seems to work really well in practice.


- Add a member to my NSView subclass, "rectsToUpdate". It's an array of the rectangles I want to draw.

- Call displayRect like this:

            unionRect = aUnionOfAllTheRectsIn( myRectangleList );

// Call displayRect and include the update hint so it doesn't update more than necessary.
rectsToUpdate = &myRectangleList;
[self displayRect:unionRect];
rectsToUpdate = NULL;


- Redo my drawRect to look like this:

- (void) drawRect:(NSRect)rect
{
    if( rectsToUpdate != NULL )
    {
        // My animation code initiated the draw.
        ... draw each of the rectsToUpdate
    }
    else
    {
        // The system initiated the draw.
        ... draw the passed in rect
    }
}


_______________________________________________ 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
  • Follow-Ups:
    • Re: Coalesced updates = pain
      • From: Guy English <email@hidden>
References: 
 >Coalesced updates = pain (From: John Stiles <email@hidden>)
 >Re: Coalesced updates = pain (From: Corbin Dunn <email@hidden>)
 >Re: Coalesced updates = pain (From: John Stiles <email@hidden>)
 >Re: Coalesced updates = pain (From: Corbin Dunn <email@hidden>)
 >Re: Coalesced updates = pain (From: John Stiles <email@hidden>)

  • Prev by Date: Re: Coalesced updates = pain
  • Next by Date: Mail.app Blue Sidebar
  • Previous by thread: Re: Coalesced updates = pain
  • Next by thread: Re: Coalesced updates = pain
  • Index(es):
    • Date
    • Thread