Chromium Code Reviews| Index: include/gpu/GrColorSpaceXform.h |
| diff --git a/include/gpu/GrColorSpaceXform.h b/include/gpu/GrColorSpaceXform.h |
| index 177230c87c8df72656a38df7f2727980f7dffc27..c1fb166f47cce383eb8574a6a672ed4e500326cf 100644 |
| --- a/include/gpu/GrColorSpaceXform.h |
| +++ b/include/gpu/GrColorSpaceXform.h |
| @@ -8,6 +8,7 @@ |
| #ifndef GrColorSpaceXform_DEFINED |
| #define GrColorSpaceXform_DEFINED |
| +#include "SkImageInfo.h" |
| #include "SkRefCnt.h" |
| class SkColorSpace; |
| @@ -18,15 +19,32 @@ class SkMatrix44; |
| */ |
| class GrColorSpaceXform : public SkRefCnt { |
| public: |
| - GrColorSpaceXform(const SkMatrix44& srcToDst); |
| + GrColorSpaceXform(const SkMatrix44& srcToDst, SkAlphaType srcAlphaType); |
| - static sk_sp<GrColorSpaceXform> Make(SkColorSpace* src, SkColorSpace* dst); |
| + static sk_sp<GrColorSpaceXform> Make(SkColorSpace* src, SkColorSpace* dst, |
| + SkAlphaType srcAlphaType); |
| const float* srcToDst() { return fSrcToDst; } |
| + SkAlphaType alphaType() const { return fSrcAlphaType; } |
| + |
| + /** |
| + * GrGLSLFragmentProcessor::GenKey() must call this and include the returned value in its |
|
bsalomon
2016/09/07 14:46:37
The GrGLSLFragmentProcessor::GenKey() thing is sor
|
| + * computed key. |
| + */ |
| + static uint32_t XformKey(GrColorSpaceXform* xform) { |
| + if (!xform) { |
| + return 0; |
| + } |
| + // Code generation just depends on whether the alpha type is premul or not |
| + return kPremul_SkAlphaType == xform->fSrcAlphaType ? 1 : 2; |
| + } |
| private: |
| // We store the column-major form of the srcToDst matrix, for easy uploading to uniforms |
| float fSrcToDst[16]; |
| + |
| + // Alpha type of the source. If it's premul, we need special handling |
| + SkAlphaType fSrcAlphaType; |
| }; |
| #endif |