[setSize:] recache representations if size changes.

[recache] throw old caches away as size may have changed.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@12778 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2002-02-26 14:37:55 +00:00
parent 7efdff1128
commit f11cd44c21

View file

@ -488,9 +488,14 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
- (void) setSize: (NSSize)aSize
{
// Optimized as this is called very often from NSImageCell
if (NSEqualSizes(_size, aSize))
return;
_size = aSize;
_flags.sizeWasExplicitlySet = YES;
// TODO: This invalidates any cached data
[self recache];
}
- (NSSize) size
@ -603,17 +608,15 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
{
unsigned i, count;
// FIXME: Not sure if this is correct
count = [_reps count];
for (i = 0; i < count; i++)
i = [_reps count];
while(i--)
{
GSRepData *repd;
repd = (GSRepData*)[_reps objectAtIndex: i];
if (repd->bg != nil)
if (repd->original != nil)
{
DESTROY(repd->bg);
[repd->rep setOpaque: YES];
[_reps removeObjectAtIndex: i];
}
}
}
@ -675,6 +678,8 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
if ([[ctxt focusView] isFlipped])
y -= rect.size.height;
NSDebugLLog(@"NSImage", @"composite rect %@ in %@",
NSStringFromRect(rect), NSStringFromRect(aRect));
// Move the drawing rectangle to the origin of the image rep
// and intersect the two rects.
aRect.origin.x += rect.origin.x;