]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
ply-pixel-buffer: Fix right and bottom edge rendering of scaled buffers
authorHans de Goede <hdegoede@redhat.com>
Fri, 1 Mar 2019 16:22:30 +0000 (17:22 +0100)
committerHans de Goede <hdegoede@redhat.com>
Mon, 4 Mar 2019 09:47:08 +0000 (10:47 +0100)
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 <hdegoede@redhat.com>
src/libply-splash-core/ply-pixel-buffer.c

index 3ce6f78f30c794a50fa2b71b702b09e16cdcd9c2..51f9c4d7ddbf4771415dd1d38543cbfc02a5ae7e 100644 (file)
@@ -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];