From eaa105d1457e205c31eba262b5d25ab1e5313b0f Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Thu, 2 Feb 2023 14:00:48 +0100 Subject: [PATCH] cleanup GitOrigin-RevId: d48147477ca58d5d6019c9093a56199e9bde0136 --- .../com/intellij/openapi/util/CachedImageIcon.kt | 4 ---- .../com/intellij/openapi/util/ScaledIconCache.kt | 16 +++++++--------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/platform/util/ui/src/com/intellij/openapi/util/CachedImageIcon.kt b/platform/util/ui/src/com/intellij/openapi/util/CachedImageIcon.kt index bb730e86c3cc..b29d9283d415 100644 --- a/platform/util/ui/src/com/intellij/openapi/util/CachedImageIcon.kt +++ b/platform/util/ui/src/com/intellij/openapi/util/CachedImageIcon.kt @@ -11,7 +11,6 @@ import com.intellij.util.SVGLoader import com.intellij.util.ui.MultiResolutionImageProvider import com.intellij.util.ui.StartupUiUtil import org.jetbrains.annotations.ApiStatus -import org.jetbrains.annotations.TestOnly import java.awt.* import java.awt.image.BufferedImage import java.awt.image.ImageFilter @@ -107,9 +106,6 @@ open class CachedImageIcon protected constructor( @ApiStatus.Internal fun getRealIcon(): ImageIcon = getRealIcon(scaleContext = null) - @TestOnly - fun doGetRealIcon(): ImageIcon? = unwrapIcon(realIcon) - internal fun getRealIcon(scaleContext: ScaleContext?): ImageIcon { if (resolver == null || !isActivated) { return EMPTY_ICON diff --git a/platform/util/ui/src/com/intellij/openapi/util/ScaledIconCache.kt b/platform/util/ui/src/com/intellij/openapi/util/ScaledIconCache.kt index c36e49fa20c2..246b46f92e49 100644 --- a/platform/util/ui/src/com/intellij/openapi/util/ScaledIconCache.kt +++ b/platform/util/ui/src/com/intellij/openapi/util/ScaledIconCache.kt @@ -18,16 +18,14 @@ import java.util.* import javax.swing.Icon import javax.swing.ImageIcon +private const val SCALED_ICONS_CACHE_LIMIT = 5 + +private fun key(context: ScaleContext): Long { + return java.lang.Float.floatToIntBits(context.getScale(DerivedScaleType.EFF_USR_SCALE).toFloat()).toLong() shl 32 or + (java.lang.Float.floatToIntBits(context.getScale(ScaleType.SYS_SCALE).toFloat()).toLong() and 0xffffffffL) +} + internal class ScaledIconCache(private val host: CachedImageIcon) { - companion object { - private const val SCALED_ICONS_CACHE_LIMIT = 5 - - private fun key(context: ScaleContext): Long { - return java.lang.Float.floatToIntBits(context.getScale(DerivedScaleType.EFF_USR_SCALE).toFloat()).toLong() shl 32 or - (java.lang.Float.floatToIntBits(context.getScale(ScaleType.SYS_SCALE).toFloat()).toLong() and 0xffffffffL) - } - } - private val cache = Collections.synchronizedMap(FixedHashMap>(SCALED_ICONS_CACHE_LIMIT)) /**