Get segment masks from GrShape.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2046753002

Review-Url: https://codereview.chromium.org/2046753002
diff --git a/src/gpu/GrShape.h b/src/gpu/GrShape.h
index 30a1b83..4ba5606 100644
--- a/src/gpu/GrShape.h
+++ b/src/gpu/GrShape.h
@@ -196,6 +196,23 @@
         return false;
     }
 
+    uint32_t segmentMask() const {
+        switch (fType) {
+            case Type::kEmpty:
+                return 0;
+            case Type::kRRect:
+                if (fRRect.getType() == SkRRect::kOval_Type) {
+                    return SkPath::kConic_SegmentMask;
+                } else if (fRRect.getType() == SkRRect::kRect_Type) {
+                    return SkPath::kLine_SegmentMask;
+                }
+                return SkPath::kLine_SegmentMask | SkPath::kConic_SegmentMask;
+            case Type::kPath:
+                return fPath.get()->getSegmentMasks();
+        }
+        return 0;
+    }
+
     /**
      * Gets the size of the key for the shape represented by this GrShape (ignoring its styling).
      * A negative value is returned if the shape has no key (shouldn't be cached).
diff --git a/tests/GrShapeTest.cpp b/tests/GrShapeTest.cpp
index 3f23a1c..f4d3d31 100644
--- a/tests/GrShapeTest.cpp
+++ b/tests/GrShapeTest.cpp
@@ -157,10 +157,13 @@
         SkPath path;
         fBase.asPath(&path);
         REPORTER_ASSERT(r, path.isEmpty() == fBase.isEmpty());
+        REPORTER_ASSERT(r, path.getSegmentMasks() == fBase.segmentMask());
         fAppliedPE.asPath(&path);
         REPORTER_ASSERT(r, path.isEmpty() == fAppliedPE.isEmpty());
+        REPORTER_ASSERT(r, path.getSegmentMasks() == fAppliedPE.segmentMask());
         fAppliedFull.asPath(&path);
         REPORTER_ASSERT(r, path.isEmpty() == fAppliedFull.isEmpty());
+        REPORTER_ASSERT(r, path.getSegmentMasks() == fAppliedFull.segmentMask());
 
         CheckBounds(r, fBase, fBase.bounds());
         CheckBounds(r, fAppliedPE, fAppliedPE.bounds());
@@ -283,6 +286,7 @@
     REPORTER_ASSERT(r, a.isEmpty() == b.isEmpty());
     REPORTER_ASSERT(r, a.knownToBeClosed() == b.knownToBeClosed());
     REPORTER_ASSERT(r, a.bounds() == b.bounds());
+    REPORTER_ASSERT(r, a.segmentMask() == b.segmentMask());
 }
 
 void TestCase::compare(skiatest::Reporter* r, const TestCase& that,