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

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

michael@0 1 /*
michael@0 2 * Copyright 2013 Google Inc.
michael@0 3 *
michael@0 4 * Use of this source code is governed by a BSD-style license that can be
michael@0 5 * found in the LICENSE file.
michael@0 6 */
michael@0 7 #ifndef SkPathOpsDebug_DEFINED
michael@0 8 #define SkPathOpsDebug_DEFINED
michael@0 9
michael@0 10 #include "SkPathOps.h"
michael@0 11 #include "SkTypes.h"
michael@0 12 #include <stdio.h>
michael@0 13
michael@0 14 #ifdef SK_RELEASE
michael@0 15 #define FORCE_RELEASE 1
michael@0 16 #else
michael@0 17 #define FORCE_RELEASE 1 // set force release to 1 for multiple thread -- no debugging
michael@0 18 #endif
michael@0 19
michael@0 20 #define ONE_OFF_DEBUG 0
michael@0 21 #define ONE_OFF_DEBUG_MATHEMATICA 0
michael@0 22
michael@0 23 #if defined(SK_BUILD_FOR_WIN) || defined(SK_BUILD_FOR_ANDROID)
michael@0 24 #define SK_RAND(seed) rand()
michael@0 25 #else
michael@0 26 #define SK_RAND(seed) rand_r(&seed)
michael@0 27 #endif
michael@0 28 #ifdef SK_BUILD_FOR_WIN
michael@0 29 #define SK_SNPRINTF _snprintf
michael@0 30 #else
michael@0 31 #define SK_SNPRINTF snprintf
michael@0 32 #endif
michael@0 33
michael@0 34 #if FORCE_RELEASE
michael@0 35
michael@0 36 #define DEBUG_ACTIVE_OP 0
michael@0 37 #define DEBUG_ACTIVE_SPANS 0
michael@0 38 #define DEBUG_ACTIVE_SPANS_FIRST_ONLY 0
michael@0 39 #define DEBUG_ACTIVE_SPANS_SHORT_FORM 1
michael@0 40 #define DEBUG_ADD_INTERSECTING_TS 0
michael@0 41 #define DEBUG_ADD_T_PAIR 0
michael@0 42 #define DEBUG_ANGLE 0
michael@0 43 #define DEBUG_AS_C_CODE 1
michael@0 44 #define DEBUG_ASSEMBLE 0
michael@0 45 #define DEBUG_CHECK_ENDS 0
michael@0 46 #define DEBUG_CHECK_TINY 0
michael@0 47 #define DEBUG_CONCIDENT 0
michael@0 48 #define DEBUG_CROSS 0
michael@0 49 #define DEBUG_FLAT_QUADS 0
michael@0 50 #define DEBUG_FLOW 0
michael@0 51 #define DEBUG_MARK_DONE 0
michael@0 52 #define DEBUG_PATH_CONSTRUCTION 0
michael@0 53 #define DEBUG_SHOW_TEST_NAME 0
michael@0 54 #define DEBUG_SHOW_TEST_PROGRESS 0
michael@0 55 #define DEBUG_SHOW_WINDING 0
michael@0 56 #define DEBUG_SORT 0
michael@0 57 #define DEBUG_SORT_COMPACT 0
michael@0 58 #define DEBUG_SORT_RAW 0
michael@0 59 #define DEBUG_SORT_SINGLE 0
michael@0 60 #define DEBUG_SWAP_TOP 0
michael@0 61 #define DEBUG_UNSORTABLE 0
michael@0 62 #define DEBUG_VALIDATE 0
michael@0 63 #define DEBUG_WIND_BUMP 0
michael@0 64 #define DEBUG_WINDING 0
michael@0 65 #define DEBUG_WINDING_AT_T 0
michael@0 66
michael@0 67 #else
michael@0 68
michael@0 69 #define DEBUG_ACTIVE_OP 1
michael@0 70 #define DEBUG_ACTIVE_SPANS 1
michael@0 71 #define DEBUG_ACTIVE_SPANS_FIRST_ONLY 0
michael@0 72 #define DEBUG_ACTIVE_SPANS_SHORT_FORM 1
michael@0 73 #define DEBUG_ADD_INTERSECTING_TS 1
michael@0 74 #define DEBUG_ADD_T_PAIR 1
michael@0 75 #define DEBUG_ANGLE 1
michael@0 76 #define DEBUG_AS_C_CODE 1
michael@0 77 #define DEBUG_ASSEMBLE 1
michael@0 78 #define DEBUG_CHECK_ENDS 1
michael@0 79 #define DEBUG_CHECK_TINY 1
michael@0 80 #define DEBUG_CONCIDENT 1
michael@0 81 #define DEBUG_CROSS 01
michael@0 82 #define DEBUG_FLAT_QUADS 0
michael@0 83 #define DEBUG_FLOW 1
michael@0 84 #define DEBUG_MARK_DONE 1
michael@0 85 #define DEBUG_PATH_CONSTRUCTION 1
michael@0 86 #define DEBUG_SHOW_TEST_NAME 1
michael@0 87 #define DEBUG_SHOW_TEST_PROGRESS 1
michael@0 88 #define DEBUG_SHOW_WINDING 0
michael@0 89 #define DEBUG_SORT 1
michael@0 90 #define DEBUG_SORT_COMPACT 0
michael@0 91 #define DEBUG_SORT_RAW 0
michael@0 92 #define DEBUG_SORT_SINGLE 0
michael@0 93 #define DEBUG_SWAP_TOP 1
michael@0 94 #define DEBUG_UNSORTABLE 1
michael@0 95 #define DEBUG_VALIDATE 1
michael@0 96 #define DEBUG_WIND_BUMP 0
michael@0 97 #define DEBUG_WINDING 1
michael@0 98 #define DEBUG_WINDING_AT_T 1
michael@0 99
michael@0 100 #endif
michael@0 101
michael@0 102 #if DEBUG_AS_C_CODE
michael@0 103 #define CUBIC_DEBUG_STR "{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}"
michael@0 104 #define QUAD_DEBUG_STR "{{%1.9g,%1.9g}, {%1.9g,%1.9g}, {%1.9g,%1.9g}}"
michael@0 105 #define LINE_DEBUG_STR "{{%1.9g,%1.9g}, {%1.9g,%1.9g}}"
michael@0 106 #define PT_DEBUG_STR "{{%1.9g,%1.9g}}"
michael@0 107 #else
michael@0 108 #define CUBIC_DEBUG_STR "(%1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g)"
michael@0 109 #define QUAD_DEBUG_STR "(%1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g)"
michael@0 110 #define LINE_DEBUG_STR "(%1.9g,%1.9g %1.9g,%1.9g)"
michael@0 111 #define PT_DEBUG_STR "(%1.9g,%1.9g)"
michael@0 112 #endif
michael@0 113 #define T_DEBUG_STR(t, n) #t "[" #n "]=%1.9g"
michael@0 114 #define TX_DEBUG_STR(t) #t "[%d]=%1.9g"
michael@0 115 #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
michael@0 116 #define QUAD_DEBUG_DATA(q) q[0].fX, q[0].fY, q[1].fX, q[1].fY, q[2].fX, q[2].fY
michael@0 117 #define LINE_DEBUG_DATA(l) l[0].fX, l[0].fY, l[1].fX, l[1].fY
michael@0 118 #define PT_DEBUG_DATA(i, n) i.pt(n).fX, i.pt(n).fY
michael@0 119
michael@0 120 #ifndef DEBUG_TEST
michael@0 121 #define DEBUG_TEST 0
michael@0 122 #endif
michael@0 123
michael@0 124 #if defined SK_DEBUG || !FORCE_RELEASE
michael@0 125
michael@0 126 #if DEBUG_SHOW_TEST_NAME
michael@0 127 #include "SkTLS.h"
michael@0 128 #endif
michael@0 129
michael@0 130 #include "SkTArray.h"
michael@0 131
michael@0 132 class SkPathOpsDebug {
michael@0 133 public:
michael@0 134 static int gMaxWindSum;
michael@0 135 static int gMaxWindValue;
michael@0 136
michael@0 137 static const char* kLVerbStr[];
michael@0 138 static int gContourID;
michael@0 139 static int gSegmentID;
michael@0 140
michael@0 141 #if DEBUG_SORT || DEBUG_SWAP_TOP
michael@0 142 static int gSortCountDefault;
michael@0 143 static int gSortCount;
michael@0 144 #endif
michael@0 145
michael@0 146 #if DEBUG_ACTIVE_OP
michael@0 147 static const char* kPathOpStr[];
michael@0 148 #endif
michael@0 149
michael@0 150 static void MathematicaIze(char* str, size_t bufferSize);
michael@0 151 static bool ValidWind(int winding);
michael@0 152 static void WindingPrintf(int winding);
michael@0 153
michael@0 154 #if DEBUG_SHOW_TEST_NAME
michael@0 155 static void* CreateNameStr();
michael@0 156 static void DeleteNameStr(void* v);
michael@0 157 #define DEBUG_FILENAME_STRING_LENGTH 64
michael@0 158 #define DEBUG_FILENAME_STRING (reinterpret_cast<char* >(SkTLS::Get(SkPathOpsDebug::CreateNameStr, \
michael@0 159 SkPathOpsDebug::DeleteNameStr)))
michael@0 160 static void BumpTestName(char* );
michael@0 161 static void ShowPath(const SkPath& one, const SkPath& two, SkPathOp op, const char* name);
michael@0 162 #endif
michael@0 163 static void DumpAngles(const SkTArray<class SkOpAngle, true>& angles);
michael@0 164 static void DumpAngles(const SkTArray<class SkOpAngle* , true>& angles);
michael@0 165 };
michael@0 166
michael@0 167 // shorthand for calling from debugger
michael@0 168 void Dump(const SkTArray<class SkOpAngle, true>& angles);
michael@0 169 void Dump(const SkTArray<class SkOpAngle* , true>& angles);
michael@0 170 void Dump(const SkTArray<class SkOpAngle, true>* angles);
michael@0 171 void Dump(const SkTArray<class SkOpAngle* , true>* angles);
michael@0 172
michael@0 173 #endif // SK_DEBUG || !FORCE_RELEASE
michael@0 174
michael@0 175 #endif

mercurial