Allow GrShadowRRectOp::Make to fail

Change-Id: Ia325c711143c76db27b7dd9dd02ea8bea13f2806
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209100
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Robert Phillips 2019-04-17 14:38:24 -04:00 committed by Skia Commit-Bot
parent e8a33ec6d0
commit e5763787f9
2 changed files with 10 additions and 4 deletions

View File

@ -1353,8 +1353,9 @@ bool GrRenderTargetContext::drawFastShadow(const GrClip& clip,
ambientRRect,
devSpaceAmbientBlur,
devSpaceInsetWidth);
SkASSERT(op);
this->addDrawOp(clip, std::move(op));
if (op) {
this->addDrawOp(clip, std::move(op));
}
}
if (SkColorGetA(rec.fSpotColor) > 0) {
@ -1450,8 +1451,9 @@ bool GrRenderTargetContext::drawFastShadow(const GrClip& clip,
spotShadowRRect,
2.0f * devSpaceSpotBlur,
insetWidth);
SkASSERT(op);
this->addDrawOp(clip, std::move(op));
if (op) {
this->addDrawOp(clip, std::move(op));
}
}
return true;

View File

@ -642,6 +642,10 @@ std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context,
SkScalar scaledRadius = SkScalarAbs(radius*matrixFactor);
SkScalar scaledInsetWidth = SkScalarAbs(insetWidth*matrixFactor);
if (scaledInsetWidth <= 0) {
return nullptr;
}
GrOpMemoryPool* pool = context->priv().opMemoryPool();
return pool->allocate<ShadowCircularRRectOp>(color, bounds,