46 lines
1.8 KiB
Diff
46 lines
1.8 KiB
Diff
From 4e1c00b89a710c38ba04206875c4d7c7c1d49c75 Mon Sep 17 00:00:00 2001
|
|
From: Hans de Goede <hdegoede@redhat.com>
|
|
Date: Fri, 1 Mar 2019 17:22:30 +0100
|
|
Subject: [PATCH 140/142] 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 <hdegoede@redhat.com>
|
|
---
|
|
src/libply-splash-core/ply-pixel-buffer.c | 8 +++++++-
|
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/libply-splash-core/ply-pixel-buffer.c b/src/libply-splash-core/ply-pixel-buffer.c
|
|
index 3ce6f78..51f9c4d 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];
|
|
--
|
|
2.7.4
|
|
|