зеркало из https://github.com/mozilla/moz-skia.git
remove unused reduce order code
BUG= Review URL: https://codereview.chromium.org/85763002 git-svn-id: http://skia.googlecode.com/svn/trunk@12377 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
6fcb0cdaa2
Коммит
927b7028d4
|
@ -30,7 +30,7 @@ static int quadPart(const SkDCubic& cubic, double tStart, double tEnd, SkReduceO
|
|||
SkDQuad quad = part.toQuad();
|
||||
// FIXME: should reduceOrder be looser in this use case if quartic is going to blow up on an
|
||||
// extremely shallow quadratic?
|
||||
int order = reducer->reduce(quad, SkReduceOrder::kFill_Style);
|
||||
int order = reducer->reduce(quad);
|
||||
#if DEBUG_QUAD_PART
|
||||
SkDebugf("%s cubic=(%1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g)"
|
||||
" t=(%1.9g,%1.9g)\n", __FUNCTION__, cubic[0].fX, cubic[0].fY,
|
||||
|
|
|
@ -118,7 +118,7 @@ static void addTs(const SkDCubic& cubic, double precision, double start, double
|
|||
// it would still take the prechopped cubic for reduce order and find cubic inflections
|
||||
void SkDCubic::toQuadraticTs(double precision, SkTArray<double, true>* ts) const {
|
||||
SkReduceOrder reducer;
|
||||
int order = reducer.reduce(*this, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
|
||||
int order = reducer.reduce(*this, SkReduceOrder::kAllow_Quadratics);
|
||||
if (order < 3) {
|
||||
return;
|
||||
}
|
||||
|
@ -153,13 +153,11 @@ void SkDCubic::toQuadraticTs(double precision, SkTArray<double, true>* ts) const
|
|||
SkDCubicPair pair;
|
||||
if (inflections == 1) {
|
||||
pair = chopAt(inflectT[0]);
|
||||
int orderP1 = reducer.reduce(pair.first(), SkReduceOrder::kNo_Quadratics,
|
||||
SkReduceOrder::kFill_Style);
|
||||
int orderP1 = reducer.reduce(pair.first(), SkReduceOrder::kNo_Quadratics);
|
||||
if (orderP1 < 2) {
|
||||
--inflections;
|
||||
} else {
|
||||
int orderP2 = reducer.reduce(pair.second(), SkReduceOrder::kNo_Quadratics,
|
||||
SkReduceOrder::kFill_Style);
|
||||
int orderP2 = reducer.reduce(pair.second(), SkReduceOrder::kNo_Quadratics);
|
||||
if (orderP2 < 2) {
|
||||
--inflections;
|
||||
}
|
||||
|
|
|
@ -183,7 +183,6 @@ public:
|
|||
return result;
|
||||
}
|
||||
|
||||
// OPTIMIZATION: mark as debugging only if used solely by tests
|
||||
double t(int tIndex) const {
|
||||
return fTs[tIndex].fT;
|
||||
}
|
||||
|
@ -212,13 +211,11 @@ public:
|
|||
return fTs[tIndex].fWindValue;
|
||||
}
|
||||
|
||||
#if defined(SK_DEBUG) || DEBUG_WINDING
|
||||
SkScalar xAtT(int index) const {
|
||||
return xAtT(&fTs[index]);
|
||||
}
|
||||
|
||||
SkScalar xAtT(const SkOpSpan* span) const {
|
||||
return xyAtT(span).fX;
|
||||
}
|
||||
#endif
|
||||
|
||||
const SkPoint& xyAtT(const SkOpSpan* span) const {
|
||||
return span->fPt;
|
||||
|
@ -228,13 +225,11 @@ public:
|
|||
return xyAtT(&fTs[index]);
|
||||
}
|
||||
|
||||
#if defined(SK_DEBUG) || DEBUG_WINDING
|
||||
SkScalar yAtT(int index) const {
|
||||
return yAtT(&fTs[index]);
|
||||
}
|
||||
|
||||
SkScalar yAtT(const SkOpSpan* span) const {
|
||||
return xyAtT(span).fY;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool activeAngle(int index, int* done, SkTArray<SkOpAngle, true>* angles);
|
||||
SkPoint activeLeftTop(bool onlySortable, int* firstT) const;
|
||||
|
@ -403,6 +398,15 @@ private:
|
|||
static bool UseInnerWindingReverse(int outerWinding, int innerWinding);
|
||||
SkOpSpan* verifyOneWinding(const char* funName, int tIndex);
|
||||
SkOpSpan* verifyOneWindingU(const char* funName, int tIndex);
|
||||
|
||||
SkScalar xAtT(const SkOpSpan* span) const {
|
||||
return xyAtT(span).fX;
|
||||
}
|
||||
|
||||
SkScalar yAtT(const SkOpSpan* span) const {
|
||||
return xyAtT(span).fY;
|
||||
}
|
||||
|
||||
void zeroSpan(SkOpSpan* span);
|
||||
|
||||
#if DEBUG_SWAP_TOP
|
||||
|
|
|
@ -13,12 +13,6 @@ int SkReduceOrder::reduce(const SkDLine& line) {
|
|||
return 1 + different;
|
||||
}
|
||||
|
||||
static double interp_quad_coords(double a, double b, double c, double t) {
|
||||
double ab = SkDInterp(a, b, t);
|
||||
double bc = SkDInterp(b, c, t);
|
||||
return SkDInterp(ab, bc, t);
|
||||
}
|
||||
|
||||
static int coincident_line(const SkDQuad& quad, SkDQuad& reduction) {
|
||||
reduction[0] = reduction[1] = quad[0];
|
||||
return 1;
|
||||
|
@ -28,49 +22,19 @@ static int reductionLineCount(const SkDQuad& reduction) {
|
|||
return 1 + !reduction[0].approximatelyEqual(reduction[1]);
|
||||
}
|
||||
|
||||
static int vertical_line(const SkDQuad& quad, SkReduceOrder::Style reduceStyle,
|
||||
SkDQuad& reduction) {
|
||||
double tValue;
|
||||
static int vertical_line(const SkDQuad& quad, SkDQuad& reduction) {
|
||||
reduction[0] = quad[0];
|
||||
reduction[1] = quad[2];
|
||||
if (reduceStyle == SkReduceOrder::kFill_Style) {
|
||||
return reductionLineCount(reduction);
|
||||
}
|
||||
int smaller = reduction[1].fY > reduction[0].fY;
|
||||
int larger = smaller ^ 1;
|
||||
if (SkDQuad::FindExtrema(quad[0].fY, quad[1].fY, quad[2].fY, &tValue)) {
|
||||
double yExtrema = interp_quad_coords(quad[0].fY, quad[1].fY, quad[2].fY, tValue);
|
||||
if (reduction[smaller].fY > yExtrema) {
|
||||
reduction[smaller].fY = yExtrema;
|
||||
} else if (reduction[larger].fY < yExtrema) {
|
||||
reduction[larger].fY = yExtrema;
|
||||
}
|
||||
}
|
||||
return reductionLineCount(reduction);
|
||||
}
|
||||
|
||||
static int horizontal_line(const SkDQuad& quad, SkReduceOrder::Style reduceStyle,
|
||||
SkDQuad& reduction) {
|
||||
double tValue;
|
||||
static int horizontal_line(const SkDQuad& quad, SkDQuad& reduction) {
|
||||
reduction[0] = quad[0];
|
||||
reduction[1] = quad[2];
|
||||
if (reduceStyle == SkReduceOrder::kFill_Style) {
|
||||
return reductionLineCount(reduction);
|
||||
}
|
||||
int smaller = reduction[1].fX > reduction[0].fX;
|
||||
int larger = smaller ^ 1;
|
||||
if (SkDQuad::FindExtrema(quad[0].fX, quad[1].fX, quad[2].fX, &tValue)) {
|
||||
double xExtrema = interp_quad_coords(quad[0].fX, quad[1].fX, quad[2].fX, tValue);
|
||||
if (reduction[smaller].fX > xExtrema) {
|
||||
reduction[smaller].fX = xExtrema;
|
||||
} else if (reduction[larger].fX < xExtrema) {
|
||||
reduction[larger].fX = xExtrema;
|
||||
}
|
||||
}
|
||||
return reductionLineCount(reduction);
|
||||
}
|
||||
|
||||
static int check_linear(const SkDQuad& quad, SkReduceOrder::Style reduceStyle,
|
||||
static int check_linear(const SkDQuad& quad,
|
||||
int minX, int maxX, int minY, int maxY, SkDQuad& reduction) {
|
||||
int startIndex = 0;
|
||||
int endIndex = 2;
|
||||
|
@ -87,47 +51,6 @@ static int check_linear(const SkDQuad& quad, SkReduceOrder::Style reduceStyle,
|
|||
// four are colinear: return line formed by outside
|
||||
reduction[0] = quad[0];
|
||||
reduction[1] = quad[2];
|
||||
if (reduceStyle == SkReduceOrder::kFill_Style) {
|
||||
return reductionLineCount(reduction);
|
||||
}
|
||||
int sameSide;
|
||||
bool useX = quad[maxX].fX - quad[minX].fX >= quad[maxY].fY - quad[minY].fY;
|
||||
if (useX) {
|
||||
sameSide = SkDSign(quad[0].fX - quad[1].fX) + SkDSign(quad[2].fX - quad[1].fX);
|
||||
} else {
|
||||
sameSide = SkDSign(quad[0].fY - quad[1].fY) + SkDSign(quad[2].fY - quad[1].fY);
|
||||
}
|
||||
if ((sameSide & 3) != 2) {
|
||||
return reductionLineCount(reduction);
|
||||
}
|
||||
double tValue;
|
||||
int root;
|
||||
if (useX) {
|
||||
root = SkDQuad::FindExtrema(quad[0].fX, quad[1].fX, quad[2].fX, &tValue);
|
||||
} else {
|
||||
root = SkDQuad::FindExtrema(quad[0].fY, quad[1].fY, quad[2].fY, &tValue);
|
||||
}
|
||||
if (root) {
|
||||
SkDPoint extrema;
|
||||
extrema.fX = interp_quad_coords(quad[0].fX, quad[1].fX, quad[2].fX, tValue);
|
||||
extrema.fY = interp_quad_coords(quad[0].fY, quad[1].fY, quad[2].fY, tValue);
|
||||
// sameSide > 0 means mid is smaller than either [0] or [2], so replace smaller
|
||||
int replace;
|
||||
if (useX) {
|
||||
if ((extrema.fX < quad[0].fX) ^ (extrema.fX < quad[2].fX)) {
|
||||
return reductionLineCount(reduction);
|
||||
}
|
||||
replace = ((extrema.fX < quad[0].fX) | (extrema.fX < quad[2].fX))
|
||||
^ (quad[0].fX < quad[2].fX);
|
||||
} else {
|
||||
if ((extrema.fY < quad[0].fY) ^ (extrema.fY < quad[2].fY)) {
|
||||
return reductionLineCount(reduction);
|
||||
}
|
||||
replace = ((extrema.fY < quad[0].fY) | (extrema.fY < quad[2].fY))
|
||||
^ (quad[0].fY < quad[2].fY);
|
||||
}
|
||||
reduction[replace] = extrema;
|
||||
}
|
||||
return reductionLineCount(reduction);
|
||||
}
|
||||
|
||||
|
@ -137,7 +60,7 @@ static int check_linear(const SkDQuad& quad, SkReduceOrder::Style reduceStyle,
|
|||
// note that three points in a line doesn't simplify a cubic
|
||||
// look for approximation with single quadratic
|
||||
// save approximation with multiple quadratics for later
|
||||
int SkReduceOrder::reduce(const SkDQuad& quad, Style reduceStyle) {
|
||||
int SkReduceOrder::reduce(const SkDQuad& quad) {
|
||||
int index, minX, maxX, minY, maxY;
|
||||
int minXSet, minYSet;
|
||||
minX = maxX = minY = maxY = 0;
|
||||
|
@ -168,12 +91,12 @@ int SkReduceOrder::reduce(const SkDQuad& quad, Style reduceStyle) {
|
|||
if (minYSet == 0x7) { // return 1 if all four are coincident
|
||||
return coincident_line(quad, fQuad);
|
||||
}
|
||||
return vertical_line(quad, reduceStyle, fQuad);
|
||||
return vertical_line(quad, fQuad);
|
||||
}
|
||||
if (minYSet == 0xF) { // test for horizontal line
|
||||
return horizontal_line(quad, reduceStyle, fQuad);
|
||||
return horizontal_line(quad, fQuad);
|
||||
}
|
||||
int result = check_linear(quad, reduceStyle, minX, maxX, minY, maxY, fQuad);
|
||||
int result = check_linear(quad, minX, maxX, minY, maxY, fQuad);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
|
@ -183,15 +106,6 @@ int SkReduceOrder::reduce(const SkDQuad& quad, Style reduceStyle) {
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
static double interp_cubic_coords(const double* src, double t) {
|
||||
double ab = SkDInterp(src[0], src[2], t);
|
||||
double bc = SkDInterp(src[2], src[4], t);
|
||||
double cd = SkDInterp(src[4], src[6], t);
|
||||
double abc = SkDInterp(ab, bc, t);
|
||||
double bcd = SkDInterp(bc, cd, t);
|
||||
return SkDInterp(abc, bcd, t);
|
||||
}
|
||||
|
||||
static int coincident_line(const SkDCubic& cubic, SkDCubic& reduction) {
|
||||
reduction[0] = reduction[1] = cubic[0];
|
||||
return 1;
|
||||
|
@ -201,51 +115,15 @@ static int reductionLineCount(const SkDCubic& reduction) {
|
|||
return 1 + !reduction[0].approximatelyEqual(reduction[1]);
|
||||
}
|
||||
|
||||
static int vertical_line(const SkDCubic& cubic, SkReduceOrder::Style reduceStyle,
|
||||
SkDCubic& reduction) {
|
||||
double tValues[2];
|
||||
static int vertical_line(const SkDCubic& cubic, SkDCubic& reduction) {
|
||||
reduction[0] = cubic[0];
|
||||
reduction[1] = cubic[3];
|
||||
if (reduceStyle == SkReduceOrder::kFill_Style) {
|
||||
return reductionLineCount(reduction);
|
||||
}
|
||||
int smaller = reduction[1].fY > reduction[0].fY;
|
||||
int larger = smaller ^ 1;
|
||||
int roots = SkDCubic::FindExtrema(cubic[0].fY, cubic[1].fY, cubic[2].fY, cubic[3].fY, tValues);
|
||||
for (int index = 0; index < roots; ++index) {
|
||||
double yExtrema = interp_cubic_coords(&cubic[0].fY, tValues[index]);
|
||||
if (reduction[smaller].fY > yExtrema) {
|
||||
reduction[smaller].fY = yExtrema;
|
||||
continue;
|
||||
}
|
||||
if (reduction[larger].fY < yExtrema) {
|
||||
reduction[larger].fY = yExtrema;
|
||||
}
|
||||
}
|
||||
return reductionLineCount(reduction);
|
||||
}
|
||||
|
||||
static int horizontal_line(const SkDCubic& cubic, SkReduceOrder::Style reduceStyle,
|
||||
SkDCubic& reduction) {
|
||||
double tValues[2];
|
||||
static int horizontal_line(const SkDCubic& cubic, SkDCubic& reduction) {
|
||||
reduction[0] = cubic[0];
|
||||
reduction[1] = cubic[3];
|
||||
if (reduceStyle == SkReduceOrder::kFill_Style) {
|
||||
return reductionLineCount(reduction);
|
||||
}
|
||||
int smaller = reduction[1].fX > reduction[0].fX;
|
||||
int larger = smaller ^ 1;
|
||||
int roots = SkDCubic::FindExtrema(cubic[0].fX, cubic[1].fX, cubic[2].fX, cubic[3].fX, tValues);
|
||||
for (int index = 0; index < roots; ++index) {
|
||||
double xExtrema = interp_cubic_coords(&cubic[0].fX, tValues[index]);
|
||||
if (reduction[smaller].fX > xExtrema) {
|
||||
reduction[smaller].fX = xExtrema;
|
||||
continue;
|
||||
}
|
||||
if (reduction[larger].fX < xExtrema) {
|
||||
reduction[larger].fX = xExtrema;
|
||||
}
|
||||
}
|
||||
return reductionLineCount(reduction);
|
||||
}
|
||||
|
||||
|
@ -276,7 +154,7 @@ static int check_quadratic(const SkDCubic& cubic, SkDCubic& reduction) {
|
|||
return 3;
|
||||
}
|
||||
|
||||
static int check_linear(const SkDCubic& cubic, SkReduceOrder::Style reduceStyle,
|
||||
static int check_linear(const SkDCubic& cubic,
|
||||
int minX, int maxX, int minY, int maxY, SkDCubic& reduction) {
|
||||
int startIndex = 0;
|
||||
int endIndex = 3;
|
||||
|
@ -293,50 +171,6 @@ static int check_linear(const SkDCubic& cubic, SkReduceOrder::Style reduceStyle,
|
|||
// four are colinear: return line formed by outside
|
||||
reduction[0] = cubic[0];
|
||||
reduction[1] = cubic[3];
|
||||
if (reduceStyle == SkReduceOrder::kFill_Style) {
|
||||
return reductionLineCount(reduction);
|
||||
}
|
||||
int sameSide1;
|
||||
int sameSide2;
|
||||
bool useX = cubic[maxX].fX - cubic[minX].fX >= cubic[maxY].fY - cubic[minY].fY;
|
||||
if (useX) {
|
||||
sameSide1 = SkDSign(cubic[0].fX - cubic[1].fX) + SkDSign(cubic[3].fX - cubic[1].fX);
|
||||
sameSide2 = SkDSign(cubic[0].fX - cubic[2].fX) + SkDSign(cubic[3].fX - cubic[2].fX);
|
||||
} else {
|
||||
sameSide1 = SkDSign(cubic[0].fY - cubic[1].fY) + SkDSign(cubic[3].fY - cubic[1].fY);
|
||||
sameSide2 = SkDSign(cubic[0].fY - cubic[2].fY) + SkDSign(cubic[3].fY - cubic[2].fY);
|
||||
}
|
||||
if (sameSide1 == sameSide2 && (sameSide1 & 3) != 2) {
|
||||
return reductionLineCount(reduction);
|
||||
}
|
||||
double tValues[2];
|
||||
int roots;
|
||||
if (useX) {
|
||||
roots = SkDCubic::FindExtrema(cubic[0].fX, cubic[1].fX, cubic[2].fX, cubic[3].fX, tValues);
|
||||
} else {
|
||||
roots = SkDCubic::FindExtrema(cubic[0].fY, cubic[1].fY, cubic[2].fY, cubic[3].fY, tValues);
|
||||
}
|
||||
for (int index = 0; index < roots; ++index) {
|
||||
SkDPoint extrema;
|
||||
extrema.fX = interp_cubic_coords(&cubic[0].fX, tValues[index]);
|
||||
extrema.fY = interp_cubic_coords(&cubic[0].fY, tValues[index]);
|
||||
// sameSide > 0 means mid is smaller than either [0] or [3], so replace smaller
|
||||
int replace;
|
||||
if (useX) {
|
||||
if ((extrema.fX < cubic[0].fX) ^ (extrema.fX < cubic[3].fX)) {
|
||||
continue;
|
||||
}
|
||||
replace = ((extrema.fX < cubic[0].fX) | (extrema.fX < cubic[3].fX))
|
||||
^ (cubic[0].fX < cubic[3].fX);
|
||||
} else {
|
||||
if ((extrema.fY < cubic[0].fY) ^ (extrema.fY < cubic[3].fY)) {
|
||||
continue;
|
||||
}
|
||||
replace = ((extrema.fY < cubic[0].fY) | (extrema.fY < cubic[3].fY))
|
||||
^ (cubic[0].fY < cubic[3].fY);
|
||||
}
|
||||
reduction[replace] = extrema;
|
||||
}
|
||||
return reductionLineCount(reduction);
|
||||
}
|
||||
|
||||
|
@ -366,8 +200,7 @@ http://kaba.hilvi.org
|
|||
// note that three points in a line doesn't simplify a cubic
|
||||
// look for approximation with single quadratic
|
||||
// save approximation with multiple quadratics for later
|
||||
int SkReduceOrder::reduce(const SkDCubic& cubic, Quadratics allowQuadratics,
|
||||
Style reduceStyle) {
|
||||
int SkReduceOrder::reduce(const SkDCubic& cubic, Quadratics allowQuadratics) {
|
||||
int index, minX, maxX, minY, maxY;
|
||||
int minXSet, minYSet;
|
||||
minX = maxX = minY = maxY = 0;
|
||||
|
@ -408,12 +241,12 @@ int SkReduceOrder::reduce(const SkDCubic& cubic, Quadratics allowQuadratics,
|
|||
if (minYSet == 0xF) { // return 1 if all four are coincident
|
||||
return coincident_line(cubic, fCubic);
|
||||
}
|
||||
return vertical_line(cubic, reduceStyle, fCubic);
|
||||
return vertical_line(cubic, fCubic);
|
||||
}
|
||||
if (minYSet == 0xF) { // test for horizontal line
|
||||
return horizontal_line(cubic, reduceStyle, fCubic);
|
||||
return horizontal_line(cubic, fCubic);
|
||||
}
|
||||
int result = check_linear(cubic, reduceStyle, minX, maxX, minY, maxY, fCubic);
|
||||
int result = check_linear(cubic, minX, maxX, minY, maxY, fCubic);
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
|
@ -429,7 +262,7 @@ SkPath::Verb SkReduceOrder::Quad(const SkPoint a[3], SkPoint* reducePts) {
|
|||
SkDQuad quad;
|
||||
quad.set(a);
|
||||
SkReduceOrder reducer;
|
||||
int order = reducer.reduce(quad, kFill_Style);
|
||||
int order = reducer.reduce(quad);
|
||||
if (order == 2) { // quad became line
|
||||
for (int index = 0; index < order; ++index) {
|
||||
*reducePts++ = reducer.fLine[index].asSkPoint();
|
||||
|
@ -442,7 +275,7 @@ SkPath::Verb SkReduceOrder::Cubic(const SkPoint a[4], SkPoint* reducePts) {
|
|||
SkDCubic cubic;
|
||||
cubic.set(a);
|
||||
SkReduceOrder reducer;
|
||||
int order = reducer.reduce(cubic, kAllow_Quadratics, kFill_Style);
|
||||
int order = reducer.reduce(cubic, kAllow_Quadratics);
|
||||
if (order == 2 || order == 3) { // cubic became line or quad
|
||||
for (int index = 0; index < order; ++index) {
|
||||
*reducePts++ = reducer.fQuad[index].asSkPoint();
|
||||
|
|
|
@ -18,14 +18,10 @@ union SkReduceOrder {
|
|||
kNo_Quadratics,
|
||||
kAllow_Quadratics
|
||||
};
|
||||
enum Style {
|
||||
kStroke_Style,
|
||||
kFill_Style
|
||||
};
|
||||
|
||||
int reduce(const SkDCubic& cubic, Quadratics, Style);
|
||||
int reduce(const SkDCubic& cubic, Quadratics);
|
||||
int reduce(const SkDLine& line);
|
||||
int reduce(const SkDQuad& quad, Style);
|
||||
int reduce(const SkDQuad& quad);
|
||||
|
||||
static SkPath::Verb Cubic(const SkPoint pts[4], SkPoint* reducePts);
|
||||
static SkPath::Verb Quad(const SkPoint pts[3], SkPoint* reducePts);
|
||||
|
|
|
@ -19,10 +19,8 @@ static void standardTestCases(skiatest::Reporter* reporter) {
|
|||
const SkDCubic& cubic1 = tests[index][0];
|
||||
const SkDCubic& cubic2 = tests[index][1];
|
||||
SkReduceOrder reduce1, reduce2;
|
||||
int order1 = reduce1.reduce(cubic1, SkReduceOrder::kNo_Quadratics,
|
||||
SkReduceOrder::kFill_Style);
|
||||
int order2 = reduce2.reduce(cubic2, SkReduceOrder::kNo_Quadratics,
|
||||
SkReduceOrder::kFill_Style);
|
||||
int order1 = reduce1.reduce(cubic1, SkReduceOrder::kNo_Quadratics);
|
||||
int order2 = reduce2.reduce(cubic2, SkReduceOrder::kNo_Quadratics);
|
||||
const bool showSkipped = false;
|
||||
if (order1 < 4) {
|
||||
if (showSkipped) {
|
||||
|
|
|
@ -49,8 +49,7 @@ static void testOne(skiatest::Reporter* reporter, int iIndex) {
|
|||
SkASSERT(ValidLine(line));
|
||||
SkReduceOrder reduce1;
|
||||
SkReduceOrder reduce2;
|
||||
int order1 = reduce1.reduce(cubic, SkReduceOrder::kNo_Quadratics,
|
||||
SkReduceOrder::kFill_Style);
|
||||
int order1 = reduce1.reduce(cubic, SkReduceOrder::kNo_Quadratics);
|
||||
int order2 = reduce2.reduce(line);
|
||||
if (order1 < 4) {
|
||||
SkDebugf("[%d] cubic order=%d\n", iIndex, order1);
|
||||
|
|
|
@ -59,9 +59,8 @@ static void PathOpsCubicQuadIntersectionTest(skiatest::Reporter* reporter) {
|
|||
SkASSERT(ValidQuad(quad));
|
||||
SkReduceOrder reduce1;
|
||||
SkReduceOrder reduce2;
|
||||
int order1 = reduce1.reduce(cubic, SkReduceOrder::kNo_Quadratics,
|
||||
SkReduceOrder::kFill_Style);
|
||||
int order2 = reduce2.reduce(quad, SkReduceOrder::kFill_Style);
|
||||
int order1 = reduce1.reduce(cubic, SkReduceOrder::kNo_Quadratics);
|
||||
int order2 = reduce2.reduce(quad);
|
||||
if (order1 != 4) {
|
||||
SkDebugf("[%d] cubic order=%d\n", iIndex, order1);
|
||||
REPORTER_ASSERT(reporter, 0);
|
||||
|
|
|
@ -98,13 +98,14 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
|
|||
? firstTestIndex : SK_MaxS32;
|
||||
int firstQuadraticModLineTest = run == RunAll ? 0 : run == RunQuadraticModLines
|
||||
? firstTestIndex : SK_MaxS32;
|
||||
#if 0
|
||||
int firstComputedLinesTest = run == RunAll ? 0 : run == RunComputedLines
|
||||
? firstTestIndex : SK_MaxS32;
|
||||
|
||||
#endif
|
||||
for (index = firstPointDegeneratesTest; index < pointDegenerates_count; ++index) {
|
||||
const SkDCubic& cubic = pointDegenerates[index];
|
||||
SkASSERT(ValidCubic(cubic));
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
|
||||
if (order != 1) {
|
||||
SkDebugf("[%d] pointDegenerates order=%d\n", static_cast<int>(index), order);
|
||||
REPORTER_ASSERT(reporter, 0);
|
||||
|
@ -113,18 +114,17 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
|
|||
for (index = firstNotPointDegeneratesTest; index < notPointDegenerates_count; ++index) {
|
||||
const SkDCubic& cubic = notPointDegenerates[index];
|
||||
SkASSERT(ValidCubic(cubic));
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
|
||||
if (order == 1) {
|
||||
SkDebugf("[%d] notPointDegenerates order=%d\n", static_cast<int>(index), order);
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics,
|
||||
SkReduceOrder::kFill_Style);
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
|
||||
REPORTER_ASSERT(reporter, 0);
|
||||
}
|
||||
}
|
||||
for (index = firstLinesTest; index < lines_count; ++index) {
|
||||
const SkDCubic& cubic = lines[index];
|
||||
SkASSERT(ValidCubic(cubic));
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
|
||||
if (order != 2) {
|
||||
SkDebugf("[%d] lines order=%d\n", static_cast<int>(index), order);
|
||||
REPORTER_ASSERT(reporter, 0);
|
||||
|
@ -133,7 +133,7 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
|
|||
for (index = firstNotLinesTest; index < notLines_count; ++index) {
|
||||
const SkDCubic& cubic = notLines[index];
|
||||
SkASSERT(ValidCubic(cubic));
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
|
||||
if (order == 2) {
|
||||
SkDebugf("[%d] notLines order=%d\n", static_cast<int>(index), order);
|
||||
REPORTER_ASSERT(reporter, 0);
|
||||
|
@ -142,7 +142,7 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
|
|||
for (index = firstModEpsilonTest; index < modEpsilonLines_count; ++index) {
|
||||
const SkDCubic& cubic = modEpsilonLines[index];
|
||||
SkASSERT(ValidCubic(cubic));
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
|
||||
if (order == 2) {
|
||||
SkDebugf("[%d] line mod by epsilon order=%d\n", static_cast<int>(index), order);
|
||||
REPORTER_ASSERT(reporter, 0);
|
||||
|
@ -151,18 +151,17 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
|
|||
for (index = firstLessEpsilonTest; index < lessEpsilonLines_count; ++index) {
|
||||
const SkDCubic& cubic = lessEpsilonLines[index];
|
||||
SkASSERT(ValidCubic(cubic));
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
|
||||
if (order != 2) {
|
||||
SkDebugf("[%d] line less by epsilon/2 order=%d\n", static_cast<int>(index), order);
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics,
|
||||
SkReduceOrder::kFill_Style);
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
|
||||
REPORTER_ASSERT(reporter, 0);
|
||||
}
|
||||
}
|
||||
for (index = firstNegEpsilonTest; index < negEpsilonLines_count; ++index) {
|
||||
const SkDCubic& cubic = negEpsilonLines[index];
|
||||
SkASSERT(ValidCubic(cubic));
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
|
||||
if (order != 2) {
|
||||
SkDebugf("[%d] line neg by epsilon/2 order=%d\n", static_cast<int>(index), order);
|
||||
REPORTER_ASSERT(reporter, 0);
|
||||
|
@ -172,7 +171,7 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
|
|||
const SkDQuad& quad = quadraticPoints[index];
|
||||
SkASSERT(ValidQuad(quad));
|
||||
SkDCubic cubic = quad.toCubic();
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
|
||||
if (order != 1) {
|
||||
SkDebugf("[%d] point quad order=%d\n", static_cast<int>(index), order);
|
||||
REPORTER_ASSERT(reporter, 0);
|
||||
|
@ -182,7 +181,7 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
|
|||
const SkDQuad& quad = quadraticLines[index];
|
||||
SkASSERT(ValidQuad(quad));
|
||||
SkDCubic cubic = quad.toCubic();
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
|
||||
if (order != 2) {
|
||||
SkDebugf("[%d] line quad order=%d\n", static_cast<int>(index), order);
|
||||
REPORTER_ASSERT(reporter, 0);
|
||||
|
@ -192,14 +191,15 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
|
|||
const SkDQuad& quad = quadraticModEpsilonLines[index];
|
||||
SkASSERT(ValidQuad(quad));
|
||||
SkDCubic cubic = quad.toCubic();
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics, SkReduceOrder::kFill_Style);
|
||||
order = reducer.reduce(cubic, SkReduceOrder::kAllow_Quadratics);
|
||||
if (order != 3) {
|
||||
SkDebugf("[%d] line mod quad order=%d\n", static_cast<int>(index), order);
|
||||
REPORTER_ASSERT(reporter, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// test if computed line end points are valid
|
||||
#if 0 // disable test until stroke reduction is supported
|
||||
// test if computed line end points are valid
|
||||
for (index = firstComputedLinesTest; index < lines_count; ++index) {
|
||||
const SkDCubic& cubic = lines[index];
|
||||
SkASSERT(ValidCubic(cubic));
|
||||
|
@ -236,6 +236,7 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#include "TestClassDef.h"
|
||||
|
|
|
@ -19,8 +19,8 @@ static void standardTestCases(skiatest::Reporter* reporter) {
|
|||
const SkDQuad& quad2 = quadraticTests[index][1];
|
||||
SkASSERT(ValidQuad(quad2));
|
||||
SkReduceOrder reduce1, reduce2;
|
||||
int order1 = reduce1.reduce(quad1, SkReduceOrder::kFill_Style);
|
||||
int order2 = reduce2.reduce(quad2, SkReduceOrder::kFill_Style);
|
||||
int order1 = reduce1.reduce(quad1);
|
||||
int order2 = reduce2.reduce(quad2);
|
||||
if (order1 < 3) {
|
||||
if (showSkipped) {
|
||||
SkDebugf("[%d] quad1 order=%d\n", static_cast<int>(index), order1);
|
||||
|
|
|
@ -109,7 +109,7 @@ static void PathOpsQuadLineIntersectionTest(skiatest::Reporter* reporter) {
|
|||
const SkDLine& line = lineQuadTests[index].line;
|
||||
SkASSERT(ValidLine(line));
|
||||
SkReduceOrder reducer1, reducer2;
|
||||
int order1 = reducer1.reduce(quad, SkReduceOrder::kFill_Style);
|
||||
int order1 = reducer1.reduce(quad);
|
||||
int order2 = reducer2.reduce(line);
|
||||
if (order1 < 3) {
|
||||
SkDebugf("%s [%d] quad order=%d\n", __FUNCTION__, iIndex, order1);
|
||||
|
|
|
@ -84,7 +84,7 @@ static void testQuadLineIntersectMain(PathOpsThreadState* data)
|
|||
SkDQuad quad = {{{(double) ax, (double) ay}, {(double) bx, (double) by},
|
||||
{(double) cx, (double) cy}}};
|
||||
SkReduceOrder reducer;
|
||||
int order = reducer.reduce(quad, SkReduceOrder::kFill_Style);
|
||||
int order = reducer.reduce(quad);
|
||||
if (order < 3) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ static void oneOffTest(skiatest::Reporter* reporter) {
|
|||
for (size_t index = 0; index < testSetCount; ++index) {
|
||||
const SkDQuad& quad = testSet[index];
|
||||
SkReduceOrder reducer;
|
||||
SkDEBUGCODE(int result = ) reducer.reduce(quad, SkReduceOrder::kFill_Style);
|
||||
SkDEBUGCODE(int result = ) reducer.reduce(quad);
|
||||
SkASSERT(result == 3);
|
||||
}
|
||||
}
|
||||
|
@ -48,14 +48,14 @@ static void standardTestCases(skiatest::Reporter* reporter) {
|
|||
|
||||
for (index = firstQuadraticLineTest; index < quadraticLines_count; ++index) {
|
||||
const SkDQuad& quad = quadraticLines[index];
|
||||
order = reducer.reduce(quad, SkReduceOrder::kFill_Style);
|
||||
order = reducer.reduce(quad);
|
||||
if (order != 2) {
|
||||
SkDebugf("[%d] line quad order=%d\n", (int) index, order);
|
||||
}
|
||||
}
|
||||
for (index = firstQuadraticModLineTest; index < quadraticModEpsilonLines_count; ++index) {
|
||||
const SkDQuad& quad = quadraticModEpsilonLines[index];
|
||||
order = reducer.reduce(quad, SkReduceOrder::kFill_Style);
|
||||
order = reducer.reduce(quad);
|
||||
if (order != 3) {
|
||||
SkDebugf("[%d] line mod quad order=%d\n", (int) index, order);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче