harden line2d effect

Suggested by https://fuzzer.skia.org/category/n32_canvas/file/c3JjL2NvcmUvU2tTdHJva2UuY3Bw?

Bug: skia:
Change-Id: I8ec48f844bfa5d063f0ab1bdfe0612ec4673ada3
Reviewed-on: https://skia-review.googlesource.com/129260
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
Mike Reed 2018-05-18 16:29:11 -04:00 committed by Skia Commit-Bot
parent 5699278b67
commit ba5b5f5171

View File

@ -56,6 +56,9 @@ private:
class SK_API SkLine2DPathEffect : public Sk2DPathEffect {
public:
static sk_sp<SkPathEffect> Make(SkScalar width, const SkMatrix& matrix) {
if (!(width >= 0)) {
return nullptr;
}
return sk_sp<SkPathEffect>(new SkLine2DPathEffect(width, matrix));
}
@ -67,7 +70,9 @@ public:
protected:
SkLine2DPathEffect(SkScalar width, const SkMatrix& matrix)
: Sk2DPathEffect(matrix), fWidth(width) {}
: Sk2DPathEffect(matrix), fWidth(width) {
SkASSERT(width >= 0);
}
void flatten(SkWriteBuffer&) const override;
void nextSpan(int u, int v, int ucount, SkPath*) const override;