mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 21:50:46 +00:00
[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:
parent
fb3ae66b51
commit
dd2c17aa3b
1 changed files with 12 additions and 7 deletions
|
@ -488,9 +488,14 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
||||||
|
|
||||||
- (void) setSize: (NSSize)aSize
|
- (void) setSize: (NSSize)aSize
|
||||||
{
|
{
|
||||||
|
// Optimized as this is called very often from NSImageCell
|
||||||
|
if (NSEqualSizes(_size, aSize))
|
||||||
|
return;
|
||||||
|
|
||||||
_size = aSize;
|
_size = aSize;
|
||||||
_flags.sizeWasExplicitlySet = YES;
|
_flags.sizeWasExplicitlySet = YES;
|
||||||
// TODO: This invalidates any cached data
|
|
||||||
|
[self recache];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSSize) size
|
- (NSSize) size
|
||||||
|
@ -603,17 +608,15 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
||||||
{
|
{
|
||||||
unsigned i, count;
|
unsigned i, count;
|
||||||
|
|
||||||
// FIXME: Not sure if this is correct
|
i = [_reps count];
|
||||||
count = [_reps count];
|
while(i--)
|
||||||
for (i = 0; i < count; i++)
|
|
||||||
{
|
{
|
||||||
GSRepData *repd;
|
GSRepData *repd;
|
||||||
|
|
||||||
repd = (GSRepData*)[_reps objectAtIndex: i];
|
repd = (GSRepData*)[_reps objectAtIndex: i];
|
||||||
if (repd->bg != nil)
|
if (repd->original != nil)
|
||||||
{
|
{
|
||||||
DESTROY(repd->bg);
|
[_reps removeObjectAtIndex: i];
|
||||||
[repd->rep setOpaque: YES];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -675,6 +678,8 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
||||||
if ([[ctxt focusView] isFlipped])
|
if ([[ctxt focusView] isFlipped])
|
||||||
y -= rect.size.height;
|
y -= rect.size.height;
|
||||||
|
|
||||||
|
NSDebugLLog(@"NSImage", @"composite rect %@ in %@",
|
||||||
|
NSStringFromRect(rect), NSStringFromRect(aRect));
|
||||||
// Move the drawing rectangle to the origin of the image rep
|
// Move the drawing rectangle to the origin of the image rep
|
||||||
// and intersect the two rects.
|
// and intersect the two rects.
|
||||||
aRect.origin.x += rect.origin.x;
|
aRect.origin.x += rect.origin.x;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue