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

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: remove unnecessary include, delete 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
« no previous file with comments | « src/core/SkErrorInternals.h ('k') | tests/ErrorTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/core/SkErrorInternals.h ('k') | tests/ErrorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698