Index: src/core/SkPath.cpp |
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp |
index 006fcf85f24d79bf700d33aad8ea86703d4c57ec..e029d438fd08ab7b317c37f07e31369f8f525cc5 100644 |
--- a/src/core/SkPath.cpp |
+++ b/src/core/SkPath.cpp |
@@ -7,9 +7,10 @@ |
*/ |
-#include "SkPath.h" |
#include "SkBuffer.h" |
+#include "SkErrorInternals.h" |
#include "SkMath.h" |
+#include "SkPath.h" |
#include "SkPathRef.h" |
#include "SkRRect.h" |
#include "SkThread.h" |
@@ -1034,6 +1035,14 @@ bool SkPath::hasOnlyMoveTos() const { |
void SkPath::addRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry, |
Direction dir) { |
assert_known_direction(dir); |
+ |
+ if (rx < 0 || ry < 0) { |
+ SkErrorInternals::SetError( kInvalidArgument_SkError, |
+ "I got %f and %f as radii to SkPath::AddRoundRect, " |
+ "but negative radii are not allowed.", |
+ SkScalarToDouble(rx), SkScalarToDouble(ry) ); |
+ return; |
+ } |
SkScalar w = rect.width(); |
SkScalar halfW = SkScalarHalf(w); |