Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Unified Diff: src/core/Sk4px.h

Issue 1141213002: Sk4px: Difference and Exclusion (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: back to 8-bit Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkXfermode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/Sk4px.h
diff --git a/src/core/Sk4px.h b/src/core/Sk4px.h
index 5537b90230ebe774deca62ddf1a910ca14ae1585..028630d100eaedb899505e5bc766e57a1c0e051f 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).
« no previous file with comments | « no previous file | src/core/SkXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698