mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 13:10:59 +00:00
Caching/opacity fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5355 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
718b2fd063
commit
91169ffc3c
2 changed files with 27 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Dec 2 6:07:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSImage.m: Use opacity values from image reps to cache more
|
||||
intelligently, and set the opacity of caches correctly.
|
||||
|
||||
Thu Dec 2 01:28:34 1999 Nicola Pero <n.pero@mi.flashnet.it>
|
||||
|
||||
* Headers/AppKit/NSTableHeaderView.h: Added copyright.
|
||||
|
|
|
@ -514,6 +514,7 @@ static Class cacheClass = 0;
|
|||
if (repd->bg != nil)
|
||||
{
|
||||
DESTROY(repd->bg);
|
||||
[repd->rep setOpaque: YES];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -603,7 +604,7 @@ static Class cacheClass = 0;
|
|||
|
||||
[self lockFocusOnRepresentation: rep];
|
||||
bounds = [_lockedView bounds];
|
||||
if (_color != nil && [_color isEqual: clearColor] == NO)
|
||||
if (_color != nil && [_color alphaComponent] != 0.0)
|
||||
{
|
||||
[_color set];
|
||||
NSEraseRect(bounds);
|
||||
|
@ -612,6 +613,14 @@ static Class cacheClass = 0;
|
|||
inRect: NSMakeRect(0, 0, _size.width, _size.height)];
|
||||
[self unlockFocus];
|
||||
repd->bg = _color ? [_color copy] : [clearColor copy];
|
||||
if ([repd->bg alphaComponent] == 1.0)
|
||||
{
|
||||
[rep setOpaque: YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
[rep setOpaque: [repd->original isOpaque]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -917,33 +926,40 @@ static Class cacheClass = 0;
|
|||
|
||||
if (validCache != nil)
|
||||
{
|
||||
if (NSImageForceCaching == NO)
|
||||
if (NSImageForceCaching == NO && [rep isOpaque] == NO)
|
||||
{
|
||||
/*
|
||||
* If the image rep has transparencey and we are drawing
|
||||
* If the image rep is not opaque and we are drawing
|
||||
* 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 alphaComponent] != 1.0)
|
||||
if ([validCache->bg alphaComponent] != 1.0)
|
||||
{
|
||||
DESTROY(validCache->bg);
|
||||
[validCache->rep setOpaque: YES];
|
||||
}
|
||||
}
|
||||
cacheRep = validCache->rep;
|
||||
}
|
||||
else if (partialCache != nil)
|
||||
{
|
||||
if (NSImageForceCaching == NO)
|
||||
if (NSImageForceCaching == NO && [rep isOpaque] == NO)
|
||||
{
|
||||
if (invalidCache != nil)
|
||||
{
|
||||
/*
|
||||
* If there is an unused cache - use it rather than
|
||||
* re-using this one, since we might get a request
|
||||
* to draw with this color again.
|
||||
*/
|
||||
partialCache = invalidCache;
|
||||
}
|
||||
else
|
||||
{
|
||||
DESTROY(validCache->bg);
|
||||
DESTROY(partialCache->bg);
|
||||
[partialCache->rep setOpaque: YES];
|
||||
}
|
||||
}
|
||||
cacheRep = partialCache->rep;
|
||||
|
|
Loading…
Reference in a new issue