Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cull GUI elements not in scissor bounds #23022

Merged
merged 1 commit into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions xbmc/guilib/GUIControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ void CGUIControl::Process(unsigned int currentTime, CDirtyRegionList &dirtyregio
// 3. reset the animation transform
void CGUIControl::DoRender()
{
if (IsControlRenderable() &&
!m_renderRegion.Intersects(CServiceBroker::GetWinSystem()->GetGfxContext().GetScissors()))
return;
Comment on lines +180 to +182
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like the root cause for issue #25279 is lying here.
i can workaround it by not calling m_renderRegion.Intersects(GetScissors()) for GUICONTROL_TOGGLEBUTTON

diff --git a/xbmc/guilib/GUIControl.cpp b/xbmc/guilib/GUIControl.cpp
index 7ae9728120..68cd9f48a3 100644
--- a/xbmc/guilib/GUIControl.cpp
+++ b/xbmc/guilib/GUIControl.cpp
@@ -180,7 +180,7 @@ void CGUIControl::Process(unsigned int currentTime, CDirtyRegionList &dirtyregio
 // 3. reset the animation transform
 void CGUIControl::DoRender()
 {
-  if (IsControlRenderable() &&
+  if (IsControlRenderable() && ControlType != GUICONTROL_TOGGLEBUTTON &&
       !m_renderRegion.Intersects(CServiceBroker::GetWinSystem()->GetGfxContext().GetScissors()))
     return;

but no idea how to fix it properly


if (IsVisible() && !m_isCulled)
{
bool hasStereo =
Expand Down Expand Up @@ -951,6 +955,24 @@ void CGUIControl::UpdateControlStats()
}
}

bool CGUIControl::IsControlRenderable()
sarbes marked this conversation as resolved.
Show resolved Hide resolved
{
switch (ControlType)
{
case GUICONTAINER_EPGGRID:
case GUICONTAINER_FIXEDLIST:
case GUICONTAINER_LIST:
case GUICONTAINER_PANEL:
case GUICONTAINER_WRAPLIST:
case GUICONTROL_GROUP:
case GUICONTROL_GROUPLIST:
case GUICONTROL_LISTGROUP:
return false;
default:
return true;
}
}

void CGUIControl::SetHitRect(const CRect& rect, const UTILS::COLOR::Color& color)
{
m_hitRect = rect;
Expand Down
5 changes: 5 additions & 0 deletions xbmc/guilib/GUIControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,11 @@ class CGUIControl
};
GUICONTROLTYPES GetControlType() const { return ControlType; }

/*! \brief Test whether the control is "drawable" (not a group or similar)
\return true if the control has textures/labels it wants to render
*/
bool IsControlRenderable();

enum GUIVISIBLE { HIDDEN = 0, DELAYED, VISIBLE };

enum GUISCROLLVALUE { FOCUS = 0, NEVER, ALWAYS };
Expand Down
5 changes: 5 additions & 0 deletions xbmc/utils/Geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@ template <typename T> class CRectGen
return (x1 <= point.x && point.x <= x2 && y1 <= point.y && point.y <= y2);
};

constexpr bool Intersects(const this_type& rect) const
{
return (x1 < rect.x2 && x2 > rect.x1 && y1 < rect.y2 && y2 > rect.y1);
};

this_type& operator-=(const point_type &point) XBMC_FORCE_INLINE
{
x1 -= point.x;
Expand Down