From 9cb60dcdf53bf9942b643fd2c93708ebc786824f Mon Sep 17 00:00:00 2001 From: Marcus Comstedt Date: Sun, 1 Mar 2020 18:41:04 +0100 Subject: [PATCH] Cairo GAL: fix incorrect use of pixman formats Fixes https://gitlab.com/kicad/code/kicad/issues/3970 (cherry-picked from 55ac575a88a9baa20a53e7a690093aeb07cc27a8) --- common/gal/cairo/cairo_gal.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/common/gal/cairo/cairo_gal.cpp b/common/gal/cairo/cairo_gal.cpp index 61559a1cc3..44fa031c3d 100644 --- a/common/gal/cairo/cairo_gal.cpp +++ b/common/gal/cairo/cairo_gal.cpp @@ -1269,10 +1269,13 @@ void CAIRO_GAL::endDrawing() // Now translate the raw context data from the format stored // by cairo into a format understood by wxImage. - pixman_image_t* dstImg = pixman_image_create_bits( PIXMAN_r8g8b8, + + pixman_image_t* dstImg = pixman_image_create_bits( + wxPlatformInfo::Get().GetEndianness() == wxENDIAN_LITTLE ? PIXMAN_b8g8r8 : + PIXMAN_r8g8b8, screenSize.x, screenSize.y, (uint32_t*) wxOutput, wxBufferWidth * 3 ); - pixman_image_t* srcImg = pixman_image_create_bits( PIXMAN_a8b8g8r8, - screenSize.x, screenSize.y, (uint32_t*) bitmapBuffer, wxBufferWidth * 4 ); + pixman_image_t* srcImg = pixman_image_create_bits( PIXMAN_a8r8g8b8, screenSize.x, screenSize.y, + (uint32_t*) bitmapBuffer, wxBufferWidth * 4 ); pixman_image_composite( PIXMAN_OP_SRC, srcImg, NULL, dstImg, 0, 0, 0, 0, 0, 0, screenSize.x, screenSize.y );