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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 /// coordinate of 0,0. | 73 /// coordinate of 0,0. |
74 /// | 74 /// |
75 /// @param[in] s A pointer to a <code>Size</code>. | 75 /// @param[in] s A pointer to a <code>Size</code>. |
76 explicit Rect(const Size& s) { | 76 explicit Rect(const Size& s) { |
77 set_x(0); | 77 set_x(0); |
78 set_y(0); | 78 set_y(0); |
79 set_size(s); | 79 set_size(s); |
80 } | 80 } |
81 | 81 |
82 /// A constructor accepting a pointer to a <code>Point</code> representing | 82 /// A constructor accepting a pointer to a <code>Point</code> representing |
83 /// the origin of the rectangle and a pointer to a Size representing the | 83 /// the origin of the rectangle and a pointer to a <code>Size</code> |
84 /// height and width. | 84 /// representing the height and width. |
85 /// | 85 /// |
86 /// @param[in] origin A pointer to a <code>Point<code> representing the | 86 /// @param[in] origin A pointer to a <code>Point</code> representing the |
87 /// upper-left starting coordinate. | 87 /// upper-left starting coordinate. |
88 /// @param[in] size A pointer to a <code>Size</code> representing the height | 88 /// @param[in] size A pointer to a <code>Size</code> representing the height |
89 /// and width. | 89 /// and width. |
90 Rect(const Point& origin, const Size& size) { | 90 Rect(const Point& origin, const Size& size) { |
91 set_point(origin); | 91 set_point(origin); |
92 set_size(size); | 92 set_size(size); |
93 } | 93 } |
94 | 94 |
95 /// Destructor. | 95 /// Destructor. |
96 ~Rect() { | 96 ~Rect() { |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 /// The union is the smallest rectangle containing both rectangles. | 351 /// The union is the smallest rectangle containing both rectangles. |
352 /// | 352 /// |
353 /// @param[in] rect A pointer to a <code>Rect</code>. | 353 /// @param[in] rect A pointer to a <code>Rect</code>. |
354 /// | 354 /// |
355 /// @return A <code>Rect</code> representing the union. | 355 /// @return A <code>Rect</code> representing the union. |
356 Rect Union(const Rect& rect) const; | 356 Rect Union(const Rect& rect) const; |
357 | 357 |
358 /// Subtract() computes the rectangle resulting from subtracting | 358 /// Subtract() computes the rectangle resulting from subtracting |
359 /// <code>rect</code> from this Rect. If <code>rect</code>does not intersect | 359 /// <code>rect</code> from this Rect. If <code>rect</code>does not intersect |
360 /// completely in either the x or y direction, then <code>*this</code> is | 360 /// completely in either the x or y direction, then <code>*this</code> is |
361 /// returned. If <code>rect<code> contains <code>this</code>, then an empty | 361 /// returned. If <code>rect</code> contains <code>this</code>, then an empty |
362 /// <code>Rect</code> is returned. | 362 /// <code>Rect</code> is returned. |
363 /// | 363 /// |
364 /// @param[in] rect A pointer to a <code>Rect</code>. | 364 /// @param[in] rect A pointer to a <code>Rect</code>. |
365 /// | 365 /// |
366 /// @return A <code>Rect</code> representing the subtraction. | 366 /// @return A <code>Rect</code> representing the subtraction. |
367 Rect Subtract(const Rect& rect) const; | 367 Rect Subtract(const Rect& rect) const; |
368 | 368 |
369 /// AdjustToFit() fits as much of the receiving rectangle within | 369 /// AdjustToFit() fits as much of the receiving rectangle within |
370 /// the supplied rectangle as possible, returning the result. For example, | 370 /// the supplied rectangle as possible, returning the result. For example, |
371 /// if the receiver had a x-location of 2 and a width of 4, and the supplied | 371 /// if the receiver had a x-location of 2 and a width of 4, and the supplied |
(...skipping 46 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 |