Represent the user interface scale as a preset table index.

Replace the userScale float with a zoomLevel index into s_zoomPresets;
the ini key changes accordingly and previously saved floats are ignored.
This commit is contained in:
Bartosz Taudul
2026-09-13 16:14:58 +02:00
parent ee067d112b
commit 1381f40bd9
5 changed files with 28 additions and 21 deletions

View File

@@ -169,10 +169,10 @@ static void ScaleWindow(ImGuiWindow* window, float scale)
static void SetupDPIScale()
{
auto scale = dpiScale * tracy::s_config.userScale;
auto scale = dpiScale * tracy::s_zoomPresets[tracy::s_config.zoomLevel];
#ifdef __APPLE__
scale = tracy::s_config.userScale;
scale = tracy::s_zoomPresets[tracy::s_config.zoomLevel];
#endif
if( !dpiFirstSetup && prevScale == scale ) return;
@@ -218,9 +218,10 @@ static int IsBusy()
return 0;
}
static void SetupScaleCallback( float scale )
static void SetupScaleCallback( int preset )
{
tracy::s_config.userScale = scale;
assert( preset >= 0 && preset < tracy::s_zoomPresetCount );
tracy::s_config.zoomLevel = preset;
if ( tracy::s_config.saveUserScale ) tracy::SaveConfig();
RunOnMainThread( []{ SetupDPIScale(); }, true );
}