[ft] Fix color font loading on big-endian systems

Untested, but the logic is correct: FreeType's BGRA type is always
laid out in that order in memory.  Cairo's ARGB32 is endianness-
dependent.  On little-endian systems the two are the same.  On big-endian
we need to flip.
This commit is contained in:
Behdad Esfahbod 2017-08-08 22:04:55 -07:00
parent 495cb9a0a7
commit f3515954e0

View file

@ -1255,6 +1255,15 @@ _get_bitmap_surface (FT_Bitmap *bitmap,
memcpy (data, bitmap->buffer, stride * height);
}
if (!_cairo_is_little_endian ())
{
/* Byteswap. */
unsigned int i, count = height * width;
uint32_t *p = (uint32_t *) data;
for (i = 0; i < count; i++)
p[i] = be32_to_cpu (p[i]);
}
format = CAIRO_FORMAT_ARGB32;
break;
#endif