[core] change std::array<uint16_t, 2> to mbgl::Size
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user