diff options
author | 2017-07-31 12:42:58 -0400 | |
---|---|---|
committer | 2017-07-31 17:21:52 +0000 | |
commit | d9b6773052951b86b20f4ff078920089d888a67c (patch) | |
tree | 01659c244d9cab52ca2fcd5bedd1eb688fdb8bd4 /src | |
parent | 972b2f6041e0b591d9556fc874c24562733c50ce (diff) |
disable single threaded debugging code
Stroking has some debug code that is examined
by StrokerTest.cpp; this test is not thread-safe.
Chrome detects this in TSAN, so disable the
test code in SkStroker.cpp the same way it
is disabled in StrokerTest.cpp
R=bsalomon@google.com
Bug: 749315
Change-Id: I6e424648b4d28509789e3e4123112e0fc95e34ed
Reviewed-on: https://skia-review.googlesource.com/28780
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkStroke.cpp | 8 | ||||
-rw-r--r-- | src/core/SkStrokerPriv.h | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/core/SkStroke.cpp b/src/core/SkStroke.cpp index 61bd730e67..ddc5a6ab3b 100644 --- a/src/core/SkStroke.cpp +++ b/src/core/SkStroke.cpp @@ -26,7 +26,7 @@ static_assert(1 == kCubic_RecursiveLimit, "cubic_stroke_relies_on_cubic_equallin static_assert(SK_ARRAY_COUNT(kRecursiveLimits) == kQuad_RecursiveLimit + 1, "recursive_limits_mismatch"); -#ifdef SK_DEBUG +#if defined SK_DEBUG && QUAD_STROKE_APPROXIMATION int gMaxRecursion[SK_ARRAY_COUNT(kRecursiveLimits)] = { 0 }; #endif #ifndef DEBUG_QUAD_STROKER @@ -1141,8 +1141,10 @@ bool SkPathStroker::cubicStroke(const SkPoint cubic[4], SkQuadConstruct* quadPts if (!SkScalarIsFinite(quadPts->fQuad[2].fX) || !SkScalarIsFinite(quadPts->fQuad[2].fY)) { return false; // just abort if projected quad isn't representable } +#if QUAD_STROKE_APPROXIMATION SkDEBUGCODE(gMaxRecursion[fFoundTangents] = SkTMax(gMaxRecursion[fFoundTangents], fRecursionDepth + 1)); +#endif if (++fRecursionDepth > kRecursiveLimits[fFoundTangents]) { return false; // just abort if projected quad isn't representable } @@ -1177,8 +1179,10 @@ bool SkPathStroker::conicStroke(const SkConic& conic, SkQuadConstruct* quadPts) addDegenerateLine(quadPts); return true; } +#if QUAD_STROKE_APPROXIMATION SkDEBUGCODE(gMaxRecursion[kConic_RecursiveLimit] = SkTMax(gMaxRecursion[kConic_RecursiveLimit], fRecursionDepth + 1)); +#endif if (++fRecursionDepth > kRecursiveLimits[kConic_RecursiveLimit]) { return false; // just abort if projected quad isn't representable } @@ -1207,8 +1211,10 @@ bool SkPathStroker::quadStroke(const SkPoint quad[3], SkQuadConstruct* quadPts) addDegenerateLine(quadPts); return true; } +#if QUAD_STROKE_APPROXIMATION SkDEBUGCODE(gMaxRecursion[kQuad_RecursiveLimit] = SkTMax(gMaxRecursion[kQuad_RecursiveLimit], fRecursionDepth + 1)); +#endif if (++fRecursionDepth > kRecursiveLimits[kQuad_RecursiveLimit]) { return false; // just abort if projected quad isn't representable } diff --git a/src/core/SkStrokerPriv.h b/src/core/SkStrokerPriv.h index d008efa11a..f763805381 100644 --- a/src/core/SkStrokerPriv.h +++ b/src/core/SkStrokerPriv.h @@ -18,6 +18,9 @@ #define CUBIC_ARC_FACTOR ((SK_ScalarSqrt2 - SK_Scalar1) * 4 / 3) +// this enables a global which is not thread-safe; doing so triggers a TSAN error in Chrome tests. +#define QUAD_STROKE_APPROXIMATION 0 // set to 1 to enable additional debugging in StrokerTest.cpp + class SkStrokerPriv { public: typedef void (*CapProc)(SkPath* path, |