return false;
}
- if (NULL != results) {
+ if (results) {
results->fFlags = 0;
SkScalar clampedInitialDashLength = SkMinScalar(length, fInitialDashLength);
SkPathEffect::DashType SkDashPathEffect::asADash(DashInfo* info) const {
if (info) {
- if (info->fCount >= fCount && NULL != info->fIntervals) {
+ if (info->fCount >= fCount && info->fIntervals) {
memcpy(info->fIntervals, fIntervals, fCount * sizeof(SkScalar));
}
info->fCount = fCount;
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)
&fInitialDashLength, &fInitialDashIndex, &fIntervalLength);
}
}
+#endif
+