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

Unified Diff: src/effects/SkDashPathEffect.cpp

Issue 395603002: Simplify flattening to just write enough to call the factory (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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
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
+

Powered by Google App Engine
This is Rietveld 408576698