Make OSD scale float to more accurate match system scale

This commit is contained in:
Morilli 2024-06-14 03:11:39 +02:00
parent 6200a12d9c
commit 2cf2eaf643
4 changed files with 10 additions and 10 deletions

View File

@ -49,7 +49,7 @@ namespace BizHawk.Bizware.Graphics
TexturePages = null;
}
public SizeF Measure(string str, int scale)
public SizeF Measure(string str, float scale)
{
float x = 0;
float y = FontInfo.LineHeight * scale;
@ -92,7 +92,7 @@ namespace BizHawk.Bizware.Graphics
return new(Math.Max(x, ox), y);
}
public void RenderString(IGuiRenderer renderer, float x, float y, string str, int scale)
public void RenderString(IGuiRenderer renderer, float x, float y, string str, float scale)
{
if (Owner != renderer.Owner)
{
@ -146,4 +146,4 @@ namespace BizHawk.Bizware.Graphics
private record TexCoords(float U0, float V0, float U1, float V1);
}
}
}

View File

@ -615,7 +615,7 @@ namespace BizHawk.Client.Common.Filters
var size = FindInput().SurfaceFormat.Size;
FilterProgram.GuiRenderer.Begin(size.Width, size.Height);
var scale = (int)Math.Round(FilterProgram.ControlDpi / 96.0f);
var scale = FilterProgram.ControlDpi / 96.0F;
var blitter = new OSDBlitter(_font, FilterProgram.GuiRenderer, new(0, 0, size.Width, size.Height), scale);
FilterProgram.GuiRenderer.EnableBlending();
_manager.DrawScreenInfo(blitter);
@ -628,7 +628,7 @@ namespace BizHawk.Client.Common.Filters
private readonly StringRenderer _font;
private readonly IGuiRenderer _renderer;
public OSDBlitter(StringRenderer font, IGuiRenderer renderer, Rectangle clipBounds, int scale)
public OSDBlitter(StringRenderer font, IGuiRenderer renderer, Rectangle clipBounds, float scale)
{
_font = font;
_renderer = renderer;
@ -648,7 +648,7 @@ namespace BizHawk.Client.Common.Filters
public Rectangle ClipBounds { get; }
public int Scale { get; }
public float Scale { get; }
}
}
}
}

View File

@ -15,6 +15,6 @@ namespace BizHawk.Client.Common
Rectangle ClipBounds { get; }
public int Scale { get; }
public float Scale { get; }
}
}

View File

@ -141,7 +141,7 @@ namespace BizHawk.Client.Common
var line = 1;
for (var i = _messages.Count - 1; i >= 0; i--, line++)
{
var yOffset = (line - 1) * 18 * g.Scale;
var yOffset = (int)Math.Round((line - 1) * 18 * g.Scale);
if (!_config.Messages.Anchor.IsTop())
{
yOffset = 0 - yOffset;
@ -355,4 +355,4 @@ namespace BizHawk.Client.Common
}
}
}
}
}