From 3e5638e548a62a303a5f7256c7599ef644409967 Mon Sep 17 00:00:00 2001 From: vladislavbelov Date: Mon, 24 May 2021 18:42:51 +0000 Subject: [PATCH] Removes hardcoded 1px width borders from GUI sprites. Tested By: Imarok Differential Revision: https://code.wildfiregames.com/D4008 This was SVN commit r25541. --- .../mods/mod/gui/common/modern/sprites.xml | 12 ++++++---- binaries/data/mods/mod/gui/gui.rng | 10 -------- .../data/mods/public/gui/common/sprites.xml | 6 +++-- .../data/mods/public/gui/pregame/sprites.xml | 6 +++-- .../public/gui/reference/civinfo/sprites.xml | 6 +++-- .../public/gui/reference/viewer/sprites.xml | 23 ++++++++----------- .../public/gui/reference/viewer/styles.xml | 2 +- .../data/mods/public/gui/session/sprites.xml | 18 ++++++++++----- source/gui/CGUI.cpp | 13 ----------- source/gui/CGUISprite.h | 5 ---- source/gui/GUIRenderer.cpp | 15 ------------ source/gui/GUIRenderer.h | 1 - 12 files changed, 43 insertions(+), 74 deletions(-) diff --git a/binaries/data/mods/mod/gui/common/modern/sprites.xml b/binaries/data/mods/mod/gui/common/modern/sprites.xml index 3d362f392a..7aa00b7ae8 100644 --- a/binaries/data/mods/mod/gui/common/modern/sprites.xml +++ b/binaries/data/mods/mod/gui/common/modern/sprites.xml @@ -9,9 +9,11 @@ + + + + + + + + diff --git a/source/gui/CGUI.cpp b/source/gui/CGUI.cpp index 21d5a2978e..1f1a2a3c68 100644 --- a/source/gui/CGUI.cpp +++ b/source/gui/CGUI.cpp @@ -1086,19 +1086,6 @@ void CGUI::Xeromyces_ReadImage(const XMBData& xmb, XMBElement element, CGUISprit if (!ParseString(this, attr_value, Image->m_BackColor)) LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value)); } - else if (attr_name == "bordercolor") - { - if (!ParseString(this, attr_value, Image->m_BorderColor)) - LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value)); - } - else if (attr_name == "border") - { - bool b; - if (!ParseString(this, attr_value, b)) - LOGERROR("GUI: Error parsing '%s' (\"%s\")", attr_name, utf8_from_wstring(attr_value)); - else - Image->m_Border = b; - } else debug_warn(L"Invalid data - DTD shouldn't allow this"); } diff --git a/source/gui/CGUISprite.h b/source/gui/CGUISprite.h index ddb4459df5..e9e75bf445 100644 --- a/source/gui/CGUISprite.h +++ b/source/gui/CGUISprite.h @@ -55,7 +55,6 @@ public: m_RoundCoordinates(true), m_WrapMode(GL_REPEAT), m_Effects(), - m_Border(false), m_Size(CGUISize::Full()), m_TextureSize(CGUISize::Full()) { @@ -97,10 +96,6 @@ public: // Color CGUIColor m_BackColor; - CGUIColor m_BorderColor; - - // 0 or 1 pixel border is the only option - bool m_Border; }; /** diff --git a/source/gui/GUIRenderer.cpp b/source/gui/GUIRenderer.cpp index 11ed38bb3d..dc0ee9889d 100644 --- a/source/gui/GUIRenderer.cpp +++ b/source/gui/GUIRenderer.cpp @@ -228,7 +228,6 @@ void GUIRenderer::UpdateDrawCallCache(const CGUI& pGUI, DrawCalls& Calls, const } Call.m_BackColor = &(*cit)->m_BackColor; - Call.m_BorderColor = (*cit)->m_Border ? &(*cit)->m_BorderColor : nullptr; if (!Call.m_HasTexture) { @@ -419,20 +418,6 @@ void GUIRenderer::Draw(DrawCalls& Calls) shader->VertexPointer(3, GL_FLOAT, 3*sizeof(float), &data[0]); glDrawArrays(GL_TRIANGLES, 0, 6); - if (cit->m_BorderColor != nullptr) - { - shader->Uniform(str_color, *cit->m_BorderColor); - - data.clear(); - ADD(Verts.left + 0.5f, Verts.top + 0.5f, 0.0f); - ADD(Verts.right - 0.5f, Verts.top + 0.5f, 0.0f); - ADD(Verts.right - 0.5f, Verts.bottom - 0.5f, 0.0f); - ADD(Verts.left + 0.5f, Verts.bottom - 0.5f, 0.0f); - - shader->VertexPointer(3, GL_FLOAT, 3*sizeof(float), &data[0]); - glDrawArrays(GL_LINE_LOOP, 0, 4); - } - if (cit->m_EnableBlending) glDisable(GL_BLEND); #undef ADD diff --git a/source/gui/GUIRenderer.h b/source/gui/GUIRenderer.h index 665bc81704..fe19814198 100644 --- a/source/gui/GUIRenderer.h +++ b/source/gui/GUIRenderer.h @@ -54,7 +54,6 @@ namespace GUIRenderer CRect m_Vertices; - CGUIColor* m_BorderColor; // == nullptr for no border CGUIColor* m_BackColor; };