detect bad radius in cornerpatheffect
Bug: skia:
Change-Id: I88b0be68e3099bcf6df608ded0e875c7a60bb5d6
Reviewed-on: https://skia-review.googlesource.com/109381
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/src/effects/SkCornerPathEffect.cpp b/src/effects/SkCornerPathEffect.cpp
index 909ef31..e1acaf9 100644
--- a/src/effects/SkCornerPathEffect.cpp
+++ b/src/effects/SkCornerPathEffect.cpp
@@ -12,7 +12,13 @@
#include "SkReadBuffer.h"
#include "SkWriteBuffer.h"
-SkCornerPathEffect::SkCornerPathEffect(SkScalar radius) : fRadius(radius) {}
+SkCornerPathEffect::SkCornerPathEffect(SkScalar radius) {
+ // check with ! to catch NaNs
+ if (!(radius > 0)) {
+ radius = 0;
+ }
+ fRadius = radius;
+}
SkCornerPathEffect::~SkCornerPathEffect() {}
static bool ComputeStep(const SkPoint& a, const SkPoint& b, SkScalar radius,
@@ -31,7 +37,7 @@
bool SkCornerPathEffect::filterPath(SkPath* dst, const SkPath& src,
SkStrokeRec*, const SkRect*) const {
- if (0 == fRadius) {
+ if (fRadius <= 0) {
return false;
}