From 8f2c482167bc4f80f7f8257f725d70da669dff5c Mon Sep 17 00:00:00 2001 From: Harald Kuhr Date: Thu, 3 Jun 2021 18:21:00 +0200 Subject: [PATCH] Minor code clean-up. --- .../com/twelvemonkeys/image/BufferedImageIcon.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/common/common-image/src/main/java/com/twelvemonkeys/image/BufferedImageIcon.java b/common/common-image/src/main/java/com/twelvemonkeys/image/BufferedImageIcon.java index 27104fea..a85827e4 100755 --- a/common/common-image/src/main/java/com/twelvemonkeys/image/BufferedImageIcon.java +++ b/common/common-image/src/main/java/com/twelvemonkeys/image/BufferedImageIcon.java @@ -45,8 +45,8 @@ import java.awt.image.BufferedImage; */ public class BufferedImageIcon implements Icon { private final BufferedImage image; - private int width; - private int height; + private final int width; + private final int height; private final boolean fast; public BufferedImageIcon(BufferedImage pImage) { @@ -81,11 +81,10 @@ public class BufferedImageIcon implements Icon { else { //System.out.println("Scaling using interpolation"); Graphics2D g2 = (Graphics2D) g; - AffineTransform xform = AffineTransform.getTranslateInstance(x, y); - xform.scale(width / (double) image.getWidth(), height / (double) image.getHeight()); - g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, - RenderingHints.VALUE_INTERPOLATION_BILINEAR); - g2.drawImage(image, xform, null); + AffineTransform transform = AffineTransform.getTranslateInstance(x, y); + transform.scale(width / (double) image.getWidth(), height / (double) image.getHeight()); + g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR); + g2.drawImage(image, transform, null); } } }