[core] remove platform::show(Color)?DebugImage
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace mbgl {
|
||||
@@ -23,10 +22,5 @@ void setCurrentThreadName(const std::string& name);
|
||||
// Makes the current thread low priority.
|
||||
void makeThreadLowPriority();
|
||||
|
||||
// Shows an alpha image with the specified dimensions in a named window.
|
||||
void showDebugImage(std::string name, const char *data, size_t width, size_t height);
|
||||
|
||||
// Shows an alpha image with the specified dimensions in a named window.
|
||||
void showColorDebugImage(std::string name, const char *data, size_t logical_width, size_t logical_height, size_t width, size_t height);
|
||||
} // namespace platform
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -720,78 +720,3 @@ void GLFWView::toggleCustomSource() {
|
||||
mbgl::style::VisibilityType::None : mbgl::style::VisibilityType::Visible);
|
||||
}
|
||||
}
|
||||
|
||||
namespace mbgl {
|
||||
namespace platform {
|
||||
|
||||
#ifndef MBGL_USE_GLES2
|
||||
void showDebugImage(std::string name, const char *data, size_t width, size_t height) {
|
||||
glfwInit();
|
||||
|
||||
static GLFWwindow *debugWindow = nullptr;
|
||||
if (!debugWindow) {
|
||||
debugWindow = glfwCreateWindow(static_cast<int>(width), static_cast<int>(height), name.c_str(), nullptr, nullptr);
|
||||
if (!debugWindow) {
|
||||
glfwTerminate();
|
||||
fprintf(stderr, "Failed to initialize window\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
GLFWwindow *currentWindow = glfwGetCurrentContext();
|
||||
|
||||
glfwSetWindowSize(debugWindow, static_cast<int>(width), static_cast<int>(height));
|
||||
glfwMakeContextCurrent(debugWindow);
|
||||
|
||||
int fbWidth, fbHeight;
|
||||
glfwGetFramebufferSize(debugWindow, &fbWidth, &fbHeight);
|
||||
float scale = static_cast<float>(fbWidth) / static_cast<float>(width);
|
||||
|
||||
glPixelZoom(scale, -scale);
|
||||
glRasterPos2f(-1.0f, 1.0f);
|
||||
glDrawPixels(width, height, GL_LUMINANCE, GL_UNSIGNED_BYTE, data);
|
||||
|
||||
glfwSwapBuffers(debugWindow);
|
||||
|
||||
glfwMakeContextCurrent(currentWindow);
|
||||
}
|
||||
|
||||
void showColorDebugImage(std::string name, const char *data, size_t logicalWidth, size_t logicalHeight, size_t width, size_t height) {
|
||||
glfwInit();
|
||||
|
||||
static GLFWwindow *debugWindow = nullptr;
|
||||
if (!debugWindow) {
|
||||
debugWindow = glfwCreateWindow(static_cast<int>(logicalWidth), static_cast<int>(logicalHeight), name.c_str(), nullptr, nullptr);
|
||||
if (!debugWindow) {
|
||||
glfwTerminate();
|
||||
fprintf(stderr, "Failed to initialize window\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
GLFWwindow *currentWindow = glfwGetCurrentContext();
|
||||
|
||||
glfwSetWindowSize(debugWindow, static_cast<int>(logicalWidth), static_cast<int>(logicalHeight));
|
||||
glfwMakeContextCurrent(debugWindow);
|
||||
|
||||
int fbWidth, fbHeight;
|
||||
glfwGetFramebufferSize(debugWindow, &fbWidth, &fbHeight);
|
||||
float xScale = static_cast<float>(fbWidth) / static_cast<float>(width);
|
||||
float yScale = static_cast<float>(fbHeight) / static_cast<float>(height);
|
||||
|
||||
glClearColor(0.8, 0.8, 0.8, 1);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glPixelZoom(xScale, -yScale);
|
||||
glRasterPos2f(-1.0f, 1.0f);
|
||||
glDrawPixels(width, height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, data);
|
||||
|
||||
glfwSwapBuffers(debugWindow);
|
||||
|
||||
glfwMakeContextCurrent(currentWindow);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace platform
|
||||
} // namespace mbgl
|
||||
|
||||
Reference in New Issue
Block a user