From 41a6ade72bd12b7f354d314ec59fac29ae783afb Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Tue, 28 Jul 2020 17:57:31 +0200 Subject: Fix for issue #119. Drawing artefacts for SVG images without XRender. Xlib: Drawing SVG images in scaled mode without XRender has drawing artefacts. --- src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/drivers/Xlib') diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx index b379a8e88..b20a84cfe 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx @@ -640,6 +640,11 @@ void Fl_Xlib_Graphics_Driver::draw_fixed(Fl_Bitmap *bm, int X, int Y, int W, int // Composite an image with alpha on systems that don't have accelerated // alpha compositing... static void alpha_blend(Fl_RGB_Image *img, int X, int Y, int W, int H, int cx, int cy) { + if (cx < 0) { W += cx; X -= cx; cx = 0; } + if (cy < 0) { H += cy; Y -= cy; cy = 0; } + if (W + cx > img->data_w()) W = img->data_w() - cx; + if (H + cy > img->data_h()) H = img->data_h() - cy; + if (W <= 0 || H <= 0) return; int ld = img->ld(); if (ld == 0) ld = img->data_w() * img->d(); uchar *srcptr = (uchar*)img->array + cy * ld + cx * img->d(); -- cgit v1.2.3