mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 18:50:48 +00:00
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:
parent
75f09619e9
commit
5ced3055c1
2 changed files with 16 additions and 17 deletions
|
@ -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>
|
2005-01-25 00:29 Alexander Malmberg <alexander@malmberg.org>
|
||||||
|
|
||||||
* Headers/AppKit/NSImage.h (-drawAtPoint:fromRect:fraction:)
|
* Headers/AppKit/NSImage.h (-drawAtPoint:fromRect:fraction:)
|
||||||
|
|
|
@ -211,7 +211,7 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
|
||||||
{
|
{
|
||||||
NSPoint position;
|
NSPoint position;
|
||||||
BOOL is_flipped = [controlView isFlipped];
|
BOOL is_flipped = [controlView isFlipped];
|
||||||
NSSize imageSize;
|
NSSize imageSize, realImageSize;
|
||||||
|
|
||||||
NSDebugLLog(@"NSImageCell", @"NSImageCell drawInteriorWithFrame called");
|
NSDebugLLog(@"NSImageCell", @"NSImageCell drawInteriorWithFrame called");
|
||||||
|
|
||||||
|
@ -221,12 +221,14 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
|
||||||
// leave room for the frame
|
// leave room for the frame
|
||||||
cellFrame = [self drawingRectForBounds: cellFrame];
|
cellFrame = [self drawingRectForBounds: cellFrame];
|
||||||
|
|
||||||
|
realImageSize = [_cell_image size];
|
||||||
|
|
||||||
switch (_imageScaling)
|
switch (_imageScaling)
|
||||||
{
|
{
|
||||||
case NSScaleProportionally:
|
case NSScaleProportionally:
|
||||||
{
|
{
|
||||||
NSDebugLLog(@"NSImageCell", @"NSScaleProportionally");
|
NSDebugLLog(@"NSImageCell", @"NSScaleProportionally");
|
||||||
imageSize = scaleProportionally ([_cell_image size], cellFrame);
|
imageSize = scaleProportionally (realImageSize, cellFrame);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NSScaleToFit:
|
case NSScaleToFit:
|
||||||
|
@ -239,7 +241,7 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
|
||||||
case NSScaleNone:
|
case NSScaleNone:
|
||||||
{
|
{
|
||||||
NSDebugLLog(@"NSImageCell", @"NSScaleNone");
|
NSDebugLLog(@"NSImageCell", @"NSScaleNone");
|
||||||
imageSize = [_cell_image size];
|
imageSize = realImageSize;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -290,20 +292,12 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
|
||||||
position.y += imageSize.height;
|
position.y += imageSize.height;
|
||||||
|
|
||||||
// draw!
|
// draw!
|
||||||
/* TODO: Clean this up when bug #11712 is fixed. */
|
[_cell_image drawInRect: NSMakeRect(position.x, position.y,
|
||||||
if (NSEqualSizes(imageSize, [_cell_image size]))
|
imageSize.width, imageSize.height)
|
||||||
[_cell_image compositeToPoint: position operation: NSCompositeSourceOver];
|
fromRect: NSMakeRect(0, 0, realImageSize.width,
|
||||||
else
|
realImageSize.height)
|
||||||
{
|
operation: NSCompositeSourceOver
|
||||||
BOOL wasScalable = [_cell_image scalesWhenResized];
|
fraction: 1.0];
|
||||||
[_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];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_cell.shows_first_responder)
|
if (_cell.shows_first_responder)
|
||||||
NSDottedFrameRect(cellFrame);
|
NSDottedFrameRect(cellFrame);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue