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

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

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/SkPathOpsCubic.cpp ('k') | src/pathops/SkPathOpsDebug.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 #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 12 matching lines...) Expand all
23 #define SK_RAND(seed) rand() 23 #define SK_RAND(seed) rand()
24 #else 24 #else
25 #define SK_RAND(seed) rand_r(&seed) 25 #define SK_RAND(seed) rand_r(&seed)
26 #endif 26 #endif
27 #ifdef SK_BUILD_FOR_WIN 27 #ifdef SK_BUILD_FOR_WIN
28 #define SK_SNPRINTF _snprintf 28 #define SK_SNPRINTF _snprintf
29 #else 29 #else
30 #define SK_SNPRINTF snprintf 30 #define SK_SNPRINTF snprintf
31 #endif 31 #endif
32 32
33 #if defined SK_DEBUG || !FORCE_RELEASE
34
35 void mathematica_ize(char* str, size_t bufferSize);
36
37 extern int gDebugMaxWindSum;
38 extern int gDebugMaxWindValue;
39
40 #endif
41
42 #if FORCE_RELEASE 33 #if FORCE_RELEASE
43 34
44 #define DEBUG_ACTIVE_OP 0 35 #define DEBUG_ACTIVE_OP 0
45 #define DEBUG_ACTIVE_SPANS 0 36 #define DEBUG_ACTIVE_SPANS 0
46 #define DEBUG_ACTIVE_SPANS_FIRST_ONLY 0 37 #define DEBUG_ACTIVE_SPANS_FIRST_ONLY 0
47 #define DEBUG_ACTIVE_SPANS_SHORT_FORM 1 38 #define DEBUG_ACTIVE_SPANS_SHORT_FORM 1
48 #define DEBUG_ADD_INTERSECTING_TS 0 39 #define DEBUG_ADD_INTERSECTING_TS 0
49 #define DEBUG_ADD_T_PAIR 0 40 #define DEBUG_ADD_T_PAIR 0
50 #define DEBUG_ANGLE 0 41 #define DEBUG_ANGLE 0
51 #define DEBUG_AS_C_CODE 1 42 #define DEBUG_AS_C_CODE 1
52 #define DEBUG_ASSEMBLE 0 43 #define DEBUG_ASSEMBLE 0
44 #define DEBUG_CHECK_ENDS 0
45 #define DEBUG_CHECK_TINY 0
53 #define DEBUG_CONCIDENT 0 46 #define DEBUG_CONCIDENT 0
54 #define DEBUG_CROSS 0 47 #define DEBUG_CROSS 0
55 #define DEBUG_FLAT_QUADS 0 48 #define DEBUG_FLAT_QUADS 0
56 #define DEBUG_FLOW 0 49 #define DEBUG_FLOW 0
57 #define DEBUG_MARK_DONE 0 50 #define DEBUG_MARK_DONE 0
58 #define DEBUG_PATH_CONSTRUCTION 0 51 #define DEBUG_PATH_CONSTRUCTION 0
59 #define DEBUG_SHOW_TEST_NAME 0 52 #define DEBUG_SHOW_TEST_NAME 0
60 #define DEBUG_SHOW_TEST_PROGRESS 0 53 #define DEBUG_SHOW_TEST_PROGRESS 0
61 #define DEBUG_SHOW_WINDING 0 54 #define DEBUG_SHOW_WINDING 0
62 #define DEBUG_SORT 0 55 #define DEBUG_SORT 0
63 #define DEBUG_SORT_COMPACT 0 56 #define DEBUG_SORT_COMPACT 0
57 #define DEBUG_SORT_RAW 0
64 #define DEBUG_SORT_SINGLE 0 58 #define DEBUG_SORT_SINGLE 0
65 #define DEBUG_SWAP_TOP 0 59 #define DEBUG_SWAP_TOP 0
66 #define DEBUG_UNSORTABLE 0 60 #define DEBUG_UNSORTABLE 0
67 #define DEBUG_VALIDATE 0 61 #define DEBUG_VALIDATE 0
68 #define DEBUG_WIND_BUMP 0 62 #define DEBUG_WIND_BUMP 0
69 #define DEBUG_WINDING 0 63 #define DEBUG_WINDING 0
70 #define DEBUG_WINDING_AT_T 0 64 #define DEBUG_WINDING_AT_T 0
71 65
72 #else 66 #else
73 67
74 #define DEBUG_ACTIVE_OP 1 68 #define DEBUG_ACTIVE_OP 1
75 #define DEBUG_ACTIVE_SPANS 1 69 #define DEBUG_ACTIVE_SPANS 1
76 #define DEBUG_ACTIVE_SPANS_FIRST_ONLY 0 70 #define DEBUG_ACTIVE_SPANS_FIRST_ONLY 0
77 #define DEBUG_ACTIVE_SPANS_SHORT_FORM 1 71 #define DEBUG_ACTIVE_SPANS_SHORT_FORM 1
78 #define DEBUG_ADD_INTERSECTING_TS 1 72 #define DEBUG_ADD_INTERSECTING_TS 1
79 #define DEBUG_ADD_T_PAIR 1 73 #define DEBUG_ADD_T_PAIR 1
80 #define DEBUG_ANGLE 1 74 #define DEBUG_ANGLE 1
81 #define DEBUG_AS_C_CODE 1 75 #define DEBUG_AS_C_CODE 1
82 #define DEBUG_ASSEMBLE 1 76 #define DEBUG_ASSEMBLE 1
77 #define DEBUG_CHECK_ENDS 1
78 #define DEBUG_CHECK_TINY 1
83 #define DEBUG_CONCIDENT 1 79 #define DEBUG_CONCIDENT 1
84 #define DEBUG_CROSS 0 80 #define DEBUG_CROSS 01
85 #define DEBUG_FLAT_QUADS 0 81 #define DEBUG_FLAT_QUADS 0
86 #define DEBUG_FLOW 1 82 #define DEBUG_FLOW 1
87 #define DEBUG_MARK_DONE 1 83 #define DEBUG_MARK_DONE 1
88 #define DEBUG_PATH_CONSTRUCTION 1 84 #define DEBUG_PATH_CONSTRUCTION 1
89 #define DEBUG_SHOW_TEST_NAME 1 85 #define DEBUG_SHOW_TEST_NAME 1
90 #define DEBUG_SHOW_TEST_PROGRESS 1 86 #define DEBUG_SHOW_TEST_PROGRESS 1
91 #define DEBUG_SHOW_WINDING 0 87 #define DEBUG_SHOW_WINDING 0
92 #define DEBUG_SORT 1 88 #define DEBUG_SORT 1
93 #define DEBUG_SORT_COMPACT 0 89 #define DEBUG_SORT_COMPACT 0
90 #define DEBUG_SORT_RAW 0
94 #define DEBUG_SORT_SINGLE 0 91 #define DEBUG_SORT_SINGLE 0
95 #define DEBUG_SWAP_TOP 1 92 #define DEBUG_SWAP_TOP 1
96 #define DEBUG_UNSORTABLE 1 93 #define DEBUG_UNSORTABLE 1
97 #define DEBUG_VALIDATE 1 94 #define DEBUG_VALIDATE 1
98 #define DEBUG_WIND_BUMP 0 95 #define DEBUG_WIND_BUMP 0
99 #define DEBUG_WINDING 1 96 #define DEBUG_WINDING 1
100 #define DEBUG_WINDING_AT_T 1 97 #define DEBUG_WINDING_AT_T 1
101 98
102 #endif 99 #endif
103 100
104 #define DEBUG_DUMP (DEBUG_ACTIVE_OP | DEBUG_ACTIVE_SPANS | DEBUG_CONCIDENT | DEB UG_SORT | \
105 DEBUG_SORT_SINGLE | DEBUG_PATH_CONSTRUCTION)
106
107 #if DEBUG_AS_C_CODE 101 #if DEBUG_AS_C_CODE
108 #define CUBIC_DEBUG_STR "{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1 .9g}}" 102 #define CUBIC_DEBUG_STR "{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1 .9g}}"
109 #define QUAD_DEBUG_STR "{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}" 103 #define QUAD_DEBUG_STR "{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}"
110 #define LINE_DEBUG_STR "{{%1.9g,%1.9g}, {%1.9g,%1.9g}}" 104 #define LINE_DEBUG_STR "{{%1.9g,%1.9g}, {%1.9g,%1.9g}}"
111 #define PT_DEBUG_STR "{{%1.9g,%1.9g}}" 105 #define PT_DEBUG_STR "{{%1.9g,%1.9g}}"
112 #else 106 #else
113 #define CUBIC_DEBUG_STR "(%1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g)" 107 #define CUBIC_DEBUG_STR "(%1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g)"
114 #define QUAD_DEBUG_STR "(%1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g)" 108 #define QUAD_DEBUG_STR "(%1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g)"
115 #define LINE_DEBUG_STR "(%1.9g,%1.9g %1.9g,%1.9g)" 109 #define LINE_DEBUG_STR "(%1.9g,%1.9g %1.9g,%1.9g)"
116 #define PT_DEBUG_STR "(%1.9g,%1.9g)" 110 #define PT_DEBUG_STR "(%1.9g,%1.9g)"
117 #endif 111 #endif
118 #define T_DEBUG_STR(t, n) #t "[" #n "]=%1.9g" 112 #define T_DEBUG_STR(t, n) #t "[" #n "]=%1.9g"
119 #define TX_DEBUG_STR(t) #t "[%d]=%1.9g" 113 #define TX_DEBUG_STR(t) #t "[%d]=%1.9g"
120 #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 114 #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
121 #define QUAD_DEBUG_DATA(q) q[0].fX, q[0].fY, q[1].fX, q[1].fY, q[2].fX, q[2].fY 115 #define QUAD_DEBUG_DATA(q) q[0].fX, q[0].fY, q[1].fX, q[1].fY, q[2].fX, q[2].fY
122 #define LINE_DEBUG_DATA(l) l[0].fX, l[0].fY, l[1].fX, l[1].fY 116 #define LINE_DEBUG_DATA(l) l[0].fX, l[0].fY, l[1].fX, l[1].fY
123 #define PT_DEBUG_DATA(i, n) i.pt(n).fX, i.pt(n).fY 117 #define PT_DEBUG_DATA(i, n) i.pt(n).fX, i.pt(n).fY
124 118
125 #if DEBUG_DUMP
126 extern const char* kLVerbStr[];
127 // extern const char* kUVerbStr[];
128 extern int gContourID;
129 extern int gSegmentID;
130 #endif
131
132 #if DEBUG_SORT || DEBUG_SWAP_TOP
133 extern int gDebugSortCountDefault;
134 extern int gDebugSortCount;
135
136 bool valid_wind(int winding);
137 void winding_printf(int winding);
138 #endif
139
140 #if DEBUG_ACTIVE_OP
141 extern const char* kPathOpStr[];
142 #endif
143
144 #if DEBUG_SHOW_TEST_NAME
145 #include "SkTLS.h"
146
147 extern void* PathOpsDebugCreateNameStr();
148 extern void PathOpsDebugDeleteNameStr(void* v);
149 #define DEBUG_FILENAME_STRING_LENGTH 64
150 #define DEBUG_FILENAME_STRING \
151 (reinterpret_cast<char* >(SkTLS::Get(PathOpsDebugCreateNameStr, PathOpsDebug DeleteNameStr)))
152 extern void DebugBumpTestName(char* );
153 extern void DebugShowPath(const SkPath& one, const SkPath& two, SkPathOp op, con st char* name);
154 #endif
155
156 #ifndef DEBUG_TEST 119 #ifndef DEBUG_TEST
157 #define DEBUG_TEST 0 120 #define DEBUG_TEST 0
158 #endif 121 #endif
159 122
123 #if defined SK_DEBUG || !FORCE_RELEASE
124
125 #if DEBUG_SHOW_TEST_NAME
126 #include "SkTLS.h"
160 #endif 127 #endif
128
129 #include "SkTArray.h"
130
131 class SkPathOpsDebug {
132 public:
133 static int gMaxWindSum;
134 static int gMaxWindValue;
135
136 static const char* kLVerbStr[];
137 static int gContourID;
138 static int gSegmentID;
139
140 #if DEBUG_SORT || DEBUG_SWAP_TOP
141 static int gSortCountDefault;
142 static int gSortCount;
143 #endif
144
145 #if DEBUG_ACTIVE_OP
146 static const char* kPathOpStr[];
147 #endif
148
149 static void MathematicaIze(char* str, size_t bufferSize);
150 static bool ValidWind(int winding);
151 static void WindingPrintf(int winding);
152
153 #if DEBUG_SHOW_TEST_NAME
154 static void* CreateNameStr();
155 static void DeleteNameStr(void* v);
156 #define DEBUG_FILENAME_STRING_LENGTH 64
157 #define DEBUG_FILENAME_STRING (reinterpret_cast<char* >(SkTLS::Get(SkPathOpsDebu g::CreateNameStr, \
158 SkPathOpsDebug::DeleteNameStr)))
159 static void BumpTestName(char* );
160 static void ShowPath(const SkPath& one, const SkPath& two, SkPathOp op, cons t char* name);
161 #endif
162 static void DumpAngles(const SkTArray<class SkOpAngle, true>& angles);
163 };
164
165 #endif // SK_DEBUG || !FORCE_RELEASE
166
167 #endif
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsCubic.cpp ('k') | src/pathops/SkPathOpsDebug.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698