mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 10:01:14 +00:00
limit size of theme icon
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27805 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
96d993adde
commit
2c9b33a1a9
2 changed files with 18 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
2009-02-07 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSThemeTools.m: Add a few checks for tile sizes
|
||||
* Source/GSTheme.m: Limit icon size to 48x48
|
||||
|
||||
2009-02-06 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
|
|
|
@ -603,6 +603,23 @@ typedef struct {
|
|||
{
|
||||
_icon = RETAIN([NSImage imageNamed: @"GNUstep"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
NSSize s = [_icon size];
|
||||
float scale = 1.0;
|
||||
|
||||
if (s.height > 48.0)
|
||||
scale = 48.0 / s.height;
|
||||
if (48.0 / s.width < scale)
|
||||
scale = 48.0 / s.width;
|
||||
if (scale != 1.0)
|
||||
{
|
||||
[_icon setScalesWhenResized: YES];
|
||||
s.height *= scale;
|
||||
s.width *= scale;
|
||||
[_icon setSize: s];
|
||||
}
|
||||
}
|
||||
}
|
||||
return _icon;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue