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

Unified Diff: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp

Issue 2677633004: Handle shader construction failures gracefully (Closed)
Patch Set: comment Created 3 years, 10 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 | third_party/WebKit/Source/platform/graphics/Image.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
diff --git a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
index fc03206702862cea7f12a1fdb60d4ec2b1a3cc00..e408ab13a67b32c02a339ae3807b76be83cdb9f0 100644
--- a/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
+++ b/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp
@@ -320,6 +320,12 @@ void SVGImage::drawPatternForContainer(GraphicsContext& context,
paint.setShader(MakePaintShaderRecord(tilePicture, SkShader::kRepeat_TileMode,
SkShader::kRepeat_TileMode,
&patternTransform, nullptr));
+ // If the shader could not be instantiated (e.g. non-invertible matrix),
+ // draw transparent.
+ // Note: we can't simply bail, because of arbitrary blend mode.
+ if (!paint.getShader())
+ paint.setColor(SK_ColorTRANSPARENT);
+
paint.setBlendMode(compositeOp);
paint.setColorFilter(sk_ref_sp(context.getColorFilter()));
context.drawRect(dstRect, paint);
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/graphics/Image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698