mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 04:20:46 +00:00
Hack to dar cached image representation on scaled context correctly.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27097 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6e3db9142d
commit
c18e1e2c12
2 changed files with 40 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2008-11-19 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/NSCachedImageRep.m(-draw): Add hack to draw on a scaled
|
||||||
|
context.
|
||||||
|
|
||||||
2008-11-17 Fred Kiefer <FredKiefer@gmx.de>
|
2008-11-17 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSBezierPath.m: (-windingCountAtPoint:) Return 0 when the
|
* Source/NSBezierPath.m: (-windingCountAtPoint:) Return 0 when the
|
||||||
|
|
|
@ -32,11 +32,16 @@
|
||||||
using the rect information.
|
using the rect information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// for fabs()
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <Foundation/NSString.h>
|
#include <Foundation/NSString.h>
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
#include <Foundation/NSUserDefaults.h>
|
#include <Foundation/NSUserDefaults.h>
|
||||||
|
|
||||||
|
#include "AppKit/NSAffineTransform.h"
|
||||||
|
#include "AppKit/NSBitmapImageRep.h"
|
||||||
#include "AppKit/NSCachedImageRep.h"
|
#include "AppKit/NSCachedImageRep.h"
|
||||||
#include "AppKit/NSView.h"
|
#include "AppKit/NSView.h"
|
||||||
#include "AppKit/NSWindow.h"
|
#include "AppKit/NSWindow.h"
|
||||||
|
@ -166,8 +171,36 @@
|
||||||
|
|
||||||
- (BOOL) draw
|
- (BOOL) draw
|
||||||
{
|
{
|
||||||
PScomposite(NSMinX(_rect), NSMinY(_rect), NSWidth(_rect), NSHeight(_rect),
|
/*
|
||||||
[_window gState], 0, 0, NSCompositeSourceOver);
|
FIXME: Horrible hack to get drawing on a scaled or rotated
|
||||||
|
context correct. We need another interface with the backend
|
||||||
|
to do it properly.
|
||||||
|
*/
|
||||||
|
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||||
|
NSAffineTransform *transform;
|
||||||
|
NSAffineTransformStruct ts;
|
||||||
|
|
||||||
|
transform = [ctxt GSCurrentCTM];
|
||||||
|
ts = [transform transformStruct];
|
||||||
|
|
||||||
|
if (fabs(ts.m11 - 1.0) < 0.01 && fabs(ts.m12) < 0.01
|
||||||
|
&& fabs(ts.m21) < 0.01 && fabs(ts.m22 - 1.0) < 0.01)
|
||||||
|
{
|
||||||
|
PScomposite(NSMinX(_rect), NSMinY(_rect), NSWidth(_rect), NSHeight(_rect),
|
||||||
|
[_window gState], 0, 0, NSCompositeSourceOver);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NSView *view = [_window contentView];
|
||||||
|
NSBitmapImageRep *rep;
|
||||||
|
|
||||||
|
[view lockFocus];
|
||||||
|
rep = [[NSBitmapImageRep alloc] initWithFocusedViewRect: _rect];
|
||||||
|
[view unlockFocus];
|
||||||
|
|
||||||
|
[rep draw];
|
||||||
|
}
|
||||||
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue