OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 PPAPI_CPP_SIZE_H_ | 5 #ifndef PPAPI_CPP_SIZE_H_ |
6 #define PPAPI_CPP_SIZE_H_ | 6 #define PPAPI_CPP_SIZE_H_ |
7 | 7 |
8 #include "ppapi/c/pp_size.h" | 8 #include "ppapi/c/pp_size.h" |
9 #include "ppapi/cpp/logging.h" | 9 #include "ppapi/cpp/logging.h" |
10 | 10 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 void set_height(int h) { | 103 void set_height(int h) { |
104 if (h < 0) { | 104 if (h < 0) { |
105 PP_DCHECK(h >= 0); | 105 PP_DCHECK(h >= 0); |
106 h = 0; | 106 h = 0; |
107 } | 107 } |
108 size_.height = h; | 108 size_.height = h; |
109 } | 109 } |
110 | 110 |
111 /// GetArea() determines the area (width * height). | 111 /// GetArea() determines the area (width * height). |
112 /// | 112 /// |
113 /// @return The area | 113 /// @return The area. |
114 int GetArea() const { | 114 int GetArea() const { |
115 return width() * height(); | 115 return width() * height(); |
116 } | 116 } |
117 | 117 |
118 /// SetSize() sets the value of width and height. | 118 /// SetSize() sets the value of width and height. |
119 /// | 119 /// |
120 /// @param[in] w A new width value. | 120 /// @param[in] w A new width value. |
121 /// @param[in] h A new height value. | 121 /// @param[in] h A new height value. |
122 void SetSize(int w, int h) { | 122 void SetSize(int w, int h) { |
123 set_width(w); | 123 set_width(w); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 /// @param[in] rhs The <code>Size</code> on the right-hand side of the equation. | 165 /// @param[in] rhs The <code>Size</code> on the right-hand side of the equation. |
166 /// | 166 /// |
167 /// @return true if the <code>Size</code> of lhs are equal to the | 167 /// @return true if the <code>Size</code> of lhs are equal to the |
168 /// <code>Size</code> of rhs, otherwise false. | 168 /// <code>Size</code> of rhs, otherwise false. |
169 inline bool operator!=(const pp::Size& lhs, const pp::Size& rhs) { | 169 inline bool operator!=(const pp::Size& lhs, const pp::Size& rhs) { |
170 return !(lhs == rhs); | 170 return !(lhs == rhs); |
171 } | 171 } |
172 | 172 |
173 #endif // PPAPI_CPP_SIZE_H_ | 173 #endif // PPAPI_CPP_SIZE_H_ |
174 | 174 |
OLD | NEW |