change SkClipOp to a class enum

BUG=skia:

Change-Id: I25dbe6d6b8666a2a0a7be7bdd2ae0b067868d14e
Reviewed-on: https://skia-review.googlesource.com/5718
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/bench/AAClipBench.cpp b/bench/AAClipBench.cpp
index f3159b6..82e4e38 100644
--- a/bench/AAClipBench.cpp
+++ b/bench/AAClipBench.cpp
@@ -12,6 +12,7 @@
 #include "SkRandom.h"
 #include "SkRegion.h"
 #include "SkString.h"
+#include "SkClipOpPriv.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 // This bench tests out AA/BW clipping via canvas' clipPath and clipRect calls
diff --git a/fuzz/FuzzDrawFunctions.cpp b/fuzz/FuzzDrawFunctions.cpp
index cee866c..af4d09b 100644
--- a/fuzz/FuzzDrawFunctions.cpp
+++ b/fuzz/FuzzDrawFunctions.cpp
@@ -13,6 +13,7 @@
 #include "SkPath.h"
 #include "SkSurface.h"
 #include "SkTypeface.h"
+#include "SkClipOpPriv.h"
 
 static const int kBmpSize = 24;
 static const int kMaxX = 250;
diff --git a/gm/blurredclippedcircle.cpp b/gm/blurredclippedcircle.cpp
index e9640ec..9bc0ace 100644
--- a/gm/blurredclippedcircle.cpp
+++ b/gm/blurredclippedcircle.cpp
@@ -7,6 +7,7 @@
 
 #include "gm.h"
 #include "SkBlurMaskFilter.h"
+#include "SkClipOpPriv.h"
 #include "SkColorFilter.h"
 #include "SkPaint.h"
 #include "SkRRect.h"
diff --git a/gm/complexclip.cpp b/gm/complexclip.cpp
index 2ae6a08..1fecd94 100644
--- a/gm/complexclip.cpp
+++ b/gm/complexclip.cpp
@@ -4,11 +4,10 @@
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
+
 #include "gm.h"
 #include "SkCanvas.h"
-//#include "SkParsePath.h"
 #include "SkPath.h"
-//#include "SkRandom.h"
 
 namespace skiagm {
 
diff --git a/gm/complexclip_blur_tiled.cpp b/gm/complexclip_blur_tiled.cpp
index 3a0f0e0..611212d 100644
--- a/gm/complexclip_blur_tiled.cpp
+++ b/gm/complexclip_blur_tiled.cpp
@@ -9,6 +9,7 @@
 #include "SkBlurImageFilter.h"
 #include "SkRRect.h"
 #include "SkSurface.h"
+#include "SkClipOpPriv.h"
 
 #define WIDTH 512
 #define HEIGHT 512
diff --git a/gm/gm.h b/gm/gm.h
index ff033a8..0b26c16 100644
--- a/gm/gm.h
+++ b/gm/gm.h
@@ -15,6 +15,7 @@
 #include "SkString.h"
 #include "SkTRegistry.h"
 #include "sk_tool_utils.h"
+#include "SkClipOpPriv.h"
 
 class SkAnimTimer;
 struct GrContextOptions;
diff --git a/gn/android_framework_defines.gni b/gn/android_framework_defines.gni
index 7ffd36d..ea6358d 100644
--- a/gn/android_framework_defines.gni
+++ b/gn/android_framework_defines.gni
@@ -15,4 +15,5 @@
   "SK_SUPPORT_LEGACY_IMAGE_ENCODER_CLASS",
   "SK_SUPPORT_LEGACY_SHADER_ISABITMAP",
   "SK_SUPPORT_LEGACY_EMBOSSMASKFILTER",
+  "SK_SUPPORT_LEGACY_CLIPOPS_PLAIN_ENUM",
 ]
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 3507786..620c582 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -42,6 +42,12 @@
 class SkSurface_Base;
 class SkTextBlob;
 
