diff options
author | fmalita <fmalita@chromium.org> | 2016-03-21 13:16:51 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-21 13:16:52 -0700 |
commit | dc6c9bf91c158e89cd9d5ef19dfbf1da98c598a6 (patch) | |
tree | b072c263452bed811ce7643fa53fb584c997359d /src/effects/gradients/Sk4fGradientBase.h | |
parent | 66be626f7f3ddda243e51aa8f36398b26769a9b4 (diff) |
Refactor 4f gradients using trait templates
Some 4f gradient housekeeping.
1) replace <DstPtrType, ColorProfile> specialization tuples with an enum covering all dest types
(L32, S32, F16, F32)
2) group various template helpers into dest trait classes, specialized for each dest type
(2a - conflate current dst_swizzle and scale_for_dest ops into one load op)
R=reed@google.com,mtklein@google.com,herb@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1816883002
Review URL: https://codereview.chromium.org/1816883002
Diffstat (limited to 'src/effects/gradients/Sk4fGradientBase.h')
-rw-r--r-- | src/effects/gradients/Sk4fGradientBase.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/effects/gradients/Sk4fGradientBase.h b/src/effects/gradients/Sk4fGradientBase.h index 03f7e6ef26..ddd0b2bc46 100644 --- a/src/effects/gradients/Sk4fGradientBase.h +++ b/src/effects/gradients/Sk4fGradientBase.h @@ -59,14 +59,16 @@ private: void addMirrorIntervals(const SkGradientShaderBase&, const Sk4f& componentScale, bool reverse); - template<typename DstType, SkShader::TileMode tileMode> + template<DstType, SkShader::TileMode tileMode> class TSampler; - template <typename DstType, ApplyPremul> - void shadePremulSpan(int x, int y, DstType[], int count) const; + template <DstType dstType, ApplyPremul premul> + void shadePremulSpan(int x, int y, typename DstTraits<dstType, premul>::Type[], + int count) const; - template <typename DstType, ApplyPremul, SkShader::TileMode tileMode> - void shadeSpanInternal(int x, int y, DstType[], int count) const; + template <DstType dstType, ApplyPremul premul, SkShader::TileMode tileMode> + void shadeSpanInternal(int x, int y, typename DstTraits<dstType, premul>::Type[], + int count) const; }; #endif // Sk4fGradientBase_DEFINED |