From 203b3b9d4623355bec24546279a422867f48ecb5 Mon Sep 17 00:00:00 2001 From: OnlyBMan <27742182+OnlyBMan@users.noreply.github.com> Date: Sun, 15 Dec 2019 19:24:00 -0500 Subject: [PATCH] Update SkinProvider.java Instead of calling the scale method 3 times, just used a cached scaled image --- .../main/java/org/geysermc/connector/utils/SkinProvider.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/connector/src/main/java/org/geysermc/connector/utils/SkinProvider.java b/connector/src/main/java/org/geysermc/connector/utils/SkinProvider.java index 2b9d9a77b..07693de7d 100644 --- a/connector/src/main/java/org/geysermc/connector/utils/SkinProvider.java +++ b/connector/src/main/java/org/geysermc/connector/utils/SkinProvider.java @@ -162,6 +162,7 @@ public class SkinProvider { private static byte[] requestImage(String imageUrl, boolean cape) throws Exception { BufferedImage image = ImageIO.read(new URL(imageUrl)); + BufferedImage scale = scale(image); Geyser.getLogger().debug("Downloaded " + imageUrl); if (cape && image.getWidth() <= 64) { @@ -174,7 +175,7 @@ public class SkinProvider { else if(cape && image.getWidth() >= 64 && image.getWidth() <= 128) { BufferedImage newImage = new BufferedImage(64, 32, BufferedImage.TYPE_INT_RGB); Graphics g = newImage.createGraphics(); - g.drawImage(scale(image), 0, 0, scale(image).getWidth(), scale(image).getHeight(), null); + g.drawImage(scale, 0, 0, scale.getWidth(), scale.getHeight(), null); g.dispose(); image = newImage; }