Index: base/gfx/size.h |
=================================================================== |
--- base/gfx/size.h (revision 14559) |
+++ base/gfx/size.h (working copy) |
@@ -23,7 +23,7 @@ |
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 @@ |
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 @@ |
} |
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) |