Fix cases of variable shadowing in samplecode/.

These were reviewed last year at http://review.skia.org/312480 but never
landed. Splitting into small chunks to land individually.

If we manage to fix all the existing cases of variable shadowing, we
could enable -Wshadow.

Change-Id: I53d04e5b2ffd7e170a8b10a6bacbc239c8b5e7ff
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/435720
Commit-Queue: John Stiles <johnstiles@google.com>
Commit-Queue: Ravi Mistry <rmistry@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Reviewed-by: Ravi Mistry <rmistry@google.com>
diff --git a/samplecode/SampleLayers.cpp b/samplecode/SampleLayers.cpp
index 4ddb9a5..e00d9e2 100644
--- a/samplecode/SampleLayers.cpp
+++ b/samplecode/SampleLayers.cpp
@@ -35,9 +35,6 @@
 
     SkRect r;
 
-    SkPaint p;
-    p.setAlpha(0x88);
-
     SkAutoCanvasRestore ar2(canvas, false);
 
     // create the layers
diff --git a/samplecode/SamplePath.cpp b/samplecode/SamplePath.cpp
index d371751..b717f62 100644
--- a/samplecode/SamplePath.cpp
+++ b/samplecode/SamplePath.cpp
@@ -604,7 +604,6 @@
         SkPoint storage[3 + 2 + 1];
         SkPoint* tmp = storage;
         const SkPoint* prev = pts;
-        int n = count;
         for (int n = count; n > 0; --n) {
             for (int i = 0; i < n; ++i) {
                 canvas->drawLine(prev[i], prev[i+1], paint);
@@ -616,7 +615,7 @@
 
         paint.setColor(SK_ColorBLUE);
         paint.setStyle(SkPaint::kFill_Style);
-        n = tmp - storage;
+        int n = tmp - storage;
         for (int i = 0; i < n; ++i) {
             Dot(canvas, storage[i], 4, SK_ColorBLUE);
         }
diff --git a/samplecode/SampleShadowUtils.cpp b/samplecode/SampleShadowUtils.cpp
index 2571c03..15199e2 100644
--- a/samplecode/SampleShadowUtils.cpp
+++ b/samplecode/SampleShadowUtils.cpp
@@ -171,9 +171,7 @@
         SkScalar dy = 0;
         SkTDArray<SkMatrix> matrices;
         matrices.push()->reset();
-        SkMatrix* m = matrices.push();
-        m->setRotate(33.f, 25.f, 25.f);
-        m->postScale(1.2f, 0.8f, 25.f, 25.f);
+        matrices.push()->setRotate(33.f, 25.f, 25.f).postScale(1.2f, 0.8f, 25.f, 25.f);
         SkPaint paint;
         paint.setColor(SK_ColorGREEN);
         paint.setAntiAlias(true);
diff --git a/samplecode/SampleThinAA.cpp b/samplecode/SampleThinAA.cpp
index 534f0ab..452548d 100644
--- a/samplecode/SampleThinAA.cpp
+++ b/samplecode/SampleThinAA.cpp
@@ -484,8 +484,7 @@
         SkFont font(nullptr, 12);
 
         if (gridX == 0) {
-            SkString name = shape->name();
-            SkScalar centering = name.size() * 4.f; // ad-hoc
+            SkScalar centering = shape->name().size() * 4.f; // ad-hoc
 
             canvas->save();
             canvas->translate(-10.f, 4 * ShapeRenderer::kTileHeight + centering);
diff --git a/samplecode/SampleXfermodesBlur.cpp b/samplecode/SampleXfermodesBlur.cpp
index c135821..bd603d5 100644
--- a/samplecode/SampleXfermodesBlur.cpp
+++ b/samplecode/SampleXfermodesBlur.cpp
@@ -104,7 +104,7 @@
         font.setEdging(SkFont::Edging::kSubpixelAntiAlias);
         setNamedTypeface(&font, "Menlo Regular");
 
-        const int W = 5;
+        const int kWrap = 5;
 
         SkScalar x0 = 0;
         for (int twice = 0; twice < 2; twice++) {
@@ -131,7 +131,7 @@
                 SkTextUtils::DrawString(canvas, label, x + w/2, y - font.getSize()/2, font, SkPaint(),
                                         SkTextUtils::kCenter_Align);
                 x += w + SkIntToScalar(10);
-                if ((i % W) == W - 1) {
+                if ((i % kWrap) == kWrap - 1) {
                     x = x0;
                     y += h + SkIntToScalar(30);
                 }