summaryrefslogtreecommitdiffstats
path: root/base/gfx/size.h
diff options
context:
space:
mode:
Diffstat (limited to 'base/gfx/size.h')
-rw-r--r--base/gfx/size.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/base/gfx/size.h b/base/gfx/size.h
index f890a51..a7a471d 100644
--- a/base/gfx/size.h
+++ b/base/gfx/size.h
@@ -23,7 +23,7 @@ namespace gfx {
class Size {
public:
Size() : width_(0), height_(0) {}
- Size(int width, int height) : width_(width), height_(height) {}
+ Size(int width, int height);
~Size() {}
@@ -31,17 +31,17 @@ class Size {
int height() const { return height_; }
void SetSize(int width, int height) {
- width_ = width;
- height_ = height;
+ set_width(width);
+ set_height(height);
}
void Enlarge(int width, int height) {
- width_ += width;
- height_ += height;
+ set_width(width_ + width);
+ set_height(height_ + height);
}
- void set_width(int width) { width_ = width; }
- void set_height(int height) { height_ = height; }
+ void set_width(int width);
+ void set_height(int height);
bool operator==(const Size& s) const {
return width_ == s.width_ && height_ == s.height_;
@@ -52,7 +52,8 @@ class Size {
}
bool IsEmpty() const {
- return !width_ && !height_;
+ // Size doesn't allow negative dimensions, so testing for 0 is enough.
+ return (width_ == 0) || (height_ == 0);
}
#if defined(OS_WIN)