struct Point {
Point() : x(0), y(0) {}
Point(int x_, int y_) : x(x_), y(y_) {}
- inline Point negate() const {return Point(-x, -y);}
+ 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 Point translate(const Point &p) const {return Point(x+p.x, y+p.y);}
- inline Point subtract(const Point &p) const {return Point(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);}
+ inline Point subtract(const Point &p) const
+ __attribute__ ((warn_unused_result))
+ {return Point(x-p.x, y-p.y);}
int x, y;
};
inline void setXYWH(int x, int y, int w, int h) {
tl.x = x; tl.y = y; br.x = x+w; br.y = y+h;
}
- inline Rect intersect(const Rect &r) const {
+ inline Rect intersect(const Rect &r) const
+ __attribute__ ((warn_unused_result))
+ {
Rect result;
result.tl.x = __rfbmax(tl.x, r.tl.x);
result.tl.y = __rfbmax(tl.y, r.tl.y);
result.br.y = __rfbmax(__rfbmin(br.y, r.br.y), result.tl.y);
return result;
}
- inline Rect union_boundary(const Rect &r) const {
+ inline Rect union_boundary(const Rect &r) const
+ __attribute__ ((warn_unused_result))
+ {
if (r.is_empty()) return *this;
if (is_empty()) return r;
Rect result;
result.br.y = __rfbmax(br.y, r.br.y);
return result;
}
- inline Rect translate(const Point &p) const {
+ inline Rect translate(const Point &p) const
+ __attribute__ ((warn_unused_result))
+ {
return Rect(tl.translate(p), br.translate(p));
}
inline bool equals(const Rect &r) const {return r.tl.equals(tl) && r.br.equals(br);}
// the following three operations return a new region:
- Region intersect(const Region& r) const;
- Region union_(const Region& r) const;
- Region subtract(const Region& r) const;
+ Region intersect(const Region& r) const
+ __attribute__ ((warn_unused_result));
+ Region union_(const Region& r) const
+ __attribute__ ((warn_unused_result));
+ Region subtract(const Region& r) const
+ __attribute__ ((warn_unused_result));
bool equals(const Region& b) const;
int numRects() const;