From 1cc2b7233acbce69cf0d1e7e3b20d1dbdfa7bc50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Sun, 15 Feb 2026 19:57:16 +0100 Subject: [PATCH] Fix some minor visual UI issues See #21223 --- Common/GPU/OpenGL/GLFeatures.cpp | 1 - Common/GPU/OpenGL/GLFeatures.h | 1 - Common/Math/geom2d.h | 12 +++++++----- Common/UI/View.cpp | 9 ++++++--- UI/GameScreen.cpp | 3 ++- UI/GameSettingsScreen.cpp | 2 +- UI/MiscScreens.cpp | 4 ++-- 7 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Common/GPU/OpenGL/GLFeatures.cpp b/Common/GPU/OpenGL/GLFeatures.cpp index 2b798142ca..c28807ad4b 100644 --- a/Common/GPU/OpenGL/GLFeatures.cpp +++ b/Common/GPU/OpenGL/GLFeatures.cpp @@ -360,7 +360,6 @@ bool CheckGLExtensions() { gl_extensions.ARB_conservative_depth = g_set_gl_extensions.count("GL_ARB_conservative_depth") != 0; gl_extensions.ARB_shader_image_load_store = (g_set_gl_extensions.count("GL_ARB_shader_image_load_store") != 0) || (g_set_gl_extensions.count("GL_EXT_shader_image_load_store") != 0); gl_extensions.ARB_shading_language_420pack = (g_set_gl_extensions.count("GL_ARB_shading_language_420pack") != 0); - gl_extensions.EXT_bgra = g_set_gl_extensions.count("GL_EXT_bgra") != 0; gl_extensions.EXT_gpu_shader4 = g_set_gl_extensions.count("GL_EXT_gpu_shader4") != 0; gl_extensions.NV_framebuffer_blit = g_set_gl_extensions.count("GL_NV_framebuffer_blit") != 0; gl_extensions.NV_copy_image = g_set_gl_extensions.count("GL_NV_copy_image") != 0; diff --git a/Common/GPU/OpenGL/GLFeatures.h b/Common/GPU/OpenGL/GLFeatures.h index 49948c8239..acd6cd75bf 100644 --- a/Common/GPU/OpenGL/GLFeatures.h +++ b/Common/GPU/OpenGL/GLFeatures.h @@ -90,7 +90,6 @@ struct GLExtensions { bool EXT_swap_control_tear; bool EXT_discard_framebuffer; bool EXT_unpack_subimage; // always supported on desktop and ES3 - bool EXT_bgra; bool EXT_shader_framebuffer_fetch; bool EXT_gpu_shader4; bool EXT_blend_minmax; diff --git a/Common/Math/geom2d.h b/Common/Math/geom2d.h index 155e34eec7..32b510c03b 100644 --- a/Common/Math/geom2d.h +++ b/Common/Math/geom2d.h @@ -97,28 +97,30 @@ struct Bounds { Point2D Center() const { return Point2D(centerX(), centerY()); } + [[nodiscard]] Bounds Expand(float amount) const { return Bounds(x - amount, y - amount, w + amount * 2, h + amount * 2); } + [[nodiscard]] Bounds Expand(float xAmount, float yAmount) const { return Bounds(x - xAmount, y - yAmount, w + xAmount * 2, h + yAmount * 2); } + [[nodiscard]] Bounds Expand(float left, float top, float right, float bottom) const { return Bounds(x - left, y - top, w + left + right, h + top + bottom); } + [[nodiscard]] Bounds Offset(float xAmount, float yAmount) const { return Bounds(x + xAmount, y + yAmount, w, h); } - Bounds Inset(float left, float top, float right, float bottom) { + [[nodiscard]] + Bounds Inset(float left, float top, float right, float bottom) const { return Bounds(x + left, y + top, w - left - right, h - bottom - top); } - + [[nodiscard]] Bounds Inset(float xAmount, float yAmount) const { return Bounds(x + xAmount, y + yAmount, w - xAmount * 2, h - yAmount * 2); } - Bounds Inset(float left, float top, float right, float bottom) const { - return Bounds(x + left, y + top, w - left - right, h - top - bottom); - } float AspectRatio() const { return w / h; diff --git a/Common/UI/View.cpp b/Common/UI/View.cpp index 0e1ce10b92..aa943187a6 100644 --- a/Common/UI/View.cpp +++ b/Common/UI/View.cpp @@ -1059,11 +1059,12 @@ void TextView::GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz if (bullet_) { availWidth -= bulletOffset; } + availWidth -= pad_.horiz(); const FontStyle *style = GetTextStyle(dc, textSize_); float measuredW; float measuredH; dc.MeasureTextRect(*style, 1.0f, 1.0f, text_, availWidth, &measuredW, &measuredH, textAlign_); - w = measuredW + pad_.horiz(); + w = measuredW; h = measuredH + pad_.vert(); if (bullet_) { w += bulletOffset; @@ -1110,11 +1111,13 @@ void TextView::Draw(UIContext &dc) { textBounds.w -= bulletOffset; } + textBounds = textBounds.Inset(pad_.left, pad_.top, pad_.right, pad_.bottom); + if (shadow_) { uint32_t shadowColor = 0x80000000; - dc.DrawTextRect(text_, textBounds.Offset(1.0f + pad_.left, 1.0f + pad_.top), shadowColor, textAlign_); + dc.DrawTextRect(text_, textBounds.Offset(1.0f, 1.0f), shadowColor, textAlign_); } - dc.DrawTextRect(text_, textBounds.Offset(pad_.left, pad_.top), textColor, textAlign_); + dc.DrawTextRect(text_, textBounds, textColor, textAlign_); if (textSize_ != TextSize::Normal) { // If we changed font style, reset it. dc.SetFontStyle(dc.GetTheme().uiFont); diff --git a/UI/GameScreen.cpp b/UI/GameScreen.cpp index fa809f2233..26856f542f 100644 --- a/UI/GameScreen.cpp +++ b/UI/GameScreen.cpp @@ -309,12 +309,13 @@ void GameScreen::CreateContentViews(UI::ViewGroup *parent) { if (System_GetPropertyBool(SYSPROP_HAS_TEXT_CLIPBOARD)) { Choice *tvCRCCopy = crcHoriz->Add(new Choice(ImageID("I_FILE_COPY"), new LinearLayoutParams(0.0, Gravity::G_VCENTER))); tvCRCCopy->OnClick.Add([this](UI::EventParams &) { + auto di = GetI18NCategory(I18NCat::DIALOG); u32 crc = Reporting::RetrieveCRC(gamePath_); char buffer[16]; snprintf(buffer, sizeof(buffer), "%08X", crc); System_CopyStringToClipboard(buffer); // Success indication. Not worth a translatable string. - g_OSD.Show(OSDType::MESSAGE_SUCCESS, buffer, 1.0f); + g_OSD.Show(OSDType::MESSAGE_INFO, ApplySafeSubstitutions(di->T("Copied to clipboard: %1"), buffer), 1.0f); }); } diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index cfbf412458..c499cf1941 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -116,7 +116,7 @@ public: SettingHint(std::string_view text) : UI::TextView(text, new UI::LinearLayoutParams(UI::FILL_PARENT, UI::WRAP_CONTENT)) { SetTextSize(UI::TextSize::Tiny); - SetPadding(UI::Margins(14, 0, 0, 8)); + SetPadding(UI::Margins(14, 0, 12, 8)); SetAlign(FLAG_WRAP_TEXT); } diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index adb47454d3..b86ccfed7f 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -746,8 +746,8 @@ void CreditsScroller::Draw(UIContext &dc) { dc.Begin(); - const Bounds &bounds = bounds_; - bounds.Inset(10.f, 10.f); + Bounds &bounds = bounds_; + bounds = bounds.Inset(10.f, 10.f); const int numItems = ARRAY_SIZE(credits); int itemHeight = 36; int contentsHeight = numItems * itemHeight + bounds.h + 200;