+#ifdef SK_SUPPORT_LEGACY_CLIPOPS_PLAIN_ENUM
+    #define SkCanvasImpl_DefaultClipOp  kIntersect_SkClipOp
+#else
+    #define SkCanvasImpl_DefaultClipOp  SkClipOp::kIntersect
+#endif
+
 /** \class SkCanvas
 
     A Canvas encapsulates all of the state about drawing into a device (bitmap).
@@ -477,7 +483,7 @@
         this->clipRect(rect, op, false);
     }
     void clipRect(const SkRect& rect, bool doAntiAlias = false) {
-        this->clipRect(rect, kIntersect_SkClipOp, doAntiAlias);
+        this->clipRect(rect, SkCanvasImpl_DefaultClipOp, doAntiAlias);
     }
 
     /**
@@ -491,7 +497,7 @@
         this->clipRRect(rrect, op, false);
     }
     void clipRRect(const SkRRect& rrect, bool doAntiAlias = false) {
-        this->clipRRect(rrect, kIntersect_SkClipOp, doAntiAlias);
+        this->clipRRect(rrect, SkCanvasImpl_DefaultClipOp, doAntiAlias);
     }
 
     /**
@@ -505,7 +511,7 @@
         this->clipPath(path, op, false);
     }
     void clipPath(const SkPath& path, bool doAntiAlias = false) {
-        this->clipPath(path, kIntersect_SkClipOp, doAntiAlias);
+        this->clipPath(path, SkCanvasImpl_DefaultClipOp, doAntiAlias);
     }
 
     /** EXPERIMENTAL -- only used for testing
@@ -522,7 +528,7 @@
         @param deviceRgn    The region to apply to the current clip
         @param op The region op to apply to the current clip
     */
