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>
This commit is contained in:
parent
a3f206e0b8
commit
960b0f344d
@ -35,9 +35,6 @@ static void test_fade(SkCanvas* canvas) {
|
|||||||
|
|
||||||
SkRect r;
|
SkRect r;
|
||||||
|
|
||||||
SkPaint p;
|
|
||||||
p.setAlpha(0x88);
|
|
||||||
|
|
||||||
SkAutoCanvasRestore ar2(canvas, false);
|
SkAutoCanvasRestore ar2(canvas, false);
|
||||||
|
|
||||||
// create the layers
|
// create the layers
|
||||||
|
@ -604,7 +604,6 @@ protected:
|
|||||||
SkPoint storage[3 + 2 + 1];
|
SkPoint storage[3 + 2 + 1];
|
||||||
SkPoint* tmp = storage;
|
SkPoint* tmp = storage;
|
||||||
const SkPoint* prev = pts;
|
const SkPoint* prev = pts;
|
||||||
int n = count;
|
|
||||||
for (int n = count; n > 0; --n) {
|
for (int n = count; n > 0; --n) {
|
||||||
for (int i = 0; i < n; ++i) {
|
for (int i = 0; i < n; ++i) {
|
||||||
canvas->drawLine(prev[i], prev[i+1], paint);
|
canvas->drawLine(prev[i], prev[i+1], paint);
|
||||||
@ -616,7 +615,7 @@ protected:
|
|||||||
|
|
||||||
paint.setColor(SK_ColorBLUE);
|
paint.setColor(SK_ColorBLUE);
|
||||||
paint.setStyle(SkPaint::kFill_Style);
|
paint.setStyle(SkPaint::kFill_Style);
|
||||||
n = tmp - storage;
|
int n = tmp - storage;
|
||||||
for (int i = 0; i < n; ++i) {
|
for (int i = 0; i < n; ++i) {
|
||||||
Dot(canvas, storage[i], 4, SK_ColorBLUE);
|
Dot(canvas, storage[i], 4, SK_ColorBLUE);
|
||||||
}
|
}
|
||||||
|
@ -171,9 +171,7 @@ protected:
|
|||||||
SkScalar dy = 0;
|
SkScalar dy = 0;
|
||||||
SkTDArray<SkMatrix> matrices;
|
SkTDArray<SkMatrix> matrices;
|
||||||
matrices.push()->reset();
|
matrices.push()->reset();
|
||||||
SkMatrix* m = matrices.push();
|
matrices.push()->setRotate(33.f, 25.f, 25.f).postScale(1.2f, 0.8f, 25.f, 25.f);
|
||||||
m->setRotate(33.f, 25.f, 25.f);
|
|
||||||
m->postScale(1.2f, 0.8f, 25.f, 25.f);
|
|
||||||
SkPaint paint;
|
SkPaint paint;
|
||||||
paint.setColor(SK_ColorGREEN);
|
paint.setColor(SK_ColorGREEN);
|
||||||
paint.setAntiAlias(true);
|
paint.setAntiAlias(true);
|
||||||
|
@ -484,8 +484,7 @@ private:
|
|||||||
SkFont font(nullptr, 12);
|
SkFont font(nullptr, 12);
|
||||||
|
|
||||||
if (gridX == 0) {
|
if (gridX == 0) {
|
||||||
SkString name = shape->name();
|
SkScalar centering = shape->name().size() * 4.f; // ad-hoc
|
||||||
SkScalar centering = name.size() * 4.f; // ad-hoc
|
|
||||||
|
|
||||||
canvas->save();
|
canvas->save();
|
||||||
canvas->translate(-10.f, 4 * ShapeRenderer::kTileHeight + centering);
|
canvas->translate(-10.f, 4 * ShapeRenderer::kTileHeight + centering);
|
||||||
|
@ -104,7 +104,7 @@ protected:
|
|||||||
font.setEdging(SkFont::Edging::kSubpixelAntiAlias);
|
font.setEdging(SkFont::Edging::kSubpixelAntiAlias);
|
||||||
setNamedTypeface(&font, "Menlo Regular");
|
setNamedTypeface(&font, "Menlo Regular");
|
||||||
|
|
||||||
const int W = 5;
|
const int kWrap = 5;
|
||||||
|
|
||||||
SkScalar x0 = 0;
|
SkScalar x0 = 0;
|
||||||
for (int twice = 0; twice < 2; twice++) {
|
for (int twice = 0; twice < 2; twice++) {
|
||||||
@ -131,7 +131,7 @@ protected:
|
|||||||
SkTextUtils::DrawString(canvas, label, x + w/2, y - font.getSize()/2, font, SkPaint(),
|
SkTextUtils::DrawString(canvas, label, x + w/2, y - font.getSize()/2, font, SkPaint(),
|
||||||
SkTextUtils::kCenter_Align);
|
SkTextUtils::kCenter_Align);
|
||||||
x += w + SkIntToScalar(10);
|
x += w + SkIntToScalar(10);
|
||||||
if ((i % W) == W - 1) {
|
if ((i % kWrap) == kWrap - 1) {
|
||||||
x = x0;
|
x = x0;
|
||||||
y += h + SkIntToScalar(30);
|
y += h + SkIntToScalar(30);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user