Don't allow > 1f scaling if constructed with maxWidth/maxHeight.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1677 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray
2005-07-17 10:06:32 +00:00
parent abc8eaa5f0
commit 1275a870bf
@@ -39,8 +39,9 @@ public class ScaledIcon implements Icon
*/ */
public ScaledIcon (Icon icon, int maxWidth, int maxHeight) public ScaledIcon (Icon icon, int maxWidth, int maxHeight)
{ {
this(icon, Math.min(maxWidth / (float) icon.getIconWidth(), this(icon,
maxHeight / (float) icon.getIconHeight())); Math.min(1f, Math.min(maxWidth / (float) icon.getIconWidth(),
maxHeight / (float) icon.getIconHeight()));
} }
// documentation inherited from interface Icon // documentation inherited from interface Icon