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

Unified Diff: src/core/SkColorFilterShader.cpp

Issue 1821103004: Revert of Revert[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 8a175024def79963a4da350025f7209c7141a66f..2e426a17eded3255f99f12f562cda2b86f510691 100644
--- a/src/core/SkColorFilterShader.cpp
+++ b/src/core/SkColorFilterShader.cpp
@@ -15,26 +15,26 @@
#include "GrFragmentProcessor.h"
#endif
-SkColorFilterShader::SkColorFilterShader(sk_sp<SkShader> shader, sk_sp<SkColorFilter> filter)
- : fShader(std::move(shader))
- , fFilter(std::move(filter))
+SkColorFilterShader::SkColorFilterShader(SkShader* shader, SkColorFilter* filter)
+ : fShader(SkRef(shader))
+ , fFilter(SkRef(filter))
{
- SkASSERT(fShader);
- SkASSERT(fFilter);
+ SkASSERT(shader);
+ SkASSERT(filter);
}
SkFlattenable* SkColorFilterShader::CreateProc(SkReadBuffer& buffer) {
auto shader = buffer.readShader();
- auto filter = buffer.readColorFilter();
- if (!shader || !filter) {
+ SkAutoTUnref<SkColorFilter> filter(buffer.readColorFilter());
+ if (!shader || !filter.get()) {
return nullptr;
}
- return new SkColorFilterShader(shader, filter);
+ return new SkColorFilterShader(shader.get(), filter);
}
void SkColorFilterShader::flatten(SkWriteBuffer& buffer) const {
- buffer.writeFlattenable(fShader.get());
- buffer.writeFlattenable(fFilter.get());
+ buffer.writeFlattenable(fShader);
+ buffer.writeFlattenable(fFilter);
}
uint32_t SkColorFilterShader::FilterShaderContext::getFlags() const {
@@ -137,10 +137,10 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
-sk_sp<SkShader> SkShader::makeWithColorFilter(sk_sp<SkColorFilter> filter) const {
+sk_sp<SkShader> SkShader::makeWithColorFilter(SkColorFilter* filter) const {
SkShader* base = const_cast<SkShader*>(this);
if (!filter) {
return sk_ref_sp(base);
}
- return sk_make_sp<SkColorFilterShader>(sk_ref_sp(base), filter);
+ return sk_make_sp<SkColorFilterShader>(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