| 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 2e7cbef90cb8f41f73ceefd6de24d0fabda1b667..5af4d8b1bb2f515fa435da2a2c03ad059946d6c5 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/Image.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/Image.cpp
|
| @@ -42,7 +42,8 @@
|
| #include "public/platform/WebData.h"
|
| #include "third_party/skia/include/core/SkCanvas.h"
|
| #include "third_party/skia/include/core/SkImage.h"
|
| -#include "third_party/skia/include/core/SkPictureRecorder.h"
|
| +#include "skia/ext/cdl_picture_recorder.h"
|
| +#include "skia/ext/cdl_shader.h"
|
| #include "wtf/StdLibExtras.h"
|
|
|
| #include <math.h>
|
| @@ -222,24 +223,25 @@ void Image::drawTiledBorder(GraphicsContext& ctxt,
|
|
|
| namespace {
|
|
|
| -sk_sp<SkShader> createPatternShader(const SkImage* image,
|
| - const SkMatrix& shaderMatrix,
|
| - const SkPaint& paint,
|
| - const FloatSize& spacing) {
|
| +sk_sp<CdlShader> createPatternShader(const SkImage* image,
|
| + const SkMatrix& shaderMatrix,
|
| + const CdlPaint& paint,
|
| + const FloatSize& spacing) {
|
| if (spacing.isZero())
|
| - return image->makeShader(SkShader::kRepeat_TileMode,
|
| - SkShader::kRepeat_TileMode, &shaderMatrix);
|
| + return MakeCdlImageShader(sk_ref_sp(const_cast<SkImage*>(image)),
|
| + SkShader::kRepeat_TileMode,
|
| + SkShader::kRepeat_TileMode, &shaderMatrix);
|
|
|
| // Arbitrary tiling is currently only supported for SkPictureShader, so we use
|
| // that instead of a plain bitmap shader to implement spacing.
|
| const SkRect tileRect = SkRect::MakeWH(image->width() + spacing.width(),
|
| image->height() + spacing.height());
|
|
|
| - SkPictureRecorder recorder;
|
| - SkCanvas* canvas = recorder.beginRecording(tileRect);
|
| + CdlPictureRecorder recorder;
|
| + CdlCanvas* canvas = recorder.beginRecording(tileRect);
|
| canvas->drawImage(image, 0, 0, &paint);
|
|
|
| - return SkShader::MakePictureShader(
|
| + return CdlShader::MakePictureShader(
|
| recorder.finishRecordingAsPicture(), SkShader::kRepeat_TileMode,
|
| SkShader::kRepeat_TileMode, &shaderMatrix, nullptr);
|
| }
|
| @@ -287,7 +289,7 @@ void Image::drawPattern(GraphicsContext& context,
|
| return;
|
|
|
| {
|
| - SkPaint paint = context.fillPaint();
|
| + CdlPaint paint = context.fillPaint();
|
| paint.setColor(SK_ColorBLACK);
|
| paint.setBlendMode(compositeOp);
|
| paint.setFilterQuality(
|
| @@ -315,15 +317,15 @@ bool Image::isTextureBacked() {
|
| return image ? image->isTextureBacked() : false;
|
| }
|
|
|
| -bool Image::applyShader(SkPaint& paint, const SkMatrix& localMatrix) {
|
| +bool Image::applyShader(CdlPaint& paint, const SkMatrix& localMatrix) {
|
| // Default shader impl: attempt to build a shader based on the current frame
|
| // SkImage.
|
| sk_sp<SkImage> image = imageForCurrentFrame();
|
| if (!image)
|
| return false;
|
|
|
| - paint.setShader(image->makeShader(SkShader::kRepeat_TileMode,
|
| - SkShader::kRepeat_TileMode, &localMatrix));
|
| + paint.setShader(MakeCdlImageShader(image, SkShader::kRepeat_TileMode,
|
| + SkShader::kRepeat_TileMode, &localMatrix));
|
|
|
| // Animation is normally refreshed in draw() impls, which we don't call when
|
| // painting via shaders.
|
|
|