Removed unused icon resources from app_list.
[chromium-blink-merge.git] / ui / gfx / geometry / size.cc
blobd916ebdadd3c94b2449060a10d7b36baf673d023
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"
7 #if defined(OS_WIN)
8 #include <windows.h>
9 #endif
11 #include "base/strings/stringprintf.h"
13 namespace gfx {
15 #if defined(OS_WIN)
16 SIZE Size::ToSIZE() const {
17 SIZE s;
18 s.cx = width();
19 s.cy = height();
20 return s;
22 #endif
24 #if defined(OS_MACOSX)
25 Size& Size::operator=(const CGSize& s) {
26 set_width(s.width);
27 set_height(s.height);
28 return *this;
30 #endif
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());
54 } // namespace gfx