Cairo GAL: fix incorrect use of pixman formats

Fixes https://gitlab.com/kicad/code/kicad/issues/3970

(cherry-picked from 55ac575a88)
This commit is contained in:
Marcus Comstedt 2020-03-01 18:41:04 +01:00 committed by Ian McInerney
parent af6db68816
commit 9cb60dcdf5
1 changed files with 6 additions and 3 deletions

View File

@ -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 );