Re: Leopard broke NSView's cacheDisplayInRect:toBitmapImageRep:
Re: Leopard broke NSView's cacheDisplayInRect:toBitmapImageRep:
- Subject: Re: Leopard broke NSView's cacheDisplayInRect:toBitmapImageRep:
- From: Gerd Knops <email@hidden>
- Date: Sat, 17 Nov 2007 12:06:55 -0600
Just in case somebody else runs into this and finds this in the
archives: A workaround is to set the NSBitmapImageRep size before
calling
cacheDisplayInRect:toBitmapImageRep:, eg in the code below this line
had to be added to make it work on Leopard:
[bir setSize:imgSize];
Gerd
On Nov 7, 2007, at 4:57 PM, Gerd Knops wrote:
I use the code below to produce a drag image. The view in question
is scaled. The code works fine under Tiger, but under Leopard the
view representation only fills a tiny area in the bottom left corner
of the drag image.
Any ideas?
Thanks
Gerd
NSSize mySize=[self bounds].size;
NSSize
imgSize
=
NSMakeSize
(mySize.width*dragScaleFactor,mySize.height*dragScaleFactor);
NSBitmapImageRep *bir=[self bitmapImageRepForCachingDisplayInRect:
[self bounds]];
[self cacheDisplayInRect:[self bounds] toBitmapImageRep:bir];
DLog(@"mySize : %@",NSStringFromSize(mySize));
DLog(@"imgSize : %@",NSStringFromSize(imgSize));
DLog(@"bir size : %@",NSStringFromSize([bir size]));
NSImage *dragImage=[[NSImage alloc]initWithSize:imgSize];
[dragImage addRepresentation:bir];
DLog(@"dragImage size: %@",NSStringFromSize([dragImage size]));
Output under Tiger:
PageView.m:398: mySize : {3728, 5856}
PageView.m:399: imgSize : {96, 150.798}
PageView.m:400: bir size : {96, 151}
PageView.m:405: dragImage size: {96, 150.798}
Leopard (different scale, but note the different size for bir):
PageView.m:398: mySize : {3728, 5856}
PageView.m:399: imgSize : {288, 452.395}
PageView.m:400: bir size : {3728, 5856}
PageView.m:405: dragImage size: {288, 452.395}
_______________________________________________
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