1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/gfx/geometry/size.h"
11 #include "base/strings/stringprintf.h"
16 SIZE
Size::ToSIZE() const {
24 #if defined(OS_MACOSX)
25 Size
& Size::operator=(const CGSize
& s
) {
32 int Size::GetArea() const {
33 return width() * height();
36 void Size::Enlarge(int grow_width
, int grow_height
) {
37 SetSize(width() + grow_width
, height() + grow_height
);
40 void Size::SetToMin(const Size
& other
) {
41 width_
= width() <= other
.width() ? width() : other
.width();
42 height_
= height() <= other
.height() ? height() : other
.height();
45 void Size::SetToMax(const Size
& other
) {
46 width_
= width() >= other
.width() ? width() : other
.width();
47 height_
= height() >= other
.height() ? height() : other
.height();
50 std::string
Size::ToString() const {
51 return base::StringPrintf("%dx%d", width(), height());