)]}'
{
  "commit": "cd22a0f520f471e3bd33bc19cf3b2fa772cdb2a8",
  "tree": "5f5ab165559f9c645ae0f582f2e1e72e6263e92c",
  "parents": [
    "4f9786327458c0e50d8e99066d1603ebe0e345c0"
  ],
  "author": {
    "name": "Peter Maydell",
    "email": "peter.maydell@linaro.org",
    "time": "Fri May 12 15:43:38 2023 +0100"
  },
  "committer": {
    "name": "Peter Maydell",
    "email": "peter.maydell@linaro.org",
    "time": "Fri May 12 15:43:38 2023 +0100"
  },
  "message": "ui: Fix pixel colour channel order for PNG screenshots\n\nWhen we take a PNG screenshot the ordering of the colour channels in\nthe data is not correct, resulting in the image having weird\ncolouring compared to the actual display.  (Specifically, on a\nlittle-endian host the blue and red channels are swapped; on\nbig-endian everything is wrong.)\n\nThis happens because the pixman idea of the pixel data and the libpng\nidea differ.  PIXMAN_a8r8g8b8 defines that pixels are 32-bit values,\nwith A in bits 24-31, R in bits 16-23, G in bits 8-15 and B in bits\n0-7.  This means that on little-endian systems the bytes in memory\nare\n   B G R A\nand on big-endian systems they are\n   A R G B\n\nlibpng, on the other hand, thinks of pixels as being a series of\nvalues for each channel, so its format PNG_COLOR_TYPE_RGB_ALPHA\nalways wants bytes in the order\n   R G B A\n\nThis isn\u0027t the same as the pixman order for either big or little\nendian hosts.\n\nThe alpha channel is also unnecessary bulk in the output PNG file,\nbecause there is no alpha information in a screenshot.\n\nTo handle the endianness issue, we already define in ui/qemu-pixman.h\nvarious PIXMAN_BE_* and PIXMAN_LE_* values that give consistent\nbyte-order pixel channel formats.  So we can use PIXMAN_BE_r8g8b8 and\nPNG_COLOR_TYPE_RGB, which both have an in-memory byte order of\n    R G B\nand 3 bytes per pixel.\n\n(PPM format screenshots get this right; they already use the\nPIXMAN_BE_r8g8b8 format.)\n\nCc: qemu-stable@nongnu.org\nResolves: https://gitlab.com/qemu-project/qemu/-/issues/1622\nFixes: 9a0a119a382867 (\"Added parameter to take screenshot with screendump as PNG\")\nSigned-off-by: Peter Maydell \u003cpeter.maydell@linaro.org\u003e\nReviewed-by: Marc-André Lureau \u003cmarcandre.lureau@redhat.com\u003e\nMessage-id: 20230502135548.2451309-1-peter.maydell@linaro.org\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "6e8a3cdc62db321531c136e36090f123c620187b",
      "old_mode": 33188,
      "old_path": "ui/console.c",
      "new_id": "e173731e2056a0edf1bedc6b1934e322da7fbe42",
      "new_mode": 33188,
      "new_path": "ui/console.c"
    }
  ]
}
