[cairo-commit] 2 commits - src/cairo-image-surface.c src/cairo-xlib-surface.c

Benjamin Otte company at kemper.freedesktop.org
Mon Sep 28 15:13:36 PDT 2009


 src/cairo-image-surface.c |    6 +++---
 src/cairo-xlib-surface.c  |   10 ++++++++++
 2 files changed, 13 insertions(+), 3 deletions(-)

New commits:
commit a160c8c4009e069db53bec79abd8926231de9a7f
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 28 23:52:14 2009 +0200

    [xlib] Handle 24bpp formats during dithering

diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 45debd4..957e436 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];
 
commit 9e89de813516c48baed67a4d18325971cd42cd4a
Author: Benjamin Otte <otte at gnome.org>
Date:   Mon Sep 28 23:51:14 2009 +0200

    [image] Fix masks computation for BGRx format
    
    Patch originally by Mark Kettenis

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 29ed119..9310a51 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -276,9 +276,9 @@ _pixman_format_to_masks (pixman_format_code_t	 format,
         return TRUE;
 #ifdef PIXMAN_TYPE_BGRA
     case PIXMAN_TYPE_BGRA:
-        masks->blue_mask  = MASK (b) << (g + r + a);
-        masks->green_mask = MASK (g) << (r + a);
-        masks->red_mask   = MASK (r) << (a);
+        masks->blue_mask  = MASK (b) << (masks->bpp - b);
+        masks->green_mask = MASK (g) << (masks->bpp - b - g);
+        masks->red_mask   = MASK (r) << (masks->bpp - b - g - r);
         masks->alpha_mask = MASK (a);
         return TRUE;
 #endif


More information about the cairo-commit mailing list