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

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

Issue 21359002: path ops work in progress (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: remove space Created 7 years, 3 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/SkPathOpsLine.h » ('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
11 #if defined SK_DEBUG || !FORCE_RELEASE 11 #if defined SK_DEBUG || !FORCE_RELEASE
12 12
13 int gDebugMaxWindSum = SK_MaxS32; 13 int SkPathOpsDebug::gMaxWindSum = SK_MaxS32;
14 int gDebugMaxWindValue = SK_MaxS32; 14 int SkPathOpsDebug::gMaxWindValue = SK_MaxS32;
15 15
16 void mathematica_ize(char* str, size_t bufferLen) { 16 const char* SkPathOpsDebug::kLVerbStr[] = {"", "line", "quad", "cubic"};
17 int SkPathOpsDebug::gContourID;
18 int SkPathOpsDebug::gSegmentID;
19
20 #if DEBUG_SORT || DEBUG_SWAP_TOP
21 int SkPathOpsDebug::gSortCountDefault = SK_MaxS32;
22 int SkPathOpsDebug::gSortCount;
23 #endif
24
25 #if DEBUG_ACTIVE_OP
26 const char* SkPathOpsDebug::kPathOpStr[] = {"diff", "sect", "union", "xor"};
27 #endif
28
29 void SkPathOpsDebug::MathematicaIze(char* str, size_t bufferLen) {
17 size_t len = strlen(str); 30 size_t len = strlen(str);
18 bool num = false; 31 bool num = false;
19 for (size_t idx = 0; idx < len; ++idx) { 32 for (size_t idx = 0; idx < len; ++idx) {
20 if (num && str[idx] == 'e') { 33 if (num && str[idx] == 'e') {
21 if (len + 2 >= bufferLen) { 34 if (len + 2 >= bufferLen) {
22 return; 35 return;
23 } 36 }
24 memmove(&str[idx + 2], &str[idx + 1], len - idx); 37 memmove(&str[idx + 2], &str[idx + 1], len - idx);
25 str[idx] = '*'; 38 str[idx] = '*';
26 str[idx + 1] = '^'; 39 str[idx + 1] = '^';
27 ++len; 40 ++len;
28 } 41 }
29 num = str[idx] >= '0' && str[idx] <= '9'; 42 num = str[idx] >= '0' && str[idx] <= '9';
30 } 43 }
31 } 44 }
32 #endif
33 45
34 #if DEBUG_SORT || DEBUG_SWAP_TOP 46 bool SkPathOpsDebug::ValidWind(int wind) {
35 bool valid_wind(int wind) {
36 return wind > SK_MinS32 + 0xFFFF && wind < SK_MaxS32 - 0xFFFF; 47 return wind > SK_MinS32 + 0xFFFF && wind < SK_MaxS32 - 0xFFFF;
37 } 48 }
38 49
39 void winding_printf(int wind) { 50 void SkPathOpsDebug::WindingPrintf(int wind) {
40 if (wind == SK_MinS32) { 51 if (wind == SK_MinS32) {
41 SkDebugf("?"); 52 SkDebugf("?");
42 } else { 53 } else {
43 SkDebugf("%d", wind); 54 SkDebugf("%d", wind);
44 } 55 }
45 } 56 }
46 #endif
47
48 #if DEBUG_DUMP
49 const char* kLVerbStr[] = {"", "line", "quad", "cubic"};
50 // static const char* kUVerbStr[] = {"", "Line", "Quad", "Cubic"};
51 int gContourID;
52 int gSegmentID;
53 #endif
54
55 #if DEBUG_SORT || DEBUG_SWAP_TOP
56 int gDebugSortCountDefault = SK_MaxS32;
57 int gDebugSortCount;
58 #endif
59
60 #if DEBUG_ACTIVE_OP
61 const char* kPathOpStr[] = {"diff", "sect", "union", "xor"};
62 #endif
63 57
64 #if DEBUG_SHOW_TEST_NAME 58 #if DEBUG_SHOW_TEST_NAME
65 void* PathOpsDebugCreateNameStr() { 59 void* SkPathOpsDebug::CreateNameStr() {
66 return SkNEW_ARRAY(char, DEBUG_FILENAME_STRING_LENGTH); 60 return SkNEW_ARRAY(char, DEBUG_FILENAME_STRING_LENGTH);
67 } 61 }
68 62
69 void PathOpsDebugDeleteNameStr(void* v) { 63 void SkPathOpsDebug::DeleteNameStr(void* v) {
70 SkDELETE_ARRAY(reinterpret_cast<char* >(v)); 64 SkDELETE_ARRAY(reinterpret_cast<char* >(v));
71 } 65 }
72 66
73 void DebugBumpTestName(char* test) { 67 void SkPathOpsDebug::BumpTestName(char* test) {
74 char* num = test + strlen(test); 68 char* num = test + strlen(test);
75 while (num[-1] >= '0' && num[-1] <= '9') { 69 while (num[-1] >= '0' && num[-1] <= '9') {
76 --num; 70 --num;
77 } 71 }
78 if (num[0] == '\0') { 72 if (num[0] == '\0') {
79 return; 73 return;
80 } 74 }
81 int dec = atoi(num); 75 int dec = atoi(num);
82 if (dec == 0) { 76 if (dec == 0) {
83 return; 77 return;
84 } 78 }
85 ++dec; 79 ++dec;
86 SK_SNPRINTF(num, DEBUG_FILENAME_STRING_LENGTH - (num - test), "%d", dec); 80 SK_SNPRINTF(num, DEBUG_FILENAME_STRING_LENGTH - (num - test), "%d", dec);
87 } 81 }
88 #endif 82 #endif
83
84 #include "SkOpSegment.h"
85
86 void SkPathOpsDebug::DumpAngles(const SkTArray<SkOpAngle, true>& angles) {
87 int count = angles.count();
88 for (int index = 0; index < count; ++index) {
89 angles[index].dump();
90 }
91 }
92 #endif // SK_DEBUG || !FORCE_RELEASE
93
94 #ifdef SK_DEBUG
95 void SkOpSpan::dump() const {
96 SkDebugf("t=");
97 DebugDumpDouble(fT);
98 SkDebugf(" pt=");
99 SkDPoint::DumpSkPoint(fPt);
100 SkDebugf(" other.fID=%d", fOther->debugID());
101 SkDebugf(" [%d] otherT=", fOtherIndex);
102 DebugDumpDouble(fOtherT);
103 SkDebugf(" windSum=");
104 SkPathOpsDebug::WindingPrintf(fWindSum);
105 if (SkPathOpsDebug::ValidWind(fOppSum) || fOppValue != 0) {
106 SkDebugf(" oppSum=");
107 SkPathOpsDebug::WindingPrintf(fOppSum);
108 }
109 SkDebugf(" windValue=%d", fWindValue);
110 if (SkPathOpsDebug::ValidWind(fOppSum) || fOppValue != 0) {
111 SkDebugf(" oppValue=%d", fOppValue);
112 }
113 if (fDone) {
114 SkDebugf(" done");
115 }
116 if (fUnsortableStart) {
117 SkDebugf(" unsortable-start");
118 }
119 if (fUnsortableEnd) {
120 SkDebugf(" unsortable-end");
121 }
122 if (fTiny) {
123 SkDebugf(" tiny");
124 } else if (fSmall) {
125 SkDebugf(" small");
126 }
127 if (fLoop) {
128 SkDebugf(" loop");
129 }
130 if (fNear) {
131 SkDebugf(" near");
132 }
133 SkDebugf("\n");
134 }
135 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsDebug.h ('k') | src/pathops/SkPathOpsLine.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698