gfx/skia/trunk/src/pathops/SkPathOpsDebug.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/pathops/SkPathOpsDebug.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,175 @@
     1.4 +/*
     1.5 + * Copyright 2013 Google Inc.
     1.6 + *
     1.7 + * Use of this source code is governed by a BSD-style license that can be
     1.8 + * found in the LICENSE file.
     1.9 + */
    1.10 +#ifndef SkPathOpsDebug_DEFINED
    1.11 +#define SkPathOpsDebug_DEFINED
    1.12 +
    1.13 +#include "SkPathOps.h"
    1.14 +#include "SkTypes.h"
    1.15 +#include <stdio.h>
    1.16 +
    1.17 +#ifdef SK_RELEASE
    1.18 +#define FORCE_RELEASE 1
    1.19 +#else
    1.20 +#define FORCE_RELEASE 1  // set force release to 1 for multiple thread -- no debugging
    1.21 +#endif
    1.22 +
    1.23 +#define ONE_OFF_DEBUG 0
    1.24 +#define ONE_OFF_DEBUG_MATHEMATICA 0
    1.25 +
    1.26 +#if defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_FOR_ANDROID)
    1.27 +    #define SK_RAND(seed) rand()
    1.28 +#else
    1.29 +    #define SK_RAND(seed) rand_r(&seed)
    1.30 +#endif
    1.31 +#ifdef SK_BUILD_FOR_WIN
    1.32 +    #define SK_SNPRINTF _snprintf
    1.33 +#else
    1.34 +    #define SK_SNPRINTF snprintf
    1.35 +#endif
    1.36 +
    1.37 +#if FORCE_RELEASE
    1.38 +
    1.39 +#define DEBUG_ACTIVE_OP 0
    1.40 +#define DEBUG_ACTIVE_SPANS 0
    1.41 +#define DEBUG_ACTIVE_SPANS_FIRST_ONLY 0
    1.42 +#define DEBUG_ACTIVE_SPANS_SHORT_FORM 1
    1.43 +#define DEBUG_ADD_INTERSECTING_TS 0
    1.44 +#define DEBUG_ADD_T_PAIR 0
    1.45 +#define DEBUG_ANGLE 0
    1.46 +#define DEBUG_AS_C_CODE 1
    1.47 +#define DEBUG_ASSEMBLE 0
    1.48 +#define DEBUG_CHECK_ENDS 0
    1.49 +#define DEBUG_CHECK_TINY 0
    1.50 +#define DEBUG_CONCIDENT 0
    1.51 +#define DEBUG_CROSS 0
    1.52 +#define DEBUG_FLAT_QUADS 0
    1.53 +#define DEBUG_FLOW 0
    1.54 +#define DEBUG_MARK_DONE 0
    1.55 +#define DEBUG_PATH_CONSTRUCTION 0
    1.56 +#define DEBUG_SHOW_TEST_NAME 0
    1.57 +#define DEBUG_SHOW_TEST_PROGRESS 0
    1.58 +#define DEBUG_SHOW_WINDING 0
    1.59 +#define DEBUG_SORT 0
    1.60 +#define DEBUG_SORT_COMPACT 0
    1.61 +#define DEBUG_SORT_RAW 0
    1.62 +#define DEBUG_SORT_SINGLE 0
    1.63 +#define DEBUG_SWAP_TOP 0
    1.64 +#define DEBUG_UNSORTABLE 0
    1.65 +#define DEBUG_VALIDATE 0
    1.66 +#define DEBUG_WIND_BUMP 0
    1.67 +#define DEBUG_WINDING 0
    1.68 +#define DEBUG_WINDING_AT_T 0
    1.69 +
    1.70 +#else
    1.71 +
    1.72 +#define DEBUG_ACTIVE_OP 1
    1.73 +#define DEBUG_ACTIVE_SPANS 1
    1.74 +#define DEBUG_ACTIVE_SPANS_FIRST_ONLY 0
    1.75 +#define DEBUG_ACTIVE_SPANS_SHORT_FORM 1
    1.76 +#define DEBUG_ADD_INTERSECTING_TS 1
    1.77 +#define DEBUG_ADD_T_PAIR 1
    1.78 +#define DEBUG_ANGLE 1
    1.79 +#define DEBUG_AS_C_CODE 1
    1.80 +#define DEBUG_ASSEMBLE 1
    1.81 +#define DEBUG_CHECK_ENDS 1
    1.82 +#define DEBUG_CHECK_TINY 1
    1.83 +#define DEBUG_CONCIDENT 1
    1.84 +#define DEBUG_CROSS 01
    1.85 +#define DEBUG_FLAT_QUADS 0
    1.86 +#define DEBUG_FLOW 1
    1.87 +#define DEBUG_MARK_DONE 1
    1.88 +#define DEBUG_PATH_CONSTRUCTION 1
    1.89 +#define DEBUG_SHOW_TEST_NAME 1
    1.90 +#define DEBUG_SHOW_TEST_PROGRESS 1
    1.91 +#define DEBUG_SHOW_WINDING 0
    1.92 +#define DEBUG_SORT 1
    1.93 +#define DEBUG_SORT_COMPACT 0
    1.94 +#define DEBUG_SORT_RAW 0
    1.95 +#define DEBUG_SORT_SINGLE 0
    1.96 +#define DEBUG_SWAP_TOP 1
    1.97 +#define DEBUG_UNSORTABLE 1
    1.98 +#define DEBUG_VALIDATE 1
    1.99 +#define DEBUG_WIND_BUMP 0
   1.100 +#define DEBUG_WINDING 1
   1.101 +#define DEBUG_WINDING_AT_T 1
   1.102 +
   1.103 +#endif
   1.104 +
   1.105 +#if DEBUG_AS_C_CODE
   1.106 +#define CUBIC_DEBUG_STR "{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}"
   1.107 +#define QUAD_DEBUG_STR  "{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}"
   1.108 +#define LINE_DEBUG_STR  "{{%1.9g,%1.9g}, {%1.9g,%1.9g}}"
   1.109 +#define PT_DEBUG_STR "{{%1.9g,%1.9g}}"
   1.110 +#else
   1.111 +#define CUBIC_DEBUG_STR "(%1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g)"
   1.112 +#define QUAD_DEBUG_STR  "(%1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g)"
   1.113 +#define LINE_DEBUG_STR  "(%1.9g,%1.9g %1.9g,%1.9g)"
   1.114 +#define PT_DEBUG_STR "(%1.9g,%1.9g)"
   1.115 +#endif
   1.116 +#define T_DEBUG_STR(t, n) #t "[" #n "]=%1.9g"
   1.117 +#define TX_DEBUG_STR(t) #t "[%d]=%1.9g"
   1.118 +#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
   1.119 +#define QUAD_DEBUG_DATA(q)  q[0].fX, q[0].fY, q[1].fX, q[1].fY, q[2].fX, q[2].fY
   1.120 +#define LINE_DEBUG_DATA(l)  l[0].fX, l[0].fY, l[1].fX, l[1].fY
   1.121 +#define PT_DEBUG_DATA(i, n) i.pt(n).fX, i.pt(n).fY
   1.122 +
   1.123 +#ifndef DEBUG_TEST
   1.124 +#define DEBUG_TEST 0
   1.125 +#endif
   1.126 +
   1.127 +#if defined SK_DEBUG || !FORCE_RELEASE
   1.128 +
   1.129 +#if DEBUG_SHOW_TEST_NAME
   1.130 +#include "SkTLS.h"
   1.131 +#endif
   1.132 +
   1.133 +#include "SkTArray.h"
   1.134 +
   1.135 +class SkPathOpsDebug {
   1.136 +public:
   1.137 +    static int gMaxWindSum;
   1.138 +    static int gMaxWindValue;
   1.139 +
   1.140 +    static const char* kLVerbStr[];
   1.141 +    static int gContourID;
   1.142 +    static int gSegmentID;
   1.143 +
   1.144 +#if DEBUG_SORT || DEBUG_SWAP_TOP
   1.145 +    static int gSortCountDefault;
   1.146 +    static int gSortCount;
   1.147 +#endif
   1.148 +
   1.149 +#if DEBUG_ACTIVE_OP
   1.150 +    static const char* kPathOpStr[];
   1.151 +#endif
   1.152 +
   1.153 +    static void MathematicaIze(char* str, size_t bufferSize);
   1.154 +    static bool ValidWind(int winding);
   1.155 +    static void WindingPrintf(int winding);
   1.156 +
   1.157 +#if DEBUG_SHOW_TEST_NAME
   1.158 +    static void* CreateNameStr();
   1.159 +    static void DeleteNameStr(void* v);
   1.160 +#define DEBUG_FILENAME_STRING_LENGTH 64
   1.161 +#define DEBUG_FILENAME_STRING (reinterpret_cast<char* >(SkTLS::Get(SkPathOpsDebug::CreateNameStr, \
   1.162 +        SkPathOpsDebug::DeleteNameStr)))
   1.163 +    static void BumpTestName(char* );
   1.164 +    static void ShowPath(const SkPath& one, const SkPath& two, SkPathOp op, const char* name);
   1.165 +#endif
   1.166 +    static void DumpAngles(const SkTArray<class SkOpAngle, true>& angles);
   1.167 +    static void DumpAngles(const SkTArray<class SkOpAngle* , true>& angles);
   1.168 +};
   1.169 +
   1.170 +// shorthand for calling from debugger
   1.171 +void Dump(const SkTArray<class SkOpAngle, true>& angles);
   1.172 +void Dump(const SkTArray<class SkOpAngle* , true>& angles);
   1.173 +void Dump(const SkTArray<class SkOpAngle, true>* angles);
   1.174 +void Dump(const SkTArray<class SkOpAngle* , true>* angles);
   1.175 +
   1.176 +#endif  // SK_DEBUG || !FORCE_RELEASE
   1.177 +
   1.178 +#endif

mercurial