| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gfx/geometry/size.h" | 5 #include "ui/gfx/geometry/size.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #elif defined(OS_IOS) | 9 #elif defined(OS_IOS) |
| 10 #include <CoreGraphics/CoreGraphics.h> | 10 #include <CoreGraphics/CoreGraphics.h> |
| 11 #elif defined(OS_MACOSX) | 11 #elif defined(OS_MACOSX) |
| 12 #include <ApplicationServices/ApplicationServices.h> | 12 #include <ApplicationServices/ApplicationServices.h> |
| 13 #endif | 13 #endif |
| 14 | 14 |
| 15 #include "base/numerics/safe_math.h" | 15 #include "base/numerics/safe_math.h" |
| 16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 17 #include "build/build_config.h" |
| 17 #include "ui/gfx/geometry/size_conversions.h" | 18 #include "ui/gfx/geometry/size_conversions.h" |
| 18 | 19 |
| 19 namespace gfx { | 20 namespace gfx { |
| 20 | 21 |
| 21 #if defined(OS_MACOSX) | 22 #if defined(OS_MACOSX) |
| 22 Size::Size(const CGSize& s) | 23 Size::Size(const CGSize& s) |
| 23 : width_(s.width < 0 ? 0 : s.width), | 24 : width_(s.width < 0 ? 0 : s.width), |
| 24 height_(s.height < 0 ? 0 : s.height) { | 25 height_(s.height < 0 ? 0 : s.height) { |
| 25 } | 26 } |
| 26 | 27 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 return ToRoundedSize(ScaleSize(gfx::SizeF(size), x_scale, y_scale)); | 103 return ToRoundedSize(ScaleSize(gfx::SizeF(size), x_scale, y_scale)); |
| 103 } | 104 } |
| 104 | 105 |
| 105 Size ScaleToRoundedSize(const Size& size, float scale) { | 106 Size ScaleToRoundedSize(const Size& size, float scale) { |
| 106 if (scale == 1.f) | 107 if (scale == 1.f) |
| 107 return size; | 108 return size; |
| 108 return ToRoundedSize(ScaleSize(gfx::SizeF(size), scale, scale)); | 109 return ToRoundedSize(ScaleSize(gfx::SizeF(size), scale, scale)); |
| 109 } | 110 } |
| 110 | 111 |
| 111 } // namespace gfx | 112 } // namespace gfx |
| OLD | NEW |