From 970a3ef4d86ee0ac574dd231e5baa9279f36637a Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Tue, 6 Jun 2023 18:39:50 +0200 Subject: [PATCH] LibGfx: Fix partial loading of tall and interlaced PNG files The function stopped copying data from a subimage when the _y_ value exceeded the image _width_ value, resulting in an incomplete image. --- Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp b/Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp index c579ff70c1b..6bf466e8548 100644 --- a/Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp +++ b/Userland/Libraries/LibGfx/ImageFormats/PNGLoader.cpp @@ -850,7 +850,7 @@ static ErrorOr decode_adam7_pass(PNGLoadingContext& context, Streamer& str // Copy the subimage data into the main image according to the pass pattern for (int y = 0, dy = adam7_starty[pass]; y < subimage_context.height && dy < context.height; ++y, dy += adam7_stepy[pass]) { - for (int x = 0, dx = adam7_startx[pass]; x < subimage_context.width && dy < context.width; ++x, dx += adam7_stepx[pass]) { + for (int x = 0, dx = adam7_startx[pass]; x < subimage_context.width && dx < context.width; ++x, dx += adam7_stepx[pass]) { context.bitmap->set_pixel(dx, dy, subimage_context.bitmap->get_pixel(x, y)); } }