2005-01-25 01:05 Alexander Malmberg <alexander@malmberg.org>

* Source/NSImageCell.m (-drawInteriorWithFrame:inView:): Use
	-drawInRect:fromRect:operation:fraction: to draw the image.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20614 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Alexander Malmberg 2005-01-25 00:01:50 +00:00
parent d67b1e64cd
commit 87a32e985f
2 changed files with 16 additions and 17 deletions

View file

@ -1,3 +1,8 @@
2005-01-25 01:05 Alexander Malmberg <alexander@malmberg.org>
* Source/NSImageCell.m (-drawInteriorWithFrame:inView:): Use
-drawInRect:fromRect:operation:fraction: to draw the image.
2005-01-25 00:29 Alexander Malmberg <alexander@malmberg.org>
* Headers/AppKit/NSImage.h (-drawAtPoint:fromRect:fraction:)

View file

@ -211,7 +211,7 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
{
NSPoint position;
BOOL is_flipped = [controlView isFlipped];
NSSize imageSize;
NSSize imageSize, realImageSize;
NSDebugLLog(@"NSImageCell", @"NSImageCell drawInteriorWithFrame called");
@ -221,12 +221,14 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
// leave room for the frame
cellFrame = [self drawingRectForBounds: cellFrame];
realImageSize = [_cell_image size];
switch (_imageScaling)
{
case NSScaleProportionally:
{
NSDebugLLog(@"NSImageCell", @"NSScaleProportionally");
imageSize = scaleProportionally ([_cell_image size], cellFrame);
imageSize = scaleProportionally (realImageSize, cellFrame);
break;
}
case NSScaleToFit:
@ -239,7 +241,7 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
case NSScaleNone:
{
NSDebugLLog(@"NSImageCell", @"NSScaleNone");
imageSize = [_cell_image size];
imageSize = realImageSize;
break;
}
}
@ -290,20 +292,12 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
position.y += imageSize.height;
// draw!
/* TODO: Clean this up when bug #11712 is fixed. */
if (NSEqualSizes(imageSize, [_cell_image size]))
[_cell_image compositeToPoint: position operation: NSCompositeSourceOver];
else
{
BOOL wasScalable = [_cell_image scalesWhenResized];
[_cell_image setScalesWhenResized: YES];
[_cell_image drawRepresentation:
[_cell_image bestRepresentationForDevice: nil]
inRect:
NSMakeRect(position.x, position.y, imageSize.width,
imageSize.height)];
[_cell_image setScalesWhenResized: wasScalable];
}
[_cell_image drawInRect: NSMakeRect(position.x, position.y,
imageSize.width, imageSize.height)
fromRect: NSMakeRect(0, 0, realImageSize.width,
realImageSize.height)
operation: NSCompositeSourceOver
fraction: 1.0];
if (_cell.shows_first_responder)
NSDottedFrameRect(cellFrame);