From e52ce34fb578e2c9f9f61fcea11e1ebb2251b6f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 2 Apr 2019 14:11:37 +0200 Subject: [core] remove platform::show(Color)?DebugImage --- include/mbgl/util/platform.hpp | 6 ---- platform/glfw/glfw_view.cpp | 75 ------------------------------------------ 2 files changed, 81 deletions(-) diff --git a/include/mbgl/util/platform.hpp b/include/mbgl/util/platform.hpp index cc8327c470..3544659740 100644 --- a/include/mbgl/util/platform.hpp +++ b/include/mbgl/util/platform.hpp @@ -1,6 +1,5 @@ #pragma once -#include #include 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 diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp index 82519e6ac2..cba3419672 100644 --- a/platform/glfw/glfw_view.cpp +++ b/platform/glfw/glfw_view.cpp @@ -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(width), static_cast(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(width), static_cast(height)); - glfwMakeContextCurrent(debugWindow); - - int fbWidth, fbHeight; - glfwGetFramebufferSize(debugWindow, &fbWidth, &fbHeight); - float scale = static_cast(fbWidth) / static_cast(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(logicalWidth), static_cast(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(logicalWidth), static_cast(logicalHeight)); - glfwMakeContextCurrent(debugWindow); - - int fbWidth, fbHeight; - glfwGetFramebufferSize(debugWindow, &fbWidth, &fbHeight); - float xScale = static_cast(fbWidth) / static_cast(width); - float yScale = static_cast(fbHeight) / static_cast(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 -- cgit v1.2.1