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

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

Issue 2130013002: Make all color xforms 'fast' (step 1) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Need to round to pass tests Created 4 years, 5 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 16 matching lines...) Expand all
27 /** 27 /**
28 * Apply the color conversion to a src buffer, storing the output in the ds t buffer. 28 * Apply the color conversion to a src buffer, storing the output in the ds t buffer.
29 * The src is opaque and stored in RGBA_8888, and the dst is also opaque an d stored 29 * The src is opaque and stored in RGBA_8888, and the dst is also opaque an d stored
30 * in 8888 platform format. 30 * in 8888 platform format.
31 */ 31 */
32 virtual void xform_RGB1_8888(uint32_t* dst, const uint32_t* src, uint32_t le n) const = 0; 32 virtual void xform_RGB1_8888(uint32_t* dst, const uint32_t* src, uint32_t le n) const = 0;
33 33
34 virtual ~SkColorSpaceXform() {} 34 virtual ~SkColorSpaceXform() {}
35 }; 35 };
36 36
37 template <SkColorSpace::GammaNamed Src, SkColorSpace::GammaNamed Dst> 37 template <SkColorSpace::GammaNamed Dst>
38 class SkFastXform : public SkColorSpaceXform { 38 class SkFastXform : public SkColorSpaceXform {
39 public: 39 public:
40 40
41 void xform_RGB1_8888(uint32_t* dst, const uint32_t* src, uint32_t len) const override; 41 void xform_RGB1_8888(uint32_t* dst, const uint32_t* src, uint32_t len) const override;
42 42
43 private: 43 private:
44 SkFastXform(const SkMatrix44& srcToDst); 44 SkFastXform(const sk_sp<SkColorSpace>& srcSpace, const SkMatrix44& srcToDst,
45 const sk_sp<SkColorSpace>& dstSpace);
45 46
46 float fSrcToDst[12]; 47 static constexpr int kDstGammaTableSize = 1024;
48
49 // May contain pointers into storage or pointers into precomputed tables.
50 const float* fSrcGammaTables[3];
51 float fSrcGammaTableStorage[3 * 256];
52
53 float fSrcToDst[12];
54
55 // May contain pointers into storage or pointers into precomputed tables.
56 const uint8_t* fDstGammaTables[3];
57 uint8_t fDstGammaTableStorage[3 * kDstGammaTableSize];
47 58
48 friend class SkColorSpaceXform; 59 friend class SkColorSpaceXform;
49 }; 60 };
50 61
51 /** 62 /**
52 * Works for any valid src and dst profiles. 63 * Works for any valid src and dst profiles.
53 */ 64 */
54 class SkDefaultXform : public SkColorSpaceXform { 65 class SkDefaultXform : public SkColorSpaceXform {
55 public: 66 public:
56 67
(...skipping 14 matching lines...) Expand all
71 const SkMatrix44 fSrcToDst; 82 const SkMatrix44 fSrcToDst;
72 83
73 // May contain pointers into storage or pointers into precomputed tables. 84 // May contain pointers into storage or pointers into precomputed tables.
74 const uint8_t* fDstGammaTables[3]; 85 const uint8_t* fDstGammaTables[3];
75 uint8_t fDstGammaTableStorage[3 * kDstGammaTableSize]; 86 uint8_t fDstGammaTableStorage[3 * kDstGammaTableSize];
76 87
77 friend class SkColorSpaceXform; 88 friend class SkColorSpaceXform;
78 }; 89 };
79 90
80 #endif 91 #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