Fix some minor visual UI issues

See #21223
This commit is contained in:
Henrik Rydgård
2026-02-15 19:57:16 +01:00
parent d8ccea3ca0
commit 1cc2b7233a
7 changed files with 18 additions and 14 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);
});
}

View File

@@ -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);
}

View File

@@ -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;