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 | |
| 8 | #include "SkPathOpsDebug.h" |
| 9 | |
| 10 | #if defined SK_DEBUG || !FORCE_RELEASE |
| 11 | |
| 12 | int gDebugMaxWindSum = SK_MaxS32; |
| 13 | int gDebugMaxWindValue = SK_MaxS32; |
| 14 | |
| 15 | void mathematica_ize(char* str, size_t bufferLen) { |
| 16 | size_t len = strlen(str); |
| 17 | bool num = false; |
| 18 | for (size_t idx = 0; idx < len; ++idx) { |
| 19 | if (num && str[idx] == 'e') { |
| 20 | if (len + 2 >= bufferLen) { |
| 21 | return; |
| 22 | } |
| 23 | memmove(&str[idx + 2], &str[idx + 1], len - idx); |
| 24 | str[idx] = '*'; |
| 25 | str[idx + 1] = '^'; |
| 26 | ++len; |
| 27 | } |
| 28 | num = str[idx] >= '0' && str[idx] <= '9'; |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | bool valid_wind(int wind) { |
| 33 | return wind > SK_MinS32 + 0xFFFF && wind < SK_MaxS32 - 0xFFFF; |
| 34 | } |
| 35 | |
| 36 | void winding_printf(int wind) { |
| 37 | if (wind == SK_MinS32) { |
| 38 | SkDebugf("?"); |
| 39 | } else { |
| 40 | SkDebugf("%d", wind); |
| 41 | } |
| 42 | } |
| 43 | #endif |
| 44 | |
| 45 | #if DEBUG_DUMP |
| 46 | const char* kLVerbStr[] = {"", "line", "quad", "cubic"}; |
| 47 | // static const char* kUVerbStr[] = {"", "Line", "Quad", "Cubic"}; |
| 48 | int gContourID; |
| 49 | int gSegmentID; |
| 50 | #endif |
| 51 | |
| 52 | #if DEBUG_SORT || DEBUG_SWAP_TOP |
| 53 | int gDebugSortCountDefault = SK_MaxS32; |
| 54 | int gDebugSortCount; |
| 55 | #endif |
| 56 | |
| 57 | #if DEBUG_ACTIVE_OP |
| 58 | const char* kPathOpStr[] = {"diff", "sect", "union", "xor"}; |
| 59 | #endif |