Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: src/core/SkPath.cpp

Issue 13699004: first draft of error checking / reporting API (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/core/SkPath.cpp
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 006fcf85f24d79bf700d33aad8ea86703d4c57ec..fbeb59fffc9e0f6d7e7624f1e1a49ce2b23e6998 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -13,6 +13,7 @@
#include "SkPathRef.h"
#include "SkRRect.h"
#include "SkThread.h"
+#include "SkErrorInternals.h"
scroggo 2013/04/08 19:24:53 Should be in alphabetical order.
humper 2013/04/08 19:43:23 Done.
////////////////////////////////////////////////////////////////////////////
@@ -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( kError_InvalidArgument,
+ "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);

Powered by Google App Engine
This is Rietveld 408576698