25 reduction[0] = reduction[1] = quad[0];
30 return 1 + !reduction[0].approximatelyEqual(reduction[1]);
34 reduction[0] = quad[0];
35 reduction[1] = quad[2];
40 reduction[0] = quad[0];
41 reduction[1] = quad[2];
46 int minX,
int maxX,
int minY,
int maxY,
SkDQuad& reduction) {
51 reduction[0] = quad[0];
52 reduction[1] = quad[2];
63 int index, minX, maxX, minY, maxY;
65 minX = maxX = minY = maxY = 0;
66 minXSet = minYSet = 0;
67 for (index = 1; index < 3; ++index) {
68 if (quad[minX].fX > quad[index].fX) {
71 if (quad[minY].fY > quad[index].fY) {
74 if (quad[maxX].fX < quad[index].fX) {
77 if (quad[maxY].fY < quad[index].fY) {
81 for (index = 0; index < 3; ++index) {
83 minXSet |= 1 << index;
86 minYSet |= 1 << index;
89 if ((minXSet & 0x05) == 0x5 && (minYSet & 0x05) == 0x5) {
111 reduction[0] = reduction[1] =
cubic[0];
116 return 1 + !reduction[0].approximatelyEqual(reduction[1]);
120 reduction[0] =
cubic[0];
121 reduction[1] =
cubic[3];
126 reduction[0] =
cubic[0];
127 reduction[1] =
cubic[3];
135 double midX =
cubic[0].fX + dx10 * 3 / 2;
136 double sideAx = midX -
cubic[3].fX;
137 double sideBx = dx23 * 3 / 2;
144 double midY =
cubic[0].fY + dy10 * 3 / 2;
145 double sideAy = midY -
cubic[3].fY;
146 double sideBy = dy23 * 3 / 2;
151 reduction[0] =
cubic[0];
152 reduction[1].fX = midX;
153 reduction[1].fY = midY;
154 reduction[2] =
cubic[3];
159 int minX,
int maxX,
int minY,
int maxY,
SkDCubic& reduction) {
160 if (!
cubic.isLinear(0, 3)) {
164 reduction[0] =
cubic[0];
165 reduction[1] =
cubic[3];
196 int index, minX, maxX, minY, maxY;
197 int minXSet, minYSet;
198 minX = maxX = minY = maxY = 0;
199 minXSet = minYSet = 0;
200 for (index = 1; index < 4; ++index) {
214 for (index = 0; index < 4; ++index) {
215 double cx =
cubic[index].fX;
216 double cy =
cubic[index].fY;
220 minXSet |= 1 << index;
221 minYSet |= 1 << index;
224 double inv = 1 / denom;
226 minXSet |= 1 << index;
229 minYSet |= 1 << index;
232 if (minXSet == 0xF) {
233 if (minYSet == 0xF) {
238 if (minYSet == 0xF) {
257 int order = reducer.
reduce(quad);
259 for (
int index = 0; index < order; ++index) {
260 *reducePts++ = reducer.
fLine[index].asSkPoint();
284 if (order == 2 || order == 3) {
285 for (
int index = 0; index < order; ++index) {
286 *reducePts++ = reducer.
fQuad[index].asSkPoint();
static SkM44 inv(const SkM44 &m)
static bool approximately_zero(double x)
bool AlmostEqualUlps(const SkPoint &pt1, const SkPoint &pt2)
bool AlmostEqualUlps_Pin(float a, float b)
bool approximately_equal(double x, double y)
bool approximately_equal_half(double x, double y)
SkPath::Verb SkPathOpsPointsToVerb(int points)
static int coincident_line(const SkDQuad &quad, SkDQuad &reduction)
static int check_linear(const SkDQuad &quad, int minX, int maxX, int minY, int maxY, SkDQuad &reduction)
static int horizontal_line(const SkDQuad &quad, SkDQuad &reduction)
static int check_quadratic(const SkDCubic &cubic, SkDCubic &reduction)
static int reductionLineCount(const SkDQuad &reduction)
static int vertical_line(const SkDQuad &quad, SkDQuad &reduction)
static float max(float r, float g, float b)
static bool ApproximatelyEqual(const SkPoint &a, const SkPoint &b)
const SkDQuad & set(const SkPoint pts[kPointCount] SkDEBUGPARAMS(SkOpGlobalState *state=nullptr))
bool isLinear(int startIndex, int endIndex) const
static SkPath::Verb Cubic(const SkPoint pts[4], SkPoint *reducePts)
static SkPath::Verb Conic(const SkConic &conic, SkPoint *reducePts)
int reduce(const SkDCubic &cubic, Quadratics)
static SkPath::Verb Quad(const SkPoint pts[3], SkPoint *reducePts)