Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / skia / src / effects / SkDashPathEffect.cpp
index d91e7be..f9a56d0 100644 (file)
@@ -104,7 +104,7 @@ bool SkDashPathEffect::asPoints(PointData* results,
         return false;
     }
 
-    if (NULL != results) {
+    if (results) {
         results->fFlags = 0;
         SkScalar clampedInitialDashLength = SkMinScalar(length, fInitialDashLength);
 
@@ -229,7 +229,7 @@ bool SkDashPathEffect::asPoints(PointData* results,
 
 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;
@@ -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
+