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

Unified Diff: src/core/SkColorFilter.cpp

Issue 1664663003: extend compose-colorfilter to 4f (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/SkColor.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkColorFilter.cpp
diff --git a/src/core/SkColorFilter.cpp b/src/core/SkColorFilter.cpp
index 4bfacfe544de8904a609e4e550894449dbdc6e81..72f5470b10b634c4dd8c3d47a495b0731e9c6d7f 100644
--- a/src/core/SkColorFilter.cpp
+++ b/src/core/SkColorFilter.cpp
@@ -29,14 +29,24 @@ bool SkColorFilter::asComponentTable(SkBitmap*) const {
return false;
}
+void SkColorFilter::filterSpan4f(const SkPM4f[], int count, SkPM4f[]) const {
+ if (this->supports4f()) {
+ SkASSERT(false && "colorfilter supports4f but didn't override");
+ } else {
+ SkASSERT(false && "filterSpan4f called but not supported");
+ }
+}
+
SkColor SkColorFilter::filterColor(SkColor c) const {
SkPMColor dst, src = SkPreMultiplyColor(c);
this->filterSpan(&src, 1, &dst);
return SkUnPreMultiply::PMColorToColor(dst);
}
-void SkColorFilter::filterSpan4f(const SkPM4f[], int count, SkPM4f[]) const {
- SkASSERT(false && "filterSpan4f called but not implemented");
+SkColor4f SkColorFilter::filterColor4f(const SkColor4f& c) const {
mtklein 2016/02/04 17:35:49 Ouch. This is a rare call, I hope?
+ SkPM4f dst, src = c.premul();
+ this->filterSpan4f(&src, 1, &dst);
+ return dst.unpremul();
}
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -54,7 +64,7 @@ void SkColorFilter::filterSpan4f(const SkPM4f[], int count, SkPM4f[]) const {
class SkComposeColorFilter : public SkColorFilter {
public:
uint32_t getFlags() const override {
- // Can only claim alphaunchanged and 16bit support if both our proxys do.
+ // Can only claim alphaunchanged and SkPM4f support if both our proxys do.
return fOuter->getFlags() & fInner->getFlags();
}
@@ -63,6 +73,13 @@ public:
fOuter->filterSpan(result, count, result);
}
+ void filterSpan4f(const SkPM4f shader[], int count, SkPM4f result[]) const override {
+ SkASSERT(fInner->supports4f());
+ SkASSERT(fOuter->supports4f());
+ fInner->filterSpan4f(shader, count, result);
+ fOuter->filterSpan4f(result, count, result);
+ }
+
#ifndef SK_IGNORE_TO_STRING
void toString(SkString* str) const override {
SkString outerS, innerS;
« no previous file with comments | « src/core/SkColor.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698