Message ID | E1ptqMT-00HAI8-NC.val15032008-mail-ru@smtp44.i.mail.ru (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Patch for png_save(), QEMU v8.0 | expand |
On Tue, 2 May 2023 at 14:48, Валентин via <qemu-devel@nongnu.org> wrote: > > Hello! > > Currently, png_save() in "console.c" uses "PIXMAN_a8r8g8b8" format when saving png. > > ( https://gitlab.com/qemu-project/qemu/-/blob/7c18f2d663521f1b31b821a13358ce38075eaf7d/ui/console.c#L314 ) > > It should probably use "PIXMAN_a8b8g8r8" (red<>blue exchanged). > Without it I'm getting PNGs with blue and red channels swapped (QEMU 8.0, qemu-system-x86_64, Arm64 host, libpng 1.6.39). Ah, I was just working on this this afternoon (it was reported last week as https://gitlab.com/qemu-project/qemu/-/issues/1622 ) and just sent a patch a minute before I read this email :-) I think your patch only fixes this problem for little-endian hosts and leaves big-endian hosts still with the wrong pixel-data order. You can see my version of the patch here: https://patchew.org/QEMU/20230502135548.2451309-1-peter.maydell@linaro.org/ thanks -- PMM
diff -ru --no-dereference /tmp/qemu-8.0.0/ui/console.c ./ui/console.c --- /tmp/qemu-8.0.0/ui/console.c 2023-04-19 16:31:47.000000000 +0000 +++ ./ui/console.c 2023-05-02 12:59:02.600469950 +0000 @@ -311,7 +311,7 @@ png_struct *png_ptr; png_info *info_ptr; g_autoptr(pixman_image_t) linebuf = - qemu_pixman_linebuf_create(PIXMAN_a8r8g8b8, width); + qemu_pixman_linebuf_create(PIXMAN_a8b8g8r8, width); uint8_t *buf = (uint8_t *)pixman_image_get_data(linebuf); FILE *f = fdopen(fd, "wb"); int y;