diff options
author | fmalita@google.com <fmalita@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-09-17 13:09:16 +0000 |
---|---|---|
committer | fmalita@google.com <fmalita@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-09-17 13:09:16 +0000 |
commit | ef45a646a730b779f419e8ea11df374adeec8206 (patch) | |
tree | 8c4b5a28b553d128d9157f3455701d0f97be5f46 /include/effects | |
parent | 07f81a57ba5720fd65563077114bd9e5ba840151 (diff) |
[External patch] Source-over support for SkLumaXfermode.
This is a patch by Andrei Parvu <parvu@adobe.com> (Adobe CLA signer).
Original CL/review: https://codereview.chromium.org/24078006/
GM:lumamode will need rebaselining after landing this.
---
In order to use CSS luminance masking, we need to be able to create an
instance of SkLumaXfermode which can receive a kSrcOver mode, and applies
that mode after converting the source using the luminance-to-alpha
coefficients.
BUG=289420
R=reed@google.com
Review URL: https://codereview.chromium.org/23710053
git-svn-id: http://skia.googlecode.com/svn/trunk@11312 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/effects')
-rw-r--r-- | include/effects/SkLumaXfermode.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/effects/SkLumaXfermode.h b/include/effects/SkLumaXfermode.h index 5bcd10eff1..b189328fdb 100644 --- a/include/effects/SkLumaXfermode.h +++ b/include/effects/SkLumaXfermode.h @@ -16,7 +16,7 @@ * http://www.w3.org/TR/css-masking/#MaskValues * * The luminance-to-alpha function is applied before performing a standard - * SrcIn/DstIn xfer: + * SrcIn/DstIn/SrcOver xfer: * * luma(C) = (0.2125 * C.r + 0.7154 * C.g + 0.0721 * C.b) * C.a * @@ -26,7 +26,7 @@ class SK_API SkLumaMaskXfermode : public SkXfermode { public: /** Return an SkLumaMaskXfermode object for the specified submode. * - * Only kSrcIn_Mode and kDstIn_Mode are supported - for everything else, + * Only kSrcIn_Mode, kDstIn_Mode kSrcOver_Mode are supported - for everything else, * the factory returns NULL. */ static SkXfermode* Create(SkXfermode::Mode); @@ -37,6 +37,7 @@ public: SK_DEVELOPER_TO_STRING() SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLumaMaskXfermode) + SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() #if SK_SUPPORT_GPU virtual bool asNewEffectOrCoeff(GrContext*, GrEffectRef**, Coeff*, Coeff*, @@ -47,12 +48,14 @@ protected: SkLumaMaskXfermode(SkFlattenableReadBuffer&); virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; -private: SkLumaMaskXfermode(SkXfermode::Mode); +private: const SkXfermode::Mode fMode; typedef SkXfermode INHERITED; + + virtual SkPMColor lumaProc(const SkPMColor a, const SkPMColor b) const; }; #endif |