diff options
author | Gayathri Berli <gayathri.berli@ibm.com> | 2024-02-05 12:26:25 +0530 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2024-02-24 12:28:30 -0500 |
commit | ac485a9b668e013eb336592727cb8e52549a6ab9 (patch) | |
tree | 6817d5daf414dc34316473877febb92edf701f28 | |
parent | fdd716109787ef825f9eb88f73447297c43e5c10 (diff) |
Revert the changes to fix the problem in big-endian architectures
This reverts commit b4a105d77232a87304b7b621e2f99e699a8eebd3.
There is an endianness issue in pixman-fast-path.c. In the function
bits_image_fetch_separable_convolution_affine we have this code:
#ifdef WORDS_BIGENDIAN
buffer[k] = (satot << 0) | (srtot << 8) | (sgtot << 16) | (sbtot << 24);
#else
buffer[k] = (satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot << 0);
#endif
This will write out the pixels as BGRA on big endian systems but
obviously that's wrong. Pixel order should be ARGB on big endian systems
so we don't need any #ifdef for big endian here at all. Instead, the
code should be the same on little and big endian, i.e. it should be just
this line instead of the 5 lines above:
buffer[k] = (satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot << 0);
Changing the code like this fixes the wrong colors that I get with
pixman on my PowerPC/s390x system.
Here is what cairo.h has to say (which is rooted in pixman):
* @CAIRO_FORMAT_ARGB32: each pixel is a 32-bit quantity, with
* alpha in the upper 8 bits, then red, then green, then blue.
* The 32-bit quantities are stored native-endian. Pre-multiplied
* alpha is used. (That is, 50% transparent red is 0x80800000,
* not 0x80ff0000.) (Since 1.0)
Closes: https://gitlab.freedesktop.org/pixman/pixman/-/issues/78
Signed-off-by: Gayathri Berli <gayathri.berli@ibm.com>
-rw-r--r-- | pixman/pixman-fast-path.c | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/pixman/pixman-fast-path.c b/pixman/pixman-fast-path.c index e62a8ac..d510cac 100644 --- a/pixman/pixman-fast-path.c +++ b/pixman/pixman-fast-path.c @@ -2836,11 +2836,7 @@ bits_image_fetch_separable_convolution_affine (pixman_image_t * image, sgtot = CLIP (sgtot, 0, 0xff); sbtot = CLIP (sbtot, 0, 0xff); -#ifdef WORDS_BIGENDIAN - buffer[k] = (satot << 0) | (srtot << 8) | (sgtot << 16) | (sbtot << 24); -#else buffer[k] = (satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot << 0); -#endif next: vx += ux; |