blob: ece3b14fe2f4b50603d2ec88749167c4dd3195a4 [file] [log] [blame]
caryclark@google.com07393ca2013-04-08 11:47:37 +00001/*
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
12int gDebugMaxWindSum = SK_MaxS32;
13int gDebugMaxWindValue = SK_MaxS32;
14
15void 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}
caryclark@google.com03610322013-04-18 15:58:21 +000031#endif
caryclark@google.com07393ca2013-04-08 11:47:37 +000032
caryclark@google.com03610322013-04-18 15:58:21 +000033#if DEBUG_SORT || DEBUG_SWAP_TOP
caryclark@google.com07393ca2013-04-08 11:47:37 +000034bool valid_wind(int wind) {
35 return wind > SK_MinS32 + 0xFFFF && wind < SK_MaxS32 - 0xFFFF;
36}
37
38void winding_printf(int wind) {
39 if (wind == SK_MinS32) {
40 SkDebugf("?");
41 } else {
42 SkDebugf("%d", wind);
43 }
44}
45#endif
46
47#if DEBUG_DUMP
48const char* kLVerbStr[] = {"", "line", "quad", "cubic"};
49// static const char* kUVerbStr[] = {"", "Line", "Quad", "Cubic"};
50int gContourID;
51int gSegmentID;
52#endif
53
54#if DEBUG_SORT || DEBUG_SWAP_TOP
55int gDebugSortCountDefault = SK_MaxS32;
56int gDebugSortCount;
57#endif
58
59#if DEBUG_ACTIVE_OP
60const char* kPathOpStr[] = {"diff", "sect", "union", "xor"};
61#endif