GitOrigin-RevId: d48147477ca58d5d6019c9093a56199e9bde0136
This commit is contained in:
Vladimir Krivosheev
2023-02-02 13:11:17 +00:00
committed by intellij-monorepo-bot
parent 2593954299
commit eaa105d145
2 changed files with 7 additions and 13 deletions
@@ -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
@@ -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<Long, SoftReference<ImageIcon>>(SCALED_ICONS_CACHE_LIMIT))
/**