diff options
author | Mike Klein <mtklein@chromium.org> | 2016-10-04 15:45:56 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-10-04 20:13:31 +0000 |
commit | 511f2d79bf6ea0ee858a3468d3aa8dcbfca58648 (patch) | |
tree | 50d33801abe2245cd147ca4bc477f6f205c0a494 /src | |
parent | 1834242ec6e3cd62669227d394bc79e1cd66dcfb (diff) |
Make global use-analytic-AA bit threadsafe.
I also had to cut it down to just a global atomic bool... as a field in a global singleton accessed through instance(), it's very hard to make threadsafe.
CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-Clang-GCE-CPU-AVX2-x86_64-Release-TSAN-Trybot
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2937
Change-Id: If80be987906dd521fbe644d1d0d577009f06d0e3
Reviewed-on: https://skia-review.googlesource.com/2937
Reviewed-by: Yuqian Li <liyuqian@google.com>
Commit-Queue: Yuqian Li <liyuqian@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkScan.cpp | 2 | ||||
-rw-r--r-- | src/core/SkScan.h | 17 | ||||
-rw-r--r-- | src/core/SkScan_AAAPath.cpp | 2 | ||||
-rw-r--r-- | src/core/SkScan_AntiPath.cpp | 2 |
4 files changed, 6 insertions, 17 deletions
diff --git a/src/core/SkScan.cpp b/src/core/SkScan.cpp index 7fce3f1726..ceb9ff6e7a 100644 --- a/src/core/SkScan.cpp +++ b/src/core/SkScan.cpp @@ -10,6 +10,8 @@ #include "SkBlitter.h" #include "SkRasterClip.h" +std::atomic<bool> gSkUseAnalyticAA{false}; + static inline void blitrect(SkBlitter* blitter, const SkIRect& r) { blitter->blitRect(r.fLeft, r.fTop, r.width(), r.height()); } diff --git a/src/core/SkScan.h b/src/core/SkScan.h index 1e3d60a290..7d513693fe 100644 --- a/src/core/SkScan.h +++ b/src/core/SkScan.h @@ -11,6 +11,7 @@ #include "SkFixed.h" #include "SkRect.h" +#include <atomic> class SkRasterClip; class SkRegion; @@ -22,21 +23,7 @@ class SkPath; */ typedef SkIRect SkXRect; -class GlobalAAConfig { -private: - GlobalAAConfig() {} - -public: - bool fUseAnalyticAA = false; - - GlobalAAConfig(const GlobalAAConfig&) = delete; - void operator=(const GlobalAAConfig&) = delete; - - static GlobalAAConfig& getInstance() { - static GlobalAAConfig instance; - return instance; - } -}; +extern std::atomic<bool> gSkUseAnalyticAA; class AdditiveBlitter; diff --git a/src/core/SkScan_AAAPath.cpp b/src/core/SkScan_AAAPath.cpp index e5b8c57d5f..501b2e67d8 100644 --- a/src/core/SkScan_AAAPath.cpp +++ b/src/core/SkScan_AAAPath.cpp @@ -1109,7 +1109,7 @@ void SkScan::aaa_fill_path(const SkPath& path, const SkIRect* clipRect, Additive // If we're convex, then we need both edges, even the right edge is past the clip const bool canCullToTheRight = !path.isConvex(); - SkASSERT(GlobalAAConfig::getInstance().fUseAnalyticAA); + SkASSERT(gSkUseAnalyticAA.load()); int count = builder.build(path, clipRect, 0, canCullToTheRight, true); SkASSERT(count >= 0); diff --git a/src/core/SkScan_AntiPath.cpp b/src/core/SkScan_AntiPath.cpp index a300d74d8f..53dac3f65f 100644 --- a/src/core/SkScan_AntiPath.cpp +++ b/src/core/SkScan_AntiPath.cpp @@ -750,7 +750,7 @@ void SkScan::FillPath(const SkPath& path, const SkRasterClip& clip, void SkScan::AntiFillPath(const SkPath& path, const SkRasterClip& clip, SkBlitter* blitter) { - if (GlobalAAConfig::getInstance().fUseAnalyticAA) { + if (gSkUseAnalyticAA.load()) { SkScan::AAAFillPath(path, clip, blitter); return; } |