From 1562396ec09cc747c21118efbfe0bd4e866a0e13 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Tue, 9 Aug 2022 16:05:53 +0200 Subject: Fix Fl_Xlib_Graphics_Driver for RGB image drawing under XQuartz. --- src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx | 8 ++++++++ 1 file changed, 8 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 0ea0b0529..dd9b7135e 100644 --- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx +++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx @@ -799,6 +799,14 @@ void Fl_Xlib_Graphics_Driver::draw_rgb(Fl_RGB_Image *rgb, int XP, int YP, int WP */ int Fl_Xlib_Graphics_Driver::scale_and_render_pixmap(Fl_Offscreen pixmap, int depth, double scale_x, double scale_y, int XP, int YP, int WP, int HP) { bool has_alpha = (depth == 2 || depth == 4); + if (!has_alpha && scale_x == 1 && scale_y == 1) { + // Fix for a problem visible under XQuartz with test/device and Fl_Image_Surface: + // the drawn image is fully black. The problem does not occur under linux. + // Why the problem occurs under XQuartz remains unknown. + // The fix is to use XCopyArea() when adequate, rather than using Xrender. + XCopyArea(fl_display, pixmap, fl_window, gc_, 0, 0, WP, HP, XP, YP); + return 1; + } XRenderPictureAttributes srcattr; memset(&srcattr, 0, sizeof(XRenderPictureAttributes)); static XRenderPictFormat *fmt24 = XRenderFindStandardFormat(fl_display, PictStandardRGB24); -- cgit v1.2.3