aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/core/SkRRect.cpp3
-rw-r--r--tests/RoundRectTest.cpp2
2 files changed, 4 insertions, 1 deletions
diff --git a/src/core/SkRRect.cpp b/src/core/SkRRect.cpp
index 9b3d70e1fd..63fd8ccfcd 100644
--- a/src/core/SkRRect.cpp
+++ b/src/core/SkRRect.cpp
@@ -530,7 +530,8 @@ void SkRRect::dump(bool asHex) const {
* We need all combinations of predicates to be true to have a "safe" radius value.
*/
static bool are_radius_check_predicates_valid(SkScalar rad, SkScalar min, SkScalar max) {
- return (min <= max) && (rad <= max - min) && (min + rad <= max) && (max - rad >= min);
+ return (min <= max) && (rad <= max - min) && (min + rad <= max) && (max - rad >= min) &&
+ rad >= 0;
}
bool SkRRect::isValid() const {
diff --git a/tests/RoundRectTest.cpp b/tests/RoundRectTest.cpp
index 2e31cf1b65..43a51430ab 100644
--- a/tests/RoundRectTest.cpp
+++ b/tests/RoundRectTest.cpp
@@ -786,6 +786,8 @@ static void test_read(skiatest::Reporter* reporter) {
test_read_rrect(reporter, rrect, false);
*innerRadius = SK_ScalarNaN;
test_read_rrect(reporter, rrect, false);
+ *innerRadius = -10.f;
+ test_read_rrect(reporter, rrect, false);
}
DEF_TEST(RoundRect, reporter) {