diff options
author | Brian Hinz <bphinz@users.sourceforge.net> | 2011-10-30 14:08:29 +0000 |
---|---|---|
committer | Brian Hinz <bphinz@users.sourceforge.net> | 2011-10-30 14:08:29 +0000 |
commit | ad78f752566d6cf699cf492641bae73e509e420b (patch) | |
tree | 96f9965954fe772f3c43b3bfc784f414f5b7de24 /java/com/tigervnc/rfb/Rect.java | |
parent | 1bb8b6c88e9add2771a56bfa56f4d9426d93edad (diff) | |
download | tigervnc-ad78f752566d6cf699cf492641bae73e509e420b.tar.gz tigervnc-ad78f752566d6cf699cf492641bae73e509e420b.zip |
massive performance improvements. zrle measured at 2.5x faster (no measurements for tight, but should be the same or better).
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4742 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'java/com/tigervnc/rfb/Rect.java')
-rw-r--r-- | java/com/tigervnc/rfb/Rect.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/java/com/tigervnc/rfb/Rect.java b/java/com/tigervnc/rfb/Rect.java index fab4f5dd..4aa69c14 100644 --- a/java/com/tigervnc/rfb/Rect.java +++ b/java/com/tigervnc/rfb/Rect.java @@ -76,7 +76,12 @@ public class Rect { public final boolean overlaps(Rect r) { return tl.x < r.br.x && tl.y < r.br.y && br.x > r.tl.x && br.y > r.tl.y; } - public final int area() {return is_empty() ? 0 : (br.x-tl.x)*(br.y-tl.y);} + public final int area() { + int area = (br.x-tl.x)*(br.y-tl.y); + if (area > 0) + return area; + return 0; + } public final Point dimensions() {return new Point(width(), height());} public final int width() {return br.x-tl.x;} public final int height() {return br.y-tl.y;} |