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 @@ static bool is_valid_3D_lut(SkData* cubeData, int cubeDimension) { |
(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); |
+ return sk_sp<SkColorFilter>(new SkColorCubeFilter(std::move(cubeData), cubeDimension)); |
} |
-SkColorCubeFilter::SkColorCubeFilter(SkData* cubeData, int cubeDimension) |
- : fCubeData(SkRef(cubeData)) |
- , fUniqueID(SkNextColorCubeUniqueID()) |
- , fCache(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 @@ SkFlattenable* SkColorCubeFilter::CreateProc(SkReadBuffer& buffer) { |
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 { |