mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 22:10:47 +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
4a59cceedd
commit
82b01db5b1
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>
|
Thu Dec 2 01:28:34 1999 Nicola Pero <n.pero@mi.flashnet.it>
|
||||||
|
|
||||||
* Headers/AppKit/NSTableHeaderView.h: Added copyright.
|
* Headers/AppKit/NSTableHeaderView.h: Added copyright.
|
||||||
|
|
|
@ -514,6 +514,7 @@ static Class cacheClass = 0;
|
||||||
if (repd->bg != nil)
|
if (repd->bg != nil)
|
||||||
{
|
{
|
||||||
DESTROY(repd->bg);
|
DESTROY(repd->bg);
|
||||||
|
[repd->rep setOpaque: YES];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -603,7 +604,7 @@ static Class cacheClass = 0;
|
||||||
|
|
||||||
[self lockFocusOnRepresentation: rep];
|
[self lockFocusOnRepresentation: rep];
|
||||||
bounds = [_lockedView bounds];
|
bounds = [_lockedView bounds];
|
||||||
if (_color != nil && [_color isEqual: clearColor] == NO)
|
if (_color != nil && [_color alphaComponent] != 0.0)
|
||||||
{
|
{
|
||||||
[_color set];
|
[_color set];
|
||||||
NSEraseRect(bounds);
|
NSEraseRect(bounds);
|
||||||
|
@ -612,6 +613,14 @@ static Class cacheClass = 0;
|
||||||
inRect: NSMakeRect(0, 0, _size.width, _size.height)];
|
inRect: NSMakeRect(0, 0, _size.width, _size.height)];
|
||||||
[self unlockFocus];
|
[self unlockFocus];
|
||||||
repd->bg = _color ? [_color copy] : [clearColor copy];
|
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 (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
|
* without an opaque background then the cache can't
|
||||||
* really be valid 'cos we might be drawing transparency
|
* really be valid 'cos we might be drawing transparency
|
||||||
* on top of anything. So we invalidate the cache by
|
* on top of anything. So we invalidate the cache by
|
||||||
* removing the background color information.
|
* removing the background color information.
|
||||||
*/
|
*/
|
||||||
if ([rep hasAlpha] && [validCache->bg alphaComponent] != 1.0)
|
if ([validCache->bg alphaComponent] != 1.0)
|
||||||
{
|
{
|
||||||
DESTROY(validCache->bg);
|
DESTROY(validCache->bg);
|
||||||
|
[validCache->rep setOpaque: YES];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cacheRep = validCache->rep;
|
cacheRep = validCache->rep;
|
||||||
}
|
}
|
||||||
else if (partialCache != nil)
|
else if (partialCache != nil)
|
||||||
{
|
{
|
||||||
if (NSImageForceCaching == NO)
|
if (NSImageForceCaching == NO && [rep isOpaque] == NO)
|
||||||
{
|
{
|
||||||
if (invalidCache != nil)
|
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;
|
partialCache = invalidCache;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DESTROY(validCache->bg);
|
DESTROY(partialCache->bg);
|
||||||
|
[partialCache->rep setOpaque: YES];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cacheRep = partialCache->rep;
|
cacheRep = partialCache->rep;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue