diff --git a/src/core/SkColorSpaceXformer.cpp b/src/core/SkColorSpaceXformer.cpp index 301a7f1e79..71715add87 100644 --- a/src/core/SkColorSpaceXformer.cpp +++ b/src/core/SkColorSpaceXformer.cpp @@ -14,22 +14,23 @@ #include "SkImage_Base.h" #include "SkImageFilter.h" #include "SkImagePriv.h" -#include "SkMakeUnique.h" #include "SkShaderBase.h" +SkColorSpaceXformer::SkColorSpaceXformer(sk_sp dst, + std::unique_ptr fromSRGB) + : fDst(std::move(dst)) + , fFromSRGB(std::move(fromSRGB)) {} + SkColorSpaceXformer::~SkColorSpaceXformer() {} std::unique_ptr SkColorSpaceXformer::Make(sk_sp dst) { std::unique_ptr fromSRGB = SkColorSpaceXform_Base::New( SkColorSpace::MakeSRGB().get(), dst.get(), SkTransferFunctionBehavior::kIgnore); - if (!fromSRGB) { - return nullptr; - } - auto xformer = std::unique_ptr(new SkColorSpaceXformer()); - xformer->fDst = std::move(dst); - xformer->fFromSRGB = std::move(fromSRGB); - return xformer; + return fromSRGB + ? std::unique_ptr(new SkColorSpaceXformer(std::move(dst), + std::move(fromSRGB))) + : nullptr; } sk_sp SkColorSpaceXformer::apply(const SkImage* src) { diff --git a/src/core/SkColorSpaceXformer.h b/src/core/SkColorSpaceXformer.h index 75db04022f..fce8d03e43 100644 --- a/src/core/SkColorSpaceXformer.h +++ b/src/core/SkColorSpaceXformer.h @@ -39,7 +39,7 @@ public: sk_sp dst() const { return fDst; } private: - SkColorSpaceXformer() = default; + SkColorSpaceXformer(sk_sp dst, std::unique_ptr fromSRGB); sk_sp fDst; std::unique_ptr fFromSRGB;