Fix additional cases of variable shadowing.

These changes will allow us to enable shadowed-variable warnings.

Change-Id: I24ee7e198c1c77b58836237c37557c00452680e1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/439476
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This commit is contained in:
John Stiles 2021-08-16 12:16:29 -04:00 committed by SkCQ
parent 7f4abe85a6
commit 13c9f6690e
9 changed files with 59 additions and 55 deletions

View File

@ -1013,7 +1013,7 @@ static void fuzz_canvas(Fuzz* fuzz, SkCanvas* canvas, int depth = 9) {
SkAutoCanvasRestore autoCanvasRestore(canvas, false);
unsigned N;
fuzz->nextRange(&N, 0, 2000);
for (unsigned i = 0; i < N; ++i) {
for (unsigned loop = 0; loop < N; ++loop) {
if (fuzz->exhausted()) {
return;
}
@ -1403,8 +1403,8 @@ static void fuzz_canvas(Fuzz* fuzz, SkCanvas* canvas, int depth = 9) {
uint16_t indices[kMaxCount * 2];
if (make_fuzz_t<bool>(fuzz)) {
fuzz->nextRange(&indexCount, vertexCount, vertexCount + kMaxCount);
for (int i = 0; i < indexCount; ++i) {
fuzz->nextRange(&indices[i], 0, vertexCount - 1);
for (int index = 0; index < indexCount; ++index) {
fuzz->nextRange(&indices[index], 0, vertexCount - 1);
}
}
canvas->drawVertices(SkVertices::MakeCopy(vertexMode, vertexCount, vertices,

View File

@ -75,9 +75,9 @@ static void add_comma(Fuzz* fuzz, SkString* atom) {
SkString MakeRandomParsePathPiece(Fuzz* fuzz) {
SkString atom;
uint8_t index;
fuzz->nextRange(&index, 0, (int) SK_ARRAY_COUNT(gLegal) - 1);
const Legal& legal = gLegal[index];
uint8_t legalIndex;
fuzz->nextRange(&legalIndex, 0, (int) SK_ARRAY_COUNT(gLegal) - 1);
const Legal& legal = gLegal[legalIndex];
gEasy ? atom.append("\n") : add_white(fuzz, &atom);
bool b;
fuzz->next(&b);

View File

@ -142,14 +142,14 @@ protected:
style.setDecorationColor(std::get<5>(para));
}
builder.pushStyle(style);
std::string name = " " + std::get<0>(para) + " " +
(std::get<1>(para) ? ", bold" : "") +
(std::get<2>(para) ? ", italic" : "") + " " +
std::to_string(std::get<3>(para) * i) +
(std::get<4>(para) != bg ? ", background" : "") +
(std::get<5>(para) != fg ? ", foreground" : "") +
(std::get<6>(para) ? ", shadow" : "") +
(test ? ", decorations " + deco : "") + ";";
name = " " + std::get<0>(para) + " " +
(std::get<1>(para) ? ", bold" : "") +
(std::get<2>(para) ? ", italic" : "") + " " +
std::to_string(std::get<3>(para) * i) +
(std::get<4>(para) != bg ? ", background" : "") +
(std::get<5>(para) != fg ? ", foreground" : "") +
(std::get<6>(para) ? ", shadow" : "") +
(test ? ", decorations " + deco : "") + ";";
builder.addText(name.c_str(), name.length());
builder.pop();
}
@ -1313,9 +1313,10 @@ protected:
}
for (auto& query : miss) {
auto miss = paragraph->getRectsForRange(query.fX, query.fY, RectHeightStyle::kTight,
RectWidthStyle::kTight);
if (miss.empty()) {
auto missRects = paragraph->getRectsForRange(query.fX, query.fY,
RectHeightStyle::kTight,
RectWidthStyle::kTight);
if (missRects.empty()) {
} else {
if (this->isVerbose()) {
SkDebugf("-[%d:%d): Bad\n", query.fX, query.fY);

View File

@ -29,7 +29,7 @@ namespace skif {
Mapping Mapping::DecomposeCTM(const SkMatrix& ctm, const SkImageFilter* filter,
const skif::ParameterSpace<SkPoint>& representativePoint) {
SkMatrix remainder, layer;
SkSize scale;
SkSize decomposed;
using MatrixCapability = SkImageFilter_Base::MatrixCapability;
MatrixCapability capability =
filter ? as_IFB(filter)->getCTMCapability() : MatrixCapability::kComplex;
@ -42,10 +42,10 @@ Mapping Mapping::DecomposeCTM(const SkMatrix& ctm, const SkImageFilter* filter,
// ctm is. In both cases, the layer space can be equivalent to device space.
remainder = SkMatrix::I();
layer = ctm;
} else if (ctm.decomposeScale(&scale, &remainder)) {
} else if (ctm.decomposeScale(&decomposed, &remainder)) {
// This case implies some amount of sampling post-filtering, either due to skew or rotation
// in the original matrix. As such, keep the layer matrix as simple as possible.
layer = SkMatrix::Scale(scale.fWidth, scale.fHeight);
layer = SkMatrix::Scale(decomposed.fWidth, decomposed.fHeight);
} else {
// Perspective, which has a non-uniform scaling effect on the filter. Pick a single scale
// factor that best matches where the filter will be evaluated.

View File

@ -855,8 +855,8 @@ sk_sp<SkData> SkMipmap::serialize() const {
return buffer.snapshotAsData();
}
bool SkMipmap::Deserialize(SkMipmapBuilder* builder, const void* data, size_t size) {
SkReadBuffer buffer(data, size);
bool SkMipmap::Deserialize(SkMipmapBuilder* builder, const void* data, size_t length) {
SkReadBuffer buffer(data, length);
int count = buffer.read32();
if (builder->countLevels() != count) {

View File

@ -1151,7 +1151,6 @@ void SkScalerContext_FreeType::generateMetrics(SkGlyph* glyph) {
return;
}
FT_Error err;
err = FT_Load_Glyph(
fFace, glyph->getGlyphID(), fLoadGlyphFlags | FT_LOAD_BITMAP_METRICS_ONLY);
if (err != 0) {

View File

@ -1559,11 +1559,10 @@ bool SkScalerContext_GDI::generatePath(SkGlyphID glyph, SkPath* path) {
SkGDIGeometrySink sink(path);
sink.process(glyphbuf, total_size);
} else {
//GDI only uses hinted outlines when axis aligned.
UINT format = GGO_NATIVE | GGO_GLYPH_INDEX;
SkAutoSTMalloc<BUFFERSIZE, uint8_t> hintedGlyphbuf(BUFFERSIZE);
DWORD hinted_total_size = getGDIGlyphPath(glyph, format, &hintedGlyphbuf);
//GDI only uses hinted outlines when axis aligned.
DWORD hinted_total_size = getGDIGlyphPath(glyph, GGO_NATIVE | GGO_GLYPH_INDEX,
&hintedGlyphbuf);
if (0 == hinted_total_size) {
return false;
}

View File

@ -54,7 +54,8 @@ static FILE* fopen_win(const char* utf8path, const char* perm) {
}
std::vector<uint16_t> wchars(n + 1);
uint16_t* out = wchars.data();
for (const char* ptr = utf8path; ptr < end;) {
ptr = utf8path;
while (ptr < end) {
out += SkUTF::ToUTF16(SkUTF::NextUTF8(&ptr, end), out);
}
SkASSERT(out == &wchars[n]);

View File

@ -185,21 +185,23 @@ static bool init_instance_extensions_and_layers(GrVkGetProc getProc,
// instance extensions
// via Vulkan implementation and implicitly enabled layers
uint32_t extensionCount = 0;
res = EnumerateInstanceExtensionProperties(nullptr, &extensionCount, nullptr);
if (VK_SUCCESS != res) {
return false;
{
uint32_t extensionCount = 0;
res = EnumerateInstanceExtensionProperties(nullptr, &extensionCount, nullptr);
if (VK_SUCCESS != res) {
return false;
}
VkExtensionProperties* extensions = new VkExtensionProperties[extensionCount];
res = EnumerateInstanceExtensionProperties(nullptr, &extensionCount, extensions);
if (VK_SUCCESS != res) {
delete[] extensions;
return false;
}
for (uint32_t i = 0; i < extensionCount; ++i) {
instanceExtensions->push_back() = extensions[i];
}
delete [] extensions;
}
VkExtensionProperties* extensions = new VkExtensionProperties[extensionCount];
res = EnumerateInstanceExtensionProperties(nullptr, &extensionCount, extensions);
if (VK_SUCCESS != res) {
delete[] extensions;
return false;
}
for (uint32_t i = 0; i < extensionCount; ++i) {
instanceExtensions->push_back() = extensions[i];
}
delete [] extensions;
// via explicitly enabled layers
layerCount = instanceLayers->count();
@ -270,21 +272,23 @@ static bool init_device_extensions_and_layers(GrVkGetProc getProc, uint32_t spec
// device extensions
// via Vulkan implementation and implicitly enabled layers
uint32_t extensionCount = 0;
res = EnumerateDeviceExtensionProperties(physDev, nullptr, &extensionCount, nullptr);
if (VK_SUCCESS != res) {
return false;
}
VkExtensionProperties* extensions = new VkExtensionProperties[extensionCount];
res = EnumerateDeviceExtensionProperties(physDev, nullptr, &extensionCount, extensions);
if (VK_SUCCESS != res) {
{
uint32_t extensionCount = 0;
res = EnumerateDeviceExtensionProperties(physDev, nullptr, &extensionCount, nullptr);
if (VK_SUCCESS != res) {
return false;
}
VkExtensionProperties* extensions = new VkExtensionProperties[extensionCount];
res = EnumerateDeviceExtensionProperties(physDev, nullptr, &extensionCount, extensions);
if (VK_SUCCESS != res) {
delete[] extensions;
return false;
}
for (uint32_t i = 0; i < extensionCount; ++i) {
deviceExtensions->push_back() = extensions[i];
}
delete[] extensions;
return false;
}
for (uint32_t i = 0; i < extensionCount; ++i) {
deviceExtensions->push_back() = extensions[i];
}
delete[] extensions;
// via explicitly enabled layers
layerCount = deviceLayers->count();