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

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

Issue 2177173003: Delete SkDefaultXform, handle edge cases in SkColorSpaceXform_Base (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use less space on Google3 Created 4 years, 4 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 | « no previous file | 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
(...skipping 21 matching lines...) Expand all
32 * The src is stored as RGBA (8888) and is treated as opaque. 32 * The src is stored as RGBA (8888) and is treated as opaque.
33 * TODO (msarett): Support non-opaque srcs. 33 * TODO (msarett): Support non-opaque srcs.
34 */ 34 */
35 virtual void applyTo8888(SkPMColor* dst, const RGBA32* src, int len) const = 0; 35 virtual void applyTo8888(SkPMColor* dst, const RGBA32* src, int len) const = 0;
36 virtual void applyToF16(RGBAF16* dst, const RGBA32* src, int len) const = 0; 36 virtual void applyToF16(RGBAF16* dst, const RGBA32* src, int len) const = 0;
37 37
38 virtual ~SkColorSpaceXform() {} 38 virtual ~SkColorSpaceXform() {}
39 }; 39 };
40 40
41 template <SkColorSpace::GammaNamed Dst> 41 template <SkColorSpace::GammaNamed Dst>
42 class SkFastXform : public SkColorSpaceXform { 42 class SkColorSpaceXform_Base : public SkColorSpaceXform {
43 public: 43 public:
44 44
45 void applyTo8888(SkPMColor* dst, const RGBA32* src, int len) const override; 45 void applyTo8888(SkPMColor* dst, const RGBA32* src, int len) const override;
46 void applyToF16(RGBAF16* dst, const RGBA32* src, int len) const override; 46 void applyToF16(RGBAF16* dst, const RGBA32* src, int len) const override;
47 47
48 static constexpr int kDstGammaTableSize = 1024;
49
48 private: 50 private:
49 SkFastXform(const sk_sp<SkColorSpace>& srcSpace, const SkMatrix44& srcToDst, 51 SkColorSpaceXform_Base(const sk_sp<SkColorSpace>& srcSpace, const SkMatrix44 & srcToDst,
50 const sk_sp<SkColorSpace>& dstSpace); 52 const sk_sp<SkColorSpace>& dstSpace);
51
52 static constexpr int kDstGammaTableSize = 1024;
53
54 // May contain pointers into storage or pointers into precomputed tables.
55 const float* fSrcGammaTables[3];
56 float fSrcGammaTableStorage[3 * 256];
57
58 float fSrcToDst[16];
59
60 // May contain pointers into storage or pointers into precomputed tables.
61 const uint8_t* fDstGammaTables[3];
62 uint8_t fDstGammaTableStorage[3 * kDstGammaTableSize];
63
64 friend class SkColorSpaceXform;
65 };
66
67 /**
68 * Works for any valid src and dst profiles.
69 */
70 // TODO (msarett):
71 // Merge with SkFastXform and delete this. SkFastXform can almost do everything that
72 // this does.
73 class SkDefaultXform : public SkColorSpaceXform {
74 public:
75
76 void applyTo8888(SkPMColor* dst, const RGBA32* src, int len) const override;
77 void applyToF16(RGBAF16* dst, const RGBA32* src, int len) const override;
78
79 static constexpr int kDstGammaTableSize = 1024;
80 private:
81 SkDefaultXform(const sk_sp<SkColorSpace>& srcSpace, const SkMatrix44& srcToD st,
82 const sk_sp<SkColorSpace>& dstSpace);
83 53
84 sk_sp<SkColorLookUpTable> fColorLUT; 54 sk_sp<SkColorLookUpTable> fColorLUT;
85 55
86 // May contain pointers into storage or pointers into precomputed tables. 56 // May contain pointers into storage or pointers into precomputed tables.
87 const float* fSrcGammaTables[3]; 57 const float* fSrcGammaTables[3];
88 float fSrcGammaTableStorage[3 * 256]; 58 float fSrcGammaTableStorage[3 * 256];
89 59
90 const SkMatrix44 fSrcToDst; 60 float fSrcToDst[16];
91 61
92 // May contain pointers into storage or pointers into precomputed tables. 62 // May contain pointers into storage or pointers into precomputed tables.
93 const uint8_t* fDstGammaTables[3]; 63 const uint8_t* fDstGammaTables[3];
94 uint8_t fDstGammaTableStorage[3 * kDstGammaTableSize]; 64 uint8_t fDstGammaTableStorage[3 * kDstGammaTableSize];
95 65
96 friend class SkColorSpaceXform; 66 friend class SkColorSpaceXform;
97 }; 67 };
98 68
99 #endif 69 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkColorSpaceXform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698