From c594b58af231bc2dd48e516cad684b3f2b74646f Mon Sep 17 00:00:00 2001 From: Roman Artiukhin Date: Fri, 19 Dec 2025 10:51:00 +0200 Subject: [PATCH] imageviewer: jpegp: Fix downscaled image rendering Fixed rendering issue when dimension is not divisible by downscale factor Fixes FS#13719 Change-Id: I3b4ad035d5cce57acd3dc8a8e846bb5303598c8d --- apps/plugins/imageviewer/jpegp/jpegp.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/apps/plugins/imageviewer/jpegp/jpegp.c b/apps/plugins/imageviewer/jpegp/jpegp.c index 88edc7e8f3..d018f6cc16 100644 --- a/apps/plugins/imageviewer/jpegp/jpegp.c +++ b/apps/plugins/imageviewer/jpegp/jpegp.c @@ -217,23 +217,18 @@ static int get_image(struct image_info *info, int frame, int ds) int v2 = j->Vmax / j->Components[2].Vi; int x, y; - for (y = 0; y < j->Y; y++) + int max_y = info->height * ds; + int max_x = info->width * ds; + for (y = 0; y < max_y; y += ds) { - if (y%ds != 0) - continue; - TCOEF *C0 = j->Components[0].du[j->Components[0].du_width * ((y / v0) / 8)] + 8 * ((y / v0) & 7); TCOEF *C1 = j->Components[1].du[j->Components[1].du_width * ((y / v1) / 8)] + 8 * ((y / v1) & 7); TCOEF *C2 = j->Components[2].du[j->Components[2].du_width * ((y / v2) / 8)] + 8 * ((y / v2) & 7); - - for (x = 0; x < j->X; x++) + for (x = 0; x < max_x; x += ds) { - if (x%ds != 0) - continue; - TCOEF c0 = C0[(x / h0 / 8) * 64 + ((x / h0) & 7)]; TCOEF c1 = C1[(x / h1 / 8) * 64 + ((x / h1) & 7)]; TCOEF c2 = C2[(x / h2 / 8) * 64 + ((x / h2) & 7)];