mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 18:11:06 +00:00
Tidied image cache stuff
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5347 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4543336546
commit
652cb43876
3 changed files with 21 additions and 11 deletions
|
@ -1,5 +1,6 @@
|
|||
Wed Dec 1 14:55:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSColor.m: Fixed a few transparency bugs in system colors.
|
||||
* Source/NSImage.m: Caching rewrite - using NSCachedImageRep - works
|
||||
with xgps, but probably not xdps. There are two global variables to
|
||||
control this -
|
||||
|
|
|
@ -49,7 +49,7 @@ NSString *NSSystemColorsDidChangeNotification =
|
|||
|
||||
// Class variables
|
||||
static BOOL gnustep_gui_ignores_alpha = YES;
|
||||
static NSColorList *systemColors = nil;
|
||||
static NSColorList *systemColors = nil;
|
||||
static NSMutableDictionary *colorStrings = nil;
|
||||
|
||||
//
|
||||
|
@ -659,7 +659,7 @@ static NSMutableDictionary *colorStrings = nil;
|
|||
* consisting of the three componets values in a quoted string.
|
||||
*/
|
||||
if ([colorspace_name isEqualToString: NSCalibratedRGBColorSpace] &&
|
||||
alpha_component == 0)
|
||||
alpha_component == 1.0)
|
||||
return [NSString stringWithFormat: @"\"%f %f %f\"",
|
||||
RGB_component.red, RGB_component.green, RGB_component.blue];
|
||||
|
||||
|
@ -1005,7 +1005,7 @@ static NSMutableDictionary *colorStrings = nil;
|
|||
return [NSColor colorWithCalibratedRed: red
|
||||
green: green
|
||||
blue: blue
|
||||
alpha: 0];
|
||||
alpha: 1.0];
|
||||
}
|
||||
|
||||
- (NSColor*) colorWithAlphaComponent: (float)alpha
|
||||
|
@ -1168,6 +1168,7 @@ static NSMutableDictionary *colorStrings = nil;
|
|||
{
|
||||
NSDictionary *dict;
|
||||
NSString *space;
|
||||
NSString *str;
|
||||
float alpha;
|
||||
|
||||
dict = [str propertyList];
|
||||
|
@ -1176,7 +1177,15 @@ static NSMutableDictionary *colorStrings = nil;
|
|||
if ((space = [dict objectForKey: @"ColorSpace"]) == nil)
|
||||
return nil;
|
||||
|
||||
alpha = [[dict objectForKey: @"Alpha"] floatValue];
|
||||
str = [dict objectForKey: @"Alpha"];
|
||||
if (str == nil || [str isEqualToString: @""])
|
||||
{
|
||||
alpha = 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
alpha = [str floatValue];
|
||||
}
|
||||
|
||||
if ([space isEqual: NSCalibratedWhiteColorSpace])
|
||||
{
|
||||
|
@ -1247,7 +1256,7 @@ static NSMutableDictionary *colorStrings = nil;
|
|||
return [self colorWithCalibratedRed: r
|
||||
green: g
|
||||
blue: b
|
||||
alpha: 0];
|
||||
alpha: 1.0];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
@ -1273,7 +1282,7 @@ static NSMutableDictionary *colorStrings = nil;
|
|||
}
|
||||
|
||||
/*
|
||||
* Go through all the names of ssystem colors - for each color where
|
||||
* Go through all the names of system colors - for each color where
|
||||
* there is a value in the defaults database, see if the current
|
||||
* istring value of the color differs from the old one.
|
||||
* Where there is a difference, update the color strings dictionary
|
||||
|
|
|
@ -916,12 +916,12 @@ static Class cacheClass = 0;
|
|||
{
|
||||
/*
|
||||
* If the image rep has transparencey and we are drawing
|
||||
* without a background (background is clear) then the
|
||||
* cache can't really be valid 'cos we might be drawing
|
||||
* transparency on top of anything. So we invalidate
|
||||
* the cache by removing the background color information.
|
||||
* without an opaque background then the cache can't
|
||||
* really be valid 'cos we might be drawing transparency
|
||||
* on top of anything. So we invalidate the cache by
|
||||
* removing the background color information.
|
||||
*/
|
||||
if ([rep hasAlpha] && [validCache->bg isEqual: clearColor])
|
||||
if ([rep hasAlpha] && [validCache->bg alphaComponent] != 1.0)
|
||||
{
|
||||
DESTROY(validCache->bg);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue