mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-26 15:27:19 +00:00
[client] imgui: support high DPI by scaling framebuffer
This allows overlays to render at correct positions on high DPI displays.
This commit is contained in:
parent
56308fcbd1
commit
b5c5ecc074
@ -677,6 +677,14 @@ int app_renderOverlay(struct Rect * rects, int maxRects)
|
|||||||
const int written =
|
const int written =
|
||||||
overlay->ops->render(overlay->udata, false, buffer, MAX_OVERLAY_RECTS);
|
overlay->ops->render(overlay->udata, false, buffer, MAX_OVERLAY_RECTS);
|
||||||
|
|
||||||
|
for (int i = 0; i < written; ++i)
|
||||||
|
{
|
||||||
|
buffer[i].x *= g_state.windowScale;
|
||||||
|
buffer[i].y *= g_state.windowScale;
|
||||||
|
buffer[i].w *= g_state.windowScale;
|
||||||
|
buffer[i].h *= g_state.windowScale;
|
||||||
|
}
|
||||||
|
|
||||||
// It is an error to run out of rectangles, because we will not be able to
|
// It is an error to run out of rectangles, because we will not be able to
|
||||||
// correctly calculate the damage of the next frame.
|
// correctly calculate the damage of the next frame.
|
||||||
assert(written >= 0);
|
assert(written >= 0);
|
||||||
|
@ -179,12 +179,14 @@ static int renderThread(void * unused)
|
|||||||
int resize = atomic_load(&g_state.lgrResize);
|
int resize = atomic_load(&g_state.lgrResize);
|
||||||
if (resize)
|
if (resize)
|
||||||
{
|
{
|
||||||
const ImVec2 displaySize =
|
g_state.io->DisplaySize = (ImVec2) {
|
||||||
{
|
|
||||||
.x = g_state.windowW,
|
.x = g_state.windowW,
|
||||||
.y = g_state.windowH
|
.y = g_state.windowH
|
||||||
};
|
};
|
||||||
g_state.io->DisplaySize = displaySize;
|
g_state.io->DisplayFramebufferScale = (ImVec2) {
|
||||||
|
.x = g_state.windowScale,
|
||||||
|
.y = g_state.windowScale,
|
||||||
|
};
|
||||||
|
|
||||||
if (g_state.lgr)
|
if (g_state.lgr)
|
||||||
g_state.lgr->on_resize(g_state.lgrData, g_state.windowW, g_state.windowH,
|
g_state.lgr->on_resize(g_state.lgrData, g_state.windowW, g_state.windowH,
|
||||||
|
Loading…
Reference in New Issue
Block a user