|
|
e08d0e |
diff --git a/vncviewer/Surface_X11.cxx b/vncviewer/Surface_X11.cxx
|
|
|
e08d0e |
index 3523da3..6562634 100644
|
|
|
e08d0e |
--- a/vncviewer/Surface_X11.cxx
|
|
|
e08d0e |
+++ b/vncviewer/Surface_X11.cxx
|
|
|
e08d0e |
@@ -109,6 +109,7 @@ void Surface::blend(Surface* dst, int src_x, int src_y, int x, int y, int w, int
|
|
|
e08d0e |
|
|
|
e08d0e |
void Surface::alloc()
|
|
|
e08d0e |
{
|
|
|
e08d0e |
+ XRenderPictFormat templ;
|
|
|
e08d0e |
XRenderPictFormat* format;
|
|
|
e08d0e |
|
|
|
e08d0e |
// Might not be open at this point
|
|
|
e08d0e |
@@ -117,7 +118,37 @@ void Surface::alloc()
|
|
|
e08d0e |
pixmap = XCreatePixmap(fl_display, XDefaultRootWindow(fl_display),
|
|
|
e08d0e |
width(), height(), 32);
|
|
|
e08d0e |
|
|
|
e08d0e |
- format = XRenderFindStandardFormat(fl_display, PictStandardARGB32);
|
|
|
e08d0e |
+ // Our code assumes a BGRA byte order, regardless of what the endian
|
|
|
e08d0e |
+ // of the machine is or the native byte order of XImage, so make sure
|
|
|
e08d0e |
+ // we find such a format
|
|
|
e08d0e |
+ templ.type = PictTypeDirect;
|
|
|
e08d0e |
+ templ.depth = 32;
|
|
|
e08d0e |
+#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
|
|
e08d0e |
+ templ.direct.alpha = 0;
|
|
|
e08d0e |
+ templ.direct.red = 8;
|
|
|
e08d0e |
+ templ.direct.green = 16;
|
|
|
e08d0e |
+ templ.direct.blue = 24;
|
|
|
e08d0e |
+#else
|
|
|
e08d0e |
+ templ.direct.alpha = 24;
|
|
|
e08d0e |
+ templ.direct.red = 16;
|
|
|
e08d0e |
+ templ.direct.green = 8;
|
|
|
e08d0e |
+ templ.direct.blue = 0;
|
|
|
e08d0e |
+#endif
|
|
|
e08d0e |
+ templ.direct.alphaMask = 0xff;
|
|
|
e08d0e |
+ templ.direct.redMask = 0xff;
|
|
|
e08d0e |
+ templ.direct.greenMask = 0xff;
|
|
|
e08d0e |
+ templ.direct.blueMask = 0xff;
|
|
|
e08d0e |
+
|
|
|
e08d0e |
+ format = XRenderFindFormat(fl_display, PictFormatType | PictFormatDepth |
|
|
|
e08d0e |
+ PictFormatRed | PictFormatRedMask |
|
|
|
e08d0e |
+ PictFormatGreen | PictFormatGreenMask |
|
|
|
e08d0e |
+ PictFormatBlue | PictFormatBlueMask |
|
|
|
e08d0e |
+ PictFormatAlpha | PictFormatAlphaMask,
|
|
|
e08d0e |
+ &templ, 0);
|
|
|
e08d0e |
+
|
|
|
e08d0e |
+ if (!format)
|
|
|
e08d0e |
+ throw rdr::Exception("XRenderFindFormat");
|
|
|
e08d0e |
+
|
|
|
e08d0e |
picture = XRenderCreatePicture(fl_display, pixmap, format, 0, NULL);
|
|
|
e08d0e |
|
|
|
e08d0e |
visFormat = XRenderFindVisualFormat(fl_display, fl_visual->visual);
|