Chromium Code Reviews| Index: ui/gfx/geometry/quad_f.h |
| diff --git a/ui/gfx/geometry/quad_f.h b/ui/gfx/geometry/quad_f.h |
| index ada5c54cae3fdb521db8e50f52c49eb408892b9d..1eaf52ea0e533212af097d819bb26721b14d2a8f 100644 |
| --- a/ui/gfx/geometry/quad_f.h |
| +++ b/ui/gfx/geometry/quad_f.h |
| @@ -67,6 +67,17 @@ class GFX_EXPORT QuadF { |
| return RectF(rl, rt, rr - rl, rb - rt); |
| } |
| + // Realigns the corners in the quad by rotating them n corners to the right. |
| + void Realign(size_t times) { |
| + for (size_t i = 0; i < times % 4; ++i) { |
|
danakj
2015/02/26 18:33:39
How about DCHECK(times < 4) and remove the mod (mo
awoloszyn
2015/02/26 19:03:40
Should be perfectly fine. Good to know % is slow o
|
| + PointF temp = p1_; |
| + p1_ = p2_; |
| + p2_ = p3_; |
| + p3_ = p4_; |
| + p4_ = temp; |
| + } |
| + } |
| + |
| // Add a vector to the quad, offseting each point in the quad by the vector. |
| void operator+=(const Vector2dF& rhs); |
| // Subtract a vector from the quad, offseting each point in the quad by the |