Reland "Add private fIsBadForDAA bit to SkPath"

This reverts commit ed5e069dbb0b2ef49e22b9d17af3875e3682cd61.

Reason for revert: add the guard flag

Original change's description:
> Revert "Add private fIsBadForDAA bit to SkPath"
> 
> This reverts commit 54aefc74103a5c1810a7cc074746915c78ab3132.
> 
> Reason for revert: Forget the guard flag. Pixel tests would fail.
> 
> Original change's description:
> > Add private fIsBadForDAA bit to SkPath
> > 
> > Bug: chromium:821353
> > Change-Id: Ic6585e76df692bb1853d0990d75f0e8d1dee22f4
> > Reviewed-on: https://skia-review.googlesource.com/120201
> > Commit-Queue: Yuqian Li <liyuqian@google.com>
> > Reviewed-by: Mike Reed <reed@google.com>
> 
> TBR=caryclark@google.com,liyuqian@google.com,reed@google.com
> 
> Change-Id: I2fe7cfcc3a80a51415f72d656da95a894a3240a4
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: chromium:821353
> Reviewed-on: https://skia-review.googlesource.com/120505
> Reviewed-by: Yuqian Li <liyuqian@google.com>
> Commit-Queue: Yuqian Li <liyuqian@google.com>

TBR=caryclark@google.com,liyuqian@google.com,reed@google.com

Change-Id: Iebf7caf9ca74f305dec25b1b6512e93cb41cc8ec
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: chromium:821353
Reviewed-on: https://skia-review.googlesource.com/120620
Commit-Queue: Yuqian Li <liyuqian@google.com>
Reviewed-by: Yuqian Li <liyuqian@google.com>
diff --git a/include/core/SkPath.h b/include/core/SkPath.h
index 895cf1f..3f1cb97 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -1626,6 +1626,7 @@
     mutable SkAtomic<Convexity, sk_memory_order_relaxed> fConvexity;
     mutable SkAtomic<uint8_t, sk_memory_order_relaxed>   fFirstDirection;// SkPathPriv::FirstDirection
     SkBool8                                              fIsVolatile;
+    SkBool8                                              fIsBadForDAA = false;
 
     /** Resets all fields other than fPathRef to their initial 'empty' values.
      *  Assumes the caller has already emptied fPathRef.
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index a06dacf..5c5247c 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -22,6 +22,7 @@
 #include "SkMatrixUtils.h"
 #include "SkPaint.h"
 #include "SkPathEffect.h"
+#include "SkPathPriv.h"
 #include "SkRasterClip.h"
 #include "SkRectPriv.h"
 #include "SkRRect.h"
@@ -1067,6 +1068,7 @@
         tmpPath = iData->fAlloc->make<SkPath>();
     }
     tmpPath->setIsVolatile(true);
+    SkPathPriv::SetIsBadForDAA(*tmpPath, SkPathPriv::IsBadForDAA(origSrcPath));
 
     if (prePathMatrix) {
         if (origPaint.getPathEffect() || origPaint.getStyle() != SkPaint::kFill_Style) {
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 942b95d..62a3cd6 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -140,6 +140,7 @@
     : fPathRef(SkPathRef::CreateEmpty()) {
     this->resetFields();
     fIsVolatile = false;
+    fIsBadForDAA = false;
 }
 
 void SkPath::resetFields() {
@@ -179,6 +180,7 @@
     fLastMoveToIndex = that.fLastMoveToIndex;
     fFillType        = that.fFillType;
     fIsVolatile      = that.fIsVolatile;
+    fIsBadForDAA     = that.fIsBadForDAA;
 
     // Non-atomic assignment of atomic values.
     fConvexity     .store(that.fConvexity     .load());
diff --git a/src/core/SkPathPriv.h b/src/core/SkPathPriv.h
index 49977b1..506c5e1 100644
--- a/src/core/SkPathPriv.h
+++ b/src/core/SkPathPriv.h
@@ -211,6 +211,10 @@
         }
         return result;
     }
+
+    // For crbug.com/821353 and skbug.com/6886
+    static bool IsBadForDAA(const SkPath& path) { return path.fIsBadForDAA; }
+    static void SetIsBadForDAA(SkPath& path, bool isBadForDAA) { path.fIsBadForDAA = isBadForDAA; }
 };
 
 #endif
diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp
index 5923e4a..7524c16 100644
--- a/src/core/SkScalerContext.cpp
+++ b/src/core/SkScalerContext.cpp
@@ -21,6 +21,7 @@
 #include "SkMatrix22.h"
 #include "SkPaintPriv.h"
 #include "SkPathEffect.h"
+#include "SkPathPriv.h"
 #include "SkRasterClip.h"
 #include "SkReadBuffer.h"
 #include "SkRectPriv.h"
@@ -445,6 +446,9 @@
         } else {
             SkASSERT(SkMask::kARGB32_Format != origGlyph.fMaskFormat);
             SkASSERT(SkMask::kARGB32_Format != mask.fFormat);
+#ifndef SK_SUPPORT_LEGACY_PATH_DAA_BIT
+            SkPathPriv::SetIsBadForDAA(devPath, true); // crbug.com/821353
+#endif
             generateMask(mask, devPath, fPreBlend);
         }
     }
diff --git a/src/core/SkScan_AntiPath.cpp b/src/core/SkScan_AntiPath.cpp
index ab86b4e..45bc2e2 100644
--- a/src/core/SkScan_AntiPath.cpp
+++ b/src/core/SkScan_AntiPath.cpp
@@ -8,6 +8,7 @@
 
 #include "SkScanPriv.h"
 #include "SkPath.h"
+#include "SkPathPriv.h"
 #include "SkMatrix.h"
 #include "SkBlitter.h"
 #include "SkRegion.h"
@@ -601,7 +602,7 @@
     if (gSkForceDeltaAA) {
         return true;
     }
-    if (!gSkUseDeltaAA) {
+    if (!gSkUseDeltaAA || SkPathPriv::IsBadForDAA(path)) {
         return false;
     }