From 746b6c6246f8a08adc482e90281a04c19d4e97f2 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 2 Mar 2024 00:21:08 +0100 Subject: [PATCH] Don't ignore user scale when DPI scale changes. --- profiler/src/main.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/profiler/src/main.cpp b/profiler/src/main.cpp index 8ae1f654..e539594a 100644 --- a/profiler/src/main.cpp +++ b/profiler/src/main.cpp @@ -96,6 +96,7 @@ static std::atomic viewShutdown { ViewShutdown::False }; static double animTime = 0; static float dpiScale = 1.f; static bool dpiScaleOverriddenFromEnv = false; +static float userScale = 1.f; static Filters* filt; static RunQueue mainThreadTasks; static uint32_t updateVersion = 0; @@ -133,8 +134,10 @@ static void RunOnMainThread( const std::function& cb, bool forceDelay = mainThreadTasks.Queue( cb, forceDelay ); } -static void SetupDPIScale( float scale ) +static void SetupDPIScale() { + const auto scale = dpiScale * userScale; + LoadFonts( scale ); if( view ) view->UpdateFont( s_fixedWidth, s_smallFont, s_bigFont ); @@ -167,7 +170,8 @@ static void SetupDPIScale( float scale ) static void SetupScaleCallback( float scale ) { - RunOnMainThread( [scale] { SetupDPIScale( scale * dpiScale ); }, true ); + userScale = scale; + RunOnMainThread( []{ SetupDPIScale(); }, true ); } static void LoadConfig() @@ -205,7 +209,7 @@ static void ScaleChanged( float scale ) if ( dpiScale == scale ) return; dpiScale = scale; - SetupDPIScale( dpiScale ); + SetupDPIScale(); } int main( int argc, char** argv ) @@ -328,7 +332,7 @@ int main( int argc, char** argv ) } } - SetupDPIScale( dpiScale ); + SetupDPIScale(); tracy::UpdateTextureRGBAMips( zigzagTex, (void**)zigzagPx, zigzagX, zigzagY, 6 ); for( auto& v : zigzagPx ) free( v );