Don't compute path keys for volatile paths in GrShape.

Otherwise, we will compute cache keys for internally transformed paths that don't repeat (e.g. clip paths transformed into device space with a changing view matrix).

BUG=chromium:649562
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2369513002

Review-Url: https://codereview.chromium.org/2369513002
diff --git a/src/gpu/GrShape.cpp b/src/gpu/GrShape.cpp
index 12fdd3b..7e0a3a4 100644
--- a/src/gpu/GrShape.cpp
+++ b/src/gpu/GrShape.cpp
@@ -132,13 +132,13 @@
             // 4 for the end points and 1 for the inverseness
             return 5;
         case Type::kPath: {
+            if (0 == fPathData.fGenID) {
+                return -1;
+            }
             int dataKeySize = path_key_from_data_size(fPathData.fPath);
             if (dataKeySize >= 0) {
                 return dataKeySize;
             }
-            if (0 == fPathData.fGenID) {
-                return -1;
-            }
             // The key is the path ID and fill type.
             return 2;
         }
@@ -172,12 +172,12 @@
                 *key++ = fLineData.fInverted ? 1 : 0;
                 break;
             case Type::kPath: {
+                SkASSERT(fPathData.fGenID);
                 int dataKeySize = path_key_from_data_size(fPathData.fPath);
                 if (dataKeySize >= 0) {
                     write_path_key_from_data(fPathData.fPath, key);
                     return;
                 }
-                SkASSERT(fPathData.fGenID);
                 *key++ = fPathData.fGenID;
                 // We could canonicalize the fill rule for paths that don't differentiate between
                 // even/odd or winding fill (e.g. convex).