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; |