Chromium Code Reviews| Index: src/core/SkCanvas.cpp |
| diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp |
| index 3acb9136e25814bacb4a725d402820986f56fdf6..0031468212f8a27a7c7e0448afc413c5a74fcefb 100644 |
| --- a/src/core/SkCanvas.cpp |
| +++ b/src/core/SkCanvas.cpp |
| @@ -391,16 +391,17 @@ static SkPaint* set_if_needed(SkLazyPaint* lazy, const SkPaint& orig) { |
| * If the paint has an imagefilter, but it can be simplified to just a colorfilter, return that |
| * colorfilter, else return nullptr. |
| */ |
| -static SkColorFilter* image_to_color_filter(const SkPaint& paint) { |
| +static sk_sp<SkColorFilter> image_to_color_filter(const SkPaint& paint) { |
| SkImageFilter* imgf = paint.getImageFilter(); |
| if (!imgf) { |
| return nullptr; |
| } |
| - SkColorFilter* imgCF; |
| - if (!imgf->asAColorFilter(&imgCF)) { |
| + SkColorFilter* imgCFPtr; |
| + if (!imgf->asAColorFilter(&imgCFPtr)) { |
| return nullptr; |
| } |
| + sk_sp<SkColorFilter> imgCF(imgCFPtr); |
| SkColorFilter* paintCF = paint.getColorFilter(); |
| if (nullptr == paintCF) { |
| @@ -410,8 +411,7 @@ static SkColorFilter* image_to_color_filter(const SkPaint& paint) { |
| // The paint has both a colorfilter(paintCF) and an imagefilter-which-is-a-colorfilter(imgCF) |
| // and we need to combine them into a single colorfilter. |
| - SkAutoTUnref<SkColorFilter> autoImgCF(imgCF); |
| - return SkColorFilter::CreateComposeFilter(imgCF, paintCF); |
| + return SkColorFilter::MakeComposeFilter(imgCF, sk_ref_sp(paintCF)); |
|
f(malita)
2016/03/21 22:24:19
std::move(imgCF)
reed1
2016/03/22 13:47:10
Done.
|
| } |
| /** |
| @@ -455,10 +455,10 @@ public: |
| fTempLayerForImageFilter = false; |
| fDone = false; |
| - SkColorFilter* simplifiedCF = image_to_color_filter(fOrigPaint); |
| + auto simplifiedCF = image_to_color_filter(fOrigPaint); |
| if (simplifiedCF) { |
| SkPaint* paint = set_if_needed(&fLazyPaintInit, fOrigPaint); |
| - paint->setColorFilter(simplifiedCF)->unref(); |
| + paint->setColorFilter(simplifiedCF); |
|
f(malita)
2016/03/21 22:24:19
std::move(simplifiedCF)
reed1
2016/03/22 13:47:10
Done.
|
| paint->setImageFilter(nullptr); |
| fPaint = paint; |
| } |