mirror of
https://github.com/openwrt/video.git
synced 2026-10-14 12:06:56 +04:00
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 <daniel@makrotopia.org>
This commit is contained in:
1 parent
389a52b148
commit
fd188acfb6
2 files changed
+11
-7
No files matched your search
@@ -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 <daniel@makrotopia.org>
|
||||
PKG_LICENSE:=GPL-2.0-or-later
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user