From 5d0196cef6607bb528df466d14a8679ed63e6ec4 Mon Sep 17 00:00:00 2001 From: Jason Perlow Date: Sun, 11 Oct 2026 11:26:47 -0400 Subject: [PATCH] fix(splash): keep the brand logo aspect ratio loginui_render_brand() scaled every logo into a 256x256 square with separate x/y factors, so a wide wordmark was squeezed horizontally and stretched vertically. Fit it inside a box with one scale factor and place the loading bar under the drawn logo. Assisted-by: DeepSeek:deepseek-flash AI-Scope: fitted the brand-splash logo into an aspect-preserving box in brand.c. --- src/brand.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/brand.c b/src/brand.c index 5a1722e..a2df786 100644 --- a/src/brand.c +++ b/src/brand.c @@ -8,7 +8,7 @@ cairo_surface_t *loginui_load_brand_logo(void) { const char *path = getenv("SINGULARITY_SPLASH_LOGO"); if (!path || !path[0]) path = LOGINUI_BRAND_LOGO_PATH; - return loginui_load_image(path, LOGINUI_BRAND_LOGO_SIZE, LOGINUI_BRAND_LOGO_SIZE); + return loginui_load_image(path, LOGINUI_BRAND_LOGO_SIZE * 4, LOGINUI_BRAND_LOGO_SIZE); } void loginui_render_brand(cairo_t *cr, int width, int height, @@ -22,14 +22,20 @@ void loginui_render_brand(cairo_t *cr, int width, int height, double size = LOGINUI_BRAND_LOGO_SIZE; double top = floor((h - size) / 2.0); + double logo_h = size; if (logo) { int lw = cairo_image_surface_get_width(logo); int lh = cairo_image_surface_get_height(logo); if (lw > 0 && lh > 0) { + double box_w = fmin(w * 0.5, size * 3.0); + double s = fmin(box_w / lw, size / lh); + double dw = lw * s, dh = lh * s; + logo_h = dh; cairo_save(cr); - cairo_translate(cr, floor((w - size) / 2.0), top); - cairo_scale(cr, size / lw, size / lh); + cairo_translate(cr, floor((w - dw) / 2.0), floor(top + (size - dh) / 2.0)); + cairo_scale(cr, s, s); cairo_set_source_surface(cr, logo, 0, 0); + cairo_pattern_set_filter(cairo_get_source(cr), CAIRO_FILTER_BEST); cairo_paint(cr); cairo_restore(cr); } @@ -38,7 +44,7 @@ void loginui_render_brand(cairo_t *cr, int width, int height, if (track_alpha > 0.0) { double track_w = 220, track_h = 4, r = track_h / 2.0; double track_x = w / 2.0 - track_w / 2.0; - double track_y = top + size + 48; + double track_y = top + (size + logo_h) / 2.0 + 48; lui_rounded_rect(cr, track_x, track_y, track_w, track_h, r); cairo_set_source_rgba(cr, 1, 1, 1, 0.12 * track_alpha); cairo_fill(cr);