-    void clipRegion(const SkRegion& deviceRgn, SkClipOp op = kIntersect_SkClipOp);
+    void clipRegion(const SkRegion& deviceRgn, SkClipOp op = SkCanvasImpl_DefaultClipOp);
 
     /** Return true if the specified rectangle, after being transformed by the
         current matrix, would lie completely outside of the current clip. Call
diff --git a/include/core/SkClipOp.h b/include/core/SkClipOp.h
index 2e4fbbf..4a69ef2 100644
--- a/include/core/SkClipOp.h
+++ b/include/core/SkClipOp.h
@@ -10,7 +10,10 @@
 
 #include "SkTypes.h"
 
-// these kept in SkRegion::Op order for now ...
+// SkClipOp enum values always match the corresponding values in SkRegion::Op
+
+#ifdef SK_SUPPORT_LEGACY_CLIPOPS_PLAIN_ENUM
+
 enum SkClipOp {
     kDifference_SkClipOp    = 0,
     kIntersect_SkClipOp     = 1,
@@ -23,4 +26,20 @@
     kReplace_SkClipOp       = 5,
 };
 
+#else
+
+enum class SkClipOp {
+    kDifference    = 0,
+    kIntersect     = 1,
+
+    // Goal: remove these, since they can grow the current clip
+
+    kUnion         = 2,
+    kXOR           = 3,
+    kReverseDifference = 4,
+    kReplace       = 5,
+};
+
+#endif
+
 #endif
diff --git a/include/core/SkClipStack.h b/include/core/SkClipStack.h
index 98a3f76..64f4626 100644
--- a/include/core/SkClipStack.h
+++ b/include/core/SkClipStack.h
@@ -18,6 +18,13 @@
 
 class SkCanvasClipVisitor;
 
+
+#ifdef SK_SUPPORT_LEGACY_CLIPOPS_PLAIN_ENUM
+    #define SkClipStackImpl_ReplaceOp  kReplace_SkClipOp
+#else
+    #define SkClipStackImpl_ReplaceOp  SkClipOp::kReplace
+#endif
+
 // Because a single save/restore state can have multiple clips, this class
 // stores the stack depth (fSaveCount) and clips (fDeque) separately.
 // Each clip in fDeque stores the stack state to which it belongs
@@ -54,7 +61,7 @@
         static const int kTypeCnt = kLastType + 1;
 
         Element() {
-            this->initCommon(0, kReplace_SkClipOp, false);
+            this->initCommon(0, SkClipStackImpl_ReplaceOp, false);
             this->setEmpty();
         }
 
@@ -226,7 +233,7 @@
         int                     fGenID;
 
         Element(int saveCount) {
-            this->initCommon(saveCount, kReplace_SkClipOp, false);
+            this->initCommon(saveCount, SkClipStackImpl_ReplaceOp, false);
             this->setEmpty();
         }
 
diff --git a/include/private/SkRecords.h b/include/private/SkRecords.h
index 54efab1..d1fadc3 100644
--- a/include/private/SkRecords.h
+++ b/include/private/SkRecords.h
@@ -192,9 +192,14 @@
 
 struct ClipOpAndAA {
     ClipOpAndAA() {}
-    ClipOpAndAA(SkClipOp op, bool aa) : op(op), aa(aa) {}
-    SkClipOp op : 31;  // This really only needs to be 3, but there's no win today to do so.
-    unsigned         aa :  1;  // MSVC won't pack an enum with an bool, so we call this an unsigned.
+    ClipOpAndAA(SkClipOp op, bool aa) : fOp(static_cast<unsigned>(op)), fAA(aa) {}
+
+    SkClipOp op() const { return static_cast<SkClipOp>(fOp); }
+    bool aa() const { return fAA != 0; }
+
+private:
+    unsigned fOp : 31;  // This really only needs to be 3, but there's no win today to do so.
+    unsigned fAA :  1;  // MSVC won't pack an enum with an bool, so we call this an unsigned.
 };
 static_assert(sizeof(ClipOpAndAA) == 4, "ClipOpAndAASize");
 
diff --git a/public.bzl b/public.bzl
index e17352b..666a598 100644
--- a/public.bzl
+++ b/public.bzl
@@ -593,6 +593,7 @@
     "SK_SUPPORT_LEGACY_IMAGE_ENCODER_CLASS",
     # Temporarily Disable analytic AA for Google3
     "SK_NO_ANALYTIC_AA",
+    "SK_SUPPORT_LEGACY_CLIPOPS_PLAIN_ENUM",
 ]
 
 ################################################################################
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 1acd975..8797c4d 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -36,6 +36,7 @@
 #include "SkWindow.h"
 #include "sk_tool_utils.h"
 #include "SkScan.h"
+#include "SkClipOpPriv.h"
 
 #include "SkReadBuffer.h"
 #include "SkStream.h"
diff --git a/samplecode/SampleClip.cpp b/samplecode/SampleClip.cpp
index 82466ba..75367cc 100644
--- a/samplecode/SampleClip.cpp
+++ b/samplecode/SampleClip.cpp
@@ -13,6 +13,7 @@
 #include "SkPaint.h"
 #include "SkPath.h"
 #include "SkRandom.h"
+#include "SkClipOpPriv.h"
 
 constexpr int W = 150;
 constexpr int H = 200;
diff --git a/samplecode/SampleComplexClip.cpp b/samplecode/SampleComplexClip.cpp
index ae8a20f..b9c9307 100644
--- a/samplecode/SampleComplexClip.cpp
+++ b/samplecode/SampleComplexClip.cpp
@@ -4,10 +4,12 @@
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
+
 #include "SampleCode.h"
 #include "SkCanvas.h"
 #include "SkPath.h"
 #include "SkView.h"
+#include "SkClipOpPriv.h"
 
 class ComplexClipView : public SampleView {
 public:
diff --git a/samplecode/SampleFatBits.cpp b/samplecode/SampleFatBits.cpp
index 65c929c..c49cdad 100644
--- a/samplecode/SampleFatBits.cpp
+++ b/samplecode/SampleFatBits.cpp
@@ -15,6 +15,7 @@
 #include "SkUtils.h"
 #include "SkImage.h"
 #include "SkSurface.h"
+#include "SkClipOpPriv.h"
 
 #define FAT_PIXEL_COLOR     SK_ColorBLACK
 #define PIXEL_CENTER_SIZE   3
diff --git a/samplecode/SampleIdentityScale.cpp b/samplecode/SampleIdentityScale.cpp
index ae6092a..95970e7 100644
--- a/samplecode/SampleIdentityScale.cpp
+++ b/samplecode/SampleIdentityScale.cpp
@@ -17,6 +17,7 @@
 #include "SkRandom.h"
 #include "SkStream.h"
 #include "SkTime.h"
+#include "SkClipOpPriv.h"
 
 // Intended to exercise pixel snapping observed with scaled images (and
 // with non-scaled images, but for a different reason):  Bug 1145
diff --git a/samplecode/SampleLayers.cpp b/samplecode/SampleLayers.cpp
index faf4fde..ab75ddb 100644
--- a/samplecode/SampleLayers.cpp
+++ b/samplecode/SampleLayers.cpp
@@ -24,6 +24,7 @@
 #include "SkUtils.h"
 #include "SkKey.h"
 #include "SkDrawFilter.h"
+#include "SkClipOpPriv.h"
 
 static void make_paint(SkPaint* paint, const SkMatrix& localMatrix) {
     SkColor colors[] = { 0, SK_ColorWHITE };
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 430556d..f8069ee 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -48,6 +48,7 @@
 #include "SkGrPriv.h"
 
 #endif
+#include "SkClipOpPriv.h"
 
 #define RETURN_ON_NULL(ptr)     do { if (nullptr == (ptr)) return; } while (0)
 
diff --git a/src/core/SkClipOpPriv.h b/src/core/SkClipOpPriv.h
new file mode 100644
index 0000000..5de8449
--- /dev/null
+++ b/src/core/SkClipOpPriv.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkClipOpPriv_DEFINED
+#define SkClipOpPriv_DEFINED
+
+#include "SkClipOp.h"
+
+#ifndef SK_SUPPORT_LEGACY_CLIPOPS_PLAIN_ENUM
+const SkClipOp kDifference_SkClipOp         = SkClipOp::kDifference;
+const SkClipOp kIntersect_SkClipOp          = SkClipOp::kIntersect;
+const SkClipOp kUnion_SkClipOp              = SkClipOp::kUnion;
+const SkClipOp kXOR_SkClipOp                = SkClipOp::kXOR;
+const SkClipOp kReverseDifference_SkClipOp  = SkClipOp::kReverseDifference;
+const SkClipOp kReplace_SkClipOp            = SkClipOp::kReplace;
+#endif
+
+#endif
diff --git a/src/core/SkClipStack.cpp b/src/core/SkClipStack.cpp
index 1a1e85f..c7d5359 100644
--- a/src/core/SkClipStack.cpp
+++ b/src/core/SkClipStack.cpp
@@ -10,6 +10,7 @@
 #include "SkClipStack.h"
 #include "SkPath.h"
 #include "SkPathOps.h"
+#include "SkClipOpPriv.h"
 
 #include <new>
 
@@ -951,16 +952,16 @@
         "reverse-difference",
         "replace",
     };
-    static_assert(0 == kDifference_SkClipOp, "op_str");
-    static_assert(1 == kIntersect_SkClipOp, "op_str");
-    static_assert(2 == kUnion_SkClipOp, "op_str");
-    static_assert(3 == kXOR_SkClipOp, "op_str");
-    static_assert(4 == kReverseDifference_SkClipOp, "op_str");
-    static_assert(5 == kReplace_SkClipOp, "op_str");
+    static_assert(0 == static_cast<int>(kDifference_SkClipOp), "op_str");
+    static_assert(1 == static_cast<int>(kIntersect_SkClipOp), "op_str");
+    static_assert(2 == static_cast<int>(kUnion_SkClipOp), "op_str");
+    static_assert(3 == static_cast<int>(kXOR_SkClipOp), "op_str");
+    static_assert(4 == static_cast<int>(kReverseDifference_SkClipOp), "op_str");
+    static_assert(5 == static_cast<int>(kReplace_SkClipOp), "op_str");
     static_assert(SK_ARRAY_COUNT(kOpStrings) == SkRegion::kOpCnt, "op_str");
 
     SkDebugf("Type: %s, Op: %s, AA: %s, Save Count: %d\n", kTypeStrings[fType],
-             kOpStrings[fOp], (fDoAA ? "yes" : "no"), fSaveCount);
+             kOpStrings[static_cast<int>(fOp)], (fDoAA ? "yes" : "no"), fSaveCount);
     switch (fType) {
         case kEmpty_Type:
             SkDebugf("\n");
diff --git a/src/core/SkPictureCommon.h b/src/core/SkPictureCommon.h
index 9b0a2f7..51724af 100644
--- a/src/core/SkPictureCommon.h
+++ b/src/core/SkPictureCommon.h
@@ -119,7 +119,7 @@
 
     void operator()(const SkRecords::ClipPath& op) {
         // TODO: does the SkRegion op matter?
-        if (op.opAA.aa && !op.path.isConvex()) {
+        if (op.opAA.aa() && !op.path.isConvex()) {
             fNumSlowPathsAndDashEffects++;
         }
     }
diff --git a/src/core/SkPictureFlat.h b/src/core/SkPictureFlat.h
index d5263ca..1ac91b7 100644
--- a/src/core/SkPictureFlat.h
+++ b/src/core/SkPictureFlat.h
@@ -130,7 +130,7 @@
 
 static inline uint32_t ClipParams_pack(SkClipOp op, bool doAA) {
     unsigned doAABit = doAA ? 1 : 0;
-    return (doAABit << 4) | op;
+    return (doAABit << 4) | static_cast<int>(op);
 }
 
 static inline SkClipOp ClipParams_unpackRegionOp(uint32_t packed) {
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index a0ac76d..98677dd 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -13,6 +13,7 @@
 #include "SkRSXform.h"
 #include "SkTextBlob.h"
 #include "SkTSearch.h"
+#include "SkClipOpPriv.h"
 
 #define HEAP_BLOCK_SIZE 4096
 
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index 05261bb..fe39cf2 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -85,9 +85,9 @@
 DRAW(Concat, concat(r.matrix));
 DRAW(Translate, translate(r.dx, r.dy));
 
-DRAW(ClipPath, clipPath(r.path, r.opAA.op, r.opAA.aa));
-DRAW(ClipRRect, clipRRect(r.rrect, r.opAA.op, r.opAA.aa));
-DRAW(ClipRect, clipRect(r.rect, r.opAA.op, r.opAA.aa));
+DRAW(ClipPath, clipPath(r.path, r.opAA.op(), r.opAA.aa()));
+DRAW(ClipRRect, clipRRect(r.rrect, r.opAA.op(), r.opAA.aa()));
+DRAW(ClipRect, clipRect(r.rect, r.opAA.op(), r.opAA.aa()));
 DRAW(ClipRegion, clipRegion(r.region, r.op));
 
 #ifdef SK_EXPERIMENTAL_SHADOWING
diff --git a/src/effects/SkXfermodeImageFilter.cpp b/src/effects/SkXfermodeImageFilter.cpp
index 3a1e6e2..8ecb8be 100644
--- a/src/effects/SkXfermodeImageFilter.cpp
+++ b/src/effects/SkXfermodeImageFilter.cpp
@@ -26,6 +26,7 @@
 #include "SkGr.h"
 #include "SkGrPriv.h"
 #endif
+#include "SkClipOpPriv.h"
 
 class SkXfermodeImageFilter_Base : public SkImageFilter {
 public:
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 1172bc6..9fc2182 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -19,6 +19,7 @@
 #include "effects/GrConvexPolyEffect.h"
 #include "effects/GrRRectEffect.h"
 #include "effects/GrTextureDomain.h"
+#include "SkClipOpPriv.h"
 
 typedef SkClipStack::Element Element;
 typedef GrReducedClip::InitialState InitialState;
@@ -204,16 +205,16 @@
         bool invert;
         bool skip = false;
         switch (op) {
-            case SkRegion::kReplace_Op:
+            case kReplace_SkClipOp:
                 SkASSERT(iter.get() == elements.head());
                 // Fallthrough, handled same as intersect.
-            case SkRegion::kIntersect_Op:
+            case kIntersect_SkClipOp:
                 invert = false;
                 if (iter.get()->contains(boundsInClipSpace)) {
                     skip = true;
                 }
                 break;
-            case SkRegion::kDifference_Op:
+            case kDifference_SkClipOp:
                 invert = true;
                 // We don't currently have a cheap test for whether a rect is fully outside an
                 // element's primitive, so don't attempt to set skip.
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp
index 8b9090f..fd61686 100644
--- a/src/gpu/GrReducedClip.cpp
+++ b/src/gpu/GrReducedClip.cpp
@@ -19,6 +19,7 @@
 #include "GrStencilSettings.h"
 #include "GrStyle.h"
 #include "GrUserStencilSettings.h"
+#include "SkClipOpPriv.h"
 
 typedef SkClipStack::Element Element;
 
@@ -432,11 +433,11 @@
 }
 
 static bool element_is_pure_subtract(SkClipOp op) {
-    SkASSERT(op >= 0);
-    return op <= kIntersect_SkClipOp;
+    SkASSERT(static_cast<int>(op) >= 0);
+    return static_cast<int>(op) <= static_cast<int>(kIntersect_SkClipOp);
 
-    GR_STATIC_ASSERT(0 == kDifference_SkClipOp);
-    GR_STATIC_ASSERT(1 == kIntersect_SkClipOp);
+    GR_STATIC_ASSERT(0 == static_cast<int>(kDifference_SkClipOp));
+    GR_STATIC_ASSERT(1 == static_cast<int>(kIntersect_SkClipOp));
 }
 
 void GrReducedClip::addInteriorWindowRectangles(int maxWindowRectangles) {
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 5724b1a..4f21489 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -42,6 +42,7 @@
 #include "SkTextFormatParams.h"
 #include "SkUtils.h"
 #include "SkXfermodeInterpretation.h"
+#include "SkClipOpPriv.h"
 
 #define DPI_FOR_RASTER_SCALE_ONE 72
 
@@ -199,8 +200,8 @@
               "region_pathop_mismatch");
 
 static SkPathOp region_op_to_pathops_op(SkClipOp op) {
-    SkASSERT(op >= 0);
-    SkASSERT(op <= kReverseDifference_SkClipOp);
+    SkASSERT(static_cast<int>(op) >= 0);
+    SkASSERT(static_cast<int>(op) <= static_cast<int>(kReverseDifference_SkClipOp));
     return (SkPathOp)op;
 }
 
diff --git a/src/svg/SkSVGDevice.cpp b/src/svg/SkSVGDevice.cpp
index b8f8938..09bd09b 100644
--- a/src/svg/SkSVGDevice.cpp
+++ b/src/svg/SkSVGDevice.cpp
@@ -22,6 +22,7 @@
 #include "SkTypeface.h"
 #include "SkUtils.h"
 #include "SkXMLWriter.h"
+#include "SkClipOpPriv.h"
 
 namespace {
 
diff --git a/src/utils/SkCanvasStateUtils.cpp b/src/utils/SkCanvasStateUtils.cpp
index 1991727..6dd0ca3 100644
--- a/src/utils/SkCanvasStateUtils.cpp
+++ b/src/utils/SkCanvasStateUtils.cpp
@@ -12,6 +12,7 @@
 #include "SkDevice.h"
 #include "SkRasterClip.h"
 #include "SkWriter32.h"
+#include "SkClipOpPriv.h"
 
 /*
  * WARNING: The structs below are part of a stable ABI and as such we explicitly
diff --git a/src/utils/SkDeferredCanvas.cpp b/src/utils/SkDeferredCanvas.cpp
index 601f9c9..bba8643 100644
--- a/src/utils/SkDeferredCanvas.cpp
+++ b/src/utils/SkDeferredCanvas.cpp
@@ -11,6 +11,7 @@
 #include "SkRRect.h"
 #include "SkSurface.h"
 #include "SkTextBlob.h"
+#include "SkClipOpPriv.h"
 
 bool SkDeferredCanvas::Rec::isConcat(SkMatrix* m) const {
     switch (fType) {
diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp
index 658da81..85e0243 100644
--- a/src/utils/SkDumpCanvas.cpp
+++ b/src/utils/SkDumpCanvas.cpp
@@ -108,7 +108,7 @@
     static const char* gOpNames[] = {
         "DIFF", "SECT", "UNION", "XOR", "RDIFF", "REPLACE"
     };
-    return gOpNames[op];
+    return gOpNames[static_cast<int>(op)];
 }
 
 static void toString(const SkRegion& rgn, SkString* str) {
diff --git a/tests/CanvasStateTest.cpp b/tests/CanvasStateTest.cpp
index a35fc08..9533474 100644
--- a/tests/CanvasStateTest.cpp
+++ b/tests/CanvasStateTest.cpp
@@ -7,6 +7,7 @@
 
 #include "CanvasStateHelpers.h"
 #include "SkCanvas.h"
+#include "SkClipOpPriv.h"
 #include "SkCanvasStateUtils.h"
 #include "SkCommandLineFlags.h"
 #include "SkDrawFilter.h"
diff --git a/tests/GrShapeTest.cpp b/tests/GrShapeTest.cpp
index f13e6b3..847e522 100644
--- a/tests/GrShapeTest.cpp
+++ b/tests/GrShapeTest.cpp
@@ -15,6 +15,7 @@
 #include "SkPath.h"
 #include "SkPathOps.h"
 #include "SkSurface.h"
+#include "SkClipOpPriv.h"
 
 using Key = SkTArray<uint32_t>;
 
diff --git a/tests/Test.h b/tests/Test.h
index 8b60039..5e6eb6d 100644
--- a/tests/Test.h
+++ b/tests/Test.h
@@ -10,6 +10,7 @@
 #include "SkString.h"
 #include "SkTRegistry.h"
 #include "SkTypes.h"
+#include "SkClipOpPriv.h"
 
 #if SK_SUPPORT_GPU
 #include "GrContextFactory.h"
diff --git a/tools/debugger/SkDebugCanvas.cpp b/tools/debugger/SkDebugCanvas.cpp
index b02ab59..b42c529 100644
--- a/tools/debugger/SkDebugCanvas.cpp
+++ b/tools/debugger/SkDebugCanvas.cpp
@@ -11,6 +11,7 @@
 #include "SkDrawCommand.h"
 #include "SkPaintFilterCanvas.h"
 #include "SkTextBlob.h"
+#include "SkClipOpPriv.h"
 
 #if SK_SUPPORT_GPU
 #include "GrAuditTrail.h"
@@ -812,7 +813,7 @@
         addPathData(fCalledAddStackData ? devPath : fSaveDevPath, "path");
         addPathData(operand, "pathB");
         fClipStackData.appendf("%stestPathOp(reporter, path, pathB, %s, filename);<br>",
-            kHTML4SpaceIndent, gOpStrs[elementOp]);
+            kHTML4SpaceIndent, gOpStrs[static_cast<int>(elementOp)]);
         fClipStackData.appendf("}<br>");
         fCalledAddStackData = true;
     }
diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp
index 6cec6eb..4eaf2ea 100644
--- a/tools/debugger/SkDrawCommand.cpp
+++ b/tools/debugger/SkDrawCommand.cpp
@@ -26,6 +26,7 @@
 #include "SkValidatingReadBuffer.h"
 #include "SkWriteBuffer.h"
 #include "picture_utils.h"
+#include "SkClipOpPriv.h"
 
 #define SKDEBUGCANVAS_ATTRIBUTE_COMMAND           "command"
 #define SKDEBUGCANVAS_ATTRIBUTE_VISIBLE           "visible"
diff --git a/tools/debugger/SkObjectParser.cpp b/tools/debugger/SkObjectParser.cpp
index 8e3f239..e89e8c5 100644
--- a/tools/debugger/SkObjectParser.cpp
+++ b/tools/debugger/SkObjectParser.cpp
@@ -16,6 +16,7 @@
 #include "SkStringUtils.h"
 #include "SkTypeface.h"
 #include "SkUtils.h"
+#include "SkClipOpPriv.h"
 
 /* TODO(chudy): Replace all std::strings with char */