From: Hans de Goede Date: Fri, 1 Mar 2019 16:22:30 +0000 (+0100) Subject: ply-pixel-buffer: Fix right and bottom edge rendering of scaled buffers X-Git-Tag: 0.9.5~69^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e1c00b89a71;p=thirdparty%2Fplymouth.git ply-pixel-buffer: Fix right and bottom edge rendering of scaled buffers When scaling a buffer 2x and calling ply_pixels_interpolate to interpolate the last row / column, the extra pixels used for pixels would go out of bounds and be replaced with a black pixel. This causes a 50% dimming of the last row / column. This 50% dimming leads to an ugly darkline when a theme draws 2 images which are supposed to be joined together. This commit fixes this by clipping the coordinates to the source image limits instead of using black pixels when interpolating right and bottom edge pixels. Signed-off-by: Hans de Goede --- diff --git a/src/libply-splash-core/ply-pixel-buffer.c b/src/libply-splash-core/ply-pixel-buffer.c index 3ce6f78f..51f9c4d7 100644 --- a/src/libply-splash-core/ply-pixel-buffer.c +++ b/src/libply-splash-core/ply-pixel-buffer.c @@ -667,7 +667,13 @@ ply_pixels_interpolate (uint32_t *bytes, ix = x + offset_x; iy = y + offset_y; - if (ix < 0 || ix >= width || iy < 0 || iy >= height) + if (ix >= width) + ix = width - 1; + + if (iy >= height) + ix = height - 1; + + if (ix < 0 || iy < 0) pixels[offset_y][offset_x] = 0x00000000; else pixels[offset_y][offset_x] = bytes[ix + iy * width];