From a88ce281ad0ed6d7f8d4ad484fd474d57cd4b8ad Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Fri, 28 Oct 2016 18:35:29 +0300 Subject: [PATCH] [followup] Add/refactor JBUI.JBIcon/ScalableJBIcon/ValidatingScalableJBIcon --- platform/core-api/src/com/intellij/ui/LayeredIcon.java | 4 ++-- platform/core-api/src/com/intellij/ui/RowIcon.java | 4 ++-- platform/platform-api/src/com/intellij/ui/SizedIcon.java | 6 +++--- platform/util/src/com/intellij/openapi/util/IconLoader.java | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/platform/core-api/src/com/intellij/ui/LayeredIcon.java b/platform/core-api/src/com/intellij/ui/LayeredIcon.java index 7e6d84fc18e4..3d83c52893b6 100644 --- a/platform/core-api/src/com/intellij/ui/LayeredIcon.java +++ b/platform/core-api/src/com/intellij/ui/LayeredIcon.java @@ -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; } diff --git a/platform/core-api/src/com/intellij/ui/RowIcon.java b/platform/core-api/src/com/intellij/ui/RowIcon.java index 173d3b847f3f..b853f2348d85 100644 --- a/platform/core-api/src/com/intellij/ui/RowIcon.java +++ b/platform/core-api/src/com/intellij/ui/RowIcon.java @@ -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; } diff --git a/platform/platform-api/src/com/intellij/ui/SizedIcon.java b/platform/platform-api/src/com/intellij/ui/SizedIcon.java index 3d8e176a983b..69907f6e6933 100644 --- a/platform/platform-api/src/com/intellij/ui/SizedIcon.java +++ b/platform/platform-api/src/com/intellij/ui/SizedIcon.java @@ -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; } diff --git a/platform/util/src/com/intellij/openapi/util/IconLoader.java b/platform/util/src/com/intellij/openapi/util/IconLoader.java index 2097900d4b02..e1f1a0e9b47f 100644 --- a/platform/util/src/com/intellij/openapi/util/IconLoader.java +++ b/platform/util/src/com/intellij/openapi/util/IconLoader.java @@ -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; }