summaryrefslogtreecommitdiff
path: root/common/glfw_view.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/glfw_view.cpp')
-rw-r--r--common/glfw_view.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/common/glfw_view.cpp b/common/glfw_view.cpp
index 2542e6cf93..3ef7bc36a9 100644
--- a/common/glfw_view.cpp
+++ b/common/glfw_view.cpp
@@ -232,10 +232,10 @@ void show_debug_image(std::string name, const char *data, size_t width, size_t h
}
-void show_color_debug_image(std::string name, const char *data, size_t width, size_t height) {
+void show_color_debug_image(std::string name, const char *data, size_t logical_width, size_t logical_height, size_t width, size_t height) {
static GLFWwindow *debug_window = nullptr;
if (!debug_window) {
- debug_window = glfwCreateWindow(width, height, name.c_str(), nullptr, nullptr);
+ debug_window = glfwCreateWindow(logical_width, logical_height, name.c_str(), nullptr, nullptr);
if (!debug_window) {
glfwTerminate();
fprintf(stderr, "Failed to initialize window\n");
@@ -245,14 +245,15 @@ void show_color_debug_image(std::string name, const char *data, size_t width, si
GLFWwindow *current_window = glfwGetCurrentContext();
- glfwSetWindowSize(debug_window, width, height);
+ glfwSetWindowSize(debug_window, logical_width, logical_height);
glfwMakeContextCurrent(debug_window);
int fb_width, fb_height;
glfwGetFramebufferSize(debug_window, &fb_width, &fb_height);
- float scale = (float)fb_width / (float)width;
+ float x_scale = (float)fb_width / (float)width;
+ float y_scale = (float)fb_height / (float)height;
- glPixelZoom(scale, -scale);
+ glPixelZoom(x_scale, -y_scale);
glRasterPos2f(-1.0f, 1.0f);
glDrawPixels(width, height, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV, data);
glfwSwapBuffers(debug_window);