| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |