Skip to content

Commit

Permalink
Fix earlier optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
stirante committed Sep 25, 2020
1 parent 747ff6d commit 5f75f3c
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/main/java/com/stirante/runechanger/gui/overlay/RuneMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,11 @@ public class RuneMenu extends OverlayLayer {
private boolean warningVisible = true;
private float currentRuneMenuPosition = 0f;
private float scroll = 0f;
private int size = 0;

public RuneMenu(ClientOverlay overlay) {
super(overlay);
try {
int size = (int) (Constants.RUNE_BUTTON_SIZE * getHeight());
icon =
SwingUtils.getScaledImage(size, size, ImageIO.read(getClass().getResourceAsStream("/images/28.png")));
grayscaleIcon =
SwingUtils.getScaledImage(size, size, ImageIO.read(getClass().getResourceAsStream("/images/28grayscale.png")));
warnIcon =
SwingUtils.getScaledImage(32, 32, ImageIO.read(getClass().getResourceAsStream("/images/info-yellow.png")));
closeIcon =
Expand Down Expand Up @@ -82,6 +78,19 @@ public void setRuneData(ObservableList<RunePage> pages, Consumer<RunePage> runeS
}

private void drawRuneButton(Graphics2D g2d) {
int size = (int) (Constants.RUNE_BUTTON_SIZE * getHeight());
if (size != this.size) {
this.size = size;
try {
icon =
SwingUtils.getScaledImage(size, size, ImageIO.read(getClass().getResourceAsStream("/images/28.png")));
grayscaleIcon =
SwingUtils.getScaledImage(size, size, ImageIO.read(getClass().getResourceAsStream("/images/28grayscale.png")));
} catch (IOException e) {
log.error("Exception occurred while loading rune button icons", e);
AnalyticsUtil.addCrashReport(e, "Exception occurred while loading rune button icons", false);
}
}
int x = (int) ((getClientWidth()) * Constants.RUNE_BUTTON_POSITION_X);
int y = (int) (getHeight() * Constants.RUNE_BUTTON_POSITION_Y);
if (pages.size() > 0) {
Expand Down

0 comments on commit 5f75f3c

Please sign in to comment.