Skip to content

Commit

Permalink
Ensure that hotspot is not negative
Browse files Browse the repository at this point in the history
  • Loading branch information
bphinz committed Dec 24, 2024
1 parent 534de4a commit 11798d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions java/com/tigervnc/vncviewer/Viewport.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ public void setCursor(int width, int height, Point hotspot,
Graphics2D g2 = tmp.createGraphics();
g2.drawImage(cursor, 0, 0, cw, ch, 0, 0, width, height, null);
g2.dispose();
x = (int) Math.min(Math.floor((float) x * (float) cw / (float) width), cw - 1);
y = (int) Math.min(Math.floor((float) y * (float) ch / (float) height), ch - 1);
x = (int) Math.min(Math.floor((float) x * (float) cw / (float) width), Math.max(cw - 1, 0));
y = (int) Math.min(Math.floor((float) y * (float) ch / (float) height), Math.max(ch - 1, 0));
cursor = tmp;
}

Expand Down

0 comments on commit 11798d7

Please sign in to comment.