| caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | #ifndef SkPathOpsDebug_DEFINED |
| 8 | #define SkPathOpsDebug_DEFINED |
| 9 | |
| 10 | #include "SkTypes.h" |
| 11 | |
| 12 | #ifdef SK_RELEASE |
| 13 | #define FORCE_RELEASE 1 |
| 14 | #else |
| 15 | #define FORCE_RELEASE 1 // set force release to 1 for multiple thread -- no debugging |
| 16 | #endif |
| 17 | |
| 18 | #define ONE_OFF_DEBUG 0 |
| 19 | #define ONE_OFF_DEBUG_MATHEMATICA 0 |
| 20 | |
| caryclark@google.com | db60de7 | 2013-04-11 12:33:23 +0000 | [diff] [blame^] | 21 | #if defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_FOR_ANDROID) |
| caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 22 | #define SK_RAND(seed) rand() |
| caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 23 | #else |
| 24 | #define SK_RAND(seed) rand_r(&seed) |
| caryclark@google.com | db60de7 | 2013-04-11 12:33:23 +0000 | [diff] [blame^] | 25 | #endif |
| 26 | #ifdef SK_BUILD_FOR_WIN |
| 27 | #define SK_SNPRINTF _snprintf |
| 28 | #else |
| skia.committer@gmail.com | 3284017 | 2013-04-09 07:01:27 +0000 | [diff] [blame] | 29 | #define SK_SNPRINTF snprintf |
| caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 30 | #endif |
| 31 | |
| caryclark@google.com | 66089e4 | 2013-04-10 15:55:37 +0000 | [diff] [blame] | 32 | #if defined SK_DEBUG || !FORCE_RELEASE |
| 33 | |
| caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 34 | void mathematica_ize(char* str, size_t bufferSize); |
| 35 | bool valid_wind(int winding); |
| 36 | void winding_printf(int winding); |
| 37 | |
| 38 | extern int gDebugMaxWindSum; |
| 39 | extern int gDebugMaxWindValue; |
| caryclark@google.com | 66089e4 | 2013-04-10 15:55:37 +0000 | [diff] [blame] | 40 | |
| caryclark@google.com | 07393ca | 2013-04-08 11:47:37 +0000 | [diff] [blame] | 41 | #endif |
| 42 | |
| 43 | #if FORCE_RELEASE |
| 44 | |
| 45 | #define DEBUG_ACTIVE_OP 0 |
| 46 | #define DEBUG_ACTIVE_SPANS 0 |
| 47 | #define DEBUG_ACTIVE_SPANS_SHORT_FORM 0 |
| 48 | #define DEBUG_ADD_INTERSECTING_TS 0 |
| 49 | #define DEBUG_ADD_T_PAIR 0 |
| 50 | #define DEBUG_ANGLE 0 |
| 51 | #define DEBUG_AS_C_CODE 1 |
| 52 | #define DEBUG_ASSEMBLE 0 |
| 53 | #define DEBUG_CONCIDENT 0 |
| 54 | #define DEBUG_CROSS 0 |
| 55 | #define DEBUG_FLAT_QUADS 0 |
| 56 | #define DEBUG_FLOW 0 |
| 57 | #define DEBUG_MARK_DONE 0 |
| 58 | #define DEBUG_PATH_CONSTRUCTION 0 |
| 59 | #define DEBUG_SHOW_TEST_PROGRESS 0 |
| 60 | #define DEBUG_SHOW_WINDING 0 |
| 61 | #define DEBUG_SORT 0 |
| 62 | #define DEBUG_SWAP_TOP 0 |
| 63 | #define DEBUG_UNSORTABLE 0 |
| 64 | #define DEBUG_WIND_BUMP 0 |
| 65 | #define DEBUG_WINDING 0 |
| 66 | #define DEBUG_WINDING_AT_T 0 |
| 67 | |
| 68 | #else |
| 69 | |
| 70 | #define DEBUG_ACTIVE_OP 1 |
| 71 | #define DEBUG_ACTIVE_SPANS 1 |
| 72 | #define DEBUG_ACTIVE_SPANS_SHORT_FORM 0 |
| 73 | #define DEBUG_ADD_INTERSECTING_TS 1 |
| 74 | #define DEBUG_ADD_T_PAIR 1 |
| 75 | #define DEBUG_ANGLE 1 |
| 76 | #define DEBUG_AS_C_CODE 1 |
| 77 | #define DEBUG_ASSEMBLE 1 |
| 78 | #define DEBUG_CONCIDENT 1 |
| 79 | #define DEBUG_CROSS 0 |
| 80 | #define DEBUG_FLAT_QUADS 0 |
| 81 | #define DEBUG_FLOW 1 |
| 82 | #define DEBUG_MARK_DONE 1 |
| 83 | #define DEBUG_PATH_CONSTRUCTION 1 |
| 84 | #define DEBUG_SHOW_TEST_PROGRESS 1 |
| 85 | #define DEBUG_SHOW_WINDING 0 |
| 86 | #define DEBUG_SORT 1 |
| 87 | #define DEBUG_SWAP_TOP 1 |
| 88 | #define DEBUG_UNSORTABLE 1 |
| 89 | #define DEBUG_WIND_BUMP 0 |
| 90 | #define DEBUG_WINDING 1 |
| 91 | #define DEBUG_WINDING_AT_T 1 |
| 92 | |
| 93 | #endif |
| 94 | |
| 95 | #define DEBUG_DUMP (DEBUG_ACTIVE_OP | DEBUG_ACTIVE_SPANS | DEBUG_CONCIDENT | DEBUG_SORT | \ |
| 96 | DEBUG_PATH_CONSTRUCTION) |
| 97 | |
| 98 | #if DEBUG_AS_C_CODE |
| 99 | #define CUBIC_DEBUG_STR "{{%1.17g,%1.17g}, {%1.17g,%1.17g}, {%1.17g,%1.17g}, {%1.17g,%1.17g}}" |
| 100 | #define QUAD_DEBUG_STR "{{%1.17g,%1.17g}, {%1.17g,%1.17g}, {%1.17g,%1.17g}}" |
| 101 | #define LINE_DEBUG_STR "{{%1.17g,%1.17g}, {%1.17g,%1.17g}}" |
| 102 | #define PT_DEBUG_STR "{{%1.17g,%1.17g}}" |
| 103 | #else |
| 104 | #define CUBIC_DEBUG_STR "(%1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g)" |
| 105 | #define QUAD_DEBUG_STR "(%1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g)" |
| 106 | #define LINE_DEBUG_STR "(%1.9g,%1.9g %1.9g,%1.9g)" |
| 107 | #define PT_DEBUG_STR "(%1.9g,%1.9g)" |
| 108 | #endif |
| 109 | #define T_DEBUG_STR(t, n) #t "[" #n "]=%1.9g" |
| 110 | #define TX_DEBUG_STR(t) #t "[%d]=%1.9g" |
| 111 | #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 |
| 112 | #define QUAD_DEBUG_DATA(q) q[0].fX, q[0].fY, q[1].fX, q[1].fY, q[2].fX, q[2].fY |
| 113 | #define LINE_DEBUG_DATA(l) l[0].fX, l[0].fY, l[1].fX, l[1].fY |
| 114 | #define PT_DEBUG_DATA(i, n) i.pt(n).fX, i.pt(n).fY |
| 115 | |
| 116 | #if DEBUG_DUMP |
| 117 | extern const char* kLVerbStr[]; |
| 118 | // extern const char* kUVerbStr[]; |
| 119 | extern int gContourID; |
| 120 | extern int gSegmentID; |
| 121 | #endif |
| 122 | |
| 123 | #if DEBUG_SORT || DEBUG_SWAP_TOP |
| 124 | extern int gDebugSortCountDefault; |
| 125 | extern int gDebugSortCount; |
| 126 | #endif |
| 127 | |
| 128 | #if DEBUG_ACTIVE_OP |
| 129 | extern const char* kPathOpStr[]; |
| 130 | #endif |
| 131 | |
| 132 | #ifndef DEBUG_TEST |
| 133 | #define DEBUG_TEST 0 |
| 134 | #endif |
| 135 | |
| 136 | #endif |