From 7e9e38faa5d3144dac9e9c3abd357435b25c16ff Mon Sep 17 00:00:00 2001 From: Chris Spencer Date: Tue, 11 Feb 2025 15:51:04 +0000 Subject: [PATCH] [client] overlay/status: don't return damage rect if nothing was drawn The renderer contains an optimization to skip ImGui if there is nothing to show, but the status overlay always returns a damage rect, even if it didn't draw anything, so the optimization can never take effect. --- client/src/overlay/status.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/src/overlay/status.c b/client/src/overlay/status.c index 0f0afc48..c61fd7d8 100644 --- a/client/src/overlay/status.c +++ b/client/src/overlay/status.c @@ -89,6 +89,7 @@ static int status_render(void * udata, bool interactive, struct Rect * windowRec }; int xPos = screen->x - marginX; + bool show = false; for(int i = 0; i < LG_USER_STATUS_MAX; ++i) { OverlayImage * img = &l_image[i]; @@ -99,6 +100,8 @@ static int status_render(void * udata, bool interactive, struct Rect * windowRec if (i == LG_USER_STATUS_RECORDING && !l_recordToggle) goto next; + show = true; + ImDrawList_AddImage( igGetBackgroundDrawList_Nil(), img->tex, @@ -118,6 +121,9 @@ next: xPos -= ICON_SIZE + gapX; } + if (!show) + return 0; + *windowRects = rect; return 1; }