diff --git a/images/src/org/intellij/images/ui/ImageComponentUI.java b/images/src/org/intellij/images/ui/ImageComponentUI.java index ac21af849c25..621ad8389157 100644 --- a/images/src/org/intellij/images/ui/ImageComponentUI.java +++ b/images/src/org/intellij/images/ui/ImageComponentUI.java @@ -87,7 +87,7 @@ public class ImageComponentUI extends ComponentUI { int patternSize = 2 * cellSize; if (pattern == null) { - pattern = UIUtil.createImage((Graphics2D)g, patternSize, patternSize, BufferedImage.TYPE_INT_ARGB); + pattern = UIUtil.createImage(g, patternSize, patternSize, BufferedImage.TYPE_INT_ARGB); Graphics imageGraphics = pattern.getGraphics(); imageGraphics.setColor(ic.getTransparencyChessboardWhiteColor()); imageGraphics.fillRect(0, 0, patternSize, patternSize); diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/animation/ArrangementAnimationPanel.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/animation/ArrangementAnimationPanel.java index 88992ff141cf..2afef0d4d131 100644 --- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/animation/ArrangementAnimationPanel.java +++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/animation/ArrangementAnimationPanel.java @@ -65,7 +65,7 @@ public class ArrangementAnimationPanel extends JPanel { //myContent.setDoubleBuffered(false); myContent.setBounds(0, 0, size.width, size.height); myContent.validate(); - myImage = UIUtil.createImage((Graphics2D)myContent.getGraphics(), size.width, size.height, BufferedImage.TYPE_INT_RGB); + myImage = UIUtil.createImage(myContent, size.width, size.height, BufferedImage.TYPE_INT_RGB); assert myImage != null; final Graphics2D graphics = myImage.createGraphics(); UISettings.setupAntialiasing(graphics); diff --git a/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java b/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java index 163a9753a1ad..a324f1d0e7b2 100644 --- a/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java +++ b/platform/platform-api/src/com/intellij/ide/wizard/AbstractWizard.java @@ -249,7 +249,7 @@ public abstract class AbstractWizard extends DialogWrapper { if (myIcon == null) { return; } - final BufferedImage image = UIUtil.createImage((Graphics2D)g, myIcon.getIconWidth(), myIcon.getIconHeight(), BufferedImage.TYPE_INT_ARGB); + final BufferedImage image = UIUtil.createImage(g, myIcon.getIconWidth(), myIcon.getIconHeight(), BufferedImage.TYPE_INT_ARGB); final Graphics2D gg = image.createGraphics(); myIcon.paintIcon(this, gg, 0, 0); diff --git a/platform/platform-api/src/com/intellij/openapi/ui/LoadingDecorator.java b/platform/platform-api/src/com/intellij/openapi/ui/LoadingDecorator.java index a8a9b8159b58..66b4846c2141 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/LoadingDecorator.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/LoadingDecorator.java @@ -173,7 +173,7 @@ public class LoadingDecorator { myCurrentAlpha = -1; if (takeSnapshot && getWidth() > 0 && getHeight() > 0) { - mySnapshot = UIUtil.createImage((Graphics2D)getGraphics(), getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB); + mySnapshot = UIUtil.createImage(getGraphics(), getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB); final Graphics2D g = mySnapshot.createGraphics(); myPane.paint(g); final Component opaque = UIUtil.findNearestOpaque(this); diff --git a/platform/platform-api/src/com/intellij/ui/components/ZoomingDelegate.java b/platform/platform-api/src/com/intellij/ui/components/ZoomingDelegate.java index 81e961e7d831..80218ac1dd0d 100644 --- a/platform/platform-api/src/com/intellij/ui/components/ZoomingDelegate.java +++ b/platform/platform-api/src/com/intellij/ui/components/ZoomingDelegate.java @@ -111,7 +111,7 @@ public class ZoomingDelegate { if (myCachedImage == null) { Rectangle bounds = myViewportComponent.getBounds(); - BufferedImage image = UIUtil.createImage((Graphics2D)myViewportComponent.getGraphics(), bounds.width, bounds.height, BufferedImage.TYPE_INT_RGB); + BufferedImage image = UIUtil.createImage(myViewportComponent.getGraphics(), bounds.width, bounds.height, BufferedImage.TYPE_INT_RGB); Graphics graphics = image.getGraphics(); graphics.setClip(0, 0, bounds.width, bounds.height); diff --git a/platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java b/platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java index 6f11082dd7e0..28d4ce35d008 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/impl/JBTabsImpl.java @@ -392,12 +392,12 @@ public class JBTabsImpl extends JComponent if (cmp.isShowing()) { final int width = cmp.getWidth(); final int height = cmp.getHeight(); - img = UIUtil.createImage((Graphics2D)info.getComponent().getGraphics(), width > 0 ? width : 500, height > 0 ? height : 500, BufferedImage.TYPE_INT_ARGB); + img = UIUtil.createImage(info.getComponent(), width > 0 ? width : 500, height > 0 ? height : 500, BufferedImage.TYPE_INT_ARGB); Graphics2D g = img.createGraphics(); cmp.paint(g); } else { - img = UIUtil.createImage((Graphics2D)info.getComponent().getGraphics(), 500, 500, BufferedImage.TYPE_INT_ARGB); + img = UIUtil.createImage(info.getComponent(), 500, 500, BufferedImage.TYPE_INT_ARGB); } return img; } @@ -1370,7 +1370,7 @@ public class JBTabsImpl extends JComponent if (blocked && !myPaintBlocked) { if (takeSnapshot) { if (getWidth() > 0 && getHeight() > 0) { - myImage = UIUtil.createImage((Graphics2D)getGraphics(), getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB); + myImage = UIUtil.createImage(this, getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB); final Graphics2D g = myImage.createGraphics(); super.paint(g); g.dispose(); @@ -3283,7 +3283,7 @@ public class JBTabsImpl extends JComponent Dimension size = label.getPreferredSize(); label.setBounds(0, 0, size.width, size.height); - BufferedImage img = UIUtil.createImage((Graphics2D)getGraphics(), size.width, size.height, BufferedImage.TYPE_INT_ARGB); + BufferedImage img = UIUtil.createImage(this, size.width, size.height, BufferedImage.TYPE_INT_ARGB); Graphics2D g = img.createGraphics(); label.paintOffscreen(g); g.dispose(); diff --git a/platform/platform-api/src/com/intellij/util/ui/FadeInFadeOut.java b/platform/platform-api/src/com/intellij/util/ui/FadeInFadeOut.java index 8e274991f858..5c68df0c1e00 100644 --- a/platform/platform-api/src/com/intellij/util/ui/FadeInFadeOut.java +++ b/platform/platform-api/src/com/intellij/util/ui/FadeInFadeOut.java @@ -54,7 +54,7 @@ public class FadeInFadeOut extends JComponent { myRatio = myFadeIn ? 0 : 1; myIcon = icon; - myComponentImage = UIUtil.createImage((Graphics2D)myComponent.getGraphics(), myComponent.getWidth(), myComponent.getHeight(), BufferedImage.TYPE_INT_ARGB); + myComponentImage = UIUtil.createImage(myComponent, myComponent.getWidth(), myComponent.getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D graphics = myComponentImage.createGraphics(); myComponent.paint(graphics); graphics.dispose(); diff --git a/platform/platform-impl/src/com/intellij/codeInsight/hint/EditorFragmentComponent.java b/platform/platform-impl/src/com/intellij/codeInsight/hint/EditorFragmentComponent.java index 75fff2f69b4e..269b9f3aaab7 100644 --- a/platform/platform-impl/src/com/intellij/codeInsight/hint/EditorFragmentComponent.java +++ b/platform/platform-impl/src/com/intellij/codeInsight/hint/EditorFragmentComponent.java @@ -85,7 +85,7 @@ public class EditorFragmentComponent extends JPanel { editor.getScrollingModel().scrollHorizontally(0); } - final BufferedImage textImage = UIUtil.createImage((Graphics2D)getGraphics(), textImageWidth, textImageHeight, BufferedImage.TYPE_INT_RGB); + final BufferedImage textImage = UIUtil.createImage(this, textImageWidth, textImageHeight, BufferedImage.TYPE_INT_RGB); Graphics textGraphics = textImage.getGraphics(); EditorUIUtil.setupAntialiasing(textGraphics); @@ -97,7 +97,7 @@ public class EditorFragmentComponent extends JPanel { rowHeader = editor.getGutterComponentEx(); markersImageWidth = Math.max(1, rowHeader.getWidth()); - markersImage = UIUtil.createImage((Graphics2D)editor.getComponent().getGraphics(), markersImageWidth, textImageHeight, BufferedImage.TYPE_INT_RGB); + markersImage = UIUtil.createImage(editor.getComponent(), markersImageWidth, textImageHeight, BufferedImage.TYPE_INT_RGB); Graphics markerGraphics = markersImage.getGraphics(); EditorUIUtil.setupAntialiasing(markerGraphics); diff --git a/platform/platform-impl/src/com/intellij/ide/dnd/aware/DnDAwareTree.java b/platform/platform-impl/src/com/intellij/ide/dnd/aware/DnDAwareTree.java index affb883c8a83..80cb331108e5 100644 --- a/platform/platform-impl/src/com/intellij/ide/dnd/aware/DnDAwareTree.java +++ b/platform/platform-impl/src/com/intellij/ide/dnd/aware/DnDAwareTree.java @@ -108,7 +108,7 @@ public class DnDAwareTree extends Tree implements DnDAware { c.setBackground(tree.getBackground()); c.setFont(tree.getFont()); c.setSize(c.getPreferredSize()); - final BufferedImage image = UIUtil.createImage((Graphics2D)c.getGraphics(), c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_ARGB); + final BufferedImage image = UIUtil.createImage(c, c.getWidth(), c.getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = (Graphics2D)image.getGraphics(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f)); c.paint(g2); diff --git a/platform/platform-impl/src/com/intellij/ide/ui/ColorBlindnessInternalAction.java b/platform/platform-impl/src/com/intellij/ide/ui/ColorBlindnessInternalAction.java index 6a462d0c8f07..0ee2e1186f55 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/ColorBlindnessInternalAction.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/ColorBlindnessInternalAction.java @@ -235,7 +235,7 @@ public class ColorBlindnessInternalAction extends DumbAwareAction { array[i] = Color.HSBtoRGB(w / width, saturation, brightness); } } - BufferedImage image = UIUtil.createImage((Graphics2D)g, bounds.width, bounds.height, BufferedImage.TYPE_INT_RGB); + BufferedImage image = UIUtil.createImage(g, bounds.width, bounds.height, BufferedImage.TYPE_INT_RGB); image.setRGB(0, 0, bounds.width, bounds.height, array, 0, bounds.width); myImage = ImageUtil.filter(image, myFilter); } diff --git a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java index ddc05c6a26b0..14567dc6555c 100644 --- a/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/editor/impl/EditorMarkupModelImpl.java @@ -636,7 +636,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark Rectangle componentBounds = c.getBounds(); ProperTextRange docRange = ProperTextRange.create(0, componentBounds.height); if (myCachedTrack == null || myCachedHeight != componentBounds.height) { - myCachedTrack = UIUtil.createImage((Graphics2D)c.getGraphics(), componentBounds.width, componentBounds.height, BufferedImage.TYPE_INT_ARGB); + myCachedTrack = UIUtil.createImage(c, componentBounds.width, componentBounds.height, BufferedImage.TYPE_INT_ARGB); myCachedHeight = componentBounds.height; myDirtyYPositions = docRange; dimensionsAreValid = false; @@ -1218,7 +1218,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark myCacheStartLine = fitLineToEditor(myVisualLine - myCachePreviewLines); myCacheEndLine = fitLineToEditor(myCacheStartLine + 2 * myCachePreviewLines + 1); if (myCacheLevel2 == null) { - myCacheLevel2 = UIUtil.createImage((Graphics2D)g, size.width, myEditor.getLineHeight() * (2 * myCachePreviewLines + 1), BufferedImage.TYPE_INT_RGB); + myCacheLevel2 = UIUtil.createImage(g, size.width, myEditor.getLineHeight() * (2 * myCachePreviewLines + 1), BufferedImage.TYPE_INT_RGB); } Graphics2D cg = myCacheLevel2.createGraphics(); final AffineTransform t = cg.getTransform(); @@ -1247,7 +1247,7 @@ public class EditorMarkupModelImpl extends MarkupModelImpl implements EditorMark } if (myCacheLevel1 == null) { - myCacheLevel1 = UIUtil.createImage((Graphics2D)g, size.width, myEditor.getLineHeight() * (2 * myPreviewLines + 1), BufferedImage.TYPE_INT_RGB); + myCacheLevel1 = UIUtil.createImage(g, size.width, myEditor.getLineHeight() * (2 * myPreviewLines + 1), BufferedImage.TYPE_INT_RGB); isDirty = true; } if (isDirty) { diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/Stripe.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/Stripe.java index 3d6c13ae93ec..465d873fb586 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/Stripe.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/Stripe.java @@ -509,7 +509,7 @@ final class Stripe extends JPanel implements UISettingsListener { public void processDropButton(final StripeButton button, JComponent buttonImage, Point screenPoint) { if (!isDroppingButton()) { - final BufferedImage image = UIUtil.createImage((Graphics2D)button.getGraphics(), button.getWidth(), button.getHeight(), BufferedImage.TYPE_INT_RGB); + final BufferedImage image = UIUtil.createImage(button, button.getWidth(), button.getHeight(), BufferedImage.TYPE_INT_RGB); buttonImage.paint(image.getGraphics()); myDragButton = button; myDragButtonImage = buttonImage; diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/StripeButton.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/StripeButton.java index 76b85ba82941..f6ad010cb4cc 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/StripeButton.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/StripeButton.java @@ -186,7 +186,7 @@ public final class StripeButton extends AnchoredButton implements ActionListener if (myDragPane == null) return; int width = getWidth() - 1; // -1 because StripeButtonUI.paint will not paint 1 pixel in case (anchor == ToolWindowAnchor.LEFT) int height = getHeight() - 1; // -1 because StripeButtonUI.paint will not paint 1 pixel in case (anchor.isHorizontal()) - BufferedImage image = UIUtil.createImage((Graphics2D)e.getComponent().getGraphics(), width, height, BufferedImage.TYPE_INT_RGB); + BufferedImage image = UIUtil.createImage(e.getComponent(), width, height, BufferedImage.TYPE_INT_RGB); Graphics graphics = image.getGraphics(); graphics.setColor(UIUtil.getBgFillColor(getParent())); graphics.fillRect(0, 0, width, height); diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowsPane.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowsPane.java index c306b610ff50..927c83aa3ecb 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowsPane.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowsPane.java @@ -1264,7 +1264,7 @@ public final class ToolWindowsPane extends JBLayeredPane implements UISettingsLi // is MUCH faster. // On Mac we create a retina-compatible image - image = UIUtil.createImage((Graphics2D)getGraphics(), width, height, BufferedImage.TYPE_INT_RGB); + image = UIUtil.createImage(getGraphics(), width, height, BufferedImage.TYPE_INT_RGB); } imageRef = new SoftReference<>(image); } diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/MemoryUsagePanel.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/MemoryUsagePanel.java index a42ed21bd0bc..2bf088109fa9 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/MemoryUsagePanel.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/status/MemoryUsagePanel.java @@ -141,7 +141,7 @@ public class MemoryUsagePanel extends JButton implements CustomStatusBarWidget { final Dimension size = getSize(); final Insets insets = getInsets(); - myBufferedImage = UIUtil.createImage((Graphics2D)g, size.width, size.height, BufferedImage.TYPE_INT_ARGB); + myBufferedImage = UIUtil.createImage(g, size.width, size.height, BufferedImage.TYPE_INT_ARGB); final Graphics2D g2 = (Graphics2D)myBufferedImage.getGraphics().create(); final Runtime rt = Runtime.getRuntime(); diff --git a/platform/platform-impl/src/com/intellij/ui/AbstractExpandableItemsHandler.java b/platform/platform-impl/src/com/intellij/ui/AbstractExpandableItemsHandler.java index a00069f92d8d..d08e5a42bd3f 100644 --- a/platform/platform-impl/src/com/intellij/ui/AbstractExpandableItemsHandler.java +++ b/platform/platform-impl/src/com/intellij/ui/AbstractExpandableItemsHandler.java @@ -358,7 +358,7 @@ public abstract class AbstractExpandableItemsHandler key = Key.create(name()); } /** @@ -703,11 +707,15 @@ public class JBUI { // ScaleType.USR - tracked // ScaleType.SYS - tracked // ScaleType.PIX - derived - Map myTrackedJBUIScale = new HashMap(); + KeyFMap myTrackedJBUIScale = KeyFMap.EMPTY_MAP; - JBUIScaleTracker() { - myTrackedJBUIScale.put(ScaleType.USR, JBIcon.currentJBUIScale()); - myTrackedJBUIScale.put(ScaleType.SYS, sysScale()); + { + put(ScaleType.USR.key, JBIcon.currentJBUIScale()); + put(ScaleType.SYS.key, sysScale()); + } + + private void put(Key key, Float value) { + myTrackedJBUIScale = myTrackedJBUIScale.plus(key, value); } @Override @@ -717,7 +725,7 @@ public class JBUI { private boolean updateJBUIScale(float scale, ScaleType type) { if (needUpdateJBUIScale(scale, type)) { - myTrackedJBUIScale.put(type, scale); + put(type.key, scale); return true; } return false; @@ -746,10 +754,9 @@ public class JBUI { @Override public float getJBUIScale(ScaleType type) { - if (type == ScaleType.PIX) { - return pixScale(this); // derive - } - return myTrackedJBUIScale.get(type); + return type == ScaleType.PIX ? + pixScale(this) : // derive + myTrackedJBUIScale.get(type.key); } } diff --git a/platform/util/src/com/intellij/util/ui/UIUtil.java b/platform/util/src/com/intellij/util/ui/UIUtil.java index 7f44700a5f97..6730a4d6e94c 100644 --- a/platform/util/src/com/intellij/util/ui/UIUtil.java +++ b/platform/util/src/com/intellij/util/ui/UIUtil.java @@ -356,14 +356,15 @@ public class UIUtil { } private static Boolean jdkManagedHiDPI; - private static Method isUIScaleOnMethod; /** * Returns whether the JDK-managed HiDPI mode is enabled. * (True for macOS JDK >= 7.10 versions) */ public static boolean isJDKManagedHiDPI() { - if (jdkManagedHiDPI != null) return jdkManagedHiDPI; + if (jdkManagedHiDPI != null) { + return jdkManagedHiDPI; + } if (SystemInfo.isMac) { return jdkManagedHiDPI = (SystemInfo.isAppleJvm ? false : true); } @@ -371,8 +372,8 @@ public class UIUtil { try { GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); if (ge instanceof SunGraphicsEnvironment) { - isUIScaleOnMethod = ReflectionUtil.getDeclaredMethod(SunGraphicsEnvironment.class, "isUIScaleOn"); - jdkManagedHiDPI = (Boolean)isUIScaleOnMethod.invoke(ge); + Method m = ReflectionUtil.getDeclaredMethod(SunGraphicsEnvironment.class, "isUIScaleOn"); + jdkManagedHiDPI = (Boolean)m.invoke(ge); } } catch (Throwable ignore) { } @@ -1886,9 +1887,9 @@ public class UIUtil { } /** - * Creates a HiDPI-aware BufferedImage in the graphics scale. + * Creates a HiDPI-aware BufferedImage in the graphics device scale. * - * @param g the graphics of the referent scale + * @param g the graphics of the target device * @param width the width in user coordinate space * @param height the height in user coordinate space * @param type the type of the image @@ -1896,16 +1897,36 @@ public class UIUtil { * @return a HiDPI-aware BufferedImage in the graphics scale */ @NotNull - public static BufferedImage createImage(Graphics2D g, int width, int height, int type) { - if (isJDKManagedHiDPIScreen(g)) { - return RetinaImage.create(g, width, height, type); + public static BufferedImage createImage(Graphics g, int width, int height, int type) { + if (g instanceof Graphics2D) { + Graphics2D g2d = (Graphics2D)g; + if (isJDKManagedHiDPIScreen(g2d)) { + return RetinaImage.create(g2d, width, height, type); + } } //noinspection UndesirableClassUsage return new BufferedImage(width, height, type); } /** - * Same as {@link #createImage(Graphics2D, int, int, int)}. + * Creates a HiDPI-aware BufferedImage in the component scale. + * + * @param comp the component associated with the target graphics device + * @param width the width in user coordinate space + * @param height the height in user coordinate space + * @param type the type of the image + * + * @return a HiDPI-aware BufferedImage in the component scale + */ + @NotNull + public static BufferedImage createImage(Component comp, int width, int height, int type) { + return comp != null ? + createImage(comp.getGraphics(), width, height, type) : + createImage(width, height, type); + } + + /** + * @deprecated use {@link #createImage(Graphics2D, int, int, int)} */ @NotNull public static BufferedImage createImageForGraphics(Graphics2D g, int width, int height, int type) { @@ -3762,7 +3783,7 @@ public class UIUtil { } public static Image getDebugImage(Component component) { - BufferedImage image = createImage((Graphics2D)component.getGraphics(), component.getWidth(), component.getHeight(), BufferedImage.TYPE_INT_ARGB); + BufferedImage image = createImage(component, component.getWidth(), component.getHeight(), BufferedImage.TYPE_INT_ARGB); Graphics2D graphics = image.createGraphics(); graphics.setColor(Color.RED); graphics.fillRect(0, 0, component.getWidth() + 1, component.getHeight() + 1); diff --git a/plugins/terminal/src/org/jetbrains/plugins/terminal/JBTerminalPanel.java b/plugins/terminal/src/org/jetbrains/plugins/terminal/JBTerminalPanel.java index 56e9c02013c1..2ece3599baf8 100644 --- a/plugins/terminal/src/org/jetbrains/plugins/terminal/JBTerminalPanel.java +++ b/plugins/terminal/src/org/jetbrains/plugins/terminal/JBTerminalPanel.java @@ -241,7 +241,7 @@ public class JBTerminalPanel extends TerminalPanel implements FocusListener, Ter @Override protected BufferedImage createBufferedImage(int width, int height) { - return UIUtil.createImage((Graphics2D)getGraphics(), width, height, BufferedImage.TYPE_INT_ARGB); + return UIUtil.createImage(this, width, height, BufferedImage.TYPE_INT_ARGB); }