OLD | NEW |
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 #ifndef SkPathOpsDebug_DEFINED | 7 #ifndef SkPathOpsDebug_DEFINED |
8 #define SkPathOpsDebug_DEFINED | 8 #define SkPathOpsDebug_DEFINED |
9 | 9 |
10 #include "SkPathOps.h" | 10 #include "SkPathOps.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #define SK_RAND(seed) rand() | 24 #define SK_RAND(seed) rand() |
25 #else | 25 #else |
26 #define SK_RAND(seed) rand_r(&seed) | 26 #define SK_RAND(seed) rand_r(&seed) |
27 #endif | 27 #endif |
28 #ifdef SK_BUILD_FOR_WIN | 28 #ifdef SK_BUILD_FOR_WIN |
29 #define SK_SNPRINTF _snprintf | 29 #define SK_SNPRINTF _snprintf |
30 #else | 30 #else |
31 #define SK_SNPRINTF snprintf | 31 #define SK_SNPRINTF snprintf |
32 #endif | 32 #endif |
33 | 33 |
| 34 #define WIND_AS_STRING(x) char x##Str[12]; \ |
| 35 if (!SkPathOpsDebug::ValidWind(x)) strcpy(x##Str, "?"); \ |
| 36 else SK_SNPRINTF(x##Str, sizeof(x##Str), "%d", x) |
| 37 |
34 #if FORCE_RELEASE | 38 #if FORCE_RELEASE |
35 | 39 |
36 #define DEBUG_ACTIVE_OP 0 | 40 #define DEBUG_ACTIVE_OP 0 |
37 #define DEBUG_ACTIVE_SPANS 0 | 41 #define DEBUG_ACTIVE_SPANS 0 |
38 #define DEBUG_ACTIVE_SPANS_FIRST_ONLY 0 | 42 #define DEBUG_ACTIVE_SPANS_FIRST_ONLY 0 |
39 #define DEBUG_ACTIVE_SPANS_SHORT_FORM 1 | 43 #define DEBUG_ACTIVE_SPANS_SHORT_FORM 1 |
40 #define DEBUG_ADD_INTERSECTING_TS 0 | 44 #define DEBUG_ADD_INTERSECTING_TS 0 |
41 #define DEBUG_ADD_T_PAIR 0 | 45 #define DEBUG_ADD_T_PAIR 0 |
42 #define DEBUG_ANGLE 0 | 46 #define DEBUG_ANGLE 0 |
43 #define DEBUG_AS_C_CODE 1 | 47 #define DEBUG_AS_C_CODE 1 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 #define TX_DEBUG_STR(t) #t "[%d]=%1.9g" | 118 #define TX_DEBUG_STR(t) #t "[%d]=%1.9g" |
115 #define CUBIC_DEBUG_DATA(c) c[0].fX, c[0].fY, c[1].fX, c[1].fY, c[2].fX, c[2].fY
, c[3].fX, c[3].fY | 119 #define CUBIC_DEBUG_DATA(c) c[0].fX, c[0].fY, c[1].fX, c[1].fY, c[2].fX, c[2].fY
, c[3].fX, c[3].fY |
116 #define QUAD_DEBUG_DATA(q) q[0].fX, q[0].fY, q[1].fX, q[1].fY, q[2].fX, q[2].fY | 120 #define QUAD_DEBUG_DATA(q) q[0].fX, q[0].fY, q[1].fX, q[1].fY, q[2].fX, q[2].fY |
117 #define LINE_DEBUG_DATA(l) l[0].fX, l[0].fY, l[1].fX, l[1].fY | 121 #define LINE_DEBUG_DATA(l) l[0].fX, l[0].fY, l[1].fX, l[1].fY |
118 #define PT_DEBUG_DATA(i, n) i.pt(n).fX, i.pt(n).fY | 122 #define PT_DEBUG_DATA(i, n) i.pt(n).fX, i.pt(n).fY |
119 | 123 |
120 #ifndef DEBUG_TEST | 124 #ifndef DEBUG_TEST |
121 #define DEBUG_TEST 0 | 125 #define DEBUG_TEST 0 |
122 #endif | 126 #endif |
123 | 127 |
124 #if defined SK_DEBUG || !FORCE_RELEASE | |
125 | |
126 #if DEBUG_SHOW_TEST_NAME | 128 #if DEBUG_SHOW_TEST_NAME |
127 #include "SkTLS.h" | 129 #include "SkTLS.h" |
128 #endif | 130 #endif |
129 | 131 |
130 #include "SkTArray.h" | 132 #include "SkTArray.h" |
| 133 #include "SkTDArray.h" |
131 | 134 |
132 class SkPathOpsDebug { | 135 class SkPathOpsDebug { |
133 public: | 136 public: |
134 static int gMaxWindSum; | 137 static int gMaxWindSum; |
135 static int gMaxWindValue; | 138 static int gMaxWindValue; |
136 | 139 |
137 static const char* kLVerbStr[]; | 140 static const char* kLVerbStr[]; |
138 static int gContourID; | 141 static int gContourID; |
139 static int gSegmentID; | 142 static int gSegmentID; |
140 | 143 |
141 #if DEBUG_SORT || DEBUG_SWAP_TOP | 144 #if DEBUG_SORT || DEBUG_SWAP_TOP |
142 static int gSortCountDefault; | 145 static int gSortCountDefault; |
143 static int gSortCount; | 146 static int gSortCount; |
144 #endif | 147 #endif |
145 | 148 |
146 #if DEBUG_ACTIVE_OP | 149 #if DEBUG_ACTIVE_OP |
147 static const char* kPathOpStr[]; | 150 static const char* kPathOpStr[]; |
148 #endif | 151 #endif |
149 | 152 |
| 153 static bool ChaseContains(const SkTDArray<struct SkOpSpan *>& , const struct
SkOpSpan * ); |
150 static void MathematicaIze(char* str, size_t bufferSize); | 154 static void MathematicaIze(char* str, size_t bufferSize); |
151 static bool ValidWind(int winding); | 155 static bool ValidWind(int winding); |
152 static void WindingPrintf(int winding); | 156 static void WindingPrintf(int winding); |
153 | 157 |
154 #if DEBUG_SHOW_TEST_NAME | 158 #if DEBUG_SHOW_TEST_NAME |
155 static void* CreateNameStr(); | 159 static void* CreateNameStr(); |
156 static void DeleteNameStr(void* v); | 160 static void DeleteNameStr(void* v); |
157 #define DEBUG_FILENAME_STRING_LENGTH 64 | 161 #define DEBUG_FILENAME_STRING_LENGTH 64 |
158 #define DEBUG_FILENAME_STRING (reinterpret_cast<char* >(SkTLS::Get(SkPathOpsDebu
g::CreateNameStr, \ | 162 #define DEBUG_FILENAME_STRING (reinterpret_cast<char* >(SkTLS::Get(SkPathOpsDebu
g::CreateNameStr, \ |
159 SkPathOpsDebug::DeleteNameStr))) | 163 SkPathOpsDebug::DeleteNameStr))) |
160 static void BumpTestName(char* ); | 164 static void BumpTestName(char* ); |
| 165 #endif |
161 static void ShowPath(const SkPath& one, const SkPath& two, SkPathOp op, cons
t char* name); | 166 static void ShowPath(const SkPath& one, const SkPath& two, SkPathOp op, cons
t char* name); |
162 #endif | |
163 static void DumpAngles(const SkTArray<class SkOpAngle, true>& angles); | 167 static void DumpAngles(const SkTArray<class SkOpAngle, true>& angles); |
164 static void DumpAngles(const SkTArray<class SkOpAngle* , true>& angles); | 168 static void DumpAngles(const SkTArray<class SkOpAngle* , true>& angles); |
| 169 static void DumpContours(const SkTArray<class SkOpContour, true>& contours); |
| 170 static void DumpContours(const SkTArray<class SkOpContour* , true>& contours
); |
| 171 static void DumpContourAngles(const SkTArray<class SkOpContour, true>& conto
urs); |
| 172 static void DumpContourAngles(const SkTArray<class SkOpContour* , true>& con
tours); |
| 173 static void DumpContourPts(const SkTArray<class SkOpContour, true>& contours
); |
| 174 static void DumpContourPts(const SkTArray<class SkOpContour* , true>& contou
rs); |
| 175 static void DumpContourSpans(const SkTArray<class SkOpContour, true>& contou
rs); |
| 176 static void DumpContourSpans(const SkTArray<class SkOpContour* , true>& cont
ours); |
| 177 static void DumpSpans(const SkTDArray<struct SkOpSpan *>& ); |
| 178 static void DumpSpans(const SkTDArray<struct SkOpSpan *>* ); |
165 }; | 179 }; |
166 | 180 |
167 // shorthand for calling from debugger | 181 // shorthand for calling from debugger |
168 void Dump(const SkTArray<class SkOpAngle, true>& angles); | 182 void Dump(const SkTArray<class SkOpAngle, true>& angles); |
169 void Dump(const SkTArray<class SkOpAngle* , true>& angles); | 183 void Dump(const SkTArray<class SkOpAngle* , true>& angles); |
170 void Dump(const SkTArray<class SkOpAngle, true>* angles); | 184 void Dump(const SkTArray<class SkOpAngle, true>* angles); |
171 void Dump(const SkTArray<class SkOpAngle* , true>* angles); | 185 void Dump(const SkTArray<class SkOpAngle* , true>* angles); |
172 | 186 |
173 #endif // SK_DEBUG || !FORCE_RELEASE | 187 void Dump(const SkTArray<class SkOpContour, true>& contours); |
| 188 void Dump(const SkTArray<class SkOpContour* , true>& contours); |
| 189 void Dump(const SkTArray<class SkOpContour, true>* contours); |
| 190 void Dump(const SkTArray<class SkOpContour* , true>* contours); |
| 191 |
| 192 void Dump(const SkTDArray<SkOpSpan *>& chaseArray); |
| 193 void Dump(const SkTDArray<SkOpSpan *>* chaseArray); |
| 194 |
| 195 void DumpAngles(const SkTArray<class SkOpContour, true>& contours); |
| 196 void DumpAngles(const SkTArray<class SkOpContour* , true>& contours); |
| 197 void DumpAngles(const SkTArray<class SkOpContour, true>* contours); |
| 198 void DumpAngles(const SkTArray<class SkOpContour* , true>* contours); |
| 199 |
| 200 void DumpPts(const SkTArray<class SkOpContour, true>& contours); |
| 201 void DumpPts(const SkTArray<class SkOpContour* , true>& contours); |
| 202 void DumpPts(const SkTArray<class SkOpContour, true>* contours); |
| 203 void DumpPts(const SkTArray<class SkOpContour* , true>* contours); |
| 204 |
| 205 void DumpSpans(const SkTArray<class SkOpContour, true>& contours); |
| 206 void DumpSpans(const SkTArray<class SkOpContour* , true>& contours); |
| 207 void DumpSpans(const SkTArray<class SkOpContour, true>* contours); |
| 208 void DumpSpans(const SkTArray<class SkOpContour* , true>* contours); |
| 209 |
| 210 // generates tools/path_sorter.htm and path_visualizer.htm compatible data |
| 211 void DumpQ(const struct SkDQuad& quad1, const struct SkDQuad& quad2, int testNo)
; |
| 212 |
| 213 void DumpT(const struct SkDQuad& quad, double t); |
174 | 214 |
175 #endif | 215 #endif |
OLD | NEW |