Cleanup yes/no enums in Ganesh

Yes/no enums should have a base type of bool, and kYes should always
be true. Also, there is no need for a "GrEnumToBool()" function, as we
can just use the enum itself directly: e.g. "GrAA(bool)".

Bug: skia:
Change-Id: I7bb3c2983f717f3467fca4ce6b32920d71026894
Reviewed-on: https://skia-review.googlesource.com/74860
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index 7d27b6c..59add78 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -208,27 +208,21 @@
 /**
  * Used to control antialiasing in draw calls.
  */
-enum class GrAA {
-    kYes,
-    kNo
+enum class GrAA : bool {
+    kNo = false,
+    kYes = true
 };
 
-static inline GrAA GrBoolToAA(bool aa) { return aa ? GrAA::kYes : GrAA::kNo; }
-
 ///////////////////////////////////////////////////////////////////////////////
 
 /**
  * Used to say whether a texture has mip levels allocated or not.
  */
-enum class GrMipMapped {
-    kYes,
-    kNo
+enum class GrMipMapped : bool {
+    kNo = false,
+    kYes = true
 };
 
-static inline GrMipMapped GrBoolToMipMapped(bool mipMapped) {
-    return mipMapped ? GrMipMapped::kYes : GrMipMapped::kNo;
-}
-
 ///////////////////////////////////////////////////////////////////////////////
 
 /**
@@ -484,9 +478,9 @@
 
 // Enum used as return value when flush with semaphores so the client knows whether the
 // semaphores were submitted to GPU or not.
-enum class GrSemaphoresSubmitted : int {
-    kNo,
-    kYes,
+enum class GrSemaphoresSubmitted : bool {
+    kNo = false,
+    kYes = true
 };
 
 #endif
diff --git a/include/private/GrTypesPriv.h b/include/private/GrTypesPriv.h
index 4c63599..4689e41 100644
--- a/include/private/GrTypesPriv.h
+++ b/include/private/GrTypesPriv.h
@@ -85,7 +85,7 @@
  * Not all drawing code paths support using mixed samples when available and instead use
  * coverage-based aa.
  */
-enum class GrAllowMixedSamples { kNo, kYes };
+enum class GrAllowMixedSamples : bool { kNo = false, kYes = true };
 
 GrAAType GrChooseAAType(GrAA, GrFSAAType, GrAllowMixedSamples, const GrCaps&);
 
@@ -94,8 +94,8 @@
  * range. This is important for blending - the latter category may require manual clamping.
  */
 enum class GrPixelConfigIsClamped : bool {
-    kNo,   // F16 or F32
-    kYes,  // Any UNORM type
+    kNo = false,   // F16 or F32
+    kYes = true,  // Any UNORM type
 };
 
 /**
diff --git a/src/gpu/GrBackendSurface.cpp b/src/gpu/GrBackendSurface.cpp
index 67cc634..02e909b 100644
--- a/src/gpu/GrBackendSurface.cpp
+++ b/src/gpu/GrBackendSurface.cpp
@@ -19,7 +19,7 @@
         : fWidth(width)
         , fHeight(height)
         , fConfig(GrVkFormatToPixelConfig(vkInfo.fFormat))
-        , fMipMapped(GrBoolToMipMapped(vkInfo.fLevelCount > 1))
+        , fMipMapped(GrMipMapped(vkInfo.fLevelCount > 1))
         , fBackend(kVulkan_GrBackend)
         , fVkInfo(vkInfo) {}
 #endif
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index 9760205d..dcd4a99 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -296,7 +296,7 @@
                           &grPaint)) {
         return;
     }
-    GrAA aa = GrBoolToAA(paint.isAntiAlias());
+    GrAA aa = GrAA(paint.isAntiAlias());
     SkMaskFilter* mf = paint.getMaskFilter();
     if (mf && !mf->asFragmentProcessor(nullptr)) {
         // The MaskFilter wasn't already handled in SkPaintToGrPaint
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 52fab72..684a52d 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -53,7 +53,7 @@
     const SkRect* rtBounds = &origRTBounds;
     bool isAA;
     if (fStack->isRRect(*rtBounds, rr, &isAA)) {
-        *aa = GrBoolToAA(isAA);
+        *aa = GrAA(isAA);
         return true;
     }
     return false;
@@ -121,7 +121,7 @@
         canDrawArgs.fClipConservativeBounds = &scissorRect;
         canDrawArgs.fViewMatrix = &viewMatrix;
         canDrawArgs.fShape = &shape;
-        canDrawArgs.fAAType = GrChooseAAType(GrBoolToAA(element->isAA()),
+        canDrawArgs.fAAType = GrChooseAAType(GrAA(element->isAA()),
                                              renderTargetContext->fsaaType(),
                                              GrAllowMixedSamples::kYes,
                                              *context->caps());
@@ -383,7 +383,7 @@
     for (ElementList::Iter iter(elements); iter.get(); iter.next()) {
         const Element* element = iter.get();
         SkClipOp op = element->getOp();
-        GrAA aa = GrBoolToAA(element->isAA());
+        GrAA aa = GrAA(element->isAA());
 
         if (kIntersect_SkClipOp == op || kReverseDifference_SkClipOp == op) {
             // Intersect and reverse difference require modifying pixels outside of the geometry
diff --git a/src/gpu/GrReducedClip.cpp b/src/gpu/GrReducedClip.cpp
index 992411a..883ed5d 100644
--- a/src/gpu/GrReducedClip.cpp
+++ b/src/gpu/GrReducedClip.cpp
@@ -108,7 +108,7 @@
     }
 
     if (SK_InvalidGenID != fAAClipRectGenID && // Is there an AA clip rect?
-        ClipResult::kNotClipped == this->addAnalyticFP(fAAClipRect, Invert::kNo, true)) {
+        ClipResult::kNotClipped == this->addAnalyticFP(fAAClipRect, Invert::kNo, GrAA::kYes)) {
         if (fMaskElements.isEmpty()) {
             // Use a replace since it is faster than intersect.
             fMaskElements.addToHead(fAAClipRect, SkMatrix::I(), kReplace_SkClipOp, true /*doAA*/);
@@ -485,10 +485,11 @@
 
         case Element::DeviceSpaceType::kRRect:
             return this->addAnalyticFP(element->getDeviceSpaceRRect(), Invert::kNo,
-                                       element->isAA());
+                                       GrAA(element->isAA()));
 
         case Element::DeviceSpaceType::kPath:
-            return this->addAnalyticFP(element->getDeviceSpacePath(), Invert::kNo, element->isAA());
+            return this->addAnalyticFP(element->getDeviceSpacePath(), Invert::kNo,
+                                       GrAA(element->isAA()));
     }
 
     SK_ABORT("Unexpected DeviceSpaceType");
@@ -510,11 +511,12 @@
                 }
             }
             return this->addAnalyticFP(element->getDeviceSpaceRect(), Invert::kYes,
-                                       element->isAA());
+                                       GrAA(element->isAA()));
 
         case Element::DeviceSpaceType::kRRect: {
             const SkRRect& clipRRect = element->getDeviceSpaceRRect();
-            ClipResult clipResult = this->addAnalyticFP(clipRRect, Invert::kYes, element->isAA());
+            ClipResult clipResult = this->addAnalyticFP(clipRRect, Invert::kYes,
+                                                        GrAA(element->isAA()));
             if (fWindowRects.count() >= fMaxWindowRectangles) {
                 return clipResult;
             }
@@ -552,7 +554,7 @@
 
         case Element::DeviceSpaceType::kPath:
             return this->addAnalyticFP(element->getDeviceSpacePath(), Invert::kYes,
-                                       element->isAA());
+                                       GrAA(element->isAA()));
     }
 
     SK_ABORT("Unexpected DeviceSpaceType");
@@ -573,16 +575,17 @@
 
 template<typename T>
 inline GrReducedClip::ClipResult GrReducedClip::addAnalyticFP(const T& deviceSpaceShape,
-                                                              Invert invert, bool aa) {
+                                                              Invert invert, GrAA aa) {
     if (fAnalyticFPs.count() >= fMaxAnalyticFPs) {
         return ClipResult::kNotClipped;
     }
 
     GrClipEdgeType edgeType;
     if (Invert::kNo == invert) {
-        edgeType = aa ? GrClipEdgeType::kFillAA : GrClipEdgeType::kFillBW;
+        edgeType = (GrAA::kYes == aa) ? GrClipEdgeType::kFillAA : GrClipEdgeType::kFillBW;
     } else {
-        edgeType = aa ? GrClipEdgeType::kInverseFillAA : GrClipEdgeType::kInverseFillBW;
+        edgeType = (GrAA::kYes == aa) ? GrClipEdgeType::kInverseFillAA
+                                      : GrClipEdgeType::kInverseFillBW;
     }
 
     if (auto fp = make_analytic_clip_fp(edgeType, deviceSpaceShape)) {
@@ -624,7 +627,7 @@
                             const GrUserStencilSettings* ss,
                             const SkMatrix& viewMatrix,
                             const SkClipStack::Element* element) {
-    GrAA aa = GrBoolToAA(element->isAA());
+    GrAA aa = GrAA(element->isAA());
     switch (element->getDeviceSpaceType()) {
         case SkClipStack::Element::DeviceSpaceType::kEmpty:
             SkDEBUGFAIL("Should never get here with an empty element.");
@@ -700,7 +703,7 @@
     for (ElementList::Iter iter(fMaskElements); iter.get(); iter.next()) {
         const Element* element = iter.get();
         SkRegion::Op op = (SkRegion::Op)element->getOp();
-        GrAA aa = GrBoolToAA(element->isAA());
+        GrAA aa = GrAA(element->isAA());
         bool invert = element->isInverseFilled();
         if (invert || SkRegion::kIntersect_Op == op || SkRegion::kReverseDifference_Op == op) {
             // draw directly into the result with the stencil set to make the pixels affected
diff --git a/src/gpu/GrReducedClip.h b/src/gpu/GrReducedClip.h
index 3ad2ab9..22387d7 100644
--- a/src/gpu/GrReducedClip.h
+++ b/src/gpu/GrReducedClip.h
@@ -109,11 +109,11 @@
     void addWindowRectangle(const SkRect& elementInteriorRect, bool elementIsAA);
 
     enum class Invert : bool {
-        kNo,
-        kYes
+        kNo = false,
+        kYes = true
     };
 
-    template<typename T> ClipResult addAnalyticFP(const T& deviceSpaceShape, Invert, bool aa);
+    template<typename T> ClipResult addAnalyticFP(const T& deviceSpaceShape, Invert, GrAA);
 
     void makeEmpty();
 
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 33837d3..3e16558 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -307,8 +307,8 @@
         path.setIsVolatile(true);
         path.moveTo(pts[0]);
         path.lineTo(pts[1]);
-        fRenderTargetContext->drawPath(this->clip(), std::move(grPaint),
-                                       GrBoolToAA(paint.isAntiAlias()), this->ctm(), path, style);
+        fRenderTargetContext->drawPath(this->clip(), std::move(grPaint), GrAA(paint.isAntiAlias()),
+                                       this->ctm(), path, style);
         return;
     }
 
@@ -380,8 +380,8 @@
     }
 
     GrStyle style(paint);
-    fRenderTargetContext->drawRect(this->clip(), std::move(grPaint),
-                                   GrBoolToAA(paint.isAntiAlias()), this->ctm(), rect, &style);
+    fRenderTargetContext->drawRect(this->clip(), std::move(grPaint), GrAA(paint.isAntiAlias()),
+                                   this->ctm(), rect, &style);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -434,8 +434,8 @@
 
     SkASSERT(!style.pathEffect());
 
-    fRenderTargetContext->drawRRect(this->clip(), std::move(grPaint),
-                                    GrBoolToAA(paint.isAntiAlias()), this->ctm(), rrect, style);
+    fRenderTargetContext->drawRRect(this->clip(), std::move(grPaint), GrAA(paint.isAntiAlias()),
+                                    this->ctm(), rrect, style);
 }
 
 
@@ -461,8 +461,7 @@
         }
 
         fRenderTargetContext->drawDRRect(this->clip(), std::move(grPaint),
-                                         GrBoolToAA(paint.isAntiAlias()), this->ctm(), outer,
-                                         inner);
+                                         GrAA(paint.isAntiAlias()), this->ctm(), outer, inner);
         return;
     }
 
@@ -493,9 +492,8 @@
         return;
     }
 
-    fRenderTargetContext->drawRegion(this->clip(), std::move(grPaint),
-                                     GrBoolToAA(paint.isAntiAlias()), this->ctm(), region,
-                                     GrStyle(paint));
+    fRenderTargetContext->drawRegion(this->clip(), std::move(grPaint), GrAA(paint.isAntiAlias()),
+                                     this->ctm(), region, GrStyle(paint));
 }
 
 void SkGpuDevice::drawOval(const SkRect& oval, const SkPaint& paint) {
@@ -522,9 +520,8 @@
         return;
     }
 
-    fRenderTargetContext->drawOval(this->clip(), std::move(grPaint),
-                                   GrBoolToAA(paint.isAntiAlias()), this->ctm(), oval,
-                                   GrStyle(paint));
+    fRenderTargetContext->drawOval(this->clip(), std::move(grPaint), GrAA(paint.isAntiAlias()),
+                                   this->ctm(), oval, GrStyle(paint));
 }
 
 void SkGpuDevice::drawArc(const SkRect& oval, SkScalar startAngle,
@@ -541,7 +538,7 @@
         return;
     }
 
-    fRenderTargetContext->drawArc(this->clip(), std::move(grPaint), GrBoolToAA(paint.isAntiAlias()),
+    fRenderTargetContext->drawArc(this->clip(), std::move(grPaint), GrAA(paint.isAntiAlias()),
                                   this->ctm(), oval, startAngle, sweepAngle, useCenter,
                                   GrStyle(paint));
 }
@@ -598,7 +595,7 @@
     }
 
     fRenderTargetContext->fillRectWithLocalMatrix(
-            this->clip(), std::move(grPaint), GrBoolToAA(newPaint.isAntiAlias()), m, rect, local);
+            this->clip(), std::move(grPaint), GrAA(newPaint.isAntiAlias()), m, rect, local);
 }
 
 void SkGpuDevice::drawPath(const SkPath& origSrcPath,
@@ -1033,8 +1030,8 @@
     }
 
     // Coverage-based AA would cause seams between tiles.
-    GrAA aa = GrBoolToAA(paint.isAntiAlias() &&
-                         GrFSAAType::kNone != fRenderTargetContext->fsaaType());
+    GrAA aa = GrAA(paint.isAntiAlias() &&
+                   GrFSAAType::kNone != fRenderTargetContext->fsaaType());
     fRenderTargetContext->drawRect(this->clip(), std::move(grPaint), aa, viewMatrix, dstRect);
 }
 
@@ -1108,7 +1105,7 @@
     fRenderTargetContext->fillRectToRect(
             this->clip(),
             std::move(grPaint),
-            GrBoolToAA(paint.isAntiAlias()),
+            GrAA(paint.isAntiAlias()),
             SkMatrix::I(),
             SkRect::Make(SkIRect::MakeXYWH(left + offset.fX, top + offset.fY, subset.width(),
                                            subset.height())),
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index c823ebd..bedd292 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -297,7 +297,7 @@
                                      &grPaint)) {
         return;
     }
-    GrAA aa = GrBoolToAA(paint.isAntiAlias());
+    GrAA aa = GrAA(paint.isAntiAlias());
     if (canUseTextureCoordsAsLocalCoords) {
         fRenderTargetContext->fillRectToRect(this->clip(), std::move(grPaint), aa, viewMatrix,
                                              clippedDstRect, clippedSrcRect);
diff --git a/src/gpu/ops/GrOp.h b/src/gpu/ops/GrOp.h
index ece868f..5f61770 100644
--- a/src/gpu/ops/GrOp.h
+++ b/src/gpu/ops/GrOp.h
@@ -164,17 +164,17 @@
      * purpose of ensuring that the fragment shader runs on partially covered pixels for
      * non-MSAA antialiasing.
      */
-    enum class HasAABloat {
-        kYes,
-        kNo
+    enum class HasAABloat : bool {
+        kNo = false,
+        kYes = true
     };
     /**
      * Indicates that the geometry represented by the op has zero area (e.g. it is hairline or
      * points).
      */
-    enum class IsZeroArea {
-        kYes,
-        kNo
+    enum class IsZeroArea : bool {
+        kNo = false,
+        kYes = true
     };
 
     void setBounds(const SkRect& newBounds, HasAABloat aabloat, IsZeroArea zeroArea) {