NoticeView: Take the padding from the theme's corner radius

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-27 13:29:01 +01:00
1 parent a941ad634d
commit adf905ce7a
1 file changed
+6 -4
+6 -4
View File
@@ -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();
}