| 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 23 matching lines...) Expand all Loading... |
| 147 | 147 |
| 148 } // namespace pp | 148 } // namespace pp |
| 149 | 149 |
| 150 /// This function determines whether the width and height values of two sizes | 150 /// This function determines whether the width and height values of two sizes |
| 151 /// are equal. | 151 /// are equal. |
| 152 /// | 152 /// |
| 153 /// @param[in] lhs The <code>Size</code> on the left-hand side of the equation. | 153 /// @param[in] lhs The <code>Size</code> on the left-hand side of the equation. |
| 154 /// @param[in] rhs The <code>Size</code> on the right-hand side of the | 154 /// @param[in] rhs The <code>Size</code> on the right-hand side of the |
| 155 /// equation. | 155 /// equation. |
| 156 /// | 156 /// |
| 157 /// @return true if they are equal, false if unequal. | 157 /// @return True if they are equal, false if unequal. |
| 158 inline bool operator==(const pp::Size& lhs, const pp::Size& rhs) { | 158 inline bool operator==(const pp::Size& lhs, const pp::Size& rhs) { |
| 159 return lhs.width() == rhs.width() && lhs.height() == rhs.height(); | 159 return lhs.width() == rhs.width() && lhs.height() == rhs.height(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 /// This function determines whether two <code>Sizes</code> are not equal. | 162 /// This function determines whether two <code>Sizes</code> are not equal. |
| 163 /// | 163 /// |
| 164 /// @param[in] lhs The <code>Size</code> on the left-hand side of the equation. | 164 /// @param[in] lhs The <code>Size</code> on the left-hand side of the equation. |
| 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 |