gdk: use portable wide stores for 0888 conversion
This commit is contained in:
parent
17de959d88
commit
ca4d48d2a2
1 changed files with 4 additions and 15 deletions
19
gdk/gdkrgb.c
19
gdk/gdkrgb.c
|
|
@ -2279,24 +2279,13 @@ gdk_rgb_convert_888_lsb (GdkRgbInfo *image_info, GdkImage *image,
|
|||
|
||||
/* convert 24-bit packed to 32-bit unpacked */
|
||||
/* todo: optimize this */
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN && GLIB_SIZEOF_VOID_P == 8 && \
|
||||
(defined(__x86_64__) || defined(__amd64__))
|
||||
#define GDK_RGB_STORE_0888(p, bp) G_STMT_START { \
|
||||
guint32 pixel; \
|
||||
pixel = 0xff000000U | \
|
||||
((guint32) (bp)[0] << 16) | \
|
||||
((guint32) (bp)[1] << 8) | \
|
||||
(guint32) (bp)[2]; \
|
||||
guint32 pixel = GUINT32_TO_LE (0xff000000U | \
|
||||
((guint32) (bp)[0] << 16) | \
|
||||
((guint32) (bp)[1] << 8) | \
|
||||
(guint32) (bp)[2]); \
|
||||
memcpy ((p), &pixel, sizeof (pixel)); \
|
||||
} G_STMT_END
|
||||
#else
|
||||
#define GDK_RGB_STORE_0888(p, bp) G_STMT_START { \
|
||||
(p)[0] = (bp)[2]; \
|
||||
(p)[1] = (bp)[1]; \
|
||||
(p)[2] = (bp)[0]; \
|
||||
(p)[3] = 0xff; \
|
||||
} G_STMT_END
|
||||
#endif
|
||||
|
||||
#define GDK_RGB_STORE_0888_BR(p, bp) G_STMT_START { \
|
||||
(p)[0] = 0xff; \
|
||||
|
|
|
|||
Loading…
Reference in a new issue