diff options
author | mtklein <mtklein@chromium.org> | 2015-05-15 10:36:21 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-15 10:36:21 -0700 |
commit | 0135a41e095a433414e21e37b277dab7dcbec373 (patch) | |
tree | ee4bb27e2777f7978990a0a08b5db9641cdd34b6 /src/core/Sk4px.h | |
parent | fa33f5a6b770130acdc55f2ffe19dd545665726a (diff) |
Sk4px: Difference and Exclusion
This will cause minor (off-by-one) diffs due to a little lost precision:
colortype_xfermodes
mixed_xfermodes
xfermodes2
xfermodeimagefilter
xfermodes3
xfermodes
Desktop:
Xfermode_Difference_aa 9.77ms -> 7.32ms 0.75x
Xfermode_Exclusion_aa 8.49ms -> 6.21ms 0.73x
Xfermode_Difference 17ms -> 7.54ms 0.44x
Xfermode_Exclusion 13.5ms -> 5.09ms 0.38x
N7:
Xfermode_Difference_aa 32.2ms -> 27.6ms 0.86x
Xfermode_Difference 43.9ms -> 32ms 0.73x
Xfermode_Exclusion_aa 40.5ms -> 26.7ms 0.66x
Xfermode_Exclusion 71.5ms -> 23.9ms 0.33x
This wraps up the xfermodes implemented in Sk4f.
BUG=skia:
Review URL: https://codereview.chromium.org/1141213002
Diffstat (limited to 'src/core/Sk4px.h')
-rw-r--r-- | src/core/Sk4px.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/Sk4px.h b/src/core/Sk4px.h index 5537b90230..028630d100 100644 --- a/src/core/Sk4px.h +++ b/src/core/Sk4px.h @@ -20,6 +20,10 @@ public: Sk4px alphas() const; // ARGB argb XYZW xyzw -> AAAA aaaa XXXX xxxx + // Mask away color or alpha lanes. + Sk4px zeroColors() const; // ARGB argb XYZW xyzw -> A000 a000 X000 x000 + Sk4px zeroAlphas() const; // ARGB argb XYZW xyzw -> 0RGB 0rgb 0YZW 0yzw + Sk4px inv() const { return Sk16b(255) - *this; } // When loading or storing fewer than 4 SkPMColors, we use the low lanes. @@ -56,6 +60,10 @@ public: Wide widenLo() const; // ARGB -> 0A 0R 0G 0B Wide widenHi() const; // ARGB -> A0 R0 G0 B0 Wide mulWiden(const Sk16b&) const; // 8-bit x 8-bit -> 16-bit components. + Wide mul255Widen() const { + // TODO: x*255 = x*256-x, so something like this->widenHi() - this->widenLo()? + return this->mulWiden(Sk16b(255)); + } // A generic driver that maps fn over a src array into a dst array. // fn should take an Sk4px (4 src pixels) and return an Sk4px (4 dst pixels). |