| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrQuad_DEFINED | 8 #ifndef GrQuad_DEFINED |
| 9 #define GrQuad_DEFINED | 9 #define GrQuad_DEFINED |
| 10 | 10 |
| 11 #include "SkPoint.h" | 11 #include "SkPoint.h" |
| 12 #include "SkMatrix.h" | 12 #include "SkMatrix.h" |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * GrQuad is a collection of 4 points which can be used to represent an arbitrar
y quadrilateral | 15 * GrQuad is a collection of 4 points which can be used to represent an arbitrar
y quadrilateral |
| 16 */ | 16 */ |
| 17 class GrQuad { | 17 class GrQuad { |
| 18 public: | 18 public: |
| 19 GrQuad() {} | |
| 20 | |
| 21 GrQuad(const GrQuad& that) { | 19 GrQuad(const GrQuad& that) { |
| 22 *this = that; | 20 *this = that; |
| 23 } | 21 } |
| 24 | 22 |
| 25 explicit GrQuad(const SkRect& rect) { | 23 explicit GrQuad(const SkRect& rect) { |
| 26 this->set(rect); | 24 this->set(rect); |
| 27 } | 25 } |
| 28 | 26 |
| 29 void set(const SkRect& rect) { | 27 void set(const SkRect& rect) { |
| 30 fPoints->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); | 28 fPoints->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 45 } | 43 } |
| 46 | 44 |
| 47 SkPoint* points() { | 45 SkPoint* points() { |
| 48 return fPoints; | 46 return fPoints; |
| 49 } | 47 } |
| 50 | 48 |
| 51 const SkPoint* points() const { | 49 const SkPoint* points() const { |
| 52 return fPoints; | 50 return fPoints; |
| 53 } | 51 } |
| 54 | 52 |
| 55 const SkPoint& point(int i) const { | |
| 56 SkASSERT(i < kNumPoints); | |
| 57 return fPoints[i]; | |
| 58 } | |
| 59 | |
| 60 private: | 53 private: |
| 61 static const int kNumPoints = 4; | 54 static const int kNumPoints = 4; |
| 62 SkPoint fPoints[kNumPoints]; | 55 SkPoint fPoints[kNumPoints]; |
| 63 }; | 56 }; |
| 64 | 57 |
| 65 #endif | 58 #endif |
| OLD | NEW |