[cairo-commit] src/cairo-image-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Sun Sep 13 08:41:44 PDT 2009


 src/cairo-image-surface.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 19881012cb31ec2aebf556e2c25b53e8387dc689
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Sep 13 16:36:12 2009 +0100

    [image] Add pixel masks for BGRA formats
    
    pixman introduced the BGRA pixel type not too long ago, and so we need to
    update our pixman_format_code_t to cairo_format_masks_t translator.

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index b35905f..3b23200 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -271,10 +271,18 @@ _pixman_format_to_masks (pixman_format_code_t	 format,
         return;
     case PIXMAN_TYPE_ABGR:
         masks->alpha_mask = MASK (a) << (b + g + r);
-        masks->blue_mask  = MASK (b) << (g +r);
+        masks->blue_mask  = MASK (b) << (g + r);
         masks->green_mask = MASK (g) << (r);
         masks->red_mask   = MASK (r);
         return;
+#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->alpha_mask = MASK (a);
+        return;
+#endif
     case PIXMAN_TYPE_A:
         masks->alpha_mask = MASK (a);
         masks->red_mask   = 0;


More information about the cairo-commit mailing list