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

Unified Diff: src/effects/SkDashPathEffect.cpp

Issue 379813004: Always initialize SkDashPathEffect fields. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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 | « no previous file | no next file » | 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 2838b1ff3e2aa4cce43c6bf5d984e303d05d7b41..d91e7be977925b471199a4263737e20fb632deec 100644
--- a/src/effects/SkDashPathEffect.cpp
+++ b/src/effects/SkDashPathEffect.cpp
@@ -11,8 +11,11 @@
#include "SkReadBuffer.h"
#include "SkWriteBuffer.h"
-SkDashPathEffect::SkDashPathEffect(const SkScalar intervals[], int count,
- SkScalar phase) {
+SkDashPathEffect::SkDashPathEffect(const SkScalar intervals[], int count, SkScalar phase)
+ : fPhase(0)
+ , fInitialDashLength(0)
+ , fInitialDashIndex(0)
+ , fIntervalLength(0) {
SkASSERT(intervals);
SkASSERT(count > 1 && SkAlign2(count) == count);
@@ -24,8 +27,8 @@ SkDashPathEffect::SkDashPathEffect(const SkScalar intervals[], int count,
}
// set the internal data members
- SkDashPath::CalcDashParameters(phase, fIntervals, fCount, &fInitialDashLength,
- &fInitialDashIndex, &fIntervalLength, &fPhase);
+ SkDashPath::CalcDashParameters(phase, fIntervals, fCount,
+ &fInitialDashLength, &fInitialDashIndex, &fIntervalLength, &fPhase);
}
SkDashPathEffect::~SkDashPathEffect() {
@@ -249,7 +252,12 @@ SkFlattenable* SkDashPathEffect::CreateProc(SkReadBuffer& buffer) {
return SkNEW_ARGS(SkDashPathEffect, (buffer));
}
-SkDashPathEffect::SkDashPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {
+SkDashPathEffect::SkDashPathEffect(SkReadBuffer& buffer)
+ : INHERITED(buffer)
+ , fPhase(0)
+ , fInitialDashLength(0)
+ , fInitialDashIndex(0)
+ , fIntervalLength(0) {
bool useOldPic = buffer.isVersionLT(SkReadBuffer::kDashWritesPhaseIntervals_Version);
if (useOldPic) {
fInitialDashIndex = buffer.readInt();
@@ -280,7 +288,7 @@ SkDashPathEffect::SkDashPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {
} else {
// set the internal data members, fPhase should have been between 0 and intervalLength
// when written to buffer so no need to adjust it
- SkDashPath::CalcDashParameters(fPhase, fIntervals, fCount, &fInitialDashLength,
- &fInitialDashIndex, &fIntervalLength);
+ SkDashPath::CalcDashParameters(fPhase, fIntervals, fCount,
+ &fInitialDashLength, &fInitialDashIndex, &fIntervalLength);
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698