initialize firstDir
authorcaryclark <caryclark@google.com>
Wed, 17 Jun 2015 15:46:12 +0000 (08:46 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 17 Jun 2015 15:46:12 +0000 (08:46 -0700)
Good catch by Florin; the variable was indeed uninitialized in
the complex followed by concave case.

R=fmalita@google.com
BUG=skia:3953

Review URL: https://codereview.chromium.org/1187273005

src/pathops/SkOpBuilder.cpp

index a434fbcf2bb002120e4c619b494b9b0ec2f75c91..2fbd4f0460b7a758deea38cfc9f18780e37ffba6 100644 (file)
@@ -106,7 +106,7 @@ bool SkOpBuilder::resolve(SkPath* result) {
     SkPath original = *result;
     int count = fOps.count();
     bool allUnion = true;
-    SkPathPriv::FirstDirection firstDir;
+    SkPathPriv::FirstDirection firstDir = SkPathPriv::kUnknown_FirstDirection;
     for (int index = 0; index < count; ++index) {
         SkPath* test = &fPathRefs[index];
         if (kUnion_SkPathOp != fOps[index] || test->isInverseFillType()) {
@@ -120,7 +120,7 @@ bool SkOpBuilder::resolve(SkPath* result) {
                 allUnion = false;
                 break;
             }
-            if (index == 0) {
+            if (firstDir == SkPathPriv::kUnknown_FirstDirection) {
                 firstDir = dir;
             } else if (firstDir != dir) {
                 SkPath temp;