Handle paths that do not report empty, but have no edges.
patch from issue 999963005 at patchset 1 (http://crrev.com/999963005#ps1)
BUG=skia:3527
Review URL: https://codereview.chromium.org/1008883002
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp
index 98cfbc1..23d4983 100644
--- a/tests/CanvasTest.cpp
+++ b/tests/CanvasTest.cpp
@@ -747,3 +747,19 @@
canvas.restore();
REPORTER_ASSERT(reporter, 1 == canvas.getSaveCount());
}
+
+DEF_TEST(Canvas_ClipEmptyPath, reporter) {
+ SkCanvas canvas(10, 10);
+ canvas.save();
+ SkPath path;
+ canvas.clipPath(path);
+ canvas.restore();
+ canvas.save();
+ path.moveTo(5, 5);
+ canvas.clipPath(path);
+ canvas.restore();
+ canvas.save();
+ path.moveTo(7, 7);
+ canvas.clipPath(path); // should not assert here
+ canvas.restore();
+}
diff --git a/tests/RegionTest.cpp b/tests/RegionTest.cpp
index ae58ae6..acb8180 100644
--- a/tests/RegionTest.cpp
+++ b/tests/RegionTest.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+#include "SkPath.h"
#include "SkRandom.h"
#include "SkRegion.h"
#include "Test.h"
@@ -91,6 +92,13 @@
REPORTER_ASSERT(reporter, !empty.contains(empty2));
REPORTER_ASSERT(reporter, !valid.contains(empty));
REPORTER_ASSERT(reporter, !empty.contains(valid));
+
+ SkPath emptyPath;
+ emptyPath.moveTo(1, 5);
+ emptyPath.close();
+ SkRegion openClip;
+ openClip.setRect(-16000, -16000, 16000, 16000);
+ empty.setPath(emptyPath, openClip); // should not assert
}
enum {