OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2016 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #ifndef SkColorSpaceXform_A2B_DEFINED |
| 9 #define SkColorSpaceXform_A2B_DEFINED |
| 10 |
| 11 #include "SkColorSpace_Base.h" |
| 12 #include "SkColorSpaceXform_Base.h" |
| 13 #include "SkRasterPipeline.h" |
| 14 |
| 15 #include <forward_list> |
| 16 #include <functional> |
| 17 #include <vector> |
| 18 |
| 19 class SkColorSpace_A2B; |
| 20 class SkColorSpace_XYZ; |
| 21 |
| 22 |
| 23 class SkColorSpaceXform_A2B : public SkColorSpaceXform_Base { |
| 24 public: |
| 25 bool onApply(ColorFormat dstFormat, void* dst, ColorFormat srcFormat, const
void* src, |
| 26 int count, SkAlphaType alphaType) const override; |
| 27 |
| 28 private: |
| 29 SkColorSpaceXform_A2B(SkColorSpace_A2B* srcSpace, SkColorSpace_XYZ* dstSpace
); |
| 30 |
| 31 enum Channels { |
| 32 kRGB_Channels = -1, |
| 33 kR_Channels = 0, |
| 34 kG_Channels = 1, |
| 35 kB_Channels = 2 |
| 36 }; |
| 37 void addGamma(std::function<float(float)> fn, Channels channels); |
| 38 |
| 39 void addMatrix(const SkMatrix44& matrix); |
| 40 |
| 41 SkRasterPipeline fElementsPipeline; |
| 42 bool fLinearDstGamma; |
| 43 // storage used by the pipeline |
| 44 std::forward_list<std::function<float(float)>> fGammaFunctions; |
| 45 std::forward_list<std::vector<float>> fMatrices; |
| 46 std::forward_list<std::vector<float>> fGammaTables; |
| 47 std::vector<sk_sp<const SkColorLookUpTable>> fCLUTs; |
| 48 // these are here to maintain ownership of tables used in the pipeline |
| 49 std::vector<sk_sp<const SkGammas>> fGammaRefs; |
| 50 |
| 51 friend class SkColorSpaceXform; |
| 52 }; |
| 53 |
| 54 #endif |
OLD | NEW |