Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: src/core/SkCanvas.cpp

Issue 1827433002: Reland of [2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.o… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkBlitter.cpp ('k') | src/core/SkColorFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 3efb44cc548bed305cf0c18450e9b45f91b6711d..f7f870210d0844b6347030575ec159d210f15ea9 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -391,16 +391,17 @@
* 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 @@
// 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(std::move(imgCF), sk_ref_sp(paintCF));
}
/**
@@ -455,10 +455,10 @@
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(std::move(simplifiedCF));
paint->setImageFilter(nullptr);
fPaint = paint;
}
« no previous file with comments | « src/core/SkBlitter.cpp ('k') | src/core/SkColorFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698