mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 18:11:06 +00:00
Image drawing improvements
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5331 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a1bd9d4cf5
commit
6aa5a54bc4
3 changed files with 53 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
|||
Tue Nov 30 11:52:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSCachecImageRep.m: Improve initialisation and added
|
||||
partial implementations (no scaling) for ([-drawAtPoint:]) and
|
||||
([-drawInRect:]) - the superclass versions didn't work due to
|
||||
current state of gstate management.
|
||||
|
||||
Mon Nov 29 17:23:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSMatrix.m: Memory bounds error fixed.
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <Foundation/NSException.h>
|
||||
|
||||
#include <AppKit/NSCachedImageRep.h>
|
||||
#include <AppKit/NSView.h>
|
||||
#include <AppKit/NSWindow.h>
|
||||
|
||||
@interface GSCacheW : NSWindow
|
||||
|
@ -104,6 +105,11 @@
|
|||
styleMask: NSBorderlessWindowMask
|
||||
backing: NSBackingStoreRetained
|
||||
defer: NO];
|
||||
[self setSize: _rect.size];
|
||||
[self setAlpha: NO]; /* FIXME - when we have alpha in windows */
|
||||
[self setOpaque: YES];
|
||||
[self setPixelsHigh: _rect.size.height];
|
||||
[self setPixelsWide: _rect.size.width];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -130,6 +136,40 @@
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) drawAtPoint: (NSPoint)aPoint
|
||||
{
|
||||
NSGraphicsContext *ctxt;
|
||||
|
||||
if (size.width == 0 && size.height == 0)
|
||||
return NO;
|
||||
|
||||
NSDebugLLog(@"NSImage", @"Drawing at point %f %f\n", aPoint.x, aPoint.y);
|
||||
ctxt = GSCurrentContext();
|
||||
if (aPoint.x != 0 || aPoint.y != 0)
|
||||
{
|
||||
if ([[ctxt focusView] isFlipped])
|
||||
aPoint.y -= size.height;
|
||||
}
|
||||
NSCopyBits([_window gState], _rect, aPoint);
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL) drawInRect: (NSRect)aRect
|
||||
{
|
||||
NSGraphicsContext *ctxt;
|
||||
|
||||
NSDebugLLog(@"NSImage", @"Drawing in rect (%f %f %f %f)\n",
|
||||
NSMinX(aRect), NSMinY(aRect), NSWidth(aRect), NSHeight(aRect));
|
||||
if (size.width == 0 && size.height == 0)
|
||||
return NO;
|
||||
|
||||
ctxt = GSCurrentContext();
|
||||
if ([[ctxt focusView] isFlipped])
|
||||
aRect.origin.y -= NSHeight(aRect);
|
||||
NSCopyBits([_window gState], _rect, aRect.origin);
|
||||
return NO;
|
||||
}
|
||||
|
||||
// NSCoding protocol
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
|
|
|
@ -892,6 +892,8 @@ static NSDictionary* nsmapping = nil;
|
|||
|
||||
/*
|
||||
* What's the best representation? FIXME
|
||||
* At the moment we take the last bitmap we find, or the first
|
||||
* rep of any type if we don't find a bitmap.
|
||||
*/
|
||||
[_reps getObjects: reps];
|
||||
for (i = 0; i < count; i++)
|
||||
|
@ -902,6 +904,10 @@ static NSDictionary* nsmapping = nil;
|
|||
{
|
||||
rep = repd->rep;
|
||||
}
|
||||
else if (rep == nil)
|
||||
{
|
||||
rep = repd->rep;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue