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

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

Issue 1037953004: add conics to path ops (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix linux build Created 5 years, 8 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
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"
11 #include "SkTypes.h" 11 #include "SkTypes.h"
12 #include <stdio.h> 12 #include <stdio.h>
13 13
14 #ifdef SK_RELEASE 14 #ifdef SK_RELEASE
15 #define FORCE_RELEASE 1 15 #define FORCE_RELEASE 1
16 #else 16 #else
17 #define FORCE_RELEASE 1 // set force release to 1 for multiple thread -- no deb ugging 17 #define FORCE_RELEASE 1 // set force release to 1 for multiple thread -- no debu gging
18 #endif 18 #endif
19 19
20 #define ONE_OFF_DEBUG 0 20 #define ONE_OFF_DEBUG 0
21 #define ONE_OFF_DEBUG_MATHEMATICA 0 21 #define ONE_OFF_DEBUG_MATHEMATICA 0
22 22
23 #if defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_FOR_ANDROID) 23 #if defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_FOR_ANDROID)
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
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 #define DEBUG_SWAP_TOP 1 77 #define DEBUG_SWAP_TOP 1
78 #define DEBUG_T_SECT 1 78 #define DEBUG_T_SECT 1
79 #define DEBUG_T_SECT_DUMP 02 79 #define DEBUG_T_SECT_DUMP 02
80 #define DEBUG_VALIDATE 1 80 #define DEBUG_VALIDATE 1
81 #define DEBUG_WINDING 1 81 #define DEBUG_WINDING 1
82 #define DEBUG_WINDING_AT_T 1 82 #define DEBUG_WINDING_AT_T 1
83 83
84 #endif 84 #endif
85 85
86 #ifdef SK_RELEASE 86 #ifdef SK_RELEASE
87 #define PATH_OPS_DEBUG_RELEASE(a, b) b 87 #define SkDEBUGRELEASE(a, b) b
88 #define PATH_OPS_DEBUG_CODE(...) 88 #define SkDEBUGPARAMS(...)
89 #define PATH_OPS_DEBUG_PARAMS(...) 89 #define SkDEBUGCODE_(...)
90 #else 90 #else
91 #define PATH_OPS_DEBUG_RELEASE(a, b) a 91 #define SkDEBUGRELEASE(a, b) a
92 #define PATH_OPS_DEBUG_CODE(...) __VA_ARGS__ 92 #define SkDEBUGPARAMS(...) , __VA_ARGS__
93 #define PATH_OPS_DEBUG_PARAMS(...) , __VA_ARGS__ 93 #define SkDEBUGCODE_(...) __VA_ARGS__ // temporary until SkDEBUGCODE is fix ed
94 #endif 94 #endif
95 95
96 #if DEBUG_T_SECT == 0 96 #if DEBUG_T_SECT == 0
97 #define PATH_OPS_DEBUG_T_SECT_RELEASE(a, b) b 97 #define PATH_OPS_DEBUG_T_SECT_RELEASE(a, b) b
98 #define PATH_OPS_DEBUG_T_SECT_PARAMS(...) 98 #define PATH_OPS_DEBUG_T_SECT_PARAMS(...)
99 #define PATH_OPS_DEBUG_T_SECT_CODE(...) 99 #define PATH_OPS_DEBUG_T_SECT_CODE(...)
100 #else 100 #else
101 #define PATH_OPS_DEBUG_T_SECT_RELEASE(a, b) a 101 #define PATH_OPS_DEBUG_T_SECT_RELEASE(a, b) a
102 #define PATH_OPS_DEBUG_T_SECT_PARAMS(...) , __VA_ARGS__ 102 #define PATH_OPS_DEBUG_T_SECT_PARAMS(...) , __VA_ARGS__
103 #define PATH_OPS_DEBUG_T_SECT_CODE(...) __VA_ARGS__ 103 #define PATH_OPS_DEBUG_T_SECT_CODE(...) __VA_ARGS__
104 #endif 104 #endif
105 105
106 #if DEBUG_T_SECT_DUMP > 1 106 #if DEBUG_T_SECT_DUMP > 1
107 extern int gDumpTSectNum; 107 extern int gDumpTSectNum;
108 #endif 108 #endif
109 109
110 #define CUBIC_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,% 1.9g}}}" 110 #define CUBIC_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g, %1.9g}}}"
111 #define QUAD_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}}" 111 #define CONIC_DEBUG_STR "{{{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}}, %1.9g }"
112 #define LINE_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}}}" 112 #define QUAD_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}}"
113 #define LINE_DEBUG_STR "{{{%1.9g,%1.9g}, {%1.9g,%1.9g}}}"
113 #define PT_DEBUG_STR "{{%1.9g,%1.9g}}" 114 #define PT_DEBUG_STR "{{%1.9g,%1.9g}}"
114 115
115 #define T_DEBUG_STR(t, n) #t "[" #n "]=%1.9g" 116 #define T_DEBUG_STR(t, n) #t "[" #n "]=%1.9g"
116 #define TX_DEBUG_STR(t) #t "[%d]=%1.9g" 117 #define TX_DEBUG_STR(t) #t "[%d]=%1.9g"
117 #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 118 #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 CONIC_DEBUG_DATA(c, w) c[0].fX, c[0].fY, c[1].fX, c[1].fY, c[2].fX, c[2] .fY, w
118 #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
119 #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
120 #define PT_DEBUG_DATA(i, n) i.pt(n).asSkPoint().fX, i.pt(n).asSkPoint().fY 122 #define PT_DEBUG_DATA(i, n) i.pt(n).asSkPoint().fX, i.pt(n).asSkPoint().fY
121 123
122 #ifndef DEBUG_TEST 124 #ifndef DEBUG_TEST
123 #define DEBUG_TEST 0 125 #define DEBUG_TEST 0
124 #endif 126 #endif
125 127
126 #if DEBUG_SHOW_TEST_NAME 128 #if DEBUG_SHOW_TEST_NAME
127 #include "SkTLS.h" 129 #include "SkTLS.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 static void DumpContours(SkTDArray<class SkOpContour* >* contours); 199 static void DumpContours(SkTDArray<class SkOpContour* >* contours);
198 static void DumpContoursAll(SkTDArray<class SkOpContour* >* contours); 200 static void DumpContoursAll(SkTDArray<class SkOpContour* >* contours);
199 static void DumpContoursAngles(const SkTDArray<class SkOpContour* >* contour s); 201 static void DumpContoursAngles(const SkTDArray<class SkOpContour* >* contour s);
200 static void DumpContoursPt(const SkTDArray<class SkOpContour* >* contours, i nt id); 202 static void DumpContoursPt(const SkTDArray<class SkOpContour* >* contours, i nt id);
201 static void DumpContoursPts(const SkTDArray<class SkOpContour* >* contours); 203 static void DumpContoursPts(const SkTDArray<class SkOpContour* >* contours);
202 static void DumpContoursSegment(const SkTDArray<class SkOpContour* >* contou rs, int id); 204 static void DumpContoursSegment(const SkTDArray<class SkOpContour* >* contou rs, int id);
203 static void DumpContoursSpan(const SkTDArray<class SkOpContour* >* contours, int id); 205 static void DumpContoursSpan(const SkTDArray<class SkOpContour* >* contours, int id);
204 static void DumpContoursSpans(const SkTDArray<class SkOpContour* >* contours ); 206 static void DumpContoursSpans(const SkTDArray<class SkOpContour* >* contours );
205 }; 207 };
206 208
207 // shorthand for calling from debugger
208 template<typename TCurve> class SkTSect;
209 template<typename TCurve> class SkTSpan;
210
211 struct SkDQuad; 209 struct SkDQuad;
212 struct SkDCubic;
213
214 const SkTSpan<SkDCubic>* DebugSpan(const SkTSect<SkDCubic>* , int id);
215 const SkTSpan<SkDQuad>* DebugSpan(const SkTSect<SkDQuad>* , int id);
216 const SkTSpan<SkDCubic>* DebugT(const SkTSect<SkDCubic>* , double t);
217 const SkTSpan<SkDQuad>* DebugT(const SkTSect<SkDQuad>* , double t);
218
219 const SkTSpan<SkDCubic>* DebugSpan(const SkTSpan<SkDCubic>* , int id);
220 const SkTSpan<SkDQuad>* DebugSpan(const SkTSpan<SkDQuad>* , int id);
221 const SkTSpan<SkDCubic>* DebugT(const SkTSpan<SkDCubic>* , double t);
222 const SkTSpan<SkDQuad>* DebugT(const SkTSpan<SkDQuad>* , double t);
223
224 void Dump(const SkTSect<SkDCubic>* );
225 void Dump(const SkTSect<SkDQuad>* );
226 void Dump(const SkTSpan<SkDCubic>* , const SkTSect<SkDCubic>* = NULL);
227 void Dump(const SkTSpan<SkDQuad>* , const SkTSect<SkDQuad>* = NULL);
228 void DumpBoth(SkTSect<SkDCubic>* sect1, SkTSect<SkDCubic>* sect2);
229 void DumpBoth(SkTSect<SkDQuad>* sect1, SkTSect<SkDQuad>* sect2);
230 void DumpCoin(SkTSect<SkDCubic>* sect1);
231 void DumpCoin(SkTSect<SkDQuad>* sect1);
232 void DumpCoinCurves(SkTSect<SkDCubic>* sect1);
233 void DumpCoinCurves(SkTSect<SkDQuad>* sect1);
234 void DumpCurves(const SkTSpan<SkDCubic>* );
235 void DumpCurves(const SkTSpan<SkDQuad>* );
236 210
237 // generates tools/path_sorter.htm and path_visualizer.htm compatible data 211 // generates tools/path_sorter.htm and path_visualizer.htm compatible data
238 void DumpQ(const SkDQuad& quad1, const SkDQuad& quad2, int testNo); 212 void DumpQ(const SkDQuad& quad1, const SkDQuad& quad2, int testNo);
239 void DumpT(const SkDQuad& quad, double t); 213 void DumpT(const SkDQuad& quad, double t);
240 214
241 const struct SkOpAngle* DebugAngle(const SkTDArray<class SkOpContour* >* contour s, int id); 215 const struct SkOpAngle* DebugAngle(const SkTDArray<class SkOpContour* >* contour s, int id);
242 class SkOpContour* DebugContour(const SkTDArray<class SkOpContour* >* contours, int id); 216 class SkOpContour* DebugContour(const SkTDArray<class SkOpContour* >* contours, int id);
243 const class SkOpPtT* DebugPtT(const SkTDArray<class SkOpContour* >* contours, in t id); 217 const class SkOpPtT* DebugPtT(const SkTDArray<class SkOpContour* >* contours, in t id);
244 const class SkOpSegment* DebugSegment(const SkTDArray<class SkOpContour* >* cont ours, int id); 218 const class SkOpSegment* DebugSegment(const SkTDArray<class SkOpContour* >* cont ours, int id);
245 const class SkOpSpanBase* DebugSpan(const SkTDArray<class SkOpContour* >* contou rs, int id); 219 const class SkOpSpanBase* DebugSpan(const SkTDArray<class SkOpContour* >* contou rs, int id);
246 220
247 void Dump(const SkTDArray<class SkOpContour* >* contours); 221 void Dump(const SkTDArray<class SkOpContour* >* contours);
248 void DumpAll(SkTDArray<class SkOpContour* >* contours); 222 void DumpAll(SkTDArray<class SkOpContour* >* contours);
249 void DumpAngles(const SkTDArray<class SkOpContour* >* contours); 223 void DumpAngles(const SkTDArray<class SkOpContour* >* contours);
250 void DumpCoin(const SkTDArray<class SkOpContour* >* contours); 224 void DumpCoin(const SkTDArray<class SkOpContour* >* contours);
251 void DumpPt(const SkTDArray<class SkOpContour* >* contours, int segmentID); 225 void DumpPt(const SkTDArray<class SkOpContour* >* contours, int segmentID);
252 void DumpPts(const SkTDArray<class SkOpContour* >* contours); 226 void DumpPts(const SkTDArray<class SkOpContour* >* contours);
253 void DumpSegment(const SkTDArray<class SkOpContour* >* contours, int segmentID); 227 void DumpSegment(const SkTDArray<class SkOpContour* >* contours, int segmentID);
254 void DumpSpan(const SkTDArray<class SkOpContour* >* contours, int spanID); 228 void DumpSpan(const SkTDArray<class SkOpContour* >* contours, int spanID);
255 void DumpSpans(const SkTDArray<class SkOpContour* >* contours); 229 void DumpSpans(const SkTDArray<class SkOpContour* >* contours);
256 #endif 230 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698