mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-04 01:17:59 +02:00
[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:
parent
495cb9a0a7
commit
f3515954e0
1 changed files with 9 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue