summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-08-09 16:05:53 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-08-09 16:05:53 +0200
commit1562396ec09cc747c21118efbfe0bd4e866a0e13 (patch)
treed58653c2f2f1c799f5562c43683a3ab1b7663ab9 /src
parent64548e2f3a911e8d133900242b1ec1d5656d5eca (diff)
Fix Fl_Xlib_Graphics_Driver for RGB image drawing under XQuartz.
Diffstat (limited to 'src')
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver_image.cxx8
1 files changed, 8 insertions, 0 deletions
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);