Index: src/effects/SkDashPathEffect.cpp |
diff --git a/src/effects/SkDashPathEffect.cpp b/src/effects/SkDashPathEffect.cpp |
index d91e7be977925b471199a4263737e20fb632deec..9bd31fae89a5c9e2bcda95543ebaafda24e324ce 100644 |
--- a/src/effects/SkDashPathEffect.cpp |
+++ b/src/effects/SkDashPathEffect.cpp |
@@ -243,13 +243,26 @@ SkFlattenable::Factory SkDashPathEffect::getFactory() const { |
} |
void SkDashPathEffect::flatten(SkWriteBuffer& buffer) const { |
- this->INHERITED::flatten(buffer); |
buffer.writeScalar(fPhase); |
buffer.writeScalarArray(fIntervals, fCount); |
} |
SkFlattenable* SkDashPathEffect::CreateProc(SkReadBuffer& buffer) { |
- return SkNEW_ARGS(SkDashPathEffect, (buffer)); |
+ const SkScalar phase = buffer.readScalar(); |
+ uint32_t count = buffer.getArrayCount(); |
+ SkAutoSTArray<32, SkScalar> intervals(count); |
+ if (buffer.readScalarArray(intervals.get(), count)) { |
+ return Create(intervals.get(), SkToInt(count), phase); |
+ } |
+ return NULL; |
+} |
+ |
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
+SkFlattenable* SkDashPathEffect::DeepCreateProc(SkReadBuffer& buffer) { |
+ if (buffer.pictureVersion() <= kNewFlattenVersion) { |
+ return SkNEW_ARGS(SkDashPathEffect, (buffer)); |
+ } |
+ return CreateProc(buffer); |
} |
SkDashPathEffect::SkDashPathEffect(SkReadBuffer& buffer) |
@@ -292,3 +305,5 @@ SkDashPathEffect::SkDashPathEffect(SkReadBuffer& buffer) |
&fInitialDashLength, &fInitialDashIndex, &fIntervalLength); |
} |
} |
+#endif |
+ |