Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrPathUtils_DEFINED | 8 #ifndef GrPathUtils_DEFINED |
| 9 #define GrPathUtils_DEFINED | 9 #define GrPathUtils_DEFINED |
| 10 | 10 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 uv->fX = sx * xy->fX + kx * xy->fY + tx; | 90 uv->fX = sx * xy->fX + kx * xy->fY + tx; |
| 91 uv->fY = ky * xy->fX + sy * xy->fY + ty; | 91 uv->fY = ky * xy->fX + sy * xy->fY + ty; |
| 92 xyPtr += STRIDE; | 92 xyPtr += STRIDE; |
| 93 uvPtr += STRIDE; | 93 uvPtr += STRIDE; |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 private: | 96 private: |
| 97 float fM[6]; | 97 float fM[6]; |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 // Input is 3 control points and a weight for a bezier conic. Calculates the | |
| 101 // three linear functionals (K,L,M) that represent the iplicit equation of t he | |
|
bsalomon
2013/08/20 16:07:59
implicit
| |
| 102 // conic, K^2 - LM. | |
| 103 // | |
| 104 // Output: | |
| 105 // K = (klm[0], klm[1], klm[2]) | |
| 106 // L = (klm[3], klm[4], klm[5]) | |
| 107 // M = (klm[6], klm[7], klm[8]) | |
| 108 void getConicKLM(const SkPoint p[3], const SkScalar weight, SkScalar klm[9]) ; | |
| 100 | 109 |
| 101 // Converts a cubic into a sequence of quads. If working in device space | 110 // Converts a cubic into a sequence of quads. If working in device space |
| 102 // use tolScale = 1, otherwise set based on stretchiness of the matrix. The | 111 // use tolScale = 1, otherwise set based on stretchiness of the matrix. The |
| 103 // result is sets of 3 points in quads (TODO: share endpoints in returned | 112 // result is sets of 3 points in quads (TODO: share endpoints in returned |
| 104 // array) | 113 // array) |
| 105 // When we approximate a cubic {a,b,c,d} with a quadratic we may have to | 114 // When we approximate a cubic {a,b,c,d} with a quadratic we may have to |
| 106 // ensure that the new control point lies between the lines ab and cd. The | 115 // ensure that the new control point lies between the lines ab and cd. The |
| 107 // convex path renderer requires this. It starts with a path where all the | 116 // convex path renderer requires this. It starts with a path where all the |
| 108 // control points taken together form a convex polygon. It relies on this | 117 // control points taken together form a convex polygon. It relies on this |
| 109 // property and the quadratic approximation of cubics step cannot alter it. | 118 // property and the quadratic approximation of cubics step cannot alter it. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 // K = (klm[0], klm[1], klm[2]) | 164 // K = (klm[0], klm[1], klm[2]) |
| 156 // L = (klm[3], klm[4], klm[5]) | 165 // L = (klm[3], klm[4], klm[5]) |
| 157 // M = (klm[6], klm[7], klm[8]) | 166 // M = (klm[6], klm[7], klm[8]) |
| 158 // | 167 // |
| 159 // Notice that the klm lines are calculated in the same space as the input c ontrol points. | 168 // Notice that the klm lines are calculated in the same space as the input c ontrol points. |
| 160 // If you transform the points the lines will also need to be transformed. T his can be done | 169 // If you transform the points the lines will also need to be transformed. T his can be done |
| 161 // by mapping the lines with the inverse-transpose of the matrix used to map the points. | 170 // by mapping the lines with the inverse-transpose of the matrix used to map the points. |
| 162 void getCubicKLM(const SkPoint p[4], SkScalar klm[9]); | 171 void getCubicKLM(const SkPoint p[4], SkScalar klm[9]); |
| 163 }; | 172 }; |
| 164 #endif | 173 #endif |
| OLD | NEW |