* Source/NSImage.m: Implement

-[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33571 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2011-07-16 02:09:06 +00:00
parent 4e36d04d40
commit 97e9d3bda8
3 changed files with 59 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2011-07-15 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSImage.m: Implement
-[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:]
2011-07-15 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSImage.m (-nativeDrawInRect:...): Fix two bugs

View file

@ -353,6 +353,17 @@ typedef enum {
fraction: (float)delta;
#endif
#if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
- (void) drawInRect: (NSRect)dstRect
fromRect: (NSRect)srcRect
operation: (NSCompositingOperation)op
fraction: (float)delta
respectFlipped: (BOOL)respectFlipped
hints: (NSDictionary*)hints;
#endif
//
// Determining How the Image is Drawn
//

View file

@ -1318,6 +1318,49 @@ Fallback for backends other than Cairo. */
}
}
- (void) drawInRect: (NSRect)dstRect
fromRect: (NSRect)srcRect
operation: (NSCompositingOperation)op
fraction: (float)delta
respectFlipped: (BOOL)respectFlipped
hints: (NSDictionary*)hints
{
NSAffineTransform *backup = nil;
NSGraphicsContext *ctx = GSCurrentContext();
BOOL compensateForFlip = (respectFlipped && [ctx isFlipped]);
// FIXME: Hints are currently ignored
if (compensateForFlip)
{
CGFloat height;
NSAffineTransform *newXform;
height = dstRect.size.height != 0 ?
dstRect.size.height : [self size].height;
backup = [ctx GSCurrentCTM];
newXform = [backup copy];
[newXform translateXBy: dstRect.origin.x yBy: dstRect.origin.y + height];
[newXform scaleXBy: 1 yBy: -1];
[ctx GSSetCTM: newXform];
[newXform release];
dstRect.origin = NSMakePoint(0, 0);
}
[self drawInRect: dstRect
fromRect: srcRect
operation: op
fraction: delta];
if (compensateForFlip)
{
[ctx GSSetCTM: backup];
}
}
- (void) addRepresentation: (NSImageRep *)imageRep
{
GSRepData *repd;