From 797f590cfb846e978561f2ff1e6921e37c2d4aff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 16 Apr 2014 10:55:06 -0400 Subject: [PATCH] cleanup + unused arguments --- common/map_view.cpp | 9 ++------- include/llmr/map/source.hpp | 6 +++--- include/llmr/platform/gl.hpp | 10 ++++++---- src/map/map.cpp | 5 +---- src/map/source.cpp | 2 +- src/map/transform.cpp | 2 -- src/map/vector_tile.cpp | 2 +- src/renderer/frame_history.cpp | 4 ++-- src/renderer/painter.cpp | 6 +++--- src/renderer/raster_bucket.cpp | 2 +- src/text/placement.cpp | 4 ++-- 11 files changed, 22 insertions(+), 30 deletions(-) diff --git a/common/map_view.cpp b/common/map_view.cpp index 8b913cd0c..cf8269a44 100644 --- a/common/map_view.cpp +++ b/common/map_view.cpp @@ -64,15 +64,10 @@ public: glfwSetWindowSizeCallback(window, resize); glfwSetFramebufferSizeCallback(window, resize); glfwSetScrollCallback(window, scroll); - glfwSetCharCallback(window, character); glfwSetKeyCallback(window, key); } - static void character(GLFWwindow *window, unsigned int codepoint) { - - } - - static void key(GLFWwindow *window, int key, int scancode, int action, int mods) { + static void key(GLFWwindow *window, int key, int /*scancode*/, int action, int mods) { MapView *mapView = (MapView *)glfwGetWindowUserPointer(window); if (action == GLFW_RELEASE) { @@ -96,7 +91,7 @@ public: } } - static void scroll(GLFWwindow *window, double xoffset, double yoffset) { + static void scroll(GLFWwindow *window, double /*xoffset*/, double yoffset) { MapView *mapView = (MapView *)glfwGetWindowUserPointer(window); double delta = yoffset * 40; diff --git a/include/llmr/map/source.hpp b/include/llmr/map/source.hpp index 9b89d0e54..029bc7873 100644 --- a/include/llmr/map/source.hpp +++ b/include/llmr/map/source.hpp @@ -32,7 +32,7 @@ public: bool update(); void prepare_render(bool is_baselayer = false); - void render(double animationTime, bool is_baselayer = false); + void render(double animationTime); public: bool enabled; @@ -59,8 +59,8 @@ private: const std::vector zooms; const std::string url; const uint32_t tile_size; - const uint32_t min_zoom; - const uint32_t max_zoom; + const int32_t min_zoom; + const int32_t max_zoom; std::forward_list tiles; std::forward_list> tile_data; diff --git a/include/llmr/platform/gl.hpp b/include/llmr/platform/gl.hpp index b695b4ed8..f8e7a7fee 100644 --- a/include/llmr/platform/gl.hpp +++ b/include/llmr/platform/gl.hpp @@ -38,17 +38,19 @@ namespace llmr { namespace gl { // Debug group markers, useful for debuggin on iOS -inline void start_group(const std::string &str) { #if GL_EXT_debug_marker +inline void start_group(const std::string &str) { glPushGroupMarkerEXT(0, str.c_str()); -#endif } inline void end_group() { -#if GL_EXT_debug_marker glPopGroupMarkerEXT(); -#endif } +#else +inline void start_group(const std::string &) {} +inline void end_group() {} +#endif + struct group { inline group(const std::string &str) { start_group(str); } diff --git a/src/map/map.cpp b/src/map/map.cpp index 942cf1878..756ef6a4c 100644 --- a/src/map/map.cpp +++ b/src/map/map.cpp @@ -347,12 +347,9 @@ bool Map::render() { // Then, render each source's tiles. TODO: handle more than one // vector source. - is_baselayer = true; - for (auto &pair : sources) { Source &source = *pair.second; - source.render(animationTime, is_baselayer); - is_baselayer = source.enabled ? false : (true && is_baselayer); + source.render(animationTime); } painter.renderMatte(); diff --git a/src/map/source.cpp b/src/map/source.cpp index a6e610a40..ca6dea980 100644 --- a/src/map/source.cpp +++ b/src/map/source.cpp @@ -47,7 +47,7 @@ void Source::prepare_render(bool is_baselayer) { } } -void Source::render(double animationTime, bool is_baselayer) { +void Source::render(double animationTime) { if (!enabled) return; for (const Tile& tile : tiles) { diff --git a/src/map/transform.cpp b/src/map/transform.cpp index 7cb0f679f..9fd97f454 100644 --- a/src/map/transform.cpp +++ b/src/map/transform.cpp @@ -9,11 +9,9 @@ using namespace llmr; -const double MAXEXTENT = 20037508.34; const double D2R = M_PI / 180.0; const double R2D = 180.0 / M_PI; const double M2PI = 2 * M_PI; -const double A = 6378137; Transform::Transform() { diff --git a/src/map/vector_tile.cpp b/src/map/vector_tile.cpp index 39f9e7e4e..ddfb62011 100644 --- a/src/map/vector_tile.cpp +++ b/src/map/vector_tile.cpp @@ -288,7 +288,7 @@ void FilteredVectorTileLayer::iterator::operator++() { // tags are packed varints. They should have an even length. pbf tags_pbf = feature_pbf.message(); while (tags_pbf) { - uint32_t tag_key = tags_pbf.varint(); + int32_t tag_key = tags_pbf.varint(); if (tags_pbf) { uint32_t tag_val = tags_pbf.varint(); // Now check if the tag_key/tag_val pair is included diff --git a/src/renderer/frame_history.cpp b/src/renderer/frame_history.cpp index 828b2c115..2cbc6f1bc 100644 --- a/src/renderer/frame_history.cpp +++ b/src/renderer/frame_history.cpp @@ -24,7 +24,7 @@ bool FrameHistory::needsAnimation(const float duration) const { const FrameSnapshot &pivot = history.back(); int i = -1; - while (history.size() > i + 1 && + while ((int)history.size() > i + 1 && history[i + 1].time + duration < pivot.time) { i++; } @@ -37,7 +37,7 @@ bool FrameHistory::needsAnimation(const float duration) const { // Make sure that all subsequent snapshots have the same zoom as the last // pivot element. - for (; history.size() > i; i++) { + for (; (int)history.size() > i; i++) { if (history[i].z != pivot.z) { return true; } diff --git a/src/renderer/painter.cpp b/src/renderer/painter.cpp index 538a4ad9f..1d26946af 100644 --- a/src/renderer/painter.cpp +++ b/src/renderer/painter.cpp @@ -390,7 +390,7 @@ void Painter::renderFill(FillBucket& bucket, const std::string& layer_name, cons } } -void Painter::renderLine(LineBucket& bucket, const std::string& layer_name, const Tile::ID& id) { +void Painter::renderLine(LineBucket& bucket, const std::string& layer_name, const Tile::ID& /*id*/) { // Abort early. if (pass == Opaque) return; if (bucket.empty()) return; @@ -472,7 +472,7 @@ void Painter::renderLine(LineBucket& bucket, const std::string& layer_name, cons } } -void Painter::renderPoint(PointBucket& bucket, const std::string& layer_name, const Tile::ID& id) { +void Painter::renderPoint(PointBucket& bucket, const std::string& layer_name, const Tile::ID& /*id&*/) { // Abort early. if (!bucket.hasPoints()) return; if (pass == Opaque) return; @@ -516,7 +516,7 @@ void Painter::renderPoint(PointBucket& bucket, const std::string& layer_name, co bucket.drawPoints(*pointShader); } -void Painter::renderText(TextBucket& bucket, const std::string& layer_name, const Tile::ID& id) { +void Painter::renderText(TextBucket& bucket, const std::string& layer_name, const Tile::ID& /*id*/) { // Abort early. if (pass == Opaque) return; if (bucket.empty()) return; diff --git a/src/renderer/raster_bucket.cpp b/src/renderer/raster_bucket.cpp index 7ae18e995..f8c656b2c 100644 --- a/src/renderer/raster_bucket.cpp +++ b/src/renderer/raster_bucket.cpp @@ -3,7 +3,7 @@ using namespace llmr; -RasterBucket::RasterBucket(const BucketDescription &bucket_desc) { +RasterBucket::RasterBucket(const BucketDescription &) { } void RasterBucket::render(Painter &, const std::string &, const Tile::ID &) { diff --git a/src/text/placement.cpp b/src/text/placement.cpp index e556e5756..15cb78751 100644 --- a/src/text/placement.cpp +++ b/src/text/placement.cpp @@ -88,7 +88,7 @@ void getSegmentGlyphs(std::back_insert_iterator glyphs, vec2 newAnchor = anchor; - if (line.size() <= segment) { + if ((int)line.size() <= segment) { return; } vec2 end = line[segment]; @@ -130,7 +130,7 @@ void getSegmentGlyphs(std::back_insert_iterator glyphs, // skip duplicate nodes while (newAnchor == end) { segment += direction; - if (line.size() <= segment) { + if ((int)line.size() <= segment) { anchor.scale = scale; return; }