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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 #define PT_DEBUG_DATA(i, n) i.pt(n).asSkPoint().fX, i.pt(n).asSkPoint().fY | 149 #define PT_DEBUG_DATA(i, n) i.pt(n).asSkPoint().fX, i.pt(n).asSkPoint().fY |
150 | 150 |
151 #ifndef DEBUG_TEST | 151 #ifndef DEBUG_TEST |
152 #define DEBUG_TEST 0 | 152 #define DEBUG_TEST 0 |
153 #endif | 153 #endif |
154 | 154 |
155 #if DEBUG_SHOW_TEST_NAME | 155 #if DEBUG_SHOW_TEST_NAME |
156 #include "SkTLS.h" | 156 #include "SkTLS.h" |
157 #endif | 157 #endif |
158 | 158 |
159 #define FAIL_IF(cond) do { bool fail = (cond); SkOPASSERT(!fail); if (fail) retu
rn false; } \ | 159 // Tests with extreme numbers may fail, but all other tests should never fail. |
160 while (false) | 160 #define FAIL_IF(cond) \ |
| 161 do { bool fail = (cond); SkOPASSERT(!fail); if (fail) return false; } wh
ile (false) |
161 | 162 |
| 163 #define FAIL_WITH_NULL_IF(cond) \ |
| 164 do { bool fail = (cond); SkOPASSERT(!fail); if (fail) return nullptr; }
while (false) |
| 165 |
| 166 // Some functions serve two masters: one allows the function to fail, the other
expects success |
| 167 // always. If abort is true, tests with normal numbers may not fail and assert i
f they do so. |
| 168 // If abort is false, both normal and extreme numbers may return false without a
sserting. |
162 #define RETURN_FALSE_IF(abort, cond) \ | 169 #define RETURN_FALSE_IF(abort, cond) \ |
163 do { bool fail = (cond); SkOPASSERT(!(abort) || !fail); if (fail) return
false; } \ | 170 do { bool fail = (cond); SkOPASSERT(!(abort) || !fail); if (fail) return
false; \ |
164 while (false) | 171 } while (false) |
165 | 172 |
166 class SkPathOpsDebug { | 173 class SkPathOpsDebug { |
167 public: | 174 public: |
168 static const char* kLVerbStr[]; | 175 static const char* kLVerbStr[]; |
169 struct GlitchLog; | 176 struct GlitchLog; |
170 | 177 |
171 #if defined(SK_DEBUG) || !FORCE_RELEASE | 178 #if defined(SK_DEBUG) || !FORCE_RELEASE |
172 static int gContourID; | 179 static int gContourID; |
173 static int gSegmentID; | 180 static int gSegmentID; |
174 #endif | 181 #endif |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 static const class SkOpSpanBase* DebugSpanSpan(const class SkOpSpanBase*, in
t id); | 248 static const class SkOpSpanBase* DebugSpanSpan(const class SkOpSpanBase*, in
t id); |
242 }; | 249 }; |
243 | 250 |
244 struct SkDQuad; | 251 struct SkDQuad; |
245 | 252 |
246 // generates tools/path_sorter.htm and path_visualizer.htm compatible data | 253 // generates tools/path_sorter.htm and path_visualizer.htm compatible data |
247 void DumpQ(const SkDQuad& quad1, const SkDQuad& quad2, int testNo); | 254 void DumpQ(const SkDQuad& quad1, const SkDQuad& quad2, int testNo); |
248 void DumpT(const SkDQuad& quad, double t); | 255 void DumpT(const SkDQuad& quad, double t); |
249 | 256 |
250 #endif | 257 #endif |
OLD | NEW |