Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/brand.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
}
Expand All @@ -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);
Expand Down
Loading