Error checking / reporting API
Review URL: https://codereview.chromium.org/13699004
git-svn-id: http://skia.googlecode.com/svn/trunk@8566 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 006fcf8..e029d43 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 @@
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);