Always include the default path renderer in the chain

This (plus SW) ensures that we can always draw any path. Changed the path
renderer command line flags so that 'default' means everything but CCPR,
and 'All' really means 'every path renderer'.

Bug: skia:
Change-Id: I2801d1c50ab939f23efb4600e0f90e6add2891b7
Reviewed-on: https://skia-review.googlesource.com/40221
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h
index 65db523..b94b5ce 100644
--- a/include/gpu/GrContextOptions.h
+++ b/include/gpu/GrContextOptions.h
@@ -89,7 +89,7 @@
      * Allows the client to include or exclude specific GPU path renderers.
      */
     enum class GpuPathRenderers {
-        kNone              = 0, // Always use sofware masks.
+        kNone              = 0, // Always use sofware masks and/or GrDefaultPathRenderer.
         kDashLine          = 1 << 0,
         kStencilAndCover   = 1 << 1,
         kMSAA              = 1 << 2,
@@ -99,16 +99,17 @@
         kSmall             = 1 << 6,
         kCoverageCounting  = 1 << 7,
         kTessellating      = 1 << 8,
-        kDefault           = 1 << 9,
+
+        kAll               = (kTessellating | (kTessellating - 1)),
 
         // Temporarily disabling CCPR by default until it has had a time to soak.
-        kAll               = (kDefault | (kDefault - 1)) & ~kCoverageCounting,
+        kDefault           = kAll & ~kCoverageCounting,
 
         // For legacy. To be removed when updated in Android.
         kDistanceField     = kSmall
     };
 
