diff --git a/ChangeLog b/ChangeLog index d07d4da79..da934e602 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-10-04 Eric Wasylishen + + * Source/NSColor.m: + * Source/NSColorWell.m: Move code to draw the black and white + triangles background for transparent colors to + -[NSColor drawSwatchInRect:]. + 2013-10-03 Eric Wasylishen * Headers/Additions/GNUstepGUI/GSTheme.h: diff --git a/Source/NSColor.m b/Source/NSColor.m index 847cb8893..38bc50ef2 100644 --- a/Source/NSColor.m +++ b/Source/NSColor.m @@ -40,6 +40,7 @@ #import #import +#import "AppKit/NSBezierPath.h" #import "AppKit/NSColor.h" #import "AppKit/NSColorList.h" #import "AppKit/NSColorSpace.h" @@ -1364,6 +1365,23 @@ systemColorWithName(NSString *name) // - (void) drawSwatchInRect: (NSRect)rect { + if ([self alphaComponent] < 1.0) + { + NSBezierPath *triangle = [NSBezierPath bezierPath]; + + [[NSColor whiteColor] set]; + NSRectFill(rect); + + [triangle moveToPoint: NSMakePoint(rect.origin.x, + rect.origin.y + rect.size.height)]; + [triangle lineToPoint: NSMakePoint(rect.origin.x + rect.size.width, + rect.origin.y + rect.size.height)]; + [triangle lineToPoint: rect.origin]; + [triangle closePath]; + [[NSColor blackColor] set]; + [triangle fill]; + } + [self set]; NSRectFill(rect); } diff --git a/Source/NSColorWell.m b/Source/NSColorWell.m index 48441324f..7c46fe9cb 100644 --- a/Source/NSColorWell.m +++ b/Source/NSColorWell.m @@ -197,22 +197,6 @@ static NSString *GSColorWellDidBecomeExclusiveNotification = { return; } - if ([_the_color alphaComponent] < 1.0) - { - NSBezierPath *triangle = [NSBezierPath bezierPath]; - - [[NSColor whiteColor] set]; - NSRectFill(insideRect); - - [triangle moveToPoint: NSMakePoint(insideRect.origin.x, - insideRect.origin.y + insideRect.size.height)]; - [triangle lineToPoint: NSMakePoint(insideRect.origin.x + insideRect.size.width, - insideRect.origin.y + insideRect.size.height)]; - [triangle lineToPoint: insideRect.origin]; - [triangle closePath]; - [[NSColor blackColor] set]; - [triangle fill]; - } [_the_color drawSwatchInRect: insideRect]; }