Lines Matching refs:cubic
103 static int coincident_line(const SkDCubic& cubic, SkDCubic& reduction) { in coincident_line() argument
104 reduction[0] = reduction[1] = cubic[0]; in coincident_line()
112 static int vertical_line(const SkDCubic& cubic, SkDCubic& reduction) { in vertical_line() argument
113 reduction[0] = cubic[0]; in vertical_line()
114 reduction[1] = cubic[3]; in vertical_line()
118 static int horizontal_line(const SkDCubic& cubic, SkDCubic& reduction) { in horizontal_line() argument
119 reduction[0] = cubic[0]; in horizontal_line()
120 reduction[1] = cubic[3]; in horizontal_line()
125 static int check_quadratic(const SkDCubic& cubic, SkDCubic& reduction) { in check_quadratic() argument
126 double dx10 = cubic[1].fX - cubic[0].fX; in check_quadratic()
127 double dx23 = cubic[2].fX - cubic[3].fX; in check_quadratic()
128 double midX = cubic[0].fX + dx10 * 3 / 2; in check_quadratic()
129 double sideAx = midX - cubic[3].fX; in check_quadratic()
135 double dy10 = cubic[1].fY - cubic[0].fY; in check_quadratic()
136 double dy23 = cubic[2].fY - cubic[3].fY; in check_quadratic()
137 double midY = cubic[0].fY + dy10 * 3 / 2; in check_quadratic()
138 double sideAy = midY - cubic[3].fY; in check_quadratic()
144 reduction[0] = cubic[0]; in check_quadratic()
147 reduction[2] = cubic[3]; in check_quadratic()
151 static int check_linear(const SkDCubic& cubic, in check_linear() argument
153 if (!cubic.isLinear(0, 3)) { in check_linear()
157 reduction[0] = cubic[0]; in check_linear()
158 reduction[1] = cubic[3]; in check_linear()
188 int SkReduceOrder::reduce(const SkDCubic& cubic, Quadratics allowQuadratics) { in reduce() argument
194 if (cubic[minX].fX > cubic[index].fX) { in reduce()
197 if (cubic[minY].fY > cubic[index].fY) { in reduce()
200 if (cubic[maxX].fX < cubic[index].fX) { in reduce()
203 if (cubic[maxY].fY < cubic[index].fY) { in reduce()
208 double cx = cubic[index].fX; in reduce()
209 double cy = cubic[index].fY; in reduce()
211 std::max(fabs(cubic[minX].fX), fabs(cubic[minY].fY)))); in reduce()
218 if (approximately_equal_half(cx * inv, cubic[minX].fX * inv)) { in reduce()
221 if (approximately_equal_half(cy * inv, cubic[minY].fY * inv)) { in reduce()
227 return coincident_line(cubic, fCubic); in reduce()
229 return vertical_line(cubic, fCubic); in reduce()
232 return horizontal_line(cubic, fCubic); in reduce()
234 int result = check_linear(cubic, minX, maxX, minY, maxY, fCubic); in reduce()
239 && (result = check_quadratic(cubic, fCubic))) { in reduce()
242 fCubic = cubic; in reduce()
273 SkDCubic cubic; in Cubic() local
274 cubic.set(a); in Cubic()
276 int order = reducer.reduce(cubic, kAllow_Quadratics); in Cubic()