Fix some shadow issues.

* Clamp path polygon points to nearest 1/16th of a pixel to help
  with floating point issues.
* Added check for multiple contour paths.
* Return empty SkVertices for certain degenerate cases to avoid
  unnecessary blurs.
* Check iteration count in SkOffsetPolygon to avoid infinite loops.
* Add new tests to verify these.

Bug: skia:
Change-Id: Ie6ad48d2504e065dcc822609d369f90c56ef3ad3
Reviewed-on: https://skia-review.googlesource.com/136701
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/src/utils/SkOffsetPolygon.cpp b/src/utils/SkOffsetPolygon.cpp
index 81b692f..c72f7d4 100755
--- a/src/utils/SkOffsetPolygon.cpp
+++ b/src/utils/SkOffsetPolygon.cpp
@@ -311,6 +311,7 @@
     int iterations = 0;
     while (prevIndex != currIndex) {
         ++iterations;
+        // we should check each edge against each other edge at most once
         if (iterations > inputPolygonSize*inputPolygonSize) {
             return false;
         }
@@ -698,7 +699,14 @@
     prevIndex = edgeDataSize - 1;
     currIndex = 0;
     int insetVertexCount = edgeDataSize;
+    int iterations = 0;
     while (prevIndex != currIndex) {
+        ++iterations;
+        // we should check each edge against each other edge at most once
+        if (iterations > edgeDataSize*edgeDataSize) {
+            return false;
+        }
+
         if (!edgeData[prevIndex].fValid) {
             prevIndex = (prevIndex + edgeDataSize - 1) % edgeDataSize;
             continue;