| 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 #ifndef BASE_GFX_SIZE_H_ | 5 #ifndef BASE_GFX_SIZE_H_ |
| 6 #define BASE_GFX_SIZE_H_ | 6 #define BASE_GFX_SIZE_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #include <iosfwd> | 10 #include <iosfwd> |
| 11 | 11 |
| 12 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
| 13 typedef struct tagSIZE SIZE; | 13 typedef struct tagSIZE SIZE; |
| 14 #elif defined(OS_MACOSX) | 14 #elif defined(OS_MACOSX) |
| 15 #include <ApplicationServices/ApplicationServices.h> | 15 #include <ApplicationServices/ApplicationServices.h> |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 namespace gfx { | 18 namespace gfx { |
| 19 | 19 |
| 20 // | 20 // |
| 21 // A size has width and height values. | 21 // A size has width and height values. |
| 22 // | 22 // |
| 23 class Size { | 23 class Size { |
| 24 public: | 24 public: |
| 25 Size() : width_(0), height_(0) {} | 25 Size() : width_(0), height_(0) {} |
| 26 Size(int width, int height); | 26 Size(int width, int height); |
| 27 #if defined(OS_MACOSX) |
| 28 explicit Size(const CGSize& s); |
| 29 #endif |
| 27 | 30 |
| 28 ~Size() {} | 31 ~Size() {} |
| 29 | 32 |
| 33 #if defined(OS_MACOSX) |
| 34 Size& operator=(const CGSize& s); |
| 35 #endif |
| 36 |
| 30 int width() const { return width_; } | 37 int width() const { return width_; } |
| 31 int height() const { return height_; } | 38 int height() const { return height_; } |
| 32 | 39 |
| 33 int GetArea() const { return width_ * height_; } | 40 int GetArea() const { return width_ * height_; } |
| 34 | 41 |
| 35 void SetSize(int width, int height) { | 42 void SetSize(int width, int height) { |
| 36 set_width(width); | 43 set_width(width); |
| 37 set_height(height); | 44 set_height(height); |
| 38 } | 45 } |
| 39 | 46 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 67 private: | 74 private: |
| 68 int width_; | 75 int width_; |
| 69 int height_; | 76 int height_; |
| 70 }; | 77 }; |
| 71 | 78 |
| 72 } // namespace gfx | 79 } // namespace gfx |
| 73 | 80 |
| 74 std::ostream& operator<<(std::ostream& out, const gfx::Size& s); | 81 std::ostream& operator<<(std::ostream& out, const gfx::Size& s); |
| 75 | 82 |
| 76 #endif // BASE_GFX_SIZE_H_ | 83 #endif // BASE_GFX_SIZE_H_ |
| OLD | NEW |