mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-131783 debugger: icon value is partly shown in variables view
This commit is contained in:
@@ -23,8 +23,8 @@ import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl;
|
||||
import com.intellij.debugger.ui.tree.ValueDescriptor;
|
||||
import com.intellij.debugger.ui.tree.render.CompoundReferenceRenderer;
|
||||
import com.intellij.debugger.ui.tree.render.DescriptorLabelListener;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
import com.intellij.util.IconUtil;
|
||||
import com.intellij.xdebugger.frame.XFullValueEvaluator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -52,11 +52,8 @@ class IconObjectRenderer extends CompoundReferenceRenderer implements FullValueE
|
||||
@Override
|
||||
public Icon calcValueIcon(ValueDescriptor descriptor, EvaluationContext evaluationContext, DescriptorLabelListener listener)
|
||||
throws EvaluateException {
|
||||
ImageIcon icon = ImageObjectRenderer.getIcon(evaluationContext, descriptor.getValue(), "iconToBytes");
|
||||
if (icon != null) {
|
||||
return IconUtil.cropIcon(icon, 16, 16);
|
||||
}
|
||||
return null;
|
||||
String getterName = AllIcons.Debugger.Value.getIconHeight() <= 16 ? "iconToBytesPreviewNormal" : "iconToBytesPreviewRetina";
|
||||
return ImageObjectRenderer.getIcon(evaluationContext, descriptor.getValue(), getterName);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -35,6 +35,21 @@ public class ImageSerializer {
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
public static byte[] iconToBytesPreview(Icon icon, int maxSize) throws IOException {
|
||||
if (icon.getIconHeight() <= maxSize && icon.getIconWidth() <= maxSize) {
|
||||
return imageToBytes(toImage(icon));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static byte[] iconToBytesPreviewNormal(Icon icon) throws IOException {
|
||||
return iconToBytesPreview(icon, 16);
|
||||
}
|
||||
|
||||
public static byte[] iconToBytesPreviewRetina(Icon icon) throws IOException {
|
||||
return iconToBytesPreview(icon, 32);
|
||||
}
|
||||
|
||||
public static byte[] iconToBytes(Icon icon) throws IOException {
|
||||
return imageToBytes(toImage(icon));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user