diff options
-rw-r--r-- | src/core/SkPath.cpp | 2 | ||||
-rw-r--r-- | tests/RectTest.cpp | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp index fe557d0fe9..ab8bf2e1fc 100644 --- a/src/core/SkPath.cpp +++ b/src/core/SkPath.cpp @@ -88,7 +88,7 @@ public: ~SkAutoPathBoundsUpdate() { fPath->setConvexity(fDegenerate ? SkPath::kConvex_Convexity : SkPath::kUnknown_Convexity); - if (fEmpty || fHasValidBounds) { + if ((fEmpty || fHasValidBounds) && fRect.isFinite()) { fPath->setBounds(fRect); } } diff --git a/tests/RectTest.cpp b/tests/RectTest.cpp index 6a588b7b6c..d34214d6d3 100644 --- a/tests/RectTest.cpp +++ b/tests/RectTest.cpp @@ -7,6 +7,7 @@ #include "SkBitmap.h" #include "SkCanvas.h" +#include "SkPath.h" #include "SkRect.h" #include "SkRectPriv.h" #include "Test.h" @@ -95,6 +96,14 @@ DEF_TEST(Rect_grow, reporter) { test_skbug4406(reporter); } +DEF_TEST(Rect_path_nan, reporter) { + SkRect r = { 0, 0, SK_ScalarNaN, 100 }; + SkPath p; + p.addRect(r); + // path normally just jams its bounds to be r, but it must notice that r is non-finite + REPORTER_ASSERT(reporter, !p.isFinite()); +} + DEF_TEST(Rect_largest, reporter) { REPORTER_ASSERT(reporter, !SkRectPriv::MakeILarge().isEmpty()); REPORTER_ASSERT(reporter, SkRectPriv::MakeILargestInverted().isEmpty()); |