From a8eea6e9c1f32d5562594656c68dc4b9f985b790 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 14 Nov 2020 09:46:34 +0100 Subject: Add x_offset to drawable::line to be able to have drawImage render images outside the parent area. --- plugingui/painter.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'plugingui/painter.cc') diff --git a/plugingui/painter.cc b/plugingui/painter.cc index f2fc66a..f746f83 100644 --- a/plugingui/painter.cc +++ b/plugingui/painter.cc @@ -437,21 +437,21 @@ void Painter::drawImage(int x0, int y0, const Drawable& image) } else { - std::size_t x = -1 * std::min(0, x0); + std::size_t x_offset = -1 * std::min(0, x0); for(std::size_t y = -1 * std::min(0, y0); y < (std::size_t)fh; ++y) { - pixbuf.blendLine(x + x0, y + y0, image.line(y), - std::min((int)image.width(), fw - (int)x)); + pixbuf.blendLine(x_offset + x0, y + y0, image.line(y, x_offset), + std::min((int)image.width(), fw - (int)x_offset)); } } } else { - std::size_t x = -1 * std::min(0, x0); + std::size_t x_offset = -1 * std::min(0, x0); for(std::size_t y = -1 * std::min(0, y0); y < (std::size_t)fh; ++y) { - pixbuf.writeLine(x + x0, y + y0, image.line(y), - std::min((int)image.width(), fw - (int)x)); + pixbuf.writeLine(x_offset + x0, y + y0, image.line(y, x_offset), + std::min((int)image.width(), fw - (int)x_offset)); } } } -- cgit v1.2.3