Skip to content

Commit

Permalink
Prevent unnecessary draw calls for settings in NavigatorFeatureScreen
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed May 14, 2024
1 parent fd4ca34 commit 8291e6a
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,11 @@ protected void onRender(DrawContext context, int mouseX, int mouseY,
{
int yc1 = window.getChild(i).getY();
int yc2 = yc1 - 2;
if(yc1 < bgy1 - windowY1)
continue;
if(yc2 > bgy3 - windowY1)
break;

bufferBuilder.vertex(matrix, xc1, yc2, 0).next();
bufferBuilder.vertex(matrix, xc1, yc1, 0).next();
bufferBuilder.vertex(matrix, xc2, yc1, 0).next();
Expand Down Expand Up @@ -431,8 +436,16 @@ protected void onRender(DrawContext context, int mouseX, int mouseY,
}

for(int i = 0; i < window.countChildren(); i++)
window.getChild(i).render(context, mouseX - bgx1, mouseY - windowY1,
{
Component child = window.getChild(i);
if(child.getY() + child.getHeight() < bgy1 - windowY1)
continue;
if(child.getY() > bgy3 - windowY1)
break;

child.render(context, mouseX - bgx1, mouseY - windowY1,
partialTicks);
}
matrixStack.pop();

// buttons
Expand Down

0 comments on commit 8291e6a

Please sign in to comment.