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

Side by Side Diff: src/core/SkColorSpaceXform.h

Issue 2360863003: Make SkColorSpaceXform::New() take bare ptrs (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « src/codec/SkWebpCodec.cpp ('k') | src/core/SkColorSpaceXform.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkColorSpaceXform_DEFINED 8 #ifndef SkColorSpaceXform_DEFINED
9 #define SkColorSpaceXform_DEFINED 9 #define SkColorSpaceXform_DEFINED
10 10
11 #include "SkColorSpace.h" 11 #include "SkColorSpace.h"
12 #include "SkColorSpace_Base.h" 12 #include "SkColorSpace_Base.h"
13 #include "SkImageInfo.h" 13 #include "SkImageInfo.h"
14 14
15 class SkColorSpaceXform : SkNoncopyable { 15 class SkColorSpaceXform : SkNoncopyable {
16 public: 16 public:
17 17
18 /** 18 /**
19 * Create an object to handle color space conversions. 19 * Create an object to handle color space conversions.
20 * 20 *
21 * @param srcSpace The encoded color space. 21 * @param srcSpace The encoded color space.
22 * @param dstSpace The destination color space. 22 * @param dstSpace The destination color space.
23 * 23 *
24 */ 24 */
25 static std::unique_ptr<SkColorSpaceXform> New(const sk_sp<SkColorSpace>& src Space, 25 static std::unique_ptr<SkColorSpaceXform> New(SkColorSpace* srcSpace, SkColo rSpace* dstSpace);
26 const sk_sp<SkColorSpace>& dst Space);
27 26
28 enum ColorFormat : uint8_t { 27 enum ColorFormat : uint8_t {
29 kRGBA_8888_ColorFormat, 28 kRGBA_8888_ColorFormat,
30 kBGRA_8888_ColorFormat, 29 kBGRA_8888_ColorFormat,
31 kRGBA_F16_ColorFormat, 30 kRGBA_F16_ColorFormat,
32 kRGBA_F32_ColorFormat, 31 kRGBA_F32_ColorFormat,
33 }; 32 };
34 33
35 /** 34 /**
36 * Apply the color conversion to a |src| buffer, storing the output in the |dst| buffer. 35 * Apply the color conversion to a |src| buffer, storing the output in the |dst| buffer.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 template <SrcGamma kSrc, DstGamma kDst, ColorSpaceMatch kCSM> 71 template <SrcGamma kSrc, DstGamma kDst, ColorSpaceMatch kCSM>
73 class SkColorSpaceXform_Base : public SkColorSpaceXform { 72 class SkColorSpaceXform_Base : public SkColorSpaceXform {
74 public: 73 public:
75 74
76 void apply(void* dst, const uint32_t* src, int len, ColorFormat dstColorForm at, 75 void apply(void* dst, const uint32_t* src, int len, ColorFormat dstColorForm at,
77 SkAlphaType dstAlphaType) const override; 76 SkAlphaType dstAlphaType) const override;
78 77
79 static constexpr int kDstGammaTableSize = 1024; 78 static constexpr int kDstGammaTableSize = 1024;
80 79
81 private: 80 private:
82 SkColorSpaceXform_Base(const sk_sp<SkColorSpace>& srcSpace, const SkMatrix44 & srcToDst, 81 SkColorSpaceXform_Base(SkColorSpace* srcSpace, const SkMatrix44& srcToDst,
83 const sk_sp<SkColorSpace>& dstSpace); 82 SkColorSpace* dstSpace);
84 83
85 sk_sp<SkColorLookUpTable> fColorLUT; 84 sk_sp<SkColorLookUpTable> fColorLUT;
86 85
87 // Contain pointers into storage or pointers into precomputed tables. 86 // Contain pointers into storage or pointers into precomputed tables.
88 const float* fSrcGammaTables[3]; 87 const float* fSrcGammaTables[3];
89 const uint8_t* fDstGammaTables[3]; 88 const uint8_t* fDstGammaTables[3];
90 SkAutoMalloc fStorage; 89 SkAutoMalloc fStorage;
91 90
92 float fSrcToDst[16]; 91 float fSrcToDst[16];
93 92
94 friend class SkColorSpaceXform; 93 friend class SkColorSpaceXform;
95 friend std::unique_ptr<SkColorSpaceXform> SlowIdentityXform(const sk_sp<SkCo lorSpace>& space); 94 friend std::unique_ptr<SkColorSpaceXform> SlowIdentityXform(SkColorSpace* sp ace);
96 }; 95 };
97 96
98 // For testing. Bypasses opts for when src and dst color spaces are equal. 97 // For testing. Bypasses opts for when src and dst color spaces are equal.
99 std::unique_ptr<SkColorSpaceXform> SlowIdentityXform(const sk_sp<SkColorSpace>& space); 98 std::unique_ptr<SkColorSpaceXform> SlowIdentityXform(SkColorSpace* space);
100 99
101 #endif 100 #endif
OLDNEW
« no previous file with comments | « src/codec/SkWebpCodec.cpp ('k') | src/core/SkColorSpaceXform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698