| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/gfx/size.h" | 5 #include "base/gfx/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_MACOSX) | 9 #elif defined(OS_MACOSX) |
| 10 #include <CoreGraphics/CGGeometry.h> | 10 #include <CoreGraphics/CGGeometry.h> |
| 11 #endif | 11 #endif |
| 12 | 12 |
| 13 #include <iostream> | 13 #include <iostream> |
| 14 | 14 |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 | 16 |
| 17 namespace gfx { | 17 namespace gfx { |
| 18 | 18 |
| 19 Size::Size(int width, int height) { | 19 Size::Size(int width, int height) { |
| 20 set_width(width); | 20 set_width(width); |
| 21 set_height(height); | 21 set_height(height); |
| 22 } | 22 } |
| 23 | 23 |
| 24 #if defined(OS_MACOSX) |
| 25 Size::Size(const CGSize& s) { |
| 26 set_width(s.width); |
| 27 set_height(s.height); |
| 28 } |
| 29 |
| 30 Size& Size::operator=(const CGSize& s) { |
| 31 set_width(s.width); |
| 32 set_height(s.height); |
| 33 return *this; |
| 34 } |
| 35 #endif |
| 36 |
| 24 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
| 25 SIZE Size::ToSIZE() const { | 38 SIZE Size::ToSIZE() const { |
| 26 SIZE s; | 39 SIZE s; |
| 27 s.cx = width_; | 40 s.cx = width_; |
| 28 s.cy = height_; | 41 s.cy = height_; |
| 29 return s; | 42 return s; |
| 30 } | 43 } |
| 31 #elif defined(OS_MACOSX) | 44 #elif defined(OS_MACOSX) |
| 32 CGSize Size::ToCGSize() const { | 45 CGSize Size::ToCGSize() const { |
| 33 return CGSizeMake(width_, height_); | 46 return CGSizeMake(width_, height_); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 48 height = 0; | 61 height = 0; |
| 49 } | 62 } |
| 50 height_ = height; | 63 height_ = height; |
| 51 } | 64 } |
| 52 | 65 |
| 53 } // namespace gfx | 66 } // namespace gfx |
| 54 | 67 |
| 55 std::ostream& operator<<(std::ostream& out, const gfx::Size& s) { | 68 std::ostream& operator<<(std::ostream& out, const gfx::Size& s) { |
| 56 return out << s.width() << "x" << s.height(); | 69 return out << s.width() << "x" << s.height(); |
| 57 } | 70 } |
| OLD | NEW |