-    GpuPathRenderers fGpuPathRenderers = GpuPathRenderers::kAll;
+    GpuPathRenderers fGpuPathRenderers = GpuPathRenderers::kDefault;
 
     /**
      * The maximum size of cache textures used for Skia's Glyph cache.
diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp
index eda7a65..32e204a 100644
--- a/src/gpu/GrPathRendererChain.cpp
+++ b/src/gpu/GrPathRendererChain.cpp
@@ -59,7 +59,7 @@
     if (options.fGpuPathRenderers & GpuPathRenderers::kSmall) {
         fChain.push_back(sk_make_sp<GrSmallPathRenderer>());
     }
-    if (options.fGpuPathRenderers & Options::GpuPathRenderers::kCoverageCounting) {
+    if (options.fGpuPathRenderers & GpuPathRenderers::kCoverageCounting) {
         if (auto ccpr = GrCoverageCountingPathRenderer::CreateIfSupported(*context->caps())) {
             context->contextPriv().addOnFlushCallbackObject(ccpr.get());
             fChain.push_back(std::move(ccpr));
@@ -68,9 +68,9 @@
     if (options.fGpuPathRenderers & GpuPathRenderers::kTessellating) {
         fChain.push_back(sk_make_sp<GrTessellatingPathRenderer>());
     }
-    if (options.fGpuPathRenderers & GpuPathRenderers::kDefault) {
-        fChain.push_back(sk_make_sp<GrDefaultPathRenderer>());
-    }
+
+    // We always include the default path renderer (as well as SW), so we can draw any path
+    fChain.push_back(sk_make_sp<GrDefaultPathRenderer>());
 }
 
 GrPathRenderer* GrPathRendererChain::getPathRenderer(
diff --git a/src/gpu/GrPathRendererChain.h b/src/gpu/GrPathRendererChain.h
index c0a0ee3..41f26de 100644
--- a/src/gpu/GrPathRendererChain.h
+++ b/src/gpu/GrPathRendererChain.h
@@ -27,7 +27,7 @@
     struct Options {
         using GpuPathRenderers = GrContextOptions::GpuPathRenderers;
         bool fAllowPathMaskCaching = false;
-        GpuPathRenderers fGpuPathRenderers = GpuPathRenderers::kAll;
+        GpuPathRenderers fGpuPathRenderers = GpuPathRenderers::kDefault;
     };
     GrPathRendererChain(GrContext* context, const Options&);
 
diff --git a/tools/flags/SkCommonFlagsPathRenderer.h b/tools/flags/SkCommonFlagsPathRenderer.h
index 0a53beb..9a89bb9 100644
--- a/tools/flags/SkCommonFlagsPathRenderer.h
+++ b/tools/flags/SkCommonFlagsPathRenderer.h
@@ -17,15 +17,17 @@
 DECLARE_string(pr);
 
 #define DEFINE_pathrenderer_flag                                                   \
-    DEFINE_string(pr, "all",                                                       \
+    DEFINE_string(pr, "default",                                                   \
                   "Set of enabled gpu path renderers. Defined as a list of: "      \
-                  "[[~]all [~]dashline [~]nvpr [~]msaa [~]aahairline [~]aaconvex " \
-                  "[~]aalinearizing [~]small [~]tess [~]grdefault]")
+                  "[[~]all [~]default [~]dashline [~]nvpr [~]msaa [~]aahairline [~]aaconvex " \
+                  "[~]aalinearizing [~]small [~]tess]")
 
 inline GrContextOptions::GpuPathRenderers get_named_pathrenderers_flags(const char* name) {
     using GpuPathRenderers = GrContextOptions::GpuPathRenderers;
     if (!strcmp(name, "all")) {
         return GpuPathRenderers::kAll;
+    } else if (!strcmp(name, "default")) {
+        return GpuPathRenderers::kDefault;
     } else if (!strcmp(name, "dashline")) {
         return GpuPathRenderers::kDashLine;
     } else if (!strcmp(name, "nvpr")) {
@@ -44,8 +46,6 @@
         return GpuPathRenderers::kCoverageCounting;
     } else if (!strcmp(name, "tess")) {
         return GpuPathRenderers::kTessellating;
-    } else if (!strcmp(name, "grdefault")) {
-        return GpuPathRenderers::kDefault;
     } else if (!strcmp(name, "none")) {
         return GpuPathRenderers::kNone;
     }
@@ -56,10 +56,10 @@
 inline GrContextOptions::GpuPathRenderers CollectGpuPathRenderersFromFlags() {
     using GpuPathRenderers = GrContextOptions::GpuPathRenderers;
     if (FLAGS_pr.isEmpty()) {
-        return GpuPathRenderers::kAll;
+        return GpuPathRenderers::kDefault;
     }
     GpuPathRenderers gpuPathRenderers = '~' == FLAGS_pr[0][0] ?
-                                        GpuPathRenderers::kAll : GpuPathRenderers::kNone;
+                                        GpuPathRenderers::kDefault : GpuPathRenderers::kNone;
     for (int i = 0; i < FLAGS_pr.count(); ++i) {
         const char* name = FLAGS_pr[i];
         if (name[0] == '~') {
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp
index dd8d330..9bfdc4b 100644
--- a/tools/viewer/Viewer.cpp
+++ b/tools/viewer/Viewer.cpp
@@ -268,13 +268,14 @@
 
     static SkOnce initPathRendererNames;
     initPathRendererNames([]() {
-        gPathRendererNames[GpuPathRenderers::kAll] = "Default Ganesh Behavior (best path renderer)";
+        gPathRendererNames[GpuPathRenderers::kAll] = "All Path Renderers";
+        gPathRendererNames[GpuPathRenderers::kDefault] =
+                "Default Ganesh Behavior (best path renderer, not including CCPR)";
         gPathRendererNames[GpuPathRenderers::kStencilAndCover] = "NV_path_rendering";
         gPathRendererNames[GpuPathRenderers::kMSAA] = "Sample shading";
         gPathRendererNames[GpuPathRenderers::kSmall] = "Small paths (cached sdf or alpha masks)";
         gPathRendererNames[GpuPathRenderers::kCoverageCounting] = "Coverage counting";
         gPathRendererNames[GpuPathRenderers::kTessellating] = "Tessellating";
-        gPathRendererNames[GpuPathRenderers::kDefault] = "Original Ganesh path renderer";
         gPathRendererNames[GpuPathRenderers::kNone] = "Software masks";
     });
 
@@ -613,7 +614,7 @@
     title.append("]");
 
     GpuPathRenderers pr = fWindow->getRequestedDisplayParams().fGrContextOptions.fGpuPathRenderers;
-    if (GpuPathRenderers::kAll != pr) {
+    if (GpuPathRenderers::kDefault != pr) {
         title.appendf(" [Path renderer: %s]", gPathRendererNames[pr].c_str());
     }
 
@@ -1103,6 +1104,7 @@
                     if (!ctx) {
                         ImGui::RadioButton("Software", true);
                     } else if (fWindow->sampleCount()) {
+                        prButton(GpuPathRenderers::kDefault);
                         prButton(GpuPathRenderers::kAll);
                         if (ctx->caps()->shaderCaps()->pathRenderingSupport()) {
                             prButton(GpuPathRenderers::kStencilAndCover);
@@ -1111,9 +1113,9 @@
                             prButton(GpuPathRenderers::kMSAA);
                         }
                         prButton(GpuPathRenderers::kTessellating);
-                        prButton(GpuPathRenderers::kDefault);
                         prButton(GpuPathRenderers::kNone);
                     } else {
+                        prButton(GpuPathRenderers::kDefault);
                         prButton(GpuPathRenderers::kAll);
                         if (GrCoverageCountingPathRenderer::IsSupported(*ctx->caps())) {
                             prButton(GpuPathRenderers::kCoverageCounting);
@@ -1342,6 +1344,7 @@
     if (!ctx) {
         prState[kOptions].append("Software");
     } else if (fWindow->sampleCount()) {
+        prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kDefault]);
         prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kAll]);
         if (ctx->caps()->shaderCaps()->pathRenderingSupport()) {
             prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kStencilAndCover]);
@@ -1350,9 +1353,9 @@
             prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kMSAA]);
         }
         prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kTessellating]);
-        prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kDefault]);
         prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kNone]);
     } else {
+        prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kDefault]);
         prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kAll]);
         if (GrCoverageCountingPathRenderer::IsSupported(*ctx->caps())) {
             prState[kOptions].append(gPathRendererNames[GpuPathRenderers::kCoverageCounting]);