[REPOST] Jaguar NSImage caching woes roundup
[REPOST] Jaguar NSImage caching woes roundup
- Subject: [REPOST] Jaguar NSImage caching woes roundup
- From: Alexander Griekspoor <email@hidden>
- Date: Wed, 11 Feb 2004 11:24:17 +0100
Sorry to post this again, but cocoa.mamasam somehow mixes up emails
sometimes.. This was my real email content:
Glen, I'm still confused and I haven't found a solution yet. Drawing my
graph is pretty expensive and in principle only has to occur when
opening the file. Redrawing it everytime would be crazy, enter the
NSImage caching. Works brilliantly, but again the moment the graph
becomes to big, the cache problem turns up. So how exactly did you do
it? Is there a way to cache views without NSImage or is there a way to
draw an NSImage offscreen that is bigger than the window limits? I
tried the following code without success (it's in my custom view method
invalidateCache: ):
topCache = [[NSImage alloc] initWithSize: [self frame].size];
[topCache setCacheMode: NSImageCacheNever]; // First I didn't
have this
[topCache lockFocus];
[self drawTopBar: [self frame]]; // Drawing
[topCache unlockFocus];
and also tried to add the following after the drawing:
rep = [[NSBitmapImageRep alloc] initWithFocusedViewRect: [self
frame]];
[topCache addRepresentation: rep];
[rep release];
I don't see why disabling the cache would help, because if I understand
correctly, you need the cache to draw an image right?
Again, the question is simple, how do I cache a large NSView? Maybe
there's even a better/simpler way without NSImage at all?
Thanks,
Alex
Op 11-feb-04 om 3:03 heeft Glen Low het volgende geschreven:
>
> The second question I had: I know this has been discussed a lot in the
>
> past and I did read all the posts I could find, but I miss a kind of
>
> summary or at least a satisfaction to understand the problem fully. My
>
> app uses the wonderful graphview framework to draw a -tata- graph. To
>
> speed up things up, I draw it in an NSImage to use it as a cache that
>
> I
>
> composite in the end to my view. It works perfectly, but then I
>
> started
>
> to get report from people running Jaguar that had problems opening
>
> certain files. To cut the story short, it turns out to be the famous
>
> caching problem, if the view gets to wide, NSImage can't cache it
>
> anymore. The thread that offers most answers is:
>
> http://cocoa.mamasam.com/COCOADEV/2003/03/2/59361.php
>
>
>
> The problem is that in none of these posts a real workaround is given.
>
> What would be the best way to deal with the problem, and again maybe
>
> it's the lack of understanding the background of it.
>
> The cachedimagerep is actually a window right? And the size of it is
>
> limited. Someone suggested to use an NSBitmapRep. Can those be of any
>
> size then? And should I in that case disable the caching, or is that
>
> still necessary to actually draw the thing offscreen? Or is the only
>
> option to tile everything?
>
>
I got bitten by this bug when doing the Graphviz.app viewer. In an old
>
version if you zoom out too large the drawing is either very slow or
>
doesn't appear at all. I fixed it by disabling cacheing in NSImage.
>
>
Since my data is PDF/Quartz-based it didn't seem to matter, and in
>
fact zooming is now more reliable and faster (I suppose in the
>
absolute sense there might be a slight slowdown when scrolling but I
>
don't notice it). The only reason I can think of to keep cacheing on
>
is scrolling a complicated graph, since the windows are
>
double-buffered already.
>
>
Cheers,
>
Glen Low, Pixelglow Software
>
www.pixelglow.com
>
>
>
*********************************************************
** Alexander Griekspoor **
*********************************************************
The Netherlands Cancer Institute
Department of Tumorbiology (H4)
Plesmanlaan 121, 1066 CX, Amsterdam
Tel: + 31 20 - 512 2023
Fax: + 31 20 - 512 2029
E-mail: email@hidden
Web:
http://www.mekentosj.com
Mac vs Windows
65 million years ago, there were more
dinosaurs than humans.
Where are the dinosaurs now?
*********************************************************
*********************************************************
** Alexander Griekspoor **
*********************************************************
The Netherlands Cancer Institute
Department of Tumorbiology (H4)
Plesmanlaan 121, 1066 CX, Amsterdam
Tel: + 31 20 - 512 2023
Fax: + 31 20 - 512 2029
E-mail: email@hidden
Web:
http://www.mekentosj.com
Mac vs Windows
65 million years ago, there were more
dinosaurs than humans.
Where are the dinosaurs now?
*********************************************************
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.