Skip to content

Commit

Permalink
[client] overlay/status: don't return damage rect if nothing was drawn
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
spencercw committed Feb 11, 2025
1 parent e25492a commit e718d63
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions client/src/overlay/status.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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,
Expand All @@ -118,6 +121,9 @@ static int status_render(void * udata, bool interactive, struct Rect * windowRec
xPos -= ICON_SIZE + gapX;
}

if (!show)
return 0;

*windowRects = rect;
return 1;
}
Expand Down

0 comments on commit e718d63

Please sign in to comment.