summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Otte <otte@gnome.org>2009-09-28 23:52:14 +0200
committerBenjamin Otte <otte@gnome.org>2009-09-29 00:11:52 +0200
commita160c8c4009e069db53bec79abd8926231de9a7f (patch)
tree219993ff777af8049c503025e89b2d5c8241cedf
parent9e89de813516c48baed67a4d18325971cd42cd4a (diff)
[xlib] Handle 24bpp formats during dithering
-rw-r--r--src/cairo-xlib-surface.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 45debd4e..957e4360 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -1118,6 +1118,16 @@ _draw_image_surface (cairo_xlib_surface_t *surface,
in_pixel = ((uint8_t*)row)[x];
else if (image_masks.bpp <= 16)
in_pixel = ((uint16_t*)row)[x];
+ else if (image_masks.bpp <= 24)
+#ifdef WORDS_BIGENDIAN
+ in_pixel = ((uint8_t*)row)[3 * x] << 16 |
+ ((uint8_t*)row)[3 * x + 1] << 8 |
+ ((uint8_t*)row)[3 * x + 2];
+#else
+ in_pixel = ((uint8_t*)row)[3 * x] |
+ ((uint8_t*)row)[3 * x + 1] << 8 |
+ ((uint8_t*)row)[3 * x + 2] << 16;
+#endif
else
in_pixel = row[x];