Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Taudul <wolf@nereid.pl>2022-10-02 14:51:28 +0300
committerBartosz Taudul <wolf@nereid.pl>2022-10-02 14:51:28 +0300
commitcf61fbf7ba9599eecef9745e7e4ef6023e8266bd (patch)
treed119b441fd02aa2394c9b984a9debbab7075c357 /profiler
parent4b5a823d3911a1706168032a6fc07fb644e19ff1 (diff)
Support hidpi.
Diffstat (limited to 'profiler')
-rw-r--r--profiler/build/wasm/index.html4
-rw-r--r--profiler/src/BackendGlfw.cpp4
2 files changed, 6 insertions, 2 deletions
diff --git a/profiler/build/wasm/index.html b/profiler/build/wasm/index.html
index 008eebe4..13ae7fbd 100644
--- a/profiler/build/wasm/index.html
+++ b/profiler/build/wasm/index.html
@@ -91,7 +91,9 @@
var canvasElement = document.getElementById('canvas');
function resizeHandler() {
- Module.ccall('nativeResize', 'number', ['number', 'number'], [window.innerWidth, window.innerHeight]);
+ Module.ccall('nativeResize', 'number', ['number', 'number'], [window.innerWidth * window.devicePixelRatio, window.innerHeight * window.devicePixelRatio]);
+ Module.canvas.style.width = window.innerWidth + 'px';
+ Module.canvas.style.height = window.innerHeight + 'px';
}
var Module = {
diff --git a/profiler/src/BackendGlfw.cpp b/profiler/src/BackendGlfw.cpp
index 27785c9b..952e473c 100644
--- a/profiler/src/BackendGlfw.cpp
+++ b/profiler/src/BackendGlfw.cpp
@@ -187,7 +187,9 @@ void Backend::SetTitle( const char* title )
float Backend::GetDpiScale()
{
-#if GLFW_VERSION_MAJOR > 3 || ( GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR >= 3 )
+#ifdef __EMSCRIPTEN__
+ return EM_ASM_DOUBLE( { return window.devicePixelRatio; } );
+#elif GLFW_VERSION_MAJOR > 3 || ( GLFW_VERSION_MAJOR == 3 && GLFW_VERSION_MINOR >= 3 )
auto monitor = glfwGetWindowMonitor( s_window );
if( !monitor ) monitor = glfwGetPrimaryMonitor();
if( monitor )