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

Vladimir Vukicevic vladimir at kemper.freedesktop.org
Thu Sep 6 12:57:09 PDT 2007


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

New commits:
diff-tree d635e0103346f22e578d17c59153d292820e00d2 (from 3c01efb0ee0c8911fba7627d056ec3b53dfab6e3)
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date:   Thu Sep 6 12:56:59 2007 -0700

    Add b8g8r8 formats to cairo-image-surface
    
    Add recognition code for x8b8g8r8 and a8b8g8r8 to cairo-image-surface.
    (Used as the default for 24bpp by some older VNC servers.)

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 359685e..ce660d1 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -208,6 +208,20 @@ _pixman_format_from_masks (cairo_format_
 	{
 	    return PIXMAN_x8r8g8b8;
 	}
+	if (masks->alpha_mask == 0xff000000 &&
+	    masks->red_mask   == 0x000000ff &&
+	    masks->green_mask == 0x0000ff00 &&
+	    masks->blue_mask  == 0x00ff0000)
+	{
+	    return PIXMAN_a8b8g8r8;
+	}
+	if (masks->alpha_mask == 0x00000000 &&
+	    masks->red_mask   == 0x000000ff &&
+	    masks->green_mask == 0x0000ff00 &&
+	    masks->blue_mask  == 0x00ff0000)
+	{
+	    return PIXMAN_x8b8g8r8;
+	}
 	break;
     case 16:
 	if (masks->alpha_mask == 0x0000 &&
@@ -278,6 +292,14 @@ _pixman_format_to_masks (pixman_format_c
 	*blue  = 0x000000ff;
 	break;
 
+    case PIXMAN_a8b8g8r8:
+    case PIXMAN_x8b8g8r8:
+	*bpp   = 32;
+	*red   = 0x000000ff;
+	*green = 0x0000ff00;
+	*blue  = 0x00ff0000;
+	break;
+
     case PIXMAN_r5g6b5:
 	*bpp   = 16;
 	*red   = 0xf800;


More information about the cairo-commit mailing list