summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-07-21 12:45:47 +0300
committerKonstantin Käfer <mail@kkaefer.com>2016-08-05 11:42:22 +0200
commit3ae506ee1301bcc3f9961a9282f710b8b7fa8039 (patch)
tree225b86322734f372a8d24c1c24ffa187aff4febd /src
parent57bed88b03e87344712800f8fbe796f81a00fc16 (diff)
downloadqtlocation-mapboxgl-3ae506ee1301bcc3f9961a9282f710b8b7fa8039.tar.gz
[core] Use NDEBUG instead of DEBUG
CMake defines 'NDEBUG' by default for release build, so we can check if that's not defined instead of using 'DEBUG' for debug build.
Diffstat (limited to 'src')
-rw-r--r--src/mbgl/geometry/glyph_atlas.cpp4
-rw-r--r--src/mbgl/gl/debugging.hpp2
-rw-r--r--src/mbgl/renderer/painter.cpp10
-rw-r--r--src/mbgl/renderer/painter.hpp6
-rw-r--r--src/mbgl/renderer/painter_debug.cpp4
-rw-r--r--src/mbgl/util/constants.cpp2
6 files changed, 10 insertions, 18 deletions
diff --git a/src/mbgl/geometry/glyph_atlas.cpp b/src/mbgl/geometry/glyph_atlas.cpp
index cfc5962eb3..ff62c5b897 100644
--- a/src/mbgl/geometry/glyph_atlas.cpp
+++ b/src/mbgl/geometry/glyph_atlas.cpp
@@ -177,10 +177,6 @@ void GlyphAtlas::upload(gl::ObjectStore& store, gl::Config& config, uint32_t uni
}
dirty = false;
-
-#if defined(DEBUG)
- // platform::showDebugImage("Glyph Atlas", reinterpret_cast<char*>(data.get()), width, height);
-#endif
}
}
diff --git a/src/mbgl/gl/debugging.hpp b/src/mbgl/gl/debugging.hpp
index b51b5dafe2..06b47a4192 100644
--- a/src/mbgl/gl/debugging.hpp
+++ b/src/mbgl/gl/debugging.hpp
@@ -2,7 +2,7 @@
#include <string>
-#if defined(DEBUG)
+#ifndef NDEBUG
#define __MBGL_DEBUG_GROUP_NAME2(counter) __MBGL_DEBUG_GROUP_##counter
#define __MBGL_DEBUG_GROUP_NAME(counter) __MBGL_DEBUG_GROUP_NAME2(counter)
#define MBGL_DEBUG_GROUP(string) ::mbgl::gl::debugging::group __MBGL_DEBUG_GROUP_NAME(__LINE__)(string);
diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp
index b196c71b96..8500a946fd 100644
--- a/src/mbgl/renderer/painter.cpp
+++ b/src/mbgl/renderer/painter.cpp
@@ -28,10 +28,6 @@
#include <mbgl/util/mat3.hpp>
#include <mbgl/util/string.hpp>
-#if defined(DEBUG)
-#include <mbgl/util/stopwatch.hpp>
-#endif
-
#include <cassert>
#include <algorithm>
#include <iostream>
@@ -46,7 +42,7 @@ Painter::Painter(const TransformState& state_,
gl::debugging::enable();
shaders = std::make_unique<Shaders>(store);
-#if defined(DEBUG)
+#ifndef NDEBUG
overdrawShaders = std::make_unique<Shaders>(store, Shader::Overdraw);
#endif
@@ -71,7 +67,7 @@ void Painter::render(const Style& style, const FrameData& frame_, SpriteAtlas& a
frame = frame_;
PaintParameters parameters {
-#if defined(DEBUG)
+#ifndef NDEBUG
isOverdraw() ? *overdrawShaders : *shaders
#else
*shaders
@@ -159,7 +155,7 @@ void Painter::render(const Style& style, const FrameData& frame_, SpriteAtlas& a
drawClippingMasks(parameters, generator.getStencils());
}
-#if defined(DEBUG)
+#ifndef NDEBUG
if (frame.debugOptions & MapDebugOptions::StencilClip) {
renderClipMasks();
return;
diff --git a/src/mbgl/renderer/painter.hpp b/src/mbgl/renderer/painter.hpp
index b291c14b14..2b6c1efdea 100644
--- a/src/mbgl/renderer/painter.hpp
+++ b/src/mbgl/renderer/painter.hpp
@@ -86,7 +86,7 @@ public:
// Renders the red debug frame around a tile, visualizing its perimeter.
void renderDebugFrame(const mat4 &matrix);
-#if defined(DEBUG)
+#ifndef NDEBUG
// Renders tile clip boundaries, using stencil buffer to calculate fill color.
void renderClipMasks();
#endif
@@ -142,7 +142,7 @@ private:
void setDepthSublayer(int n);
-#if defined(DEBUG)
+#ifndef NDEBUG
bool isOverdraw() const { return frame.debugOptions & MapDebugOptions::Overdraw; }
#else
bool isOverdraw() const { return false; }
@@ -181,7 +181,7 @@ private:
FrameHistory frameHistory;
std::unique_ptr<Shaders> shaders;
-#if defined(DEBUG)
+#ifndef NDEBUG
std::unique_ptr<Shaders> overdrawShaders;
#endif
diff --git a/src/mbgl/renderer/painter_debug.cpp b/src/mbgl/renderer/painter_debug.cpp
index 8bb8e9d646..d6336b843c 100644
--- a/src/mbgl/renderer/painter_debug.cpp
+++ b/src/mbgl/renderer/painter_debug.cpp
@@ -87,7 +87,7 @@ void Painter::renderDebugFrame(const mat4 &matrix) {
MBGL_CHECK_ERROR(glDrawArrays(GL_LINE_STRIP, 0, (GLsizei)tileBorderBuffer.index()));
}
-#if defined(DEBUG)
+#ifndef NDEBUG
void Painter::renderClipMasks() {
config.stencilTest = GL_FALSE;
config.depthTest = GL_FALSE;
@@ -123,6 +123,6 @@ void Painter::renderClipMasks() {
MBGL_CHECK_ERROR(glDrawPixels(fbSize[0], fbSize[1], GL_LUMINANCE, GL_UNSIGNED_BYTE, pixels.get()));
#endif // GL_ES_VERSION_2_0
}
-#endif // defined(DEBUG)
+#endif // NDEBUG
} // namespace mbgl
diff --git a/src/mbgl/util/constants.cpp b/src/mbgl/util/constants.cpp
index d86adb4d69..9faef140ef 100644
--- a/src/mbgl/util/constants.cpp
+++ b/src/mbgl/util/constants.cpp
@@ -6,7 +6,7 @@ namespace mbgl {
namespace debug {
-#if defined(DEBUG)
+#ifndef NDEBUG
const bool tileParseWarnings = false;
const bool styleParseWarnings = false;
const bool spriteWarnings = false;