From 4be0e7cfe0efceeaf4c7a4d598d77c27cfd3e69b Mon Sep 17 00:00:00 2001 From: msarett Date: Thu, 22 Sep 2016 07:02:24 -0700 Subject: Make SkColorSpaceXform::New() take bare ptrs There's no need to take sk_sp if we're not going to ref the ptr. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2360863003 Review-Url: https://codereview.chromium.org/2360863003 --- src/core/SkColorSpaceXform.cpp | 19 +++++++++---------- src/core/SkColorSpaceXform.h | 11 +++++------ 2 files changed, 14 insertions(+), 16 deletions(-) (limited to 'src/core') diff --git a/src/core/SkColorSpaceXform.cpp b/src/core/SkColorSpaceXform.cpp index b1dda34817..f1c7511f4e 100644 --- a/src/core/SkColorSpaceXform.cpp +++ b/src/core/SkColorSpaceXform.cpp @@ -256,8 +256,8 @@ static const GammaFns kFromLinear { // Build tables to transform src gamma to linear. template static void build_gamma_tables(const T* outGammaTables[3], T* gammaTableStorage, int gammaTableSize, - const sk_sp& space, const GammaFns& fns, - bool gammasAreMatching) { + SkColorSpace* space, const GammaFns& fns, bool gammasAreMatching) +{ switch (as_CSB(space)->gammaNamed()) { case kSRGB_SkGammaNamed: outGammaTables[0] = outGammaTables[1] = outGammaTables[2] = fns.fSRGBTable; @@ -342,8 +342,8 @@ static inline bool is_almost_identity(const SkMatrix44& srcToDst) { /////////////////////////////////////////////////////////////////////////////////////////////////// -std::unique_ptr SkColorSpaceXform::New(const sk_sp& srcSpace, - const sk_sp& dstSpace) { +std::unique_ptr SkColorSpaceXform::New(SkColorSpace* srcSpace, + SkColorSpace* dstSpace) { if (!srcSpace || !dstSpace) { // Invalid input return nullptr; @@ -351,7 +351,7 @@ std::unique_ptr SkColorSpaceXform::New(const sk_sp SkColorSpaceXform_Base -::SkColorSpaceXform_Base(const sk_sp& srcSpace, const SkMatrix44& srcToDst, - const sk_sp& dstSpace) +::SkColorSpaceXform_Base(SkColorSpace* srcSpace, const SkMatrix44& srcToDst, SkColorSpace* dstSpace) : fColorLUT(sk_ref_sp((SkColorLookUpTable*) as_CSB(srcSpace)->colorLUT())) { srcToDst.asColMajorf(fSrcToDst); - const int numSrcTables = num_tables(srcSpace.get()); - const int numDstTables = num_tables(dstSpace.get()); + const int numSrcTables = num_tables(srcSpace); + const int numDstTables = num_tables(dstSpace); const size_t srcTableBytes = numSrcTables * 256 * sizeof(float); const size_t dstTableBytes = numDstTables * kDstGammaTableSize * sizeof(uint8_t); fStorage.reset(srcTableBytes + dstTableBytes); @@ -1365,7 +1364,7 @@ const /////////////////////////////////////////////////////////////////////////////////////////////////// -std::unique_ptr SlowIdentityXform(const sk_sp& space) { +std::unique_ptr SlowIdentityXform(SkColorSpace* space) { return std::unique_ptr(new SkColorSpaceXform_Base (space, SkMatrix::I(), space)); diff --git a/src/core/SkColorSpaceXform.h b/src/core/SkColorSpaceXform.h index 6c996a9c09..307cc709cd 100644 --- a/src/core/SkColorSpaceXform.h +++ b/src/core/SkColorSpaceXform.h @@ -22,8 +22,7 @@ public: * @param dstSpace The destination color space. * */ - static std::unique_ptr New(const sk_sp& srcSpace, - const sk_sp& dstSpace); + static std::unique_ptr New(SkColorSpace* srcSpace, SkColorSpace* dstSpace); enum ColorFormat : uint8_t { kRGBA_8888_ColorFormat, @@ -79,8 +78,8 @@ public: static constexpr int kDstGammaTableSize = 1024; private: - SkColorSpaceXform_Base(const sk_sp& srcSpace, const SkMatrix44& srcToDst, - const sk_sp& dstSpace); + SkColorSpaceXform_Base(SkColorSpace* srcSpace, const SkMatrix44& srcToDst, + SkColorSpace* dstSpace); sk_sp fColorLUT; @@ -92,10 +91,10 @@ private: float fSrcToDst[16]; friend class SkColorSpaceXform; - friend std::unique_ptr SlowIdentityXform(const sk_sp& space); + friend std::unique_ptr SlowIdentityXform(SkColorSpace* space); }; // For testing. Bypasses opts for when src and dst color spaces are equal. -std::unique_ptr SlowIdentityXform(const sk_sp& space); +std::unique_ptr SlowIdentityXform(SkColorSpace* space); #endif -- cgit v1.2.3