Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(562)

Unified Diff: src/core/SkDevice.cpp

Issue 1298233003: handle no shader from image in drawAtlas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkDevice.cpp
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index dd55aad0ce42379d502fa5f6b6e573114ad983d8..b2cc0ddbc3551cafa4fa1f95bcc4559f97bbcc52 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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698