Index: src/effects/SkColorFilters.cpp |
diff --git a/src/effects/SkColorFilters.cpp b/src/effects/SkColorFilters.cpp |
index 8bcd0ebc5d67d96acf3d94149a744e30fd23f292..8c021e452b0ad1904c79ea91a9dac075df921d93 100644 |
--- a/src/effects/SkColorFilters.cpp |
+++ b/src/effects/SkColorFilters.cpp |
@@ -27,7 +27,14 @@ bool SkModeColorFilter::asColorMode(SkColor* color, SkXfermode::Mode* mode) cons |
} |
uint32_t SkModeColorFilter::getFlags() const { |
- return fProc16 ? (kAlphaUnchanged_Flag | kHasFilter16_Flag) : 0; |
+ switch (fMode) { |
+ case SkXfermode::kDst_Mode: //!< [Da, Dc] |
+ case SkXfermode::kSrcATop_Mode: //!< [Da, Sc * Da + (1 - Sa) * Dc] |
+ return kAlphaUnchanged_Flag; |
+ default: |
+ break; |
+ } |
+ return 0; |
} |
void SkModeColorFilter::filterSpan(const SkPMColor shader[], int count, SkPMColor result[]) const { |
@@ -39,16 +46,6 @@ void SkModeColorFilter::filterSpan(const SkPMColor shader[], int count, SkPMColo |
} |
} |
-void SkModeColorFilter::filterSpan16(const uint16_t shader[], int count, uint16_t result[]) const { |
- SkASSERT(this->getFlags() & kHasFilter16_Flag); |
- |
- SkPMColor color = fPMColor; |
- SkXfermodeProc16 proc16 = fProc16; |
- |
- for (int i = 0; i < count; i++) { |
- result[i] = proc16(color, shader[i]); |
- } |
-} |
void SkModeColorFilter::flatten(SkWriteBuffer& buffer) const { |
buffer.writeColor(fColor); |
buffer.writeUInt(fMode); |
@@ -57,7 +54,6 @@ void SkModeColorFilter::flatten(SkWriteBuffer& buffer) const { |
void SkModeColorFilter::updateCache() { |
fPMColor = SkPreMultiplyColor(fColor); |
fProc = SkXfermode::GetProc(fMode); |
- fProc16 = SkXfermode::GetProc16(fMode, fColor); |
} |
SkFlattenable* SkModeColorFilter::CreateProc(SkReadBuffer& buffer) { |
@@ -388,25 +384,10 @@ class Src_SkModeColorFilter : public SkModeColorFilter { |
public: |
Src_SkModeColorFilter(SkColor color) : INHERITED(color, SkXfermode::kSrc_Mode) {} |
- uint32_t getFlags() const SK_OVERRIDE { |
- if (SkGetPackedA32(this->getPMColor()) == 0xFF) { |
- return kAlphaUnchanged_Flag | kHasFilter16_Flag; |
- } else { |
- return 0; |
- } |
- } |
- |
- virtual void filterSpan(const SkPMColor shader[], int count, |
- SkPMColor result[]) const SK_OVERRIDE { |
+ void filterSpan(const SkPMColor shader[], int count, SkPMColor result[]) const SK_OVERRIDE { |
sk_memset32(result, this->getPMColor(), count); |
} |
- virtual void filterSpan16(const uint16_t shader[], int count, |
- uint16_t result[]) const SK_OVERRIDE { |
- SkASSERT(this->getFlags() & kHasFilter16_Flag); |
- sk_memset16(result, SkPixel32ToPixel16(this->getPMColor()), count); |
- } |
- |
private: |
typedef SkModeColorFilter INHERITED; |
}; |
@@ -418,25 +399,10 @@ public: |
fColor32Proc = SkBlitRow::ColorProcFactory(); |
} |
- uint32_t getFlags() const SK_OVERRIDE { |
- if (SkGetPackedA32(this->getPMColor()) == 0xFF) { |
- return kAlphaUnchanged_Flag | kHasFilter16_Flag; |
- } else { |
- return 0; |
- } |
- } |
- |
- virtual void filterSpan(const SkPMColor shader[], int count, |
- SkPMColor result[]) const SK_OVERRIDE { |
+ void filterSpan(const SkPMColor shader[], int count, SkPMColor result[]) const SK_OVERRIDE { |
fColor32Proc(result, shader, count, this->getPMColor()); |
} |
- virtual void filterSpan16(const uint16_t shader[], int count, |
- uint16_t result[]) const SK_OVERRIDE { |
- SkASSERT(this->getFlags() & kHasFilter16_Flag); |
- sk_memset16(result, SkPixel32ToPixel16(this->getPMColor()), count); |
- } |
- |
private: |
SkBlitRow::ColorProc fColor32Proc; |