summaryrefslogtreecommitdiff
path: root/src/mbgl/renderer/painter_debug.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2016-10-26 15:22:31 -0700
committerKonstantin Käfer <mail@kkaefer.com>2016-10-27 18:30:58 -0700
commit62b56b799a7d4fcd1a8f151eed878054b862da5b (patch)
tree34d510a69f9dd1bca30e9b137feffbd1eb6495d0 /src/mbgl/renderer/painter_debug.cpp
parentef8017198ce8f0bd79ba5a5ed31e35a16e3433bb (diff)
downloadqtlocation-mapboxgl-62b56b799a7d4fcd1a8f151eed878054b862da5b.tar.gz
[core] change std::array<uint16_t, 2> to mbgl::Size
Diffstat (limited to 'src/mbgl/renderer/painter_debug.cpp')
-rw-r--r--src/mbgl/renderer/painter_debug.cpp45
1 files changed, 23 insertions, 22 deletions
diff --git a/src/mbgl/renderer/painter_debug.cpp b/src/mbgl/renderer/painter_debug.cpp
index e57bb2205e..5a737369bf 100644
--- a/src/mbgl/renderer/painter_debug.cpp
+++ b/src/mbgl/renderer/painter_debug.cpp
@@ -85,7 +85,8 @@ void Painter::renderDebugFrame(const mat4 &matrix) {
tileBorderArray.bind(plainShader, tileLineStripVertexBuffer, BUFFER_OFFSET_0, context);
plainShader.u_color = { 1.0f, 0.0f, 0.0f, 1.0f };
context.lineWidth = 4.0f * frame.pixelRatio;
- MBGL_CHECK_ERROR(glDrawArrays(GL_LINE_STRIP, 0, static_cast<GLsizei>(tileLineStripVertexBuffer.vertexCount)));
+ MBGL_CHECK_ERROR(glDrawArrays(GL_LINE_STRIP, 0,
+ static_cast<GLsizei>(tileLineStripVertexBuffer.vertexCount)));
}
#ifndef NDEBUG
@@ -101,28 +102,28 @@ void Painter::renderClipMasks(PaintParameters&) {
// Read the stencil buffer
const auto viewport = context.viewport.getCurrentValue();
- auto pixels = std::make_unique<uint8_t[]>(viewport.width * viewport.height);
+ auto pixels = std::make_unique<uint8_t[]>(viewport.size.width * viewport.size.height);
MBGL_CHECK_ERROR(glReadPixels(
- viewport.x, // GLint x
- viewport.y, // GLint y
- viewport.width, // GLsizei width
- viewport.height, // GLsizei height
- GL_STENCIL_INDEX, // GLenum format
- GL_UNSIGNED_BYTE, // GLenum type
- pixels.get() // GLvoid * data
+ viewport.x, // GLint x
+ viewport.y, // GLint y
+ viewport.size.width, // GLsizei width
+ viewport.size.height, // GLsizei height
+ GL_STENCIL_INDEX, // GLenum format
+ GL_UNSIGNED_BYTE, // GLenum type
+ pixels.get() // GLvoid * data
));
// Scale the Stencil buffer to cover the entire color space.
auto it = pixels.get();
- auto end = it + viewport.width * viewport.height;
+ auto end = it + viewport.size.width * viewport.size.height;
const auto factor = 255.0f / *std::max_element(it, end);
for (; it != end; ++it) {
*it *= factor;
}
MBGL_CHECK_ERROR(glWindowPos2i(viewport.x, viewport.y));
- MBGL_CHECK_ERROR(glDrawPixels(viewport.width, viewport.height, GL_LUMINANCE, GL_UNSIGNED_BYTE,
- pixels.get()));
+ MBGL_CHECK_ERROR(glDrawPixels(viewport.size.width, viewport.size.height, GL_LUMINANCE,
+ GL_UNSIGNED_BYTE, pixels.get()));
#endif // MBGL_USE_GLES2
}
#endif // NDEBUG
@@ -140,25 +141,25 @@ void Painter::renderDepthBuffer(PaintParameters&) {
// Read the stencil buffer
const auto viewport = context.viewport.getCurrentValue();
- auto pixels = std::make_unique<uint8_t[]>(viewport.width * viewport.height);
+ auto pixels = std::make_unique<uint8_t[]>(viewport.size.width * viewport.size.height);
const double base = 1.0 / (1.0 - depthRangeSize);
glPixelTransferf(GL_DEPTH_SCALE, base);
glPixelTransferf(GL_DEPTH_BIAS, 1.0 - base);
MBGL_CHECK_ERROR(glReadPixels(
- viewport.x, // GLint x
- viewport.y, // GLint y
- viewport.width, // GLsizei width
- viewport.height, // GLsizei height
- GL_DEPTH_COMPONENT, // GLenum format
- GL_UNSIGNED_BYTE, // GLenum type
- pixels.get() // GLvoid * data
+ viewport.x, // GLint x
+ viewport.y, // GLint y
+ viewport.size.width, // GLsizei width
+ viewport.size.height, // GLsizei height
+ GL_DEPTH_COMPONENT, // GLenum format
+ GL_UNSIGNED_BYTE, // GLenum type
+ pixels.get() // GLvoid * data
));
MBGL_CHECK_ERROR(glWindowPos2i(viewport.x, viewport.y));
- MBGL_CHECK_ERROR(glDrawPixels(viewport.width, viewport.height, GL_LUMINANCE, GL_UNSIGNED_BYTE,
- pixels.get()));
+ MBGL_CHECK_ERROR(glDrawPixels(viewport.size.width, viewport.size.height, GL_LUMINANCE,
+ GL_UNSIGNED_BYTE, pixels.get()));
#endif // MBGL_USE_GLES2
}
#endif // NDEBUG