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

Unified Diff: src/effects/SkColorCubeFilter.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/effects/SkBlurDrawLooper.cpp ('k') | src/effects/SkColorFilterImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkColorCubeFilter.cpp
diff --git a/src/effects/SkColorCubeFilter.cpp b/src/effects/SkColorCubeFilter.cpp
index d59f123a80aaf0bfd2c37f6650571873a0f8f6c2..d80a02fef2424bb801407aaacdf95c35e75e6687 100644
--- a/src/effects/SkColorCubeFilter.cpp
+++ b/src/effects/SkColorCubeFilter.cpp
@@ -48,19 +48,19 @@
(nullptr != cubeData) && (cubeData->size() >= minMemorySize);
}
-SkColorFilter* SkColorCubeFilter::Create(SkData* cubeData, int cubeDimension) {
- if (!is_valid_3D_lut(cubeData, cubeDimension)) {
+sk_sp<SkColorFilter> SkColorCubeFilter::Make(sk_sp<SkData> cubeData, int cubeDimension) {
+ if (!is_valid_3D_lut(cubeData.get(), cubeDimension)) {
return nullptr;
}
- return new SkColorCubeFilter(cubeData, cubeDimension);
-}
-
-SkColorCubeFilter::SkColorCubeFilter(SkData* cubeData, int cubeDimension)
- : fCubeData(SkRef(cubeData))
- , fUniqueID(SkNextColorCubeUniqueID())
- , fCache(cubeDimension) {
-}
+ return sk_sp<SkColorFilter>(new SkColorCubeFilter(std::move(cubeData), cubeDimension));
+}
+
+SkColorCubeFilter::SkColorCubeFilter(sk_sp<SkData> cubeData, int cubeDimension)
+ : fCubeData(std::move(cubeData))
+ , fUniqueID(SkNextColorCubeUniqueID())
+ , fCache(cubeDimension)
+{}
uint32_t SkColorCubeFilter::getFlags() const {
return this->INHERITED::getFlags() | kAlphaUnchanged_Flag;
@@ -142,7 +142,7 @@
if (!buffer.validate(is_valid_3D_lut(cubeData.get(), cubeDimension))) {
return nullptr;
}
- return Create(cubeData.get(), cubeDimension);
+ return Make(std::move(cubeData), cubeDimension).release();
}
void SkColorCubeFilter::flatten(SkWriteBuffer& buffer) const {
« no previous file with comments | « src/effects/SkBlurDrawLooper.cpp ('k') | src/effects/SkColorFilterImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698