Minor SkColorSpaceXformer cleanup
Instead of plugging private fields from the factory, pass to ctor. Change-Id: Iea186e394182bddb6a569de1a05f2e40d6815c80 Reviewed-on: https://skia-review.googlesource.com/21734 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
This commit is contained in:
parent
71479b7922
commit
24a2ecfa25
@ -14,22 +14,23 @@
|
|||||||
#include "SkImage_Base.h"
|
#include "SkImage_Base.h"
|
||||||
#include "SkImageFilter.h"
|
#include "SkImageFilter.h"
|
||||||
#include "SkImagePriv.h"
|
#include "SkImagePriv.h"
|
||||||
#include "SkMakeUnique.h"
|
|
||||||
#include "SkShaderBase.h"
|
#include "SkShaderBase.h"
|
||||||
|
|
||||||
|
SkColorSpaceXformer::SkColorSpaceXformer(sk_sp<SkColorSpace> dst,
|
||||||
|
std::unique_ptr<SkColorSpaceXform> fromSRGB)
|
||||||
|
: fDst(std::move(dst))
|
||||||
|
, fFromSRGB(std::move(fromSRGB)) {}
|
||||||
|
|
||||||
SkColorSpaceXformer::~SkColorSpaceXformer() {}
|
SkColorSpaceXformer::~SkColorSpaceXformer() {}
|
||||||
|
|
||||||
std::unique_ptr<SkColorSpaceXformer> SkColorSpaceXformer::Make(sk_sp<SkColorSpace> dst) {
|
std::unique_ptr<SkColorSpaceXformer> SkColorSpaceXformer::Make(sk_sp<SkColorSpace> dst) {
|
||||||
std::unique_ptr<SkColorSpaceXform> fromSRGB = SkColorSpaceXform_Base::New(
|
std::unique_ptr<SkColorSpaceXform> fromSRGB = SkColorSpaceXform_Base::New(
|
||||||
SkColorSpace::MakeSRGB().get(), dst.get(), SkTransferFunctionBehavior::kIgnore);
|
SkColorSpace::MakeSRGB().get(), dst.get(), SkTransferFunctionBehavior::kIgnore);
|
||||||
if (!fromSRGB) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto xformer = std::unique_ptr<SkColorSpaceXformer>(new SkColorSpaceXformer());
|
return fromSRGB
|
||||||
xformer->fDst = std::move(dst);
|
? std::unique_ptr<SkColorSpaceXformer>(new SkColorSpaceXformer(std::move(dst),
|
||||||
xformer->fFromSRGB = std::move(fromSRGB);
|
std::move(fromSRGB)))
|
||||||
return xformer;
|
: nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<SkImage> SkColorSpaceXformer::apply(const SkImage* src) {
|
sk_sp<SkImage> SkColorSpaceXformer::apply(const SkImage* src) {
|
||||||
|
@ -39,7 +39,7 @@ public:
|
|||||||
sk_sp<SkColorSpace> dst() const { return fDst; }
|
sk_sp<SkColorSpace> dst() const { return fDst; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SkColorSpaceXformer() = default;
|
SkColorSpaceXformer(sk_sp<SkColorSpace> dst, std::unique_ptr<SkColorSpaceXform> fromSRGB);
|
||||||
|
|
||||||
sk_sp<SkColorSpace> fDst;
|
sk_sp<SkColorSpace> fDst;
|
||||||
std::unique_ptr<SkColorSpaceXform> fFromSRGB;
|
std::unique_ptr<SkColorSpaceXform> fFromSRGB;
|
||||||
|
Loading…
Reference in New Issue
Block a user