aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-02-22 10:03:35 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-22 17:47:55 +0000
commit85fdbe2b5c210a8d8179d0fd4c1c01cb0b1349d6 (patch)
tree1355cb3b0ff06a877422653b8dac249c1a83cb8f /src
parent5e11edf4c00662abdc21b7ba885afff06e67d3bc (diff)
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>
Diffstat (limited to 'src')
-rw-r--r--src/effects/SkCornerPathEffect.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/effects/SkCornerPathEffect.cpp b/src/effects/SkCornerPathEffect.cpp
index 909ef31478..e1acaf9997 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 @@ static bool ComputeStep(const SkPoint& a, const SkPoint& b, SkScalar radius,
bool SkCornerPathEffect::filterPath(SkPath* dst, const SkPath& src,
SkStrokeRec*, const SkRect*) const {
- if (0 == fRadius) {
+ if (fRadius <= 0) {
return false;
}