* Source/NSImage.m (-lockFocusOnRepresentation:): Draw the

representation into the new cache. Use NSRectFillUsingOperation
  instead of PScompositerect.
* Source/NSImage.m (-drawRepresentation:inRect:): Use DPS
  operations instead of PS operations.

Should fix bug #34470


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33948 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2011-10-06 11:06:31 +00:00
parent d4edc7228e
commit fd9bd0faa7
2 changed files with 18 additions and 14 deletions

View file

@ -1,3 +1,11 @@
2011-10-06 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSImage.m (-lockFocusOnRepresentation:): Draw the
representation into the new cache. Use NSRectFillUsingOperation
instead of PScompositerect.
* Source/NSImage.m (-drawRepresentation:inRect:): Use DPS
operations instead of PS operations.
2011-10-06 Fred Kiefer <FredKiefer@gmx.de> 2011-10-06 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSProgressIndicator.m (-encodeWithCoder:, initWithCoder:) * Source/NSProgressIndicator.m (-encodeWithCoder:, initWithCoder:)

View file

@ -51,7 +51,7 @@
#import "AppKit/NSScreen.h" #import "AppKit/NSScreen.h"
#import "AppKit/NSView.h" #import "AppKit/NSView.h"
#import "AppKit/NSWindow.h" #import "AppKit/NSWindow.h"
#import "AppKit/PSOperators.h" #import "AppKit/DPSOperators.h"
#import "GNUstepGUI/GSDisplayServer.h" #import "GNUstepGUI/GSDisplayServer.h"
#import "GSThemePrivate.h" #import "GSThemePrivate.h"
@ -863,8 +863,9 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
- (BOOL) drawRepresentation: (NSImageRep *)imageRep inRect: (NSRect)aRect - (BOOL) drawRepresentation: (NSImageRep *)imageRep inRect: (NSRect)aRect
{ {
BOOL r; BOOL r;
NSGraphicsContext *ctxt = GSCurrentContext();
PSgsave(); DPSgsave(ctxt);
if (_color != nil) if (_color != nil)
{ {
@ -885,7 +886,7 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
else else
r = [imageRep drawInRect: aRect]; r = [imageRep drawInRect: aRect];
PSgrestore(); DPSgrestore(ctxt);
return r; return r;
} }
@ -1076,6 +1077,8 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
[_lockedView lockFocus]; [_lockedView lockFocus];
if (repd->bg == nil) if (repd->bg == nil)
{ {
NSRect fillrect = NSMakeRect(0, 0, _size.width, _size.height);
// Clear the background of the cached image, as it is not valid // Clear the background of the cached image, as it is not valid
if ([_color alphaComponent] < 1.0) if ([_color alphaComponent] < 1.0)
{ {
@ -1086,18 +1089,10 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
implemented correctly in all backends yet (as of implemented correctly in all backends yet (as of
2002-08-23). Also, this will work with both the Quartz- 2002-08-23). Also, this will work with both the Quartz-
and DPS-model.) */ and DPS-model.) */
PScompositerect(0, 0, _size.width, _size.height, NSRectFillUsingOperation(fillrect, NSCompositeClear);
NSCompositeClear);
} }
repd->bg = [_color copy]; repd->bg = [_color copy];
if (_color != nil)
{
// Won't be needed when drawRepresentation: gets called,
// but we never know.
[_color set];
NSRectFill(NSMakeRect(0, 0, _size.width, _size.height));
}
if ([repd->bg alphaComponent] == 1.0) if ([repd->bg alphaComponent] == 1.0)
{ {
@ -1108,6 +1103,9 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
[imageRep setOpaque: [repd->original isOpaque]]; [imageRep setOpaque: [repd->original isOpaque]];
} }
// Fill with background colour and draw repesentation
[self drawRepresentation: repd->original
inRect: fillrect];
} }
} }
} }
@ -1952,8 +1950,6 @@ iterate_reps_for_types(NSArray* imageReps, SEL method)
if (repd->bg == nil) if (repd->bg == nil)
{ {
[self lockFocusOnRepresentation: cache]; [self lockFocusOnRepresentation: cache];
[self drawRepresentation: repd->original
inRect: [cache rect]];
[self unlockFocus]; [self unlockFocus];
NSDebugLLog(@"NSImage", @"Rendered rep %p on background %@", NSDebugLLog(@"NSImage", @"Rendered rep %p on background %@",