Image cache: Where is it and how do I refresh it?
Image cache: Where is it and how do I refresh it?
- Subject: Image cache: Where is it and how do I refresh it?
- From: Gregory Weston <email@hidden>
- Date: Sat, 27 May 2006 10:51:58 -0400
Ran into an unexpected problem last night while updating some pixel-
level manipulation to be Intel-friendly. Spent a while searching
Google and the list archives for ideas with no joy. Here's the
situation:
1) I've got an NSView subclass whose drawRect: (among other things)
draws part of an NSImage into (all of) itself, using
NSImage>>drawInRect:fromRect:operation:fraction:.
2) I create a data buffer and load it with pixel data. I construct an
NSBitmapImageRep using that buffer. I construct an NSImage and add
the rep.
My NSView comes up on-screen and draws itself exactly as I expect.
Then at some point the pixel buffer changes and setNeedsDisplay:YES
is sent to the view. And it does redraw itself. But it's still
showing the original image. I add some code before the
setNeedsDisplay to dump the NSImage as a TIFF and that saved file has
the updated image. NSImage>>representations returns an array with a
single entry, and it's the one I created.
Sending setCacheMode:NSImageCacheNever to the image doesn't help.
If I remove the imagerep from the image and add a new one created
from the same buffer it works.
The fact that the TIFF save works while a subsequent draw doesn't
suggests to me that the view or window is doing the caching and
recognizing that it's being asked to draw the same image but _not_
recognizing (understandably, I suppose) that the pixel data for the
imagerep in that image has changed. Can anyone confirm where my stale
cache is and suggest a way to refresh it?
_______________________________________________
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