| 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 #ifndef UI_GFX_SIZE_BASE_H_ | 5 #ifndef UI_GFX_SIZE_BASE_H_ |
| 6 #define UI_GFX_SIZE_BASE_H_ | 6 #define UI_GFX_SIZE_BASE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 void SetSize(Type width, Type height) { | 25 void SetSize(Type width, Type height) { |
| 26 set_width(width); | 26 set_width(width); |
| 27 set_height(height); | 27 set_height(height); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void Enlarge(Type width, Type height) { | 30 void Enlarge(Type width, Type height) { |
| 31 set_width(width_ + width); | 31 set_width(width_ + width); |
| 32 set_height(height_ + height); | 32 set_height(height_ + height); |
| 33 } | 33 } |
| 34 | 34 |
| 35 Class Scale(float scale) const WARN_UNUSED_RESULT { | |
| 36 return Scale(scale, scale); | |
| 37 } | |
| 38 | |
| 39 Class Scale(float x_scale, float y_scale) const WARN_UNUSED_RESULT { | |
| 40 return Class(static_cast<Type>(width_ * x_scale), | |
| 41 static_cast<Type>(height_ * y_scale)); | |
| 42 } | |
| 43 | |
| 44 void set_width(Type width) { width_ = width; } | 35 void set_width(Type width) { width_ = width; } |
| 45 void set_height(Type height) { height_ = height; } | 36 void set_height(Type height) { height_ = height; } |
| 46 | 37 |
| 47 bool operator==(const Class& s) const { | 38 bool operator==(const Class& s) const { |
| 48 return width_ == s.width_ && height_ == s.height_; | 39 return width_ == s.width_ && height_ == s.height_; |
| 49 } | 40 } |
| 50 | 41 |
| 51 bool operator!=(const Class& s) const { | 42 bool operator!=(const Class& s) const { |
| 52 return !(*this == s); | 43 return !(*this == s); |
| 53 } | 44 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 73 ~SizeBase() {} | 64 ~SizeBase() {} |
| 74 | 65 |
| 75 private: | 66 private: |
| 76 Type width_; | 67 Type width_; |
| 77 Type height_; | 68 Type height_; |
| 78 }; | 69 }; |
| 79 | 70 |
| 80 } // namespace gfx | 71 } // namespace gfx |
| 81 | 72 |
| 82 #endif // UI_GFX_SIZE_BASE_H_ | 73 #endif // UI_GFX_SIZE_BASE_H_ |
| OLD | NEW |