Skip to content

Commit

Permalink
Screenshot: Use correct pixel format on Big Endian systems (Wii/U)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghabry committed Feb 25, 2025
1 parent 902207a commit 2bc56a8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/bitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,13 @@ bool Bitmap::WritePNG(std::ostream& os) const {

std::vector<uint32_t> data(width * height);

auto dst = PixmanImagePtr{pixman_image_create_bits(PIXMAN_b8g8r8, width, height, &data.front(), stride)};
#ifdef WORDS_BIGENDIAN
auto format = PIXMAN_r8g8b8;
#else
auto format = PIXMAN_b8g8r8;
#endif

auto dst = PixmanImagePtr{pixman_image_create_bits(format, width, height, &data.front(), stride)};
pixman_image_composite32(PIXMAN_OP_SRC, bitmap.get(), NULL, dst.get(),
0, 0, 0, 0, 0, 0, width, height);

Expand Down

0 comments on commit 2bc56a8

Please sign in to comment.