• 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
[SOLVED] Re: cachImageInRect and Scrolling Views
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SOLVED] Re: cachImageInRect and Scrolling Views


  • Subject: [SOLVED] Re: cachImageInRect and Scrolling Views
  • From: Joseph Jones <email@hidden>
  • Date: Sat, 5 Mar 2005 16:57:01 -0800

Well, for the benefit of all I'll outline the solution that worked for me:

...
[self setHidden:YES];
[win restoreCachedImage];
[win discardCachedImage];
if ([superview autoscroll:theEvent])
{
[win disableFlushWindow];
[superview lockFocus];
[superview displayRect:[self convertRect:r toView:superview]];
[superview unlockFocus];
[win enableFlushWindow];
[win flushWindowIfNeeded];
}
[win cacheImageInRect:[self convertRect:r toView:nil]];
[self setHidden:NO];
[self lockFocus];
[self displayRect:r];
[self unlockFocus];
[win flushWindowIfNeeded];
...


Thanx,
joe

On Mar 4, 2005, at 11:44 PM, Joseph Jones wrote:

Hi all,

I was looking around the mail lists for a way to optimize the drawing of an overlay drag indicator when I cam across cacheImageInRect. Using this works 100% as intended for static (i.e. non-scrolling) views. What I need is a way to do the same thing but over a scrolling view. The graphic area I need to provide access to is much larger than the screen and is very rich (read expensive to re-draw).

There is one post that mentions a hack someone was trying to implement to deal with this but it appears to not be working very well. I am posting in hopes that someone out there has a solution to this situation since I hate to be stuck with such a non-performant portion of my application.

The current solution I have (in pseudo code) is as follows:

//Generate Update Rect...

[window restoreCachedImage];
[window discardCached Image];

[superView autoscroll:theEvent];*

[window cacheImageInRect:[self convertRect:updateRect toView:nil]];
[self lockFocus];
[self displayRect:updateRect];
[self unlockFocus];

[window flushWIndow];

When I drag to a point where scrolling occurs, though, garbage is left behind from my drag indicator. Scrolling back appears to paste old, incorrect information over the view.

Thanx,
joe

*I have also tried the following to see if the scrolling was just not being picked up (to no avail):

if ([superView autoscroll:theEvent])
{
[window disableFlushWindow];
[superView lockFocus];
[superView displayRect:[self convertRect:updateRect toView:superView]];
[superView unlockFocus];
[window enableFlushWindow];
}



_______________________________________________ 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
References: 
 >cachImageInRect and Scrolling Views (From: Joseph Jones <email@hidden>)

  • Prev by Date: Re: How to make key shortcuts and mouse click trigger controlTextDidEndEditing:
  • Next by Date: Re: Creating a JavaVM with JNI & Re:JavaBridge
  • Previous by thread: cachImageInRect and Scrolling Views
  • Next by thread: Threads and widgets
  • Index(es):
    • Date
    • Thread