diff options
author | reed <reed@google.com> | 2015-08-18 12:50:24 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-18 12:50:24 -0700 |
commit | 4f0e04736c9f7f008f4b8ae49999667b3482b71c (patch) | |
tree | 1a9f979da95eb2fd8009e93a0a0509f6fbf3e5f4 | |
parent | f46c5e8fdb0d832bc5ef7f4272f36286578980ec (diff) |
handle no shader from image in drawAtlas
BUG=skia:
TBR=
Review URL: https://codereview.chromium.org/1298233003
-rw-r--r-- | src/core/SkDevice.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp index dd55aad0ce..b2cc0ddbc3 100644 --- a/src/core/SkDevice.cpp +++ b/src/core/SkDevice.cpp @@ -198,8 +198,14 @@ void SkBaseDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkR localM.preTranslate(-tex[i].left(), -tex[i].top()); SkPaint pnt(paint); - pnt.setShader(atlas->newShader(SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, - &localM))->unref(); + SkAutoTUnref<SkShader> shader(atlas->newShader(SkShader::kClamp_TileMode, + SkShader::kClamp_TileMode, + &localM)); + if (!shader) { + break; + } + pnt.setShader(shader); + if (colors && colors[i] != SK_ColorWHITE) { SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(colors[i], mode)); pnt.setColorFilter(cf); |