From fd188acfb623ffa74918da1a458ffd1fc9125d76 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Thu, 1 Oct 2026 12:41:24 +0100 Subject: [PATCH] plymouth-plugin-ucode: honour the display device scale ply_pixel_buffer_get_size() reports the logical area while ply_pixel_buffer_get_argb32_data() points at the device pixel buffer. Where the device scale is above one, the plutovg surface then describes the buffer as too narrow and with too short a stride, so each odd logical row lands in the right half of the panel and the image collapses into a fraction of it. The damaged area is handed over in logical coordinates as well, while ply_renderer_head_flush_area() reads it as device pixels. Size the surface in device pixels, scale the canvas by the device scale so a theme keeps drawing in logical coordinates, and report the damaged area in device pixels. Signed-off-by: Daniel Golle --- utils/plymouth-plugin-ucode/Makefile | 2 +- utils/plymouth-plugin-ucode/src/ucode-splash.c | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/utils/plymouth-plugin-ucode/Makefile b/utils/plymouth-plugin-ucode/Makefile index fe52617..4378424 100644 --- a/utils/plymouth-plugin-ucode/Makefile +++ b/utils/plymouth-plugin-ucode/Makefile @@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=plymouth-plugin-ucode PKG_VERSION:=1 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_MAINTAINER:=Daniel Golle PKG_LICENSE:=GPL-2.0-or-later diff --git a/utils/plymouth-plugin-ucode/src/ucode-splash.c b/utils/plymouth-plugin-ucode/src/ucode-splash.c index 0fab7d2..2f00e15 100644 --- a/utils/plymouth-plugin-ucode/src/ucode-splash.c +++ b/utils/plymouth-plugin-ucode/src/ucode-splash.c @@ -565,6 +565,7 @@ on_draw (void *user_data, ply_pixel_buffer_t *pixel_buffer, int x, int y, ply_rectangle_t size; uc_value_t *args[5]; uint32_t *data; + int scale; if (!plugin->vm_ready) return; @@ -575,10 +576,12 @@ on_draw (void *user_data, ply_pixel_buffer_t *pixel_buffer, int x, int y, return; ply_pixel_buffer_get_size (pixel_buffer, &size); + scale = ply_pixel_buffer_get_device_scale (pixel_buffer); surface = plutovg_surface_create_for_data ((unsigned char *)data, - size.width, size.height, - size.width * 4); + size.width * scale, + size.height * scale, + size.width * scale * 4); if (!surface) return; @@ -589,6 +592,7 @@ on_draw (void *user_data, ply_pixel_buffer_t *pixel_buffer, int x, int y, if (!canvas) return; + plutovg_canvas_scale (canvas, scale, scale); plutovg_canvas_rect (canvas, x, y, width, height); plutovg_canvas_clip (canvas); @@ -608,10 +612,10 @@ on_draw (void *user_data, ply_pixel_buffer_t *pixel_buffer, int x, int y, /* drawing through the raw ARGB pointer bypasses the helpers that * record what changed, so plymouth would upload nothing */ - painted.x = x; - painted.y = y; - painted.width = width; - painted.height = height; + painted.x = x * scale; + painted.y = y * scale; + painted.width = width * scale; + painted.height = height * scale; ply_region_add_rectangle (ply_pixel_buffer_get_updated_areas (pixel_buffer), &painted); }