| Index: third_party/WebKit/Source/platform/graphics/Image.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/Image.cpp b/third_party/WebKit/Source/platform/graphics/Image.cpp
|
| index c3dc079a280203837cafa1731e543f5121c6fc8e..b87996e7110e5cb732f8d5c5f8fcc75781c9d5fb 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/Image.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/Image.cpp
|
| @@ -303,20 +303,24 @@ void Image::drawPattern(GraphicsContext& context,
|
| const auto tmy = computeTileMode(destRect.y(), destRect.maxY(), adjustedY,
|
| adjustedY + tileSize.height());
|
|
|
| - {
|
| - PaintFlags paint = context.fillPaint();
|
| - paint.setColor(SK_ColorBLACK);
|
| - paint.setBlendMode(compositeOp);
|
| - paint.setFilterQuality(
|
| - context.computeFilterQuality(this, destRect, normSrcRect));
|
| - paint.setAntiAlias(context.shouldAntialias());
|
| - paint.setShader(
|
| - createPatternShader(image.get(), localMatrix, paint,
|
| - FloatSize(repeatSpacing.width() / scale.width(),
|
| - repeatSpacing.height() / scale.height()),
|
| - tmx, tmy));
|
| - context.drawRect(destRect, paint);
|
| - }
|
| + PaintFlags paint = context.fillPaint();
|
| + paint.setColor(SK_ColorBLACK);
|
| + paint.setBlendMode(compositeOp);
|
| + paint.setFilterQuality(
|
| + context.computeFilterQuality(this, destRect, normSrcRect));
|
| + paint.setAntiAlias(context.shouldAntialias());
|
| + paint.setShader(
|
| + createPatternShader(image.get(), localMatrix, paint,
|
| + FloatSize(repeatSpacing.width() / scale.width(),
|
| + repeatSpacing.height() / scale.height()),
|
| + tmx, tmy));
|
| + // 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);
|
| +
|
| + context.drawRect(destRect, paint);
|
|
|
| if (currentFrameIsLazyDecoded())
|
| PlatformInstrumentation::didDrawLazyPixelRef(imageID);
|
| @@ -339,6 +343,8 @@ bool Image::applyShader(SkPaint& paint,
|
|
|
| paint.setShader(image->makeShader(SkShader::kRepeat_TileMode,
|
| SkShader::kRepeat_TileMode, &localMatrix));
|
| + if (!paint.getShader())
|
| + return false;
|
|
|
| // Animation is normally refreshed in draw() impls, which we don't call when
|
| // painting via shaders.
|
|
|