mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
* Source/NSImageCell.m (-drawInteriorWithFrame:inView:): Simplify a bit
bit by using -[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:] * Source/NSCell.m (-drawInteriorWithFrame:inView:): Switch from -[NSImage compositeToPoint...] to -[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:] git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33813 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
19b6765e49
commit
a6788023fb
3 changed files with 19 additions and 25 deletions
|
@ -1,3 +1,12 @@
|
|||
2011-09-07 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/NSImageCell.m (-drawInteriorWithFrame:inView:): Simplify a bit
|
||||
bit by using
|
||||
-[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:]
|
||||
* Source/NSCell.m (-drawInteriorWithFrame:inView:): Switch from
|
||||
-[NSImage compositeToPoint...] to
|
||||
-[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:]
|
||||
|
||||
2011-09-07 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/NSOpenPanel.m: Use the NSSavePanel _allowedFileTypes ivar
|
||||
|
|
|
@ -2027,14 +2027,13 @@ static NSColor *dtxtCol;
|
|||
size = [_cell_image size];
|
||||
position.x = MAX(NSMidX(drawingRect) - (size.width/2.),0.);
|
||||
position.y = MAX(NSMidY(drawingRect) - (size.height/2.),0.);
|
||||
/*
|
||||
* Images are always drawn with their bottom-left corner
|
||||
* at the origin so we must adjust the position to take
|
||||
* account of a flipped view.
|
||||
*/
|
||||
if ([controlView isFlipped])
|
||||
position.y += size.height;
|
||||
[_cell_image compositeToPoint: position operation: NSCompositeSourceOver];
|
||||
|
||||
[_cell_image drawInRect: NSMakeRect(position.x, position.y, size.width, size.height)
|
||||
fromRect: NSZeroRect
|
||||
operation: NSCompositeSourceOver
|
||||
fraction: 1.0
|
||||
respectFlipped: YES
|
||||
hints: nil];
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -195,7 +195,6 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect, BOOL scaleUpOrDown)
|
|||
NSPoint position;
|
||||
BOOL is_flipped = [controlView isFlipped];
|
||||
NSSize imageSize, realImageSize;
|
||||
NSAffineTransform *xform = nil;
|
||||
|
||||
NSDebugLLog(@"NSImageCell", @"NSImageCell drawInteriorWithFrame called");
|
||||
|
||||
|
@ -277,29 +276,16 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect, BOOL scaleUpOrDown)
|
|||
break;
|
||||
}
|
||||
|
||||
// account for flipped views
|
||||
if (is_flipped && controlView != nil)
|
||||
{
|
||||
xform = [NSAffineTransform transform];
|
||||
[xform translateXBy: 0 yBy: [controlView bounds].size.height];
|
||||
[xform scaleXBy: 1 yBy: -1];
|
||||
[xform concat];
|
||||
position.y = [controlView bounds].size.height - position.y - imageSize.height;
|
||||
}
|
||||
|
||||
// draw!
|
||||
[_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];
|
||||
fraction: 1.0
|
||||
respectFlipped: YES
|
||||
hints: nil];
|
||||
|
||||
if (is_flipped && controlView != nil)
|
||||
{
|
||||
[xform invert];
|
||||
[xform concat];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSSize) cellSize
|
||||
|
|
Loading…
Reference in a new issue