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

Unified Diff: src/core/SkModeColorFilter.cpp

Issue 1670063002: extend modecolorfilter to 4f (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove pin for modulate Created 4 years, 10 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 | « src/core/SkModeColorFilter.h ('k') | src/core/SkXfermode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkModeColorFilter.cpp
diff --git a/src/core/SkModeColorFilter.cpp b/src/core/SkModeColorFilter.cpp
index df1051abb0ea35fa07b8db6b49fc84ab817a7ff8..14e3fb7068b35419cc2be5efffdda8c0adcbd51b 100644
--- a/src/core/SkModeColorFilter.cpp
+++ b/src/core/SkModeColorFilter.cpp
@@ -37,20 +37,30 @@ bool SkModeColorFilter::asColorMode(SkColor* color, SkXfermode::Mode* mode) cons
}
uint32_t SkModeColorFilter::getFlags() const {
+ uint32_t flags = kSupports4f_Flag;
switch (fMode) {
case SkXfermode::kDst_Mode: //!< [Da, Dc]
case SkXfermode::kSrcATop_Mode: //!< [Da, Sc * Da + (1 - Sa) * Dc]
- return kAlphaUnchanged_Flag;
+ flags |= kAlphaUnchanged_Flag;
default:
break;
}
- return 0;
+ return flags;
}
void SkModeColorFilter::filterSpan(const SkPMColor shader[], int count, SkPMColor result[]) const {
SkPMColor color = fPMColor;
SkXfermodeProc proc = fProc;
+
+ for (int i = 0; i < count; i++) {
+ result[i] = proc(color, shader[i]);
+ }
+}
+void SkModeColorFilter::filterSpan4f(const SkPM4f shader[], int count, SkPM4f result[]) const {
+ SkPM4f color = SkPM4f::FromPMColor(fPMColor);
+ SkXfermodeProc4f proc = SkXfermode::GetProc4f(fMode);
+
for (int i = 0; i < count; i++) {
result[i] = proc(color, shader[i]);
}
« no previous file with comments | « src/core/SkModeColorFilter.h ('k') | src/core/SkXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698