fix variable shadowing

This commit is contained in:
Konstantin Käfer
2014-10-22 18:06:11 +02:00
parent 74387c54e3
commit 214f99673f
60 changed files with 276 additions and 278 deletions

View File

@@ -30,17 +30,17 @@
using namespace mbgl;
Map::Map(View& view)
Map::Map(View& view_)
: loop(std::make_shared<uv::loop>()),
thread(std::make_unique<uv::thread>()),
async_terminate(new uv_async_t()),
async_render(new uv_async_t()),
async_cleanup(new uv_async_t()),
view(view),
view(view_),
#ifndef NDEBUG
main_thread(uv_thread_self()),
#endif
transform(view),
transform(view_),
glyphAtlas(std::make_shared<GlyphAtlas>(1024, 1024)),
spriteAtlas(std::make_shared<SpriteAtlas>(512, 512)),
texturepool(std::make_shared<Texturepool>()),
@@ -653,9 +653,6 @@ void Map::prepare() {
void Map::render() {
view.make_active();
#if defined(DEBUG)
std::vector<std::string> debug;
#endif
painter.clear();
painter.resize();

View File

@@ -20,8 +20,8 @@
namespace mbgl {
Source::Source(const util::ptr<SourceInfo>& info)
: info(info)
Source::Source(const util::ptr<SourceInfo>& info_)
: info(info_)
{
}
@@ -219,15 +219,15 @@ std::forward_list<Tile::ID> Source::coveringTiles(const TransformState& state) c
box points = state.cornersToBox(z);
const vec2<double>& center = points.center;
std::forward_list<Tile::ID> tiles = Tile::cover(z, points);
std::forward_list<Tile::ID> covering_tiles = Tile::cover(z, points);
tiles.sort([&center](const Tile::ID& a, const Tile::ID& b) {
covering_tiles.sort([&center](const Tile::ID& a, const Tile::ID& b) {
// Sorts by distance from the box center
return std::fabs(a.x - center.x) + std::fabs(a.y - center.y) <
std::fabs(b.x - center.x) + std::fabs(b.y - center.y);
});
return tiles;
return covering_tiles;
}
/**

View File

@@ -13,13 +13,13 @@
using namespace mbgl;
SpritePosition::SpritePosition(uint16_t x, uint16_t y, uint16_t width, uint16_t height, float pixelRatio, bool sdf)
: x(x),
y(y),
width(width),
height(height),
pixelRatio(pixelRatio),
sdf(sdf) {
SpritePosition::SpritePosition(uint16_t x_, uint16_t y_, uint16_t width_, uint16_t height_, float pixelRatio_, bool sdf_)
: x(x_),
y(y_),
width(width_),
height(height_),
pixelRatio(pixelRatio_),
sdf(sdf_) {
}
util::ptr<Sprite> Sprite::Create(const std::string& base_url, float pixelRatio, const util::ptr<FileSource> &fileSource) {
@@ -28,11 +28,11 @@ util::ptr<Sprite> Sprite::Create(const std::string& base_url, float pixelRatio,
return sprite;
}
Sprite::Sprite(const Key &, const std::string& base_url, float pixelRatio)
Sprite::Sprite(const Key &, const std::string& base_url, float pixelRatio_)
: valid(base_url.length() > 0),
pixelRatio(pixelRatio),
spriteURL(base_url + (pixelRatio > 1 ? "@2x" : "") + ".png"),
jsonURL(base_url + (pixelRatio > 1 ? "@2x" : "") + ".json"),
pixelRatio(pixelRatio_),
spriteURL(base_url + (pixelRatio_ > 1 ? "@2x" : "") + ".png"),
jsonURL(base_url + (pixelRatio_ > 1 ? "@2x" : "") + ".json"),
raster(),
loadedImage(false),
loadedJSON(false),
@@ -123,16 +123,16 @@ void Sprite::parseJSON() {
uint16_t y = 0;
uint16_t width = 0;
uint16_t height = 0;
float pixelRatio = 1.0f;
float spritePixelRatio = 1.0f;
bool sdf = false;
if (value.HasMember("x")) x = value["x"].GetInt();
if (value.HasMember("y")) y = value["y"].GetInt();
if (value.HasMember("width")) width = value["width"].GetInt();
if (value.HasMember("height")) height = value["height"].GetInt();
if (value.HasMember("pixelRatio")) pixelRatio = value["pixelRatio"].GetInt();
if (value.HasMember("pixelRatio")) spritePixelRatio = value["pixelRatio"].GetInt();
if (value.HasMember("sdf")) sdf = value["sdf"].GetBool();
pos.emplace(name, SpritePosition { x, y, width, height, pixelRatio, sdf });
pos.emplace(name, SpritePosition { x, y, width, height, spritePixelRatio, sdf });
}
}
} else {

View File

@@ -7,8 +7,8 @@ using namespace mbgl;
#include <iostream>
Tile::Tile(const ID& id)
: id(id) {
Tile::Tile(const ID& id_)
: id(id_) {
}
Tile::ID Tile::ID::parent(int8_t parent_z) const {

View File

@@ -9,14 +9,14 @@
using namespace mbgl;
TileData::TileData(Tile::ID id, Map &map, const util::ptr<SourceInfo> &source)
: id(id),
TileData::TileData(Tile::ID id_, Map &map_, const util::ptr<SourceInfo> &source_)
: id(id_),
state(State::initial),
map(map),
source(source),
map(map_),
source(source_),
debugBucket(debugFontBuffer) {
// Initialize tile debug coordinates
const std::string str = util::sprintf<32>("%d/%d/%d", id.z, id.x, id.y);
const std::string str = util::sprintf<32>("%d/%d/%d", id_.z, id_.x, id_.y);
debugFontBuffer.addText(str.c_str(), 50, 200, 5);
}

View File

@@ -37,14 +37,14 @@ namespace mbgl {
// its header file.
TileParser::~TileParser() = default;
TileParser::TileParser(const std::string &data, VectorTileData &tile,
TileParser::TileParser(const std::string &data, VectorTileData &tile_,
const util::ptr<const Style> &style_,
const util::ptr<GlyphAtlas> &glyphAtlas_,
const util::ptr<GlyphStore> &glyphStore_,
const util::ptr<SpriteAtlas> &spriteAtlas_,
const util::ptr<Sprite> &sprite_)
: vector_data(pbf((const uint8_t *)data.data(), data.size())),
tile(tile),
tile(tile_),
style(style_),
glyphAtlas(glyphAtlas_),
glyphStore(glyphStore_),

View File

@@ -17,7 +17,7 @@ const double R2D = 180.0 / M_PI;
const double M2PI = 2 * M_PI;
const double MIN_ROTATE_SCALE = 8;
Transform::Transform(View &view) : view(view), mtx(std::make_unique<uv::rwlock>()) {
Transform::Transform(View &view_) : view(view_), mtx(std::make_unique<uv::rwlock>()) {
setScale(current.scale);
setAngle(current.angle);
}

View File

@@ -96,8 +96,8 @@ float TransformState::lngX(float lon) const {
}
float TransformState::latY(float lat) const {
float y = 180 / M_PI * std::log(std::tan(M_PI / 4 + lat * M_PI / 360));
return (180 - y) * worldSize() / 360;
float latY = 180 / M_PI * std::log(std::tan(M_PI / 4 + lat * M_PI / 360));
return (180 - latY) * worldSize() / 360;
}
std::array<float, 2> TransformState::locationCoordinate(float lon, float lat) const {

View File

@@ -103,9 +103,9 @@ VectorTileLayer::VectorTileLayer(pbf layer) : data(layer) {
}
}
FilteredVectorTileLayer::FilteredVectorTileLayer(const VectorTileLayer& layer, const FilterExpression &filterExpression)
: layer(layer),
filterExpression(filterExpression) {
FilteredVectorTileLayer::FilteredVectorTileLayer(const VectorTileLayer& layer_, const FilterExpression &filterExpression_)
: layer(layer_),
filterExpression(filterExpression_) {
}
FilteredVectorTileLayer::iterator FilteredVectorTileLayer::begin() const {
@@ -116,10 +116,10 @@ FilteredVectorTileLayer::iterator FilteredVectorTileLayer::end() const {
return iterator(*this, pbf(layer.data.end, 0));
}
FilteredVectorTileLayer::iterator::iterator(const FilteredVectorTileLayer& parent, const pbf& data)
: parent(parent),
FilteredVectorTileLayer::iterator::iterator(const FilteredVectorTileLayer& parent_, const pbf& data_)
: parent(parent_),
feature(pbf()),
data(data) {
data(data_) {
operator++();
}