Index: src/effects/SkMergeImageFilter.cpp |
diff --git a/src/effects/SkMergeImageFilter.cpp b/src/effects/SkMergeImageFilter.cpp |
index 4022da3096d4c49a9696991b9c0a6172c32c42c6..a76702f64904fbf7e139f515043d3818de558a5f 100755 |
--- a/src/effects/SkMergeImageFilter.cpp |
+++ b/src/effects/SkMergeImageFilter.cpp |
@@ -105,15 +105,41 @@ bool SkMergeImageFilter::onFilterImage(Proxy* proxy, const SkBitmap& src, |
return true; |
} |
+SkFlattenable* SkMergeImageFilter::CreateProc(SkReadBuffer& buffer) { |
+ Common common; |
+ if (!common.unflatten(buffer, -1)) { |
+ return NULL; |
+ } |
+ |
+ const int count = common.inputCount(); |
+ bool hasModes = buffer.readBool(); |
+ if (hasModes) { |
+ SkAutoSTArray<4, SkXfermode::Mode> modes(count); |
+ SkAutoSTArray<4, uint8_t> modes8(count); |
+ if (!buffer.readByteArray(modes8.get(), count)) { |
+ return NULL; |
+ } |
+ for (int i = 0; i < count; ++i) { |
+ modes[i] = (SkXfermode::Mode)modes8[i]; |
+ buffer.validate(SkIsValidMode(modes[i])); |
+ } |
+ if (!buffer.isValid()) { |
+ return NULL; |
+ } |
+ return Create(common.inputs(), count, modes.get(), &common.cropRect()); |
+ } |
+ return Create(common.inputs(), count, NULL, &common.cropRect()); |
+} |
+ |
void SkMergeImageFilter::flatten(SkWriteBuffer& buffer) const { |
this->INHERITED::flatten(buffer); |
- |
buffer.writeBool(fModes != NULL); |
if (fModes) { |
buffer.writeByteArray(fModes, countInputs() * sizeof(fModes[0])); |
} |
} |
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
SkMergeImageFilter::SkMergeImageFilter(SkReadBuffer& buffer) |
: INHERITED(-1, buffer) { |
bool hasModes = buffer.readBool(); |
@@ -132,3 +158,4 @@ SkMergeImageFilter::SkMergeImageFilter(SkReadBuffer& buffer) |
fModes = 0; |
} |
} |
+#endif |