[cairo] cairo_surface_write_to_png and 32-bit visuals in 1.10.0

Uli Schlachter psychon at znc.in
Mon Oct 11 01:43:00 PDT 2010


Am 06.10.2010 10:28, Ross Alexander wrote:
> After looking at this problem some more, specially in the setup of XCB surfaces I noticed if cairo is passed a 32bit visual it effectively assumes it is 24bit by setting alpha_masks = 0 before getting the pixman format, resulting in a 24 bit x8r8g8b8 format.  It then gets the xrender format which is a 32bit format but there doesn't seem to be a simple way of getting from the xrender format back to the correct pixman format.  I've just hacked a simple chance which works may well not be the way forward.
> 
> *** cairo-xcb-surface.c.orig	2010-10-06 09:13:36.000000000 +0100
> --- cairo-xcb-surface.c	2010-10-06 09:14:30.000000000 +0100
> ***************
> *** 1179,1184 ****
> --- 1179,1186 ----
>       image_masks.red_mask   = visual->red_mask;
>       image_masks.green_mask = visual->green_mask;
>       image_masks.blue_mask  = visual->blue_mask;
> +     if (depth == 32)
> +         image_masks.alpha_mask = 0xffffffff & (~visual->red_mask) & (~visual->green_mask) & (~visual->blue_mask);
>       if (depth > 16)
>   	image_masks.bpp = 32;
>       else if (depth > 8)
> 
> Cheers,
> Ross

Did anyone have a chance to look at this? This patch fixes a problem that I am
seeing myself.

-- 
- Buck, when, exactly, did you lose your mind?
- Three months ago. I woke up one morning married to a pineapple.
  An ugly pineapple... But I loved her


More information about the cairo mailing list