fix variable shadowing
This commit is contained in:
@@ -30,8 +30,8 @@ std::string mbgl::util::compress_png(int width, int height, void *rgba, bool fli
|
||||
}
|
||||
|
||||
std::string result;
|
||||
png_set_write_fn(png_ptr, &result, [](png_structp png_ptr, png_bytep data, png_size_t length) {
|
||||
std::string *out = static_cast<std::string *>(png_get_io_ptr(png_ptr));
|
||||
png_set_write_fn(png_ptr, &result, [](png_structp png_ptr_, png_bytep data, png_size_t length) {
|
||||
std::string *out = static_cast<std::string *>(png_get_io_ptr(png_ptr_));
|
||||
out->append(reinterpret_cast<char *>(data), length);
|
||||
}, NULL);
|
||||
|
||||
@@ -57,8 +57,8 @@ using namespace mbgl::util;
|
||||
|
||||
|
||||
struct Buffer {
|
||||
Buffer(const std::string& data)
|
||||
: data(data.data()), length(data.size()) {}
|
||||
Buffer(const std::string& data_)
|
||||
: data(data_.data()), length(data_.size()) {}
|
||||
const char *const data = 0;
|
||||
const size_t length = 0;
|
||||
size_t pos = 0;
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
|
||||
using namespace mbgl;
|
||||
|
||||
Raster::Raster(const util::ptr<Texturepool> &texturepool)
|
||||
: texturepool(texturepool)
|
||||
Raster::Raster(const util::ptr<Texturepool> &texturepool_)
|
||||
: texturepool(texturepool_)
|
||||
{}
|
||||
|
||||
Raster::~Raster() {
|
||||
@@ -59,32 +59,32 @@ void Raster::bind(bool linear) {
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
}
|
||||
|
||||
GLuint filter = linear ? GL_LINEAR : GL_NEAREST;
|
||||
if (filter != this->filter) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
|
||||
this->filter = filter;
|
||||
GLuint new_filter = linear ? GL_LINEAR : GL_NEAREST;
|
||||
if (new_filter != this->filter) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, new_filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, new_filter);
|
||||
filter = new_filter;
|
||||
}
|
||||
}
|
||||
|
||||
// overload ::bind for prerendered raster textures
|
||||
void Raster::bind(const GLuint texture) {
|
||||
void Raster::bind(const GLuint custom_texture) {
|
||||
if (img && !textured) {
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
glBindTexture(GL_TEXTURE_2D, custom_texture);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, img->getData());
|
||||
img.reset();
|
||||
textured = true;
|
||||
} else if (textured) {
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
glBindTexture(GL_TEXTURE_2D, custom_texture);
|
||||
}
|
||||
|
||||
GLuint filter = GL_LINEAR;
|
||||
if (filter != this->filter) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
|
||||
this->filter = filter;
|
||||
GLuint new_filter = GL_LINEAR;
|
||||
if (new_filter != this->filter) {
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, new_filter);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, new_filter);
|
||||
filter = new_filter;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,22 +8,22 @@
|
||||
|
||||
using namespace mbgl::util;
|
||||
|
||||
timer::timer(Event event)
|
||||
: event(event), start(now()) {}
|
||||
timer::timer(Event event_)
|
||||
: event(event_), start(now()) {}
|
||||
|
||||
timer::timer(EventSeverity severity, Event event)
|
||||
: severity(severity), event(event), start(now()) {}
|
||||
timer::timer(EventSeverity severity_, Event event_)
|
||||
: severity(severity_), event(event_), start(now()) {}
|
||||
|
||||
timer::timer(const std::string &name, Event event)
|
||||
: name(name), event(event), start(now()) {}
|
||||
timer::timer(const std::string &name_, Event event_)
|
||||
: name(name_), event(event_), start(now()) {}
|
||||
|
||||
timer::timer(const std::string &name, EventSeverity severity, Event event)
|
||||
: name(name), severity(severity), event(event), start(now()) {}
|
||||
timer::timer(const std::string &name_, EventSeverity severity_, Event event_)
|
||||
: name(name_), severity(severity_), event(event_), start(now()) {}
|
||||
|
||||
void timer::report(const std::string &name) {
|
||||
void timer::report(const std::string &name_) {
|
||||
timestamp duration = now() - start;
|
||||
|
||||
Log::Record(severity, event, name + ": " + std::to_string((double)(duration) / 1_millisecond) + "ms");
|
||||
Log::Record(severity, event, name_ + ": " + std::to_string((double)(duration) / 1_millisecond) + "ms");
|
||||
start += duration;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user