diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-11 09:32:12 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-11 09:32:12 +0000 |
commit | 54a337516820c79a368a8bbca2aa2da9944cfb5c (patch) | |
tree | 14850789dc739e6618de5f51e04a9a35ccc82ed2 /ui/gfx/size.cc | |
parent | e5c45f6c5f6778f1da0053ccbb8d95a15bdbcc14 (diff) | |
download | chromium_src-54a337516820c79a368a8bbca2aa2da9944cfb5c.zip chromium_src-54a337516820c79a368a8bbca2aa2da9944cfb5c.tar.gz chromium_src-54a337516820c79a368a8bbca2aa2da9944cfb5c.tar.bz2 |
Revert r131737 "Use template for Point/Size/Rect and remove duplicates "
TBR=oshima@chromium.org
BUG=114664
TEST=none
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=131737
Review URL: https://chromiumcodereview.appspot.com/10020034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131738 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/size.cc')
-rw-r--r-- | ui/gfx/size.cc | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/ui/gfx/size.cc b/ui/gfx/size.cc index 303559d..0173e1b 100644 --- a/ui/gfx/size.cc +++ b/ui/gfx/size.cc @@ -12,22 +12,18 @@ #include "base/logging.h" #include "base/stringprintf.h" -#include "ui/gfx/size_base.h" -#include "ui/gfx/size_base_impl.h" namespace gfx { -template class SizeBase<Size, int>; +Size::Size() : width_(0), height_(0) {} -Size::Size() : SizeBase<Size, int>(0, 0) {} - -Size::Size(int width, int height) : SizeBase<Size, int>(0, 0) { +Size::Size(int width, int height) { set_width(width); set_height(height); } #if defined(OS_MACOSX) -Size::Size(const CGSize& s) : SizeBase<Size, int>(0, 0) { +Size::Size(const CGSize& s) { set_width(s.width); set_height(s.height); } @@ -44,18 +40,34 @@ Size::~Size() {} #if defined(OS_WIN) SIZE Size::ToSIZE() const { SIZE s; - s.cx = width(); - s.cy = height(); + s.cx = width_; + s.cy = height_; return s; } #elif defined(OS_MACOSX) CGSize Size::ToCGSize() const { - return CGSizeMake(width(), height()); + return CGSizeMake(width_, height_); } #endif +void Size::set_width(int width) { + if (width < 0) { + NOTREACHED() << "negative width:" << width; + width = 0; + } + width_ = width; +} + +void Size::set_height(int height) { + if (height < 0) { + NOTREACHED() << "negative height:" << height; + height = 0; + } + height_ = height; +} + std::string Size::ToString() const { - return base::StringPrintf("%dx%d", width(), height()); + return base::StringPrintf("%dx%d", width_, height_); } } // namespace gfx |