]> source.dussan.org Git - tigervnc.git/commitdiff
Update Surface_X11.cxx
authorjohnmartin-oracle <55413843+johnmartin-oracle@users.noreply.github.com>
Fri, 28 Aug 2020 02:30:23 +0000 (22:30 -0400)
committerGitHub <noreply@github.com>
Fri, 28 Aug 2020 02:30:23 +0000 (22:30 -0400)
Runtime sellection of ARGB  XImage byte order

vncviewer/Surface_X11.cxx

index 6562634dce84d0569bd3a3be7fc79d4c75312782..8944c3f719a9c08fe0f454058528b0b584ff51a3 100644 (file)
@@ -123,17 +123,17 @@ void Surface::alloc()
   // we find such a format
   templ.type = PictTypeDirect;
   templ.depth = 32;
-#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-  templ.direct.alpha = 0;
-  templ.direct.red   = 8;
-  templ.direct.green = 16;
-  templ.direct.blue  = 24;
-#else
-  templ.direct.alpha = 24;
-  templ.direct.red   = 16;
-  templ.direct.green = 8;
-  templ.direct.blue  = 0;
-#endif
+  if (XImageByteOrder(fl_display) == MSBFirst) {
+    templ.direct.alpha = 0;
+    templ.direct.red   = 8;
+    templ.direct.green = 16;
+    templ.direct.blue  = 24;
+  } else {
+    templ.direct.alpha = 24;
+    templ.direct.red   = 16;
+    templ.direct.green = 8;
+    templ.direct.blue  = 0;
+  }
   templ.direct.alphaMask = 0xff;
   templ.direct.redMask = 0xff;
   templ.direct.greenMask = 0xff;