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_RECT_H_ | 5 #ifndef PPAPI_CPP_RECT_H_ |
6 #define PPAPI_CPP_RECT_H_ | 6 #define PPAPI_CPP_RECT_H_ |
7 | 7 |
8 #include "ppapi/c/pp_rect.h" | 8 #include "ppapi/c/pp_rect.h" |
9 #include "ppapi/cpp/point.h" | 9 #include "ppapi/cpp/point.h" |
10 #include "ppapi/cpp/size.h" | 10 #include "ppapi/cpp/size.h" |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 /// | 292 /// |
293 /// @param[in] point A pointer to a <code>Point</code> representing the | 293 /// @param[in] point A pointer to a <code>Point</code> representing the |
294 /// horizontal and vertical move distances. | 294 /// horizontal and vertical move distances. |
295 void Offset(const Point& point) { | 295 void Offset(const Point& point) { |
296 Offset(point.x(), point.y()); | 296 Offset(point.x(), point.y()); |
297 } | 297 } |
298 | 298 |
299 /// IsEmpty() determines if the area of a rectangle is zero. Returns true if | 299 /// IsEmpty() determines if the area of a rectangle is zero. Returns true if |
300 /// the area of the rectangle is zero. | 300 /// the area of the rectangle is zero. |
301 /// | 301 /// |
302 /// @return True if the area of the rectangle is zero. | 302 /// @return true if the area of the rectangle is zero. |
303 bool IsEmpty() const { | 303 bool IsEmpty() const { |
304 return rect_.size.width == 0 && rect_.size.height == 0; | 304 return rect_.size.width == 0 && rect_.size.height == 0; |
305 } | 305 } |
306 | 306 |
307 /// Contains() determines if the point identified by point_x and point_y | 307 /// Contains() determines if the point identified by point_x and point_y |
308 /// falls inside this rectangle. The point (x, y) is inside the rectangle, | 308 /// falls inside this rectangle. The point (x, y) is inside the rectangle, |
309 /// but the point (x + width, y + height) is not. | 309 /// but the point (x + width, y + height) is not. |
310 /// | 310 /// |
311 /// @param[in] point_x An int32_t value representing a x value. | 311 /// @param[in] point_x An int32_t value representing a x value. |
312 /// @param[in] point_y An int32_t value representing a y value. | 312 /// @param[in] point_y An int32_t value representing a y value. |
313 /// | 313 /// |
314 /// @return True if the point_x and point_y fall inside the rectangle. | 314 /// @return true if the point_x and point_y fall inside the rectangle. |
315 bool Contains(int32_t point_x, int32_t point_y) const; | 315 bool Contains(int32_t point_x, int32_t point_y) const; |
316 | 316 |
317 /// Contains() determines if the specified point is contained by this | 317 /// Contains() determines if the specified point is contained by this |
318 /// rectangle. | 318 /// rectangle. |
319 /// | 319 /// |
320 /// @param[in] point A pointer to a Point representing a 2D coordinate. | 320 /// @param[in] point A pointer to a Point representing a 2D coordinate. |
321 /// | 321 /// |
322 /// @return True if the point_x and point_y fall inside the rectangle. | 322 /// @return true if the point_x and point_y fall inside the rectangle. |
323 bool Contains(const Point& point) const { | 323 bool Contains(const Point& point) const { |
324 return Contains(point.x(), point.y()); | 324 return Contains(point.x(), point.y()); |
325 } | 325 } |
326 | 326 |
327 /// Contains() determines if this rectangle contains the specified rectangle. | 327 /// Contains() determines if this rectangle contains the specified rectangle. |
328 /// | 328 /// |
329 /// @param[in] rect A pointer to a <code>Rect</code>. | 329 /// @param[in] rect A pointer to a <code>Rect</code>. |
330 /// | 330 /// |
331 /// @return True if the rectangle fall inside this rectangle. | 331 /// @return true if the rectangle fall inside this rectangle. |
332 bool Contains(const Rect& rect) const; | 332 bool Contains(const Rect& rect) const; |
333 | 333 |
334 /// Insersects() determines if this rectangle intersects the specified | 334 /// Insersects() determines if this rectangle intersects the specified |
335 /// rectangle. | 335 /// rectangle. |
336 /// | 336 /// |
337 /// @param[in] rect A pointer to a <code>Rect</code>. | 337 /// @param[in] rect A pointer to a <code>Rect</code>. |
338 /// | 338 /// |
339 /// @return True if the rectangle intersects this rectangle. | 339 /// @return true if the rectangle intersects this rectangle. |
340 bool Intersects(const Rect& rect) const; | 340 bool Intersects(const Rect& rect) const; |
341 | 341 |
342 /// Intersect() computes the intersection of this rectangle with the given | 342 /// Intersect() computes the intersection of this rectangle with the given |
343 /// rectangle. | 343 /// rectangle. |
344 /// | 344 /// |
345 /// @param[in] rect A pointer to a <code>Rect</code>. | 345 /// @param[in] rect A pointer to a <code>Rect</code>. |
346 /// | 346 /// |
347 /// @return A <code>Rect</code> representing the intersection. | 347 /// @return A <code>Rect</code> representing the intersection. |
348 Rect Intersect(const Rect& rect) const; | 348 Rect Intersect(const Rect& rect) const; |
349 | 349 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 /// @param[in] rhs The <code>Rect</code> on the right-hand side of the | 418 /// @param[in] rhs The <code>Rect</code> on the right-hand side of the |
419 /// equation. | 419 /// equation. |
420 /// | 420 /// |
421 /// @return true if the given Rects are equal, otherwise false. | 421 /// @return true if the given Rects are equal, otherwise false. |
422 inline bool operator!=(const pp::Rect& lhs, const pp::Rect& rhs) { | 422 inline bool operator!=(const pp::Rect& lhs, const pp::Rect& rhs) { |
423 return !(lhs == rhs); | 423 return !(lhs == rhs); |
424 } | 424 } |
425 | 425 |
426 #endif | 426 #endif |
427 | 427 |
OLD | NEW |