aboutsummaryrefslogtreecommitdiffstats
path: root/common/rfb/Rect.h
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2023-01-06 15:31:24 +0100
committerPierre Ossman <ossman@cendio.se>2023-02-04 14:03:13 +0100
commitf55abd7b0074bc6db9774ed563e02b11e634aa7d (patch)
tree4e84caf8a93212f64e4fc875a99585d7a1fd6c87 /common/rfb/Rect.h
parent9854463f16a3b98c55494e40f909d3b1f5f39192 (diff)
downloadtigervnc-f55abd7b0074bc6db9774ed563e02b11e634aa7d.tar.gz
tigervnc-f55abd7b0074bc6db9774ed563e02b11e634aa7d.zip
Use operator overloading for comparison
It is much more natural than custom methods for this very common operation.
Diffstat (limited to 'common/rfb/Rect.h')
-rw-r--r--common/rfb/Rect.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/common/rfb/Rect.h b/common/rfb/Rect.h
index bd9b160a..b82ed274 100644
--- a/common/rfb/Rect.h
+++ b/common/rfb/Rect.h
@@ -50,7 +50,8 @@ namespace rfb {
inline Point negate() const
__attribute__ ((warn_unused_result))
{return Point(-x, -y);}
- inline bool equals(const Point &p) const {return x==p.x && y==p.y;}
+ inline bool operator==(const Point &p) const {return x==p.x && y==p.y;}
+ inline bool operator!=(const Point &p) const {return x!=p.x || y!=p.y;}
inline Point translate(const Point &p) const
__attribute__ ((warn_unused_result))
{return Point(x+p.x, y+p.y);}
@@ -105,7 +106,8 @@ namespace rfb {
{
return Rect(tl.translate(p), br.translate(p));
}
- inline bool equals(const Rect &r) const {return r.tl.equals(tl) && r.br.equals(br);}
+ inline bool operator==(const Rect &r) const {return r.tl == tl && r.br == br;}
+ inline bool operator!=(const Rect &r) const {return r.tl != tl || r.br != br;}
inline bool is_empty() const {return (tl.x >= br.x) || (tl.y >= br.y);}
inline void clear() {tl = Point(); br = Point();}
inline bool enclosed_by(const Rect &r) const {