| Index: ui/gfx/geometry/size.cc
|
| diff --git a/ui/gfx/geometry/size.cc b/ui/gfx/geometry/size.cc
|
| index 38ec4b3a516836f97582ce9c1ccad5ed7f29f54b..d916ebdadd3c94b2449060a10d7b36baf673d023 100644
|
| --- a/ui/gfx/geometry/size.cc
|
| +++ b/ui/gfx/geometry/size.cc
|
| @@ -12,13 +12,16 @@
|
|
|
| namespace gfx {
|
|
|
| -template class SizeBase<Size, int>;
|
| -
|
| -#if defined(OS_MACOSX)
|
| -Size::Size(const CGSize& s)
|
| - : SizeBase<Size, int>(s.width, s.height) {
|
| +#if defined(OS_WIN)
|
| +SIZE Size::ToSIZE() const {
|
| + SIZE s;
|
| + s.cx = width();
|
| + s.cy = height();
|
| + return s;
|
| }
|
| +#endif
|
|
|
| +#if defined(OS_MACOSX)
|
| Size& Size::operator=(const CGSize& s) {
|
| set_width(s.width);
|
| set_height(s.height);
|
| @@ -26,18 +29,23 @@ Size& Size::operator=(const CGSize& s) {
|
| }
|
| #endif
|
|
|
| -#if defined(OS_WIN)
|
| -SIZE Size::ToSIZE() const {
|
| - SIZE s;
|
| - s.cx = width();
|
| - s.cy = height();
|
| - return s;
|
| +int Size::GetArea() const {
|
| + return width() * height();
|
| }
|
| -#elif defined(OS_MACOSX)
|
| -CGSize Size::ToCGSize() const {
|
| - return CGSizeMake(width(), height());
|
| +
|
| +void Size::Enlarge(int grow_width, int grow_height) {
|
| + SetSize(width() + grow_width, height() + grow_height);
|
| +}
|
| +
|
| +void Size::SetToMin(const Size& other) {
|
| + width_ = width() <= other.width() ? width() : other.width();
|
| + height_ = height() <= other.height() ? height() : other.height();
|
| +}
|
| +
|
| +void Size::SetToMax(const Size& other) {
|
| + width_ = width() >= other.width() ? width() : other.width();
|
| + height_ = height() >= other.height() ? height() : other.height();
|
| }
|
| -#endif
|
|
|
| std::string Size::ToString() const {
|
| return base::StringPrintf("%dx%d", width(), height());
|
|
|