diff options
author | Jim Van Verth <jvanverth@google.com> | 2017-07-13 15:13:52 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-13 19:54:33 +0000 |
commit | 7d8955ee4b6e75c684708089bbf737aedf663fd5 (patch) | |
tree | 51c3dab9c4fd65be1f5ab9b5e31304343a2c5b42 /src | |
parent | 4e91f16fdf94cab7f3361d7efa6b12bccabee25e (diff) |
Add null check for non-cached shadows.
Change-Id: I8015a026d4bb54f04ee86fca0d4b0be3bc1d9bd8
Reviewed-on: https://skia-review.googlesource.com/23123
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/SkShadowUtils.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/src/utils/SkShadowUtils.cpp b/src/utils/SkShadowUtils.cpp index 29437e529b..11bcd7552c 100644 --- a/src/utils/SkShadowUtils.cpp +++ b/src/utils/SkShadowUtils.cpp @@ -538,13 +538,15 @@ void SkBaseDevice::drawShadow(const SkPath& path, const SkDrawShadowRec& rec) { sk_sp<SkVertices> vertices = SkShadowTessellator::MakeAmbient(path, viewMatrix, zPlaneParams, transparent); - SkPaint paint; - // Run the vertex color through a GaussianColorFilter and then modulate the grayscale - // result of that against our 'color' param. - paint.setColorFilter(SkColorFilter::MakeComposeFilter( - SkColorFilter::MakeModeFilter(renderColor, SkBlendMode::kModulate), - SkGaussianColorFilter::Make())); - this->drawVertices(vertices.get(), SkBlendMode::kModulate, paint); + if (vertices) { + SkPaint paint; + // Run the vertex color through a GaussianColorFilter and then modulate the + // grayscale result of that against our 'color' param. + paint.setColorFilter(SkColorFilter::MakeComposeFilter( + SkColorFilter::MakeModeFilter(renderColor, SkBlendMode::kModulate), + SkGaussianColorFilter::Make())); + this->drawVertices(vertices.get(), SkBlendMode::kModulate, paint); + } } else { AmbientVerticesFactory factory; factory.fOccluderHeight = zPlaneParams.fZ; @@ -569,13 +571,15 @@ void SkBaseDevice::drawShadow(const SkPath& path, const SkDrawShadowRec& rec) { zPlaneParams, devLightPos, lightRadius, transparent); - SkPaint paint; - // Run the vertex color through a GaussianColorFilter and then modulate the grayscale - // result of that against our 'color' param. - paint.setColorFilter(SkColorFilter::MakeComposeFilter( - SkColorFilter::MakeModeFilter(renderColor, SkBlendMode::kModulate), - SkGaussianColorFilter::Make())); - this->drawVertices(vertices.get(), SkBlendMode::kModulate, paint); + if (vertices) { + SkPaint paint; + // Run the vertex color through a GaussianColorFilter and then modulate the + // grayscale result of that against our 'color' param. + paint.setColorFilter(SkColorFilter::MakeComposeFilter( + SkColorFilter::MakeModeFilter(renderColor, SkBlendMode::kModulate), + SkGaussianColorFilter::Make())); + this->drawVertices(vertices.get(), SkBlendMode::kModulate, paint); + } } else { SpotVerticesFactory factory; SkScalar occluderHeight = zPlaneParams.fZ; |