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

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: rebase 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
« no previous file with comments | « src/effects/SkCornerPathEffect.cpp ('k') | src/effects/SkDiscretePathEffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkDashPathEffect.cpp
diff --git a/src/effects/SkDashPathEffect.cpp b/src/effects/SkDashPathEffect.cpp
index d91e7be977925b471199a4263737e20fb632deec..66462af85bb22e127dc38429d4373704110ba379 100644
--- a/src/effects/SkDashPathEffect.cpp
+++ b/src/effects/SkDashPathEffect.cpp
@@ -238,20 +238,22 @@ SkPathEffect::DashType SkDashPathEffect::asADash(DashInfo* info) const {
return kDash_DashType;
}
-SkFlattenable::Factory SkDashPathEffect::getFactory() const {
- return CreateProc;
-}
-
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
SkDashPathEffect::SkDashPathEffect(SkReadBuffer& buffer)
: INHERITED(buffer)
, fPhase(0)
@@ -292,3 +294,5 @@ SkDashPathEffect::SkDashPathEffect(SkReadBuffer& buffer)
&fInitialDashLength, &fInitialDashIndex, &fIntervalLength);
}
}
+#endif
+
« no previous file with comments | « src/effects/SkCornerPathEffect.cpp ('k') | src/effects/SkDiscretePathEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698