OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 SkPatch_DEFINED | 8 #ifndef SkPatch_DEFINED |
9 #define SkPatch_DEFINED | 9 #define SkPatch_DEFINED |
10 | 10 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 * 10 5 | 76 * 10 5 |
77 * 9 8 7 6 | 77 * 9 8 7 6 |
78 * (bottom curve) | 78 * (bottom curve) |
79 * Used pointer to an array to guarantee that this method receives an array
of 4 SkColors | 79 * Used pointer to an array to guarantee that this method receives an array
of 4 SkColors |
80 */ | 80 */ |
81 SkPatch(SkPoint points[12], SkColor colors[4]); | 81 SkPatch(SkPoint points[12], SkColor colors[4]); |
82 | 82 |
83 /** | 83 /** |
84 * Function that evaluates the coons patch interpolation. | 84 * Function that evaluates the coons patch interpolation. |
85 * data refers to the pointer of the PatchData struct in which the tessellat
ion data is set. | 85 * data refers to the pointer of the PatchData struct in which the tessellat
ion data is set. |
86 * divisions defines the number of steps in which the SkPatch is going to be
subdivided per | 86 * lod refers the level of detail for each axis. |
87 * axis. | |
88 */ | 87 */ |
89 bool getVertexData(SkPatch::VertexData* data, int divisions); | 88 bool getVertexData(SkPatch::VertexData* data, int lodX, int lodY) const; |
90 | 89 |
91 void getTopPoints(SkPoint points[4]) { | 90 void getTopPoints(SkPoint points[4]) const { |
92 points[0] = fCtrlPoints[kTopP0_CubicCtrlPts]; | 91 points[0] = fCtrlPoints[kTopP0_CubicCtrlPts]; |
93 points[1] = fCtrlPoints[kTopP1_CubicCtrlPts]; | 92 points[1] = fCtrlPoints[kTopP1_CubicCtrlPts]; |
94 points[2] = fCtrlPoints[kTopP2_CubicCtrlPts]; | 93 points[2] = fCtrlPoints[kTopP2_CubicCtrlPts]; |
95 points[3] = fCtrlPoints[kTopP3_CubicCtrlPts]; | 94 points[3] = fCtrlPoints[kTopP3_CubicCtrlPts]; |
96 } | 95 } |
97 | 96 |
98 void getBottomPoints(SkPoint points[4]) { | 97 void getBottomPoints(SkPoint points[4]) const { |
99 points[0] = fCtrlPoints[kBottomP0_CubicCtrlPts]; | 98 points[0] = fCtrlPoints[kBottomP0_CubicCtrlPts]; |
100 points[1] = fCtrlPoints[kBottomP1_CubicCtrlPts]; | 99 points[1] = fCtrlPoints[kBottomP1_CubicCtrlPts]; |
101 points[2] = fCtrlPoints[kBottomP2_CubicCtrlPts]; | 100 points[2] = fCtrlPoints[kBottomP2_CubicCtrlPts]; |
102 points[3] = fCtrlPoints[kBottomP3_CubicCtrlPts]; | 101 points[3] = fCtrlPoints[kBottomP3_CubicCtrlPts]; |
103 } | 102 } |
104 | 103 |
105 void getLeftPoints(SkPoint points[4]) { | 104 void getLeftPoints(SkPoint points[4]) const { |
106 points[0] = fCtrlPoints[kLeftP0_CubicCtrlPts]; | 105 points[0] = fCtrlPoints[kLeftP0_CubicCtrlPts]; |
107 points[1] = fCtrlPoints[kLeftP1_CubicCtrlPts]; | 106 points[1] = fCtrlPoints[kLeftP1_CubicCtrlPts]; |
108 points[2] = fCtrlPoints[kLeftP2_CubicCtrlPts]; | 107 points[2] = fCtrlPoints[kLeftP2_CubicCtrlPts]; |
109 points[3] = fCtrlPoints[kLeftP3_CubicCtrlPts]; | 108 points[3] = fCtrlPoints[kLeftP3_CubicCtrlPts]; |
110 } | 109 } |
111 | 110 |
112 void getRightPoints(SkPoint points[4]) { | 111 void getRightPoints(SkPoint points[4]) const { |
113 points[0] = fCtrlPoints[kRightP0_CubicCtrlPts]; | 112 points[0] = fCtrlPoints[kRightP0_CubicCtrlPts]; |
114 points[1] = fCtrlPoints[kRightP1_CubicCtrlPts]; | 113 points[1] = fCtrlPoints[kRightP1_CubicCtrlPts]; |
115 points[2] = fCtrlPoints[kRightP2_CubicCtrlPts]; | 114 points[2] = fCtrlPoints[kRightP2_CubicCtrlPts]; |
116 points[3] = fCtrlPoints[kRightP3_CubicCtrlPts]; | 115 points[3] = fCtrlPoints[kRightP3_CubicCtrlPts]; |
117 } | 116 } |
118 | 117 |
| 118 void getCornerPoints(SkPoint points[4]) const { |
| 119 points[0] = fCtrlPoints[kTopP0_CubicCtrlPts]; |
| 120 points[1] = fCtrlPoints[kTopP3_CubicCtrlPts]; |
| 121 points[2] = fCtrlPoints[kBottomP0_CubicCtrlPts]; |
| 122 points[3] = fCtrlPoints[kBottomP3_CubicCtrlPts]; |
| 123 } |
| 124 |
| 125 const SkPoint* getControlPoints() const { |
| 126 return fCtrlPoints; |
| 127 } |
| 128 |
119 private: | 129 private: |
120 SkPoint fCtrlPoints[12]; | 130 SkPoint fCtrlPoints[12]; |
121 SkPMColor fCornerColors[4]; | 131 SkPMColor fCornerColors[4]; |
122 }; | 132 }; |
123 | 133 |
124 #endif | 134 #endif |
OLD | NEW |