aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PathOpsExtendedTest.cpp
diff options
context:
space:
mode:
authorGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-25 11:51:54 +0000
committerGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-25 11:51:54 +0000
commit6dc7df69ae6b24c90d231e0d6a4516bf4f1aee2e (patch)
treef4e88f8eb29a84c72044c211da6d0dd9c5b87db7 /tests/PathOpsExtendedTest.cpp
parent83f0d302e8eaa054d0b20303131f953181dd4f47 (diff)
path ops : fix empty-diff bug, op-in-place
add some debugging around reverse diff, inverse Review URL: https://codereview.chromium.org/13851015 git-svn-id: http://skia.googlecode.com/svn/trunk@8852 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/PathOpsExtendedTest.cpp')
-rw-r--r--tests/PathOpsExtendedTest.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp
index c5dbceb0f3..4626454ac1 100644
--- a/tests/PathOpsExtendedTest.cpp
+++ b/tests/PathOpsExtendedTest.cpp
@@ -29,6 +29,7 @@ static const char* opStrs[] = {
"kIntersect_PathOp",
"kUnion_PathOp",
"kXor_PathOp",
+ "kReverseDifference_PathOp",
};
static const char* opSuffixes[] = {
@@ -43,7 +44,7 @@ static bool gComparePaths = true;
static bool gComparePathsAssert = true;
static bool gPathStrAssert = true;
-static void showPathContour(SkPath::Iter& iter) {
+static void showPathContours(SkPath::Iter& iter) {
uint8_t verb;
SkPoint pts[4];
while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
@@ -77,6 +78,13 @@ void showPath(const SkPath& path, const char* str) {
showPath(path);
}
+const char* fillTypeStr[] = {
+ "kWinding_FillType",
+ "kEvenOdd_FillType",
+ "kInverseWinding_FillType",
+ "kInverseEvenOdd_FillType"
+};
+
void showPath(const SkPath& path) {
SkPath::Iter iter(path, true);
#define SUPPORT_RECT_CONTOUR_DETECTION 0
@@ -97,8 +105,11 @@ void showPath(const SkPath& path) {
return;
}
#endif
+ SkPath::FillType fillType = path.getFillType();
+ SkASSERT(fillType >= SkPath::kWinding_FillType && fillType <= SkPath::kInverseEvenOdd_FillType);
+ SkDebugf("path.setFillType(%s);\n", fillTypeStr[fillType]);
iter.setPath(path, true);
- showPathContour(iter);
+ showPathContours(iter);
}
void showPathData(const SkPath& path) {
@@ -145,6 +156,9 @@ void showOp(const SkPathOp op) {
case kXOR_PathOp:
SkDebugf("op xor\n");
break;
+ case kReverseDifference_PathOp:
+ SkDebugf("op reverse difference\n");
+ break;
default:
SkASSERT(0);
}
@@ -356,10 +370,13 @@ static int comparePaths(skiatest::Reporter* reporter, const SkPath& one, const S
int errors2x2;
int errors = pathsDrawTheSame(bitmap, scaledOne, scaledTwo, errors2x2);
if (errors2x2 == 0) {
+ if (gShowPath) {
+ showPathOpPath(one, two, a, b, scaledOne, scaledTwo, shapeOp, scale);
+ }
return 0;
}
const int MAX_ERRORS = 8;
- if (errors2x2 == MAX_ERRORS || errors2x2 == MAX_ERRORS - 1) {
+ if (gShowPath || errors2x2 == MAX_ERRORS || errors2x2 == MAX_ERRORS - 1) {
showPathOpPath(one, two, a, b, scaledOne, scaledTwo, shapeOp, scale);
}
if (errors2x2 > MAX_ERRORS && gComparePathsAssert) {