Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/pathops/SkPathOpsDebug.cpp

Issue 15338003: path ops -- rewrite angle sort (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/pathops/SkPathOpsDebug.h ('k') | src/pathops/SkPathOpsOp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 #include "SkPathOpsDebug.h" 8 #include "SkPathOpsDebug.h"
9 #include "SkPath.h" 9 #include "SkPath.h"
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 const char* kPathOpStr[] = {"diff", "sect", "union", "xor"}; 61 const char* kPathOpStr[] = {"diff", "sect", "union", "xor"};
62 #endif 62 #endif
63 63
64 #if DEBUG_SHOW_PATH 64 #if DEBUG_SHOW_PATH
65 static void showPathContours(SkPath::Iter& iter, const char* pathName) { 65 static void showPathContours(SkPath::Iter& iter, const char* pathName) {
66 uint8_t verb; 66 uint8_t verb;
67 SkPoint pts[4]; 67 SkPoint pts[4];
68 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { 68 while ((verb = iter.next(pts)) != SkPath::kDone_Verb) {
69 switch (verb) { 69 switch (verb) {
70 case SkPath::kMove_Verb: 70 case SkPath::kMove_Verb:
71 SkDebugf("%s.moveTo(%#1.9gf, %#1.9gf);\n", pathName, pts[0].fX, pts[0].fY); 71 SkDebugf(" %s.moveTo(%#1.9gf, %#1.9gf);\n", pathName, pts[0]. fX, pts[0].fY);
72 continue; 72 continue;
73 case SkPath::kLine_Verb: 73 case SkPath::kLine_Verb:
74 SkDebugf("%s.lineTo(%#1.9gf, %#1.9gf);\n", pathName, pts[1].fX, pts[1].fY); 74 SkDebugf(" %s.lineTo(%#1.9gf, %#1.9gf);\n", pathName, pts[1]. fX, pts[1].fY);
75 break; 75 break;
76 case SkPath::kQuad_Verb: 76 case SkPath::kQuad_Verb:
77 SkDebugf("%s.quadTo(%#1.9gf, %#1.9gf, %#1.9gf, %#1.9gf);\n", pat hName, 77 SkDebugf(" %s.quadTo(%#1.9gf, %#1.9gf, %#1.9gf, %#1.9gf);\n", pathName,
78 pts[1].fX, pts[1].fY, pts[2].fX, pts[2].fY); 78 pts[1].fX, pts[1].fY, pts[2].fX, pts[2].fY);
79 break; 79 break;
80 case SkPath::kCubic_Verb: 80 case SkPath::kCubic_Verb:
81 SkDebugf("%s.cubicTo(%#1.9gf, %#1.9gf, %#1.9gf, %#1.9gf, %#1.9gf , %#1.9gf);\n", 81 SkDebugf(" %s.cubicTo(%#1.9gf, %#1.9gf, %#1.9gf, %#1.9gf, %#1 .9gf, %#1.9gf);\n",
82 pathName, pts[1].fX, pts[1].fY, pts[2].fX, pts[2].fY, pts[3] .fX, pts[3].fY); 82 pathName, pts[1].fX, pts[1].fY, pts[2].fX, pts[2].fY, pts[3] .fX, pts[3].fY);
83 break; 83 break;
84 case SkPath::kClose_Verb: 84 case SkPath::kClose_Verb:
85 SkDebugf("%s.close();\n", pathName); 85 SkDebugf(" %s.close();\n", pathName);
86 break; 86 break;
87 default: 87 default:
88 SkDEBUGFAIL("bad verb"); 88 SkDEBUGFAIL("bad verb");
89 return; 89 return;
90 } 90 }
91 } 91 }
92 } 92 }
93 93
94 static const char* gFillTypeStr[] = { 94 static const char* gFillTypeStr[] = {
95 "kWinding_FillType", 95 "kWinding_FillType",
96 "kEvenOdd_FillType", 96 "kEvenOdd_FillType",
97 "kInverseWinding_FillType", 97 "kInverseWinding_FillType",
98 "kInverseEvenOdd_FillType" 98 "kInverseEvenOdd_FillType"
99 }; 99 };
100 100
101
102 void ShowFunctionHeader() {
103 SkDebugf("\nstatic void test#(skiatest::Reporter* reporter) {\n");
104 }
105
101 void ShowPath(const SkPath& path, const char* pathName) { 106 void ShowPath(const SkPath& path, const char* pathName) {
102 SkPath::Iter iter(path, true); 107 SkPath::Iter iter(path, true);
103 SkPath::FillType fillType = path.getFillType(); 108 SkPath::FillType fillType = path.getFillType();
104 SkASSERT(fillType >= SkPath::kWinding_FillType && fillType <= SkPath::kInver seEvenOdd_FillType); 109 SkASSERT(fillType >= SkPath::kWinding_FillType && fillType <= SkPath::kInver seEvenOdd_FillType);
105 SkDebugf("SkPath %s;\n", pathName); 110 SkDebugf(" SkPath %s;\n", pathName);
106 SkDebugf("%s.setFillType(SkPath::%s);\n", pathName, gFillTypeStr[fillType]); 111 SkDebugf(" %s.setFillType(SkPath::%s);\n", pathName, gFillTypeStr[fillTyp e]);
107 iter.setPath(path, true); 112 iter.setPath(path, true);
108 showPathContours(iter, pathName); 113 showPathContours(iter, pathName);
109 } 114 }
110 115
111 static const char* gOpStrs[] = { 116 static const char* gOpStrs[] = {
112 "kDifference_PathOp", 117 "kDifference_PathOp",
113 "kIntersect_PathOp", 118 "kIntersect_PathOp",
114 "kUnion_PathOp", 119 "kUnion_PathOp",
115 "kXor_PathOp", 120 "kXor_PathOp",
116 "kReverseDifference_PathOp", 121 "kReverseDifference_PathOp",
117 }; 122 };
118 123
119 void ShowOp(SkPathOp op, const char* pathOne, const char* pathTwo) { 124 void ShowOp(SkPathOp op, const char* pathOne, const char* pathTwo) {
120 SkDebugf("SkPath result;\n"); 125 SkDebugf(" testPathOp(reporter, %s, %s, %s);\n", pathOne, pathTwo, gOpStr s[op]);
121 SkDebugf("bool success = Op(%s, %s, %s, &result);\n", pathOne, pathTwo, gOpS trs[op]); 126 SkDebugf("}\n");
122 SkDebugf("SkASSERT(success);\n");
123 } 127 }
124 #endif 128 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsDebug.h ('k') | src/pathops/SkPathOpsOp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698