Add SkGraphics::SetForceAnalyticAA
To be used like SetPathAnalyticAADecider, but in cases where we need a
thread-safe API (particularly in Google3).
Change-Id: Ie4ba0cfafa72e5171e83ef6a28fc3067e44328a9
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/662742
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/include/core/SkGraphics.h b/include/core/SkGraphics.h
index 2a20825..6ce9175 100644
--- a/include/core/SkGraphics.h
+++ b/include/core/SkGraphics.h
@@ -157,6 +157,15 @@
*/
typedef bool (*PathAnalyticAADeciderProc)(const SkPath&);
static void SetPathAnalyticAADecider(PathAnalyticAADeciderProc);
+
+ /*
+ * Similar to above, but simply forces the CPU backend to always use analytic AA.
+ *
+ * NOTE: This is a temporary API, intended for migration of all clients to one algorithm.
+ * If the PathAnalyticAADeciderProc is *also* set, this setting has no effect.
+ * Unlike that API, this function is thread-safe.
+ */
+ static void SetForceAnalyticAA(bool);
};
class SkAutoGraphics {
diff --git a/src/core/SkScan_AntiPath.cpp b/src/core/SkScan_AntiPath.cpp
index 4ccc82a..a915e12 100644
--- a/src/core/SkScan_AntiPath.cpp
+++ b/src/core/SkScan_AntiPath.cpp
@@ -31,6 +31,10 @@
gAnalyticAADeciderProc = decider;
}
+void SkGraphics::SetForceAnalyticAA(bool force) {
+ gSkForceAnalyticAA = force;
+}
+
static bool ShouldUseAAA(const SkPath& path) {
#if defined(SK_DISABLE_AAA)
return false;