mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 13:10:38 +00:00
Fixed many drawing issues (many ones being related to the flipping).
See bug report #27782 In particular, fixed -[NSImage drawXXX] and -[NSImage composite/dissolveXXX] methods to work exactly as Cocoa when the Cairo backend is used. Added a new draw operator (in addition to composite) to the backend. Cairo is the only backend that implements it for now. Eliminated as many flipping checks as possible. Warning: Untested with the winlib backend. You must update, recompile and install both Back and Gui. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30523 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
67adeb4133
commit
0eee79f7b5
9 changed files with 274 additions and 28 deletions
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include "config.h"
|
||||
#include <Foundation/NSDebug.h>
|
||||
#include "AppKit/NSAffineTransform.h"
|
||||
#include "AppKit/NSCell.h"
|
||||
#include "AppKit/NSGraphics.h"
|
||||
#include "AppKit/NSImageCell.h"
|
||||
|
@ -197,6 +198,7 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
|
|||
NSPoint position;
|
||||
BOOL is_flipped = [controlView isFlipped];
|
||||
NSSize imageSize, realImageSize;
|
||||
NSAffineTransform *xform = nil;
|
||||
|
||||
NSDebugLLog(@"NSImageCell", @"NSImageCell drawInteriorWithFrame called");
|
||||
|
||||
|
@ -273,10 +275,13 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
|
|||
}
|
||||
|
||||
// account for flipped views
|
||||
if (is_flipped)
|
||||
if (is_flipped && controlView != nil)
|
||||
{
|
||||
position.y += imageSize.height;
|
||||
imageSize.height = -imageSize.height;
|
||||
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!
|
||||
|
@ -286,6 +291,12 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
|
|||
realImageSize.height)
|
||||
operation: NSCompositeSourceOver
|
||||
fraction: 1.0];
|
||||
|
||||
if (is_flipped && controlView != nil)
|
||||
{
|
||||
[xform invert];
|
||||
[xform concat];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSSize) cellSize
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue