SkPathOpsDebug.cpp revision 07393cab57ce74a4aae89a31fae9aaa9780fc19d
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
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}
31
32bool valid_wind(int wind) {
33    return wind > SK_MinS32 + 0xFFFF && wind < SK_MaxS32 - 0xFFFF;
34}
35
36void 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
46const char* kLVerbStr[] = {"", "line", "quad", "cubic"};
47// static const char* kUVerbStr[] = {"", "Line", "Quad", "Cubic"};
48int gContourID;
49int gSegmentID;
50#endif
51
52#if DEBUG_SORT || DEBUG_SWAP_TOP
53int gDebugSortCountDefault = SK_MaxS32;
54int gDebugSortCount;
55#endif
56
57#if DEBUG_ACTIVE_OP
58const char* kPathOpStr[] = {"diff", "sect", "union", "xor"};
59#endif
60