MCPcopy Create free account
hub / github.com/cdcseacave/openMVS / UpdateDevicePixelRatio

Method UpdateDevicePixelRatio

apps/Viewer/Window.cpp:880–903  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

878}
879
880void Window::UpdateDevicePixelRatio() {
881 if (!window) {
882 devicePixelRatio = Eigen::Vector2d(1.0, 1.0);
883 return;
884 }
885
886 // Get logical window size and framebuffer size
887 cv::Size windowSize, size;
888 glfwGetWindowSize(window, &windowSize.width, &windowSize.height);
889 glfwGetFramebufferSize(window, &size.width, &size.height);
890
891 // Calculate device pixel ratio (scale factor)
892 devicePixelRatio.x() = (windowSize.width > 0 ? static_cast<double>(size.width) / static_cast<double>(windowSize.width) : 1.0);
893 devicePixelRatio.y() = (windowSize.height > 0 ? static_cast<double>(size.height) / static_cast<double>(windowSize.height) : 1.0);
894
895 // Set initial viewport to match framebuffer size
896 GL_CHECK(glViewport(0, 0, size.width, size.height));
897
898 // Set initial camera size
899 camera.SetSize(size);
900
901 DEBUG("Framebuffer size changed: %dx%d (window size: %dx%d)",
902 size.width, size.height, windowSize.width, windowSize.height);
903}
904
905Eigen::Vector2d Window::NormalizeMousePos(double x, double y) const {
906 // Convert mouse coordinates from logical window coordinates to framebuffer coordinates

Callers 1

Calls 1

SetSizeMethod · 0.80

Tested by

no test coverage detected