From adf905ce7ae6bb0dfcab05164599873455bb13a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 27 Oct 2026 13:29:01 +0100 Subject: [PATCH] NoticeView: Take the padding from the theme's corner radius Co-Authored-By: Claude Opus 5.5 --- UI/OnScreenDisplay.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/UI/OnScreenDisplay.cpp b/UI/OnScreenDisplay.cpp index 616b200aba..314cb1dfda 100644 --- a/UI/OnScreenDisplay.cpp +++ b/UI/OnScreenDisplay.cpp @@ -427,8 +427,10 @@ ViewLayoutMode OSDOverlayScreen::LayoutMode() const { return ViewLayoutMode::ApplyInsets; } -// Inside the background, like the text padding of a Choice. -static const float g_noticeViewPadding = 8.0f; +// Inside the background, enough to keep the contents clear of the rounded corners. +static float NoticeViewPadding(const UIContext &dc) { + return dc.GetTheme().choiceRoundRadius * 0.5f; +} NoticeView::NoticeView(NoticeLevel level, std::string_view text, std::string_view detailsText, UI::LayoutParams *layoutParams) : InertView(layoutParams), level_(level), text_(text), detailsText_(detailsText) { @@ -446,12 +448,12 @@ void NoticeView::GetContentDimensionsBySpec(const UIContext &dc, UI::MeasureSpec } ApplyBoundBySpec(layoutWidth, horiz); const int align = wrapText_ ? FLAG_WRAP_TEXT : 0; - MeasureNotice(dc, level_, text_, detailsText_, iconName_, align, layoutWidth, &w, &h, &height1_, g_noticeViewPadding); + MeasureNotice(dc, level_, text_, detailsText_, iconName_, align, layoutWidth, &w, &h, &height1_, NoticeViewPadding(dc)); } void NoticeView::Draw(UIContext &dc) { dc.PushScissor(bounds_); const int align = wrapText_ ? FLAG_WRAP_TEXT : 0; - RenderNotice(dc, bounds_, height1_, level_, text_, detailsText_, iconName_, align, 1.0f, OSDMessageFlags::None, 0.0f, g_noticeViewPadding, roundCorners_); + RenderNotice(dc, bounds_, height1_, level_, text_, detailsText_, iconName_, align, 1.0f, OSDMessageFlags::None, 0.0f, NoticeViewPadding(dc), roundCorners_); dc.PopScissor(); }