| Index: third_party/WebKit/Source/platform/graphics/ImagePattern.cpp
|
| diff --git a/third_party/WebKit/Source/platform/graphics/ImagePattern.cpp b/third_party/WebKit/Source/platform/graphics/ImagePattern.cpp
|
| index 9ae1fd60567713f10660a605e025ff2c733f920f..cef83a559ef6475caf5af4b1ca7b254e5a3ddf9f 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/ImagePattern.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/ImagePattern.cpp
|
| @@ -5,11 +5,10 @@
|
| #include "platform/graphics/ImagePattern.h"
|
|
|
| #include "platform/graphics/Image.h"
|
| +#include "platform/graphics/paint/PaintShader.h"
|
| +#include "platform/graphics/paint/PaintSurface.h"
|
| #include "platform/graphics/skia/SkiaUtils.h"
|
| -#include "third_party/skia/include/core/SkCanvas.h"
|
| #include "third_party/skia/include/core/SkImage.h"
|
| -#include "third_party/skia/include/core/SkShader.h"
|
| -#include "third_party/skia/include/core/SkSurface.h"
|
|
|
| namespace blink {
|
|
|
| @@ -41,14 +40,14 @@ bool ImagePattern::isLocalMatrixChanged(const SkMatrix& localMatrix) const {
|
| return localMatrix != m_previousLocalMatrix;
|
| }
|
|
|
| -sk_sp<SkShader> ImagePattern::createShader(const SkMatrix& localMatrix) {
|
| +sk_sp<PaintShader> ImagePattern::createShader(const SkMatrix& localMatrix) {
|
| if (!m_tileImage)
|
| - return SkShader::MakeColorShader(SK_ColorTRANSPARENT);
|
| + return WrapSkShader(SkShader::MakeColorShader(SK_ColorTRANSPARENT));
|
|
|
| if (isRepeatXY()) {
|
| // Fast path: for repeatXY we just return a shader from the original image.
|
| - return m_tileImage->makeShader(SkShader::kRepeat_TileMode,
|
| - SkShader::kRepeat_TileMode, &localMatrix);
|
| + return MakePaintShaderImage(m_tileImage, SkShader::kRepeat_TileMode,
|
| + SkShader::kRepeat_TileMode, &localMatrix);
|
| }
|
|
|
| // Skia does not have a "draw the tile only once" option. Clamp_TileMode
|
| @@ -66,11 +65,11 @@ sk_sp<SkShader> ImagePattern::createShader(const SkMatrix& localMatrix) {
|
| // Create a transparent image 2 pixels wider and/or taller than the
|
| // original, then copy the orignal into the middle of it.
|
| // FIXME: Is there a better way to pad (not scale) an image in skia?
|
| - sk_sp<SkSurface> surface =
|
| - SkSurface::MakeRasterN32Premul(m_tileImage->width() + 2 * borderPixelX,
|
| - m_tileImage->height() + 2 * borderPixelY);
|
| + sk_sp<PaintSurface> surface = PaintSurface::MakeRasterN32Premul(
|
| + m_tileImage->width() + 2 * borderPixelX,
|
| + m_tileImage->height() + 2 * borderPixelY);
|
| if (!surface)
|
| - return SkShader::MakeColorShader(SK_ColorTRANSPARENT);
|
| + return WrapSkShader(SkShader::MakeColorShader(SK_ColorTRANSPARENT));
|
|
|
| SkPaint paint;
|
| paint.setBlendMode(SkBlendMode::kSrc);
|
| @@ -81,8 +80,8 @@ sk_sp<SkShader> ImagePattern::createShader(const SkMatrix& localMatrix) {
|
| SkMatrix adjustedMatrix(localMatrix);
|
| adjustedMatrix.postTranslate(-borderPixelX, -borderPixelY);
|
|
|
| - return surface->makeImageSnapshot()->makeShader(tileModeX, tileModeY,
|
| - &adjustedMatrix);
|
| + return MakePaintShaderImage(surface->makeImageSnapshot(), tileModeX,
|
| + tileModeY, &adjustedMatrix);
|
| }
|
|
|
| bool ImagePattern::isTextureBacked() const {
|
|
|