Skip to content

Commit

Permalink
Refactor computation
Browse files Browse the repository at this point in the history
  • Loading branch information
RoanH committed Aug 26, 2020
1 parent 5fbda66 commit a355d75
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions KeysPerSecond/src/me/roan/kps/panels/GraphPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
}
}
}
Expand Down

0 comments on commit a355d75

Please sign in to comment.