Chromium Code Reviews| 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 5ab1d6f47e714896ef405937e8ceda2110650766..0bb2a7b5a7cfdc4944777e1487ceed970befc92c 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/Image.cpp |
| +++ b/third_party/WebKit/Source/platform/graphics/Image.cpp |
| @@ -185,11 +185,11 @@ void Image::drawTiled(GraphicsContext& ctxt, const FloatRect& dstRect, const Flo |
| namespace { |
| -PassRefPtr<SkShader> createPatternShader(const SkImage* image, const SkMatrix& shaderMatrix, |
| +sk_sp<SkShader> createPatternShader(const SkImage* image, const SkMatrix& shaderMatrix, |
| const SkPaint& paint, const FloatSize& spacing) |
| { |
| if (spacing.isZero()) |
| - return adoptRef(image->newShader(SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, &shaderMatrix)); |
| + return sk_sp<SkShader>(image->newShader(SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, &shaderMatrix)); |
|
reed1
2016/03/09 21:09:06
I will add SkImage::makeShader(...) NOW
f(malita)
2016/03/10 13:57:58
Thanks, done.
|
| // Arbitrary tiling is currently only supported for SkPictureShader - so we use it instead |
| // of a plain bitmap shader to implement spacing. |
| @@ -200,10 +200,10 @@ PassRefPtr<SkShader> createPatternShader(const SkImage* image, const SkMatrix& s |
| SkPictureRecorder recorder; |
| SkCanvas* canvas = recorder.beginRecording(tileRect); |
| canvas->drawImage(image, 0, 0, &paint); |
| - RefPtr<const SkPicture> picture = adoptRef(recorder.endRecordingAsPicture()); |
| + sk_sp<const SkPicture> picture(recorder.endRecordingAsPicture()); |
| - return adoptRef(SkShader::CreatePictureShader( |
| - picture.get(), SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, &shaderMatrix, nullptr)); |
| + return SkShader::MakePictureShader( |
| + std::move(picture), SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode, &shaderMatrix, nullptr); |
| } |
| } // anonymous namespace |
| @@ -249,9 +249,9 @@ void Image::drawPattern(GraphicsContext& context, const FloatRect& floatSrcRect, |
| paint.setXfermodeMode(compositeOp); |
| paint.setFilterQuality(context.computeFilterQuality(this, destRect, normSrcRect)); |
| paint.setAntiAlias(context.shouldAntialias()); |
| - RefPtr<SkShader> shader = createPatternShader(image.get(), localMatrix, paint, |
| + auto shader = createPatternShader(image.get(), localMatrix, paint, |
| FloatSize(repeatSpacing.width() / scale.width(), repeatSpacing.height() / scale.height())); |
| - paint.setShader(shader.get()); |
| + paint.setShader(std::move(shader)); |
|
reed1
2016/03/09 21:09:06
move up 2 lines and eliminate named variable shade
f(malita)
2016/03/10 13:57:58
Done.
|
| context.drawRect(destRect, paint); |
| } |