Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: src/core/SkColorSpaceXform.cpp

Issue 2360863003: Make SkColorSpaceXform::New() take bare ptrs (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkColorSpaceXform.h ('k') | tests/ColorSpaceXformTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkColorSpaceXform.cpp
diff --git a/src/core/SkColorSpaceXform.cpp b/src/core/SkColorSpaceXform.cpp
index b1dda348177f0599cdc796e11c55bbe1e9d8e4e6..f1c7511f4e64bdfaf41d82b8f71b8b517b509d6b 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));
« no previous file with comments | « src/core/SkColorSpaceXform.h ('k') | tests/ColorSpaceXformTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698