aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-09-22 07:02:24 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-09-22 07:02:24 -0700
commit4be0e7cfe0efceeaf4c7a4d598d77c27cfd3e69b (patch)
tree0d47793cb5bbe8142570595d0cba13bb70382061 /src/core
parent90939aa22f621ac2d47a601402391a2fde7ba323 (diff)
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
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkColorSpaceXform.cpp19
-rw-r--r--src/core/SkColorSpaceXform.h11
2 files changed, 14 insertions, 16 deletions
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<uint8_t> kFromLinear {
// Build tables to transform src gamma to linear.
template <typename T>
static void build_gamma_tables(const T* outGammaTables[3], T* gammaTableStorage, int gammaTableSize,
- const sk_sp<SkColorSpace>& space, const GammaFns<T>& fns,
- bool gammasAreMatching) {
+ SkColorSpace* space, const GammaFns<T>& 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> SkColorSpaceXform::New(const sk_sp<SkColorSpace>& srcSpace,
- const sk_sp<SkColorSpace>& dstSpace) {
+std::unique_ptr<SkColorSpaceXform> SkColorSpaceXform::New(SkColorSpace* srcSpace,
+ SkColorSpace* dstSpace) {
if (!srcSpace || !dstSpace) {
// Invalid input
return nullptr;
@@ -351,7 +351,7 @@ std::unique_ptr<SkColorSpaceXform> SkColorSpaceXform::New(const sk_sp<SkColorSpa
ColorSpaceMatch csm = kNone_ColorSpaceMatch;
SkMatrix44 srcToDst(SkMatrix44::kUninitialized_Constructor);
- if (SkColorSpace::Equals(srcSpace.get(), dstSpace.get())) {
+ if (SkColorSpace::Equals(srcSpace, dstSpace)) {
srcToDst.setIdentity();
csm = kFull_ColorSpaceMatch;
} else {
@@ -1210,14 +1210,13 @@ static inline int num_tables(SkColorSpace* space) {
template <SrcGamma kSrc, DstGamma kDst, ColorSpaceMatch kCSM>
SkColorSpaceXform_Base<kSrc, kDst, kCSM>
-::SkColorSpaceXform_Base(const sk_sp<SkColorSpace>& srcSpace, const SkMatrix44& srcToDst,
- const sk_sp<SkColorSpace>& 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<SkColorSpaceXform> SlowIdentityXform(const sk_sp<SkColorSpace>& space) {
+std::unique_ptr<SkColorSpaceXform> SlowIdentityXform(SkColorSpace* space) {
return std::unique_ptr<SkColorSpaceXform>(new SkColorSpaceXform_Base
<kTable_SrcGamma, kTable_DstGamma, kNone_ColorSpaceMatch>
(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<SkColorSpaceXform> New(const sk_sp<SkColorSpace>& srcSpace,
- const sk_sp<SkColorSpace>& dstSpace);
+ static std::unique_ptr<SkColorSpaceXform> 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<SkColorSpace>& srcSpace, const SkMatrix44& srcToDst,
- const sk_sp<SkColorSpace>& dstSpace);
+ SkColorSpaceXform_Base(SkColorSpace* srcSpace, const SkMatrix44& srcToDst,
+ SkColorSpace* dstSpace);
sk_sp<SkColorLookUpTable> fColorLUT;
@@ -92,10 +91,10 @@ private:
float fSrcToDst[16];
friend class SkColorSpaceXform;
- friend std::unique_ptr<SkColorSpaceXform> SlowIdentityXform(const sk_sp<SkColorSpace>& space);
+ friend std::unique_ptr<SkColorSpaceXform> SlowIdentityXform(SkColorSpace* space);
};
// For testing. Bypasses opts for when src and dst color spaces are equal.
-std::unique_ptr<SkColorSpaceXform> SlowIdentityXform(const sk_sp<SkColorSpace>& space);
+std::unique_ptr<SkColorSpaceXform> SlowIdentityXform(SkColorSpace* space);
#endif