mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 18:11:06 +00:00
* Source/NSImage.m (-nativeDrawInRect:...): Fix drawing images
with a source rect smaller than the entire image. This was a mistake left by my last commit to this method. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33135 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5f73c3f623
commit
8e6b334c1d
2 changed files with 13 additions and 6 deletions
|
@ -1,3 +1,9 @@
|
|||
2011-05-26 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/NSImage.m (-nativeDrawInRect:...): Fix drawing images
|
||||
with a source rect smaller than the entire image. This was a mistake
|
||||
left by my last commit to this method.
|
||||
|
||||
2011-05-25 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/NSLayoutManager.m:
|
||||
|
|
|
@ -1013,7 +1013,8 @@ behavior precisely matches Cocoa. */
|
|||
/* The context of the cache window */
|
||||
NSGraphicsContext *cacheCtxt;
|
||||
/* The size of the cache window that will hold the scaled image */
|
||||
NSSize cacheSize = [[ctxt GSCurrentCTM] transformSize: dstRect.size];
|
||||
NSSize cacheSize = [[ctxt GSCurrentCTM] transformSize: imgSize];
|
||||
|
||||
CGFloat imgToCacheWidthScaleFactor = cacheSize.width / imgSize.width;
|
||||
CGFloat imgToCacheHeightScaleFactor = cacheSize.height / imgSize.height;
|
||||
|
||||
|
@ -1024,7 +1025,7 @@ behavior precisely matches Cocoa. */
|
|||
NSAffineTransform *transform;
|
||||
|
||||
cache = [[NSCachedImageRep alloc]
|
||||
initWithSize: cacheSize
|
||||
initWithSize: NSMakeSize(ceil(cacheSize.width), ceil(cacheSize.height))
|
||||
depth: [[NSScreen mainScreen] depth]
|
||||
separate: YES
|
||||
alpha: YES];
|
||||
|
@ -1033,7 +1034,7 @@ behavior precisely matches Cocoa. */
|
|||
cacheCtxt = GSCurrentContext();
|
||||
|
||||
/* Clear the cache window surface */
|
||||
DPScompositerect(cacheCtxt, 0, 0, cacheSize.width, cacheSize.height, NSCompositeClear);
|
||||
DPScompositerect(cacheCtxt, 0, 0, ceil(cacheSize.width), ceil(cacheSize.height), NSCompositeClear);
|
||||
gState = [cacheCtxt GSDefineGState];
|
||||
|
||||
//NSLog(@"Draw in cache size %@", NSStringFromSize(cacheSize));
|
||||
|
@ -1047,7 +1048,7 @@ behavior precisely matches Cocoa. */
|
|||
if (delta != 1.0)
|
||||
{
|
||||
DPSsetalpha(cacheCtxt, delta);
|
||||
DPScompositerect(cacheCtxt, 0, 0, cacheSize.width, cacheSize.height,
|
||||
DPScompositerect(cacheCtxt, 0, 0, ceil(cacheSize.width), ceil(cacheSize.height),
|
||||
NSCompositeDestinationIn);
|
||||
}
|
||||
|
||||
|
@ -1060,8 +1061,8 @@ behavior precisely matches Cocoa. */
|
|||
|
||||
transform = [NSAffineTransform transform];
|
||||
[transform translateXBy: dstRect.origin.x yBy: dstRect.origin.y];
|
||||
[transform scaleXBy: dstRect.size.width / cacheSize.width
|
||||
yBy: dstRect.size.height / cacheSize.height];
|
||||
[transform scaleXBy: dstRect.size.width / srcRectInCache.size.width
|
||||
yBy: dstRect.size.height / srcRectInCache.size.height];
|
||||
[transform concat];
|
||||
|
||||
[ctxt GSdraw: gState
|
||||
|
|
Loading…
Reference in a new issue