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

Unified Diff: src/core/SkColorFilterShader.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/SkColorFilterShader.h ('k') | src/core/SkColorMatrixFilterRowMajor255.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkColorFilterShader.cpp
diff --git a/src/core/SkColorFilterShader.cpp b/src/core/SkColorFilterShader.cpp
index 2e426a17eded3255f99f12f562cda2b86f510691..8a175024def79963a4da350025f7209c7141a66f 100644
--- a/src/core/SkColorFilterShader.cpp
+++ b/src/core/SkColorFilterShader.cpp
@@ -15,26 +15,26 @@
#include "GrFragmentProcessor.h"
#endif
-SkColorFilterShader::SkColorFilterShader(SkShader* shader, SkColorFilter* filter)
- : fShader(SkRef(shader))
- , fFilter(SkRef(filter))
+SkColorFilterShader::SkColorFilterShader(sk_sp<SkShader> shader, sk_sp<SkColorFilter> filter)
+ : fShader(std::move(shader))
+ , fFilter(std::move(filter))
{
- SkASSERT(shader);
- SkASSERT(filter);
+ SkASSERT(fShader);
+ SkASSERT(fFilter);
}
SkFlattenable* SkColorFilterShader::CreateProc(SkReadBuffer& buffer) {
auto shader = buffer.readShader();
- SkAutoTUnref<SkColorFilter> filter(buffer.readColorFilter());
- if (!shader || !filter.get()) {
+ auto filter = buffer.readColorFilter();
+ if (!shader || !filter) {
return nullptr;
}
- return new SkColorFilterShader(shader.get(), filter);
+ return new SkColorFilterShader(shader, filter);
}
void SkColorFilterShader::flatten(SkWriteBuffer& buffer) const {
- buffer.writeFlattenable(fShader);
- buffer.writeFlattenable(fFilter);
+ buffer.writeFlattenable(fShader.get());
+ buffer.writeFlattenable(fFilter.get());
}
uint32_t SkColorFilterShader::FilterShaderContext::getFlags() const {
@@ -137,10 +137,10 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
-sk_sp<SkShader> SkShader::makeWithColorFilter(SkColorFilter* filter) const {
+sk_sp<SkShader> SkShader::makeWithColorFilter(sk_sp<SkColorFilter> filter) const {
SkShader* base = const_cast<SkShader*>(this);
if (!filter) {
return sk_ref_sp(base);
}
- return sk_make_sp<SkColorFilterShader>(base, filter);
+ return sk_make_sp<SkColorFilterShader>(sk_ref_sp(base), filter);
}
« no previous file with comments | « src/core/SkColorFilterShader.h ('k') | src/core/SkColorMatrixFilterRowMajor255.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698