mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 06:51:44 +00:00
* Source/NSCachedImageRep.m: Restore the implementation of -draw
because libart/xlib need it. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33797 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
42162c4e22
commit
1b780e1bc7
3 changed files with 42 additions and 7 deletions
|
@ -1,3 +1,8 @@
|
|||
2011-08-29 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/NSCachedImageRep.m: Restore the implementation of -draw
|
||||
because libart/xlib need it.
|
||||
|
||||
2011-08-28 Christopher Armstrong <carmstrong@fastmail.com.au>
|
||||
* Source/GSHorizontalTypesetter.m: Split declaration of struct
|
||||
GSHorizontalTypesetter_glyph_cache_s and struct
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
*/
|
||||
- (id) initWithSize: (NSSize)aSize
|
||||
pixelsWide: (int)pixelsWide
|
||||
pixelsHigh: (NSInteger)pixelsHigh
|
||||
pixelsHigh: (int)pixelsHigh
|
||||
depth: (int)aDepth
|
||||
separate: (BOOL)separate
|
||||
alpha: (BOOL)alpha;
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
*/
|
||||
- (id) initWithSize: (NSSize)aSize
|
||||
pixelsWide: (int)pixelsWide
|
||||
pixelsHigh: (NSInteger)pixelsHigh
|
||||
pixelsHigh: (int)pixelsHigh
|
||||
depth: (int)aDepth
|
||||
separate: (BOOL)separate
|
||||
alpha: (BOOL)alpha
|
||||
|
@ -187,13 +187,43 @@
|
|||
return _window;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) draw
|
||||
{
|
||||
// FIXME: Could re-implement
|
||||
// Drawing of NSCachedImageRep is only supported by using
|
||||
// -drawInRect:fromRect:operation:fraction:respectFlipped:hints: for now.
|
||||
return NO;
|
||||
/*
|
||||
Horrible hack to get drawing on a scaled or rotated
|
||||
context correct. Only used on backends not supporting GSdraw:
|
||||
(art/xlib backend).
|
||||
*/
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
NSAffineTransform *transform;
|
||||
NSAffineTransformStruct ts;
|
||||
// Is there anything to draw?
|
||||
if (NSIsEmptyRect(_rect))
|
||||
return YES;
|
||||
|
||||
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];
|
||||
RELEASE(rep);
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue