From a05e40f96ab71b514b7f3e39c3a52de8a962360a Mon Sep 17 00:00:00 2001 From: oy Date: Sun, 9 Dec 2018 19:27:22 +0100 Subject: [PATCH] fixed clipping in the server browser. closes #1818 --- src/game/client/components/menus_browser.cpp | 12 ++++++++---- src/game/client/ui.h | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp index 339fa7aca..1e90b7310 100644 --- a/src/game/client/components/menus_browser.cpp +++ b/src/game/client/components/menus_browser.cpp @@ -604,7 +604,13 @@ int CMenus::DoBrowserEntry(const void *pID, CUIRect View, const CServerInfo *pEn View.VSplitLeft(160.0f, &Info, &View); RenderDetailInfo(Info, pEntry); + CUIRect NewClipArea = *UI()->ClipArea(); + CUIRect OldClipArea = NewClipArea; + NewClipArea.x = View.x; + NewClipArea.w = View.w; + UI()->ClipEnable(&NewClipArea); RenderDetailScoreboard(View, pEntry, 4); + UI()->ClipEnable(&OldClipArea); if(ReturnValue && UI()->MouseInside(&View)) ReturnValue++; @@ -1952,8 +1958,6 @@ void CMenus::RenderDetailScoreboard(CUIRect View, const CServerInfo *pInfo, int CUIRect Scroll; - UI()->ClipEnable(&View); - float RowWidth = (RowCount == 0) ? View.w : (View.w * 0.25f); float LineHeight = 20.0f; @@ -2091,8 +2095,6 @@ void CMenus::RenderDetailScoreboard(CUIRect View, const CServerInfo *pInfo, int ++Count; } - - UI()->ClipDisable(); } } @@ -2114,7 +2116,9 @@ void CMenus::RenderServerbrowserServerDetail(CUIRect View, const CServerInfo *pI //RenderTools()->DrawUIRect(&View, vec4(0, 0, 0, 0.15f), CUI::CORNER_B, 4.0f); ServerHeader.HMargin(2.0f, &ServerHeader); UI()->DoLabelScaled(&ServerHeader, Localize("Scoreboard"), FontSize + 2.0f, CUI::ALIGN_CENTER); + UI()->ClipEnable(&ServerScoreboard); RenderDetailScoreboard(ServerScoreboard, pInfo, 0); + UI()->ClipDisable(); } void CMenus::FriendlistOnUpdate() diff --git a/src/game/client/ui.h b/src/game/client/ui.h index c0f20f169..c3588f468 100644 --- a/src/game/client/ui.h +++ b/src/game/client/ui.h @@ -110,6 +110,7 @@ public: float PixelSize(); void ClipEnable(const CUIRect *pRect); void ClipDisable(); + const CUIRect *ClipArea() const { return &m_ClipRect; }; // TODO: Refactor: Redo UI scaling float Scale() const;