[followup] Add/refactor JBUI.JBIcon/ScalableJBIcon/ValidatingScalableJBIcon

This commit is contained in:
Anton Tarasov
2016-10-28 18:36:59 +03:00
parent 1f99e078e7
commit a88ce281ad
4 changed files with 10 additions and 10 deletions
@@ -271,9 +271,9 @@ public class LayeredIcon extends JBUI.AuxScalableJBIcon {
@Override
public Icon scale(float scale) {
if (scale == 1f) return this;
if (scale == getScale()) return this;
setScale(scaleVal(scale, Scale.ARBITRARY));
setScale(scale);
if (myScaledIcons != null) Arrays.fill(myScaledIcons, null);
return this;
}
@@ -57,9 +57,9 @@ public class RowIcon extends JBUI.AuxScalableJBIcon {
@Override
public Icon scale(float scale) {
if (scale == 1f) return this;
if (scale == getScale()) return this;
setScale(scaleVal(scale, Scale.ARBITRARY));
setScale(scale);
rescale();
return this;
}
@@ -58,11 +58,11 @@ public class SizedIcon extends JBUI.ScalableJBIcon {
@Override
public Icon scale(float scale) {
if (scale == 1f) return this;
if (scale == getScale()) return this;
if (myDelegate instanceof ScalableIcon) {
setScale(scaleVal(scale, Scale.ARBITRARY));
myScaledDelegate = ((ScalableIcon)myDelegate).scale(getScale());
setScale(scale);
myScaledDelegate = ((ScalableIcon)myDelegate).scale(scale);
}
return this;
}
@@ -580,12 +580,12 @@ public final class IconLoader {
@Override
public Icon scale(float scale) {
if (scale == 1f) return this;
if (scale == getScale()) return this;
getOrComputeIcon();
if (myIcon instanceof ScalableIcon) {
setScale(scaleVal(scale, Scale.ARBITRARY));
myIcon = ((ScalableIcon)myIcon).scale(getScale());
setScale(scale);
myIcon = ((ScalableIcon)myIcon).scale(scale);
}
return this;
}