From a355d757ea098a7afcf379267b5e7026da38fd58 Mon Sep 17 00:00:00 2001 From: Roan Hofland Date: Wed, 26 Aug 2020 18:42:20 +0200 Subject: [PATCH] Refactor computation --- KeysPerSecond/src/me/roan/kps/panels/GraphPanel.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KeysPerSecond/src/me/roan/kps/panels/GraphPanel.java b/KeysPerSecond/src/me/roan/kps/panels/GraphPanel.java index 20730cab..de2c566b 100644 --- a/KeysPerSecond/src/me/roan/kps/panels/GraphPanel.java +++ b/KeysPerSecond/src/me/roan/kps/panels/GraphPanel.java @@ -74,7 +74,7 @@ public void paintComponent(Graphics g1){ poly.addPoint(this.getWidth() - Main.config.borderOffset - RenderingMode.insideOffset - 2, this.getHeight() - Main.config.borderOffset - RenderingMode.insideOffset - 1); for(int i = 1; i <= values.size(); i++){ int px = (int)(Main.config.borderOffset + RenderingMode.insideOffset + ((double)(this.getWidth() - (Main.config.borderOffset + RenderingMode.insideOffset) * 2 - 2) / (double)(Main.config.backlog - 1)) * (Main.config.backlog - i)); - int py = (int)(this.getHeight() - Main.config.borderOffset - RenderingMode.insideOffset - 1 - ((float)(this.getHeight() - (Main.config.borderOffset + RenderingMode.insideOffset) * 2) * ((float)values.get(i - 1) / (float)maxval))); + int py = (int)(this.getHeight() - Main.config.borderOffset - RenderingMode.insideOffset - 1 - ((float)((this.getHeight() - (Main.config.borderOffset + RenderingMode.insideOffset) * 2) * values.get(i - 1)) / (float)maxval)); poly.addPoint(px, py); if(i == values.size()){ poly.addPoint(px, this.getHeight() - Main.config.borderOffset - RenderingMode.insideOffset - 1); @@ -103,7 +103,7 @@ public void paintComponent(Graphics g1){ }catch(NullPointerException e){ //catch but do not solve, this is caused by a race //condition. However adding synchronisation would impact - //performance more then it is worth + //performance more than it is worth } } }