From 71ebd08406547339a5decd9c61ab3e83739e96b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hubert=20G=C5=82uchowski?= Date: Fri, 5 Jun 2026 21:50:26 +0200 Subject: [PATCH] sub/packer: correctly offset instance bitmap pointer in `pack_subrandr` The software scaling code expects this pointer to already be offset by `src_x` and `src_y` but this function copied a pointer only offset by the image offset, forgetting about instance offset. --- sub/packer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sub/packer.c b/sub/packer.c index 5f4f986d1c..67a8dd766e 100644 --- a/sub/packer.c +++ b/sub/packer.c @@ -369,7 +369,9 @@ static bool pack_subrandr(struct mp_sub_packer *p, struct sub_bitmaps *res, .w = instance->src_width, .h = instance->src_height, .src_x = image_b->src_x + instance->src_off_x, .src_y = image_b->src_y + instance->src_off_y, - .bitmap = image_b->bitmap, .stride = byte_stride, + .bitmap = (sbr_bgra8 *)image_b->bitmap + + pixel_stride * instance->src_off_y + instance->src_off_x, + .stride = byte_stride, }; res->num_parts++; }