| 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 25 matching lines...) Expand all Loading... |
| 36 #define WIND_AS_STRING(x) char x##Str[12]; \ | 36 #define WIND_AS_STRING(x) char x##Str[12]; \ |
| 37 if (!SkPathOpsDebug::ValidWind(x)) strcpy(x##Str, "?"); \ | 37 if (!SkPathOpsDebug::ValidWind(x)) strcpy(x##Str, "?"); \ |
| 38 else SK_SNPRINTF(x##Str, sizeof(x##Str), "%d", x) | 38 else SK_SNPRINTF(x##Str, sizeof(x##Str), "%d", x) |
| 39 | 39 |
| 40 #if FORCE_RELEASE | 40 #if FORCE_RELEASE |
| 41 | 41 |
| 42 #define DEBUG_ACTIVE_OP 0 | 42 #define DEBUG_ACTIVE_OP 0 |
| 43 #define DEBUG_ACTIVE_SPANS 0 | 43 #define DEBUG_ACTIVE_SPANS 0 |
| 44 #define DEBUG_ADD_INTERSECTING_TS 0 | 44 #define DEBUG_ADD_INTERSECTING_TS 0 |
| 45 #define DEBUG_ADD_T 0 | 45 #define DEBUG_ADD_T 0 |
| 46 #define DEBUG_ALIGNMENT 0 |
| 46 #define DEBUG_ANGLE 0 | 47 #define DEBUG_ANGLE 0 |
| 47 #define DEBUG_ASSEMBLE 0 | 48 #define DEBUG_ASSEMBLE 0 |
| 49 #define DEBUG_COINCIDENCE 0 |
| 48 #define DEBUG_CUBIC_BINARY_SEARCH 0 | 50 #define DEBUG_CUBIC_BINARY_SEARCH 0 |
| 49 #define DEBUG_CUBIC_SPLIT 0 | 51 #define DEBUG_CUBIC_SPLIT 0 |
| 50 #define DEBUG_DUMP_SEGMENTS 0 | 52 #define DEBUG_DUMP_SEGMENTS 0 |
| 51 #define DEBUG_FLOW 0 | 53 #define DEBUG_FLOW 0 |
| 52 #define DEBUG_LIMIT_WIND_SUM 0 | 54 #define DEBUG_LIMIT_WIND_SUM 0 |
| 53 #define DEBUG_MARK_DONE 0 | 55 #define DEBUG_MARK_DONE 0 |
| 54 #define DEBUG_PATH_CONSTRUCTION 0 | 56 #define DEBUG_PATH_CONSTRUCTION 0 |
| 55 #define DEBUG_PERP 0 | 57 #define DEBUG_PERP 0 |
| 56 #define DEBUG_SHOW_TEST_NAME 0 | 58 #define DEBUG_SHOW_TEST_NAME 0 |
| 57 #define DEBUG_SORT 0 | 59 #define DEBUG_SORT 0 |
| 58 #define DEBUG_T_SECT 0 | 60 #define DEBUG_T_SECT 0 |
| 59 #define DEBUG_T_SECT_DUMP 0 | 61 #define DEBUG_T_SECT_DUMP 0 |
| 62 #define DEBUG_T_SECT_LOOP_COUNT 0 |
| 60 #define DEBUG_VALIDATE 0 | 63 #define DEBUG_VALIDATE 0 |
| 61 #define DEBUG_WINDING 0 | 64 #define DEBUG_WINDING 0 |
| 62 #define DEBUG_WINDING_AT_T 0 | 65 #define DEBUG_WINDING_AT_T 0 |
| 63 | 66 |
| 67 |
| 64 #else | 68 #else |
| 65 | 69 |
| 66 #define DEBUG_ACTIVE_OP 1 | 70 #define DEBUG_ACTIVE_OP 1 |
| 67 #define DEBUG_ACTIVE_SPANS 1 | 71 #define DEBUG_ACTIVE_SPANS 1 |
| 68 #define DEBUG_ADD_INTERSECTING_TS 1 | 72 #define DEBUG_ADD_INTERSECTING_TS 1 |
| 69 #define DEBUG_ADD_T 1 | 73 #define DEBUG_ADD_T 1 |
| 74 #define DEBUG_ALIGNMENT 0 |
| 70 #define DEBUG_ANGLE 1 | 75 #define DEBUG_ANGLE 1 |
| 71 #define DEBUG_ASSEMBLE 1 | 76 #define DEBUG_ASSEMBLE 1 |
| 77 #define DEBUG_COINCIDENCE 1 |
| 72 #define DEBUG_CUBIC_BINARY_SEARCH 0 | 78 #define DEBUG_CUBIC_BINARY_SEARCH 0 |
| 73 #define DEBUG_CUBIC_SPLIT 1 | 79 #define DEBUG_CUBIC_SPLIT 1 |
| 74 #define DEBUG_DUMP_SEGMENTS 1 | 80 #define DEBUG_DUMP_SEGMENTS 1 |
| 75 #define DEBUG_FLOW 1 | 81 #define DEBUG_FLOW 1 |
| 76 #define DEBUG_LIMIT_WIND_SUM 5 | 82 #define DEBUG_LIMIT_WIND_SUM 5 |
| 77 #define DEBUG_MARK_DONE 1 | 83 #define DEBUG_MARK_DONE 1 |
| 78 #define DEBUG_PATH_CONSTRUCTION 1 | 84 #define DEBUG_PATH_CONSTRUCTION 1 |
| 79 #define DEBUG_PERP 1 | 85 #define DEBUG_PERP 1 |
| 80 #define DEBUG_SHOW_TEST_NAME 1 | 86 #define DEBUG_SHOW_TEST_NAME 1 |
| 81 #define DEBUG_SORT 1 | 87 #define DEBUG_SORT 1 |
| 82 #define DEBUG_T_SECT 0 | 88 #define DEBUG_T_SECT 1 |
| 83 #define DEBUG_T_SECT_DUMP 0 | 89 #define DEBUG_T_SECT_DUMP 1 |
| 90 #define DEBUG_T_SECT_LOOP_COUNT 1 |
| 84 #define DEBUG_VALIDATE 1 | 91 #define DEBUG_VALIDATE 1 |
| 85 #define DEBUG_WINDING 1 | 92 #define DEBUG_WINDING 1 |
| 86 #define DEBUG_WINDING_AT_T 1 | 93 #define DEBUG_WINDING_AT_T 1 |
| 87 | 94 |
| 88 #endif | 95 #endif |
| 89 | 96 |
| 90 #ifdef SK_RELEASE | 97 #ifdef SK_RELEASE |
| 91 #define SkDEBUGRELEASE(a, b) b | 98 #define SkDEBUGRELEASE(a, b) b |
| 92 #define SkDEBUGPARAMS(...) | 99 #define SkDEBUGPARAMS(...) |
| 93 #define SkDEBUGCODE_(...) | 100 #define SkDEBUGCODE_(...) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 110 #else | 117 #else |
| 111 #define PATH_OPS_DEBUG_T_SECT_RELEASE(a, b) a | 118 #define PATH_OPS_DEBUG_T_SECT_RELEASE(a, b) a |
| 112 #define PATH_OPS_DEBUG_T_SECT_PARAMS(...) , __VA_ARGS__ | 119 #define PATH_OPS_DEBUG_T_SECT_PARAMS(...) , __VA_ARGS__ |
| 113 #define PATH_OPS_DEBUG_T_SECT_CODE(...) __VA_ARGS__ | 120 #define PATH_OPS_DEBUG_T_SECT_CODE(...) __VA_ARGS__ |
| 114 #endif | 121 #endif |
| 115 | 122 |
| 116 #if DEBUG_T_SECT_DUMP > 1 | 123 #if DEBUG_T_SECT_DUMP > 1 |
| 117 extern int gDumpTSectNum; | 124 extern int gDumpTSectNum; |
| 118 #endif | 125 #endif |
| 119 | 126 |
| 127 #if DEBUG_COINCIDENCE |
| 128 #define DEBUG_COINCIDENCE_HEALTH(contourList, id) \ |
| 129 SkPathOpsDebug::CheckHealth(contourList, id) |
| 130 #else |
| 131 #define DEBUG_COINCIDENCE_HEALTH(contourList, id) |
| 132 #endif |
| 133 |
| 120 #define CUBIC_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,
%1.9g}}}" | 134 #define CUBIC_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,
%1.9g}}}" |
| 121 #define CONIC_DEBUG_STR "{{{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}}, %1.9g
}" | 135 #define CONIC_DEBUG_STR "{{{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}}, %1.9g
}" |
| 122 #define QUAD_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}}" | 136 #define QUAD_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}}" |
| 123 #define LINE_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}}}" | 137 #define LINE_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}}}" |
| 124 #define PT_DEBUG_STR "{{%1.9g,%1.9g}}" | 138 #define PT_DEBUG_STR "{{%1.9g,%1.9g}}" |
| 125 | 139 |
| 126 #define T_DEBUG_STR(t, n) #t "[" #n "]=%1.9g" | 140 #define T_DEBUG_STR(t, n) #t "[" #n "]=%1.9g" |
| 127 #define TX_DEBUG_STR(t) #t "[%d]=%1.9g" | 141 #define TX_DEBUG_STR(t) #t "[%d]=%1.9g" |
| 128 #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 | 142 #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 |
| 129 #define CONIC_DEBUG_DATA(c, w) c[0].fX, c[0].fY, c[1].fX, c[1].fY, c[2].fX, c[2]
.fY, w | 143 #define CONIC_DEBUG_DATA(c, w) c[0].fX, c[0].fY, c[1].fX, c[1].fY, c[2].fX, c[2]
.fY, w |
| 130 #define QUAD_DEBUG_DATA(q) q[0].fX, q[0].fY, q[1].fX, q[1].fY, q[2].fX, q[2].fY | 144 #define QUAD_DEBUG_DATA(q) q[0].fX, q[0].fY, q[1].fX, q[1].fY, q[2].fX, q[2].fY |
| 131 #define LINE_DEBUG_DATA(l) l[0].fX, l[0].fY, l[1].fX, l[1].fY | 145 #define LINE_DEBUG_DATA(l) l[0].fX, l[0].fY, l[1].fX, l[1].fY |
| 132 #define PT_DEBUG_DATA(i, n) i.pt(n).asSkPoint().fX, i.pt(n).asSkPoint().fY | 146 #define PT_DEBUG_DATA(i, n) i.pt(n).asSkPoint().fX, i.pt(n).asSkPoint().fY |
| 133 | 147 |
| 134 #ifndef DEBUG_TEST | 148 #ifndef DEBUG_TEST |
| 135 #define DEBUG_TEST 0 | 149 #define DEBUG_TEST 0 |
| 136 #endif | 150 #endif |
| 137 | 151 |
| 138 #if DEBUG_SHOW_TEST_NAME | 152 #if DEBUG_SHOW_TEST_NAME |
| 139 #include "SkTLS.h" | 153 #include "SkTLS.h" |
| 140 #endif | 154 #endif |
| 141 | 155 |
| 142 class SkPathOpsDebug { | 156 class SkPathOpsDebug { |
| 143 public: | 157 public: |
| 144 static const char* kLVerbStr[]; | 158 static const char* kLVerbStr[]; |
| 159 struct GlitchLog; |
| 145 | 160 |
| 146 #if defined(SK_DEBUG) || !FORCE_RELEASE | 161 #if defined(SK_DEBUG) || !FORCE_RELEASE |
| 147 static int gContourID; | 162 static int gContourID; |
| 148 static int gSegmentID; | 163 static int gSegmentID; |
| 149 #endif | 164 #endif |
| 150 | 165 |
| 151 #if DEBUG_SORT | 166 #if DEBUG_SORT |
| 152 static int gSortCountDefault; | 167 static int gSortCountDefault; |
| 153 static int gSortCount; | 168 static int gSortCount; |
| 154 #endif | 169 #endif |
| 155 | 170 |
| 156 #if DEBUG_ACTIVE_OP | 171 #if DEBUG_ACTIVE_OP |
| 157 static const char* kPathOpStr[]; | 172 static const char* kPathOpStr[]; |
| 158 #endif | 173 #endif |
| 159 | 174 |
| 175 static void CoincidentHealth(class SkOpContourHead* contourList, const char*
id); |
| 160 static void MathematicaIze(char* str, size_t bufferSize); | 176 static void MathematicaIze(char* str, size_t bufferSize); |
| 161 static bool ValidWind(int winding); | 177 static bool ValidWind(int winding); |
| 162 static void WindingPrintf(int winding); | 178 static void WindingPrintf(int winding); |
| 163 | 179 |
| 164 #if DEBUG_SHOW_TEST_NAME | 180 #if DEBUG_SHOW_TEST_NAME |
| 165 static void* CreateNameStr(); | 181 static void* CreateNameStr(); |
| 166 static void DeleteNameStr(void* v); | 182 static void DeleteNameStr(void* v); |
| 167 #define DEBUG_FILENAME_STRING_LENGTH 64 | 183 #define DEBUG_FILENAME_STRING_LENGTH 64 |
| 168 #define DEBUG_FILENAME_STRING (reinterpret_cast<char* >(SkTLS::Get(SkPathOpsDebu
g::CreateNameStr, \ | 184 #define DEBUG_FILENAME_STRING (reinterpret_cast<char* >(SkTLS::Get(SkPathOpsDebu
g::CreateNameStr, \ |
| 169 SkPathOpsDebug::DeleteNameStr))) | 185 SkPathOpsDebug::DeleteNameStr))) |
| 170 static void BumpTestName(char* ); | 186 static void BumpTestName(char* ); |
| 171 #endif | 187 #endif |
| 172 static const char* OpStr(SkPathOp ); | 188 static const char* OpStr(SkPathOp ); |
| 173 static void ShowOnePath(const SkPath& path, const char* name, bool includeDe
claration); | 189 static void ShowOnePath(const SkPath& path, const char* name, bool includeDe
claration); |
| 174 static void ShowPath(const SkPath& one, const SkPath& two, SkPathOp op, cons
t char* name); | 190 static void ShowPath(const SkPath& one, const SkPath& two, SkPathOp op, cons
t char* name); |
| 175 | 191 |
| 176 static bool ChaseContains(const SkTDArray<class SkOpSpanBase*>& , const clas
s SkOpSpanBase* ); | 192 static bool ChaseContains(const SkTDArray<class SkOpSpanBase*>& , const clas
s SkOpSpanBase* ); |
| 177 | 193 |
| 194 static void CheckHealth(class SkOpContourHead* contourList, const char* id); |
| 195 |
| 178 static const struct SkOpAngle* DebugAngleAngle(const struct SkOpAngle*, int
id); | 196 static const struct SkOpAngle* DebugAngleAngle(const struct SkOpAngle*, int
id); |
| 179 static class SkOpContour* DebugAngleContour(struct SkOpAngle*, int id); | 197 static class SkOpContour* DebugAngleContour(struct SkOpAngle*, int id); |
| 180 static const class SkOpPtT* DebugAnglePtT(const struct SkOpAngle*, int id); | 198 static const class SkOpPtT* DebugAnglePtT(const struct SkOpAngle*, int id); |
| 181 static const class SkOpSegment* DebugAngleSegment(const struct SkOpAngle*, i
nt id); | 199 static const class SkOpSegment* DebugAngleSegment(const struct SkOpAngle*, i
nt id); |
| 182 static const class SkOpSpanBase* DebugAngleSpan(const struct SkOpAngle*, int
id); | 200 static const class SkOpSpanBase* DebugAngleSpan(const struct SkOpAngle*, int
id); |
| 183 | 201 |
| 184 static const struct SkOpAngle* DebugContourAngle(class SkOpContour*, int id)
; | 202 static const struct SkOpAngle* DebugContourAngle(class SkOpContour*, int id)
; |
| 185 static class SkOpContour* DebugContourContour(class SkOpContour*, int id); | 203 static class SkOpContour* DebugContourContour(class SkOpContour*, int id); |
| 186 static const class SkOpPtT* DebugContourPtT(class SkOpContour*, int id); | 204 static const class SkOpPtT* DebugContourPtT(class SkOpContour*, int id); |
| 187 static const class SkOpSegment* DebugContourSegment(class SkOpContour*, int
id); | 205 static const class SkOpSegment* DebugContourSegment(class SkOpContour*, int
id); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 212 static const class SkOpSpanBase* DebugSpanSpan(const class SkOpSpanBase*, in
t id); | 230 static const class SkOpSpanBase* DebugSpanSpan(const class SkOpSpanBase*, in
t id); |
| 213 }; | 231 }; |
| 214 | 232 |
| 215 struct SkDQuad; | 233 struct SkDQuad; |
| 216 | 234 |
| 217 // generates tools/path_sorter.htm and path_visualizer.htm compatible data | 235 // generates tools/path_sorter.htm and path_visualizer.htm compatible data |
| 218 void DumpQ(const SkDQuad& quad1, const SkDQuad& quad2, int testNo); | 236 void DumpQ(const SkDQuad& quad1, const SkDQuad& quad2, int testNo); |
| 219 void DumpT(const SkDQuad& quad, double t); | 237 void DumpT(const SkDQuad& quad, double t); |
| 220 | 238 |
| 221 #endif | 239 #endif |
| OLD | NEW |