[client] renderer: add interface for high DPI rendering

This commit is contained in:
Quantum
2021-02-21 00:08:52 -05:00
committed by Geoffrey McRae
parent 6b26089353
commit b35e19fc27
10 changed files with 18 additions and 15 deletions

View File

@@ -349,18 +349,19 @@ void app_updateWindowPos(int x, int y)
g_state.windowPos.y = y;
}
void app_handleResizeEvent(int w, int h, const struct Border border)
void app_handleResizeEvent(int w, int h, double scale, const struct Border border)
{
memcpy(&g_state.border, &border, sizeof(border));
/* don't do anything else if the window dimensions have not changed */
if (g_state.windowW == w && g_state.windowH == h)
if (g_state.windowW == w && g_state.windowH == h && g_state.windowScale == scale)
return;
g_state.windowW = w;
g_state.windowH = h;
g_state.windowCX = w / 2;
g_state.windowCY = h / 2;
g_state.windowW = w;
g_state.windowH = h;
g_state.windowCX = w / 2;
g_state.windowCY = h / 2;
g_state.windowScale = scale;
core_updatePositionInfo();
if (core_inputEnabled())

View File

@@ -126,7 +126,7 @@ static int renderThread(void * unused)
{
if (g_state.lgr)
g_state.lgr->on_resize(g_state.lgrData, g_state.windowW, g_state.windowH,
g_state.dstRect, g_params.winRotate);
g_state.windowScale, g_state.dstRect, g_params.winRotate);
atomic_compare_exchange_weak(&g_state.lgrResize, &resize, 0);
}

View File

@@ -58,6 +58,7 @@ struct AppState
struct Point windowPos;
int windowW, windowH;
int windowCX, windowCY;
double windowScale;
LG_RendererRotate rotate;
bool focused;
struct Border border;