• 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: Leopard broke NSView's cacheDisplayInRect:toBitmapImageRep:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: How to know OS Version
  • Next by Date: Re: [NSHost currentHost] halts app for 2s on Leopard
  • Previous by thread: Leopard broke NSView's cacheDisplayInRect:toBitmapImageRep:
  • Next by thread: Bindings, IKImageBrowserView, and reordering
  • Index(es):
    • Date
    • Thread