remove PLAIN_ENUM flag for SkClipOp
authorMike Reed <reed@google.com>
Wed, 14 Dec 2016 19:00:03 +0000 (14:00 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Wed, 14 Dec 2016 19:48:56 +0000 (19:48 +0000)
BUG=skia:

Change-Id: I4fc6f270582bb02218144098427bc356b715c893
Reviewed-on: https://skia-review.googlesource.com/6083
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>

include/core/SkCanvas.h
include/core/SkClipOp.h
include/core/SkClipStack.h
src/core/SkClipOpPriv.h

index 2a6100d..18b23ff 100644 (file)
@@ -42,12 +42,6 @@ class SkSurface;
 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).
@@ -483,7 +477,7 @@ public:
         this->clipRect(rect, op, false);
     }
     void clipRect(const SkRect& rect, bool doAntiAlias = false) {
-        this->clipRect(rect, SkCanvasImpl_DefaultClipOp, doAntiAlias);
+        this->clipRect(rect, SkClipOp::kIntersect, doAntiAlias);
     }
 
     /**
@@ -508,7 +502,7 @@ public:
         this->clipRRect(rrect, op, false);
     }
     void clipRRect(const SkRRect& rrect, bool doAntiAlias = false) {
-        this->clipRRect(rrect, SkCanvasImpl_DefaultClipOp, doAntiAlias);
+        this->clipRRect(rrect, SkClipOp::kIntersect, doAntiAlias);
     }
 
     /**
@@ -522,7 +516,7 @@ public:
         this->clipPath(path, op, false);
     }
     void clipPath(const SkPath& path, bool doAntiAlias = false) {
-        this->clipPath(path, SkCanvasImpl_DefaultClipOp, doAntiAlias);
+        this->clipPath(path, SkClipOp::kIntersect, doAntiAlias);
     }
 
     /** EXPERIMENTAL -- only used for testing
@@ -539,7 +533,7 @@ public:
         @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 = SkCanvasImpl_DefaultClipOp);
+    void clipRegion(const SkRegion& deviceRgn, SkClipOp op = SkClipOp::kIntersect);
 
     /** Return true if the specified rectangle, after being transformed by the
         current matrix, would lie completely outside of the current clip. Call
index 45e0044..1c4b3b7 100644 (file)
 
 // 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,
-
-    // Goal: remove these, since they can grow the current clip
-
-    kUnion_SkClipOp         = 2,
-    kXOR_SkClipOp           = 3,
-    kReverseDifference_SkClipOp = 4,
-    kReplace_SkClipOp       = 5,
-};
-
-#else
-
 enum class SkClipOp {
     kDifference    = 0,
     kIntersect     = 1,
@@ -80,5 +64,3 @@ enum class SkClipOp {
 };
 
 #endif
-
-#endif
index 95e8a94..dce6904 100644 (file)
 
 class SkCanvasClipVisitor;
 
-
-#ifdef SK_SUPPORT_LEGACY_CLIPOPS_PLAIN_ENUM
-    #define SkClipStackImpl_UnionOp    kUnion_SkClipOp
-    #define SkClipStackImpl_ReplaceOp  kReplace_SkClipOp
-#else
-    #define SkClipStackImpl_UnionOp    SkClipOp::kUnion_private_internal_do_not_use
-    #define SkClipStackImpl_ReplaceOp  SkClipOp::kReplace_private_internal_do_not_use
-#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
@@ -63,7 +54,7 @@ public:
         static const int kTypeCnt = kLastType + 1;
 
         Element() {
-            this->initCommon(0, SkClipStackImpl_ReplaceOp, false);
+            this->initCommon(0, SkClipOp::kReplace_private_internal_do_not_use, false);
             this->setEmpty();
         }
 
@@ -235,7 +226,7 @@ public:
         int                     fGenID;
 
         Element(int saveCount) {
-            this->initCommon(saveCount, SkClipStackImpl_ReplaceOp, false);
+            this->initCommon(saveCount, SkClipOp::kReplace_private_internal_do_not_use, false);
             this->setEmpty();
         }
 
@@ -525,7 +516,7 @@ private:
     void restoreTo(int saveCount);
 
     inline bool hasClipRestriction(SkClipOp op) {
-        return op >= SkClipStackImpl_UnionOp && !fClipRestrictionRect.isEmpty();
+        return op >= SkClipOp::kUnion_private_internal_do_not_use && !fClipRestrictionRect.isEmpty();
     }
 
     /**
index 00fb5ba..4af442a 100644 (file)
@@ -10,7 +10,6 @@
 
 #include "SkClipOp.h"
 
-#ifndef SK_SUPPORT_LEGACY_CLIPOPS_PLAIN_ENUM
 const SkClipOp kDifference_SkClipOp         = SkClipOp::kDifference;
 const SkClipOp kIntersect_SkClipOp          = SkClipOp::kIntersect;
 
@@ -18,6 +17,5 @@ const SkClipOp kUnion_SkClipOp              = SkClipOp::kUnion_private_internal_
 const SkClipOp kXOR_SkClipOp                = SkClipOp::kXOR_private_internal_do_not_use;
 const SkClipOp kReverseDifference_SkClipOp  = SkClipOp::kReverseDifference_private_internal_do_not_use;
 const SkClipOp kReplace_SkClipOp            = SkClipOp::kReplace_private_internal_do_not_use;
-#endif
 
 #endif