From e9f8d5ff53ff7b8075e73ebf67feff6e655745c3 Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Wed, 5 Apr 2017 15:08:09 +0300 Subject: [PATCH] IDEA-170024 Checkboxes are broken --- .../ide/ui/laf/darcula/ui/DarculaCheckBoxUI.java | 2 +- platform/util/src/com/intellij/util/ui/EmptyIcon.java | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaCheckBoxUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaCheckBoxUI.java index 9194be86566a..458153ccd66e 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaCheckBoxUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaCheckBoxUI.java @@ -225,6 +225,6 @@ public class DarculaCheckBoxUI extends MetalCheckBoxUI { @Override public Icon getDefaultIcon() { - return JBUI.scale(EmptyIcon.create(20)).asUIResource(); + return EmptyIcon.create(JBUI.scale(20)).asUIResource(); } } diff --git a/platform/util/src/com/intellij/util/ui/EmptyIcon.java b/platform/util/src/com/intellij/util/ui/EmptyIcon.java index df750196011c..98d85dbcf353 100644 --- a/platform/util/src/com/intellij/util/ui/EmptyIcon.java +++ b/platform/util/src/com/intellij/util/ui/EmptyIcon.java @@ -17,6 +17,7 @@ package com.intellij.util.ui; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import javax.swing.plaf.UIResource; @@ -115,7 +116,7 @@ public class EmptyIcon extends JBUI.CachingScalableJBIcon { @Override public EmptyIcon withJBUIPreScaled(boolean preScaled) { if (myUseCache && isJBUIPreScaled() != preScaled) { - Integer key = key(width, height, isJBUIPreScaled()); + Integer key = key(width, height); if (key != null) cache.remove(key); // rather useless to keep it in cache return create(width, height, preScaled); } @@ -123,7 +124,7 @@ public class EmptyIcon extends JBUI.CachingScalableJBIcon { } private static EmptyIcon create(int width, int height, boolean preScaled) { - Integer key = key(width, height, preScaled); + Integer key = key(width, height); EmptyIcon icon = key != null ? cache.get(key) : null; if (icon == null) { icon = new EmptyIcon(width, height, true); @@ -133,8 +134,9 @@ public class EmptyIcon extends JBUI.CachingScalableJBIcon { return icon; } - private static Integer key(int width, int height, boolean preScaled) { - return width == height && width < 129 ? preScaled ? width : JBUI.scale(width) : null; + @Nullable + private static Integer key(int width, int height) { + return width == height && width < 129 ? width : null; } @Override