[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

cairo xlib surface (was: Re: Linux-x86-64 and cairo crash)

From: Eric Wasylishen
Subject: cairo xlib surface (was: Re: Linux-x86-64 and cairo crash)
Date: Tue, 13 Sep 2011 12:38:38 -0600

On 2011-09-13, at 10:46 AM, Wolfgang Lux wrote:

> Fred Kiefer wrote:
>> As for transparent windows working with XGCairoSurface, I would not be to 
>> surprised to learn that you are using X11 with 32 bit depth. But then, who 
>> isn't these times?
> Me. Apple's X11 server (even in Lion) supports only 15 and 24 bit visuals.
>> Maybe we could just live with that limitation, when five years ago this 
>> would have excluded almost everybody.
> Maybe it would be an option to make the surface class selection a bit more 
> dynamic on X11 (if we don't use glitz)? If the X server supports 32-bit 
> visuals, CairoContext would use XGCairoSurface and otherwise 
> XGCairoXImageSurface?
> Wolfgang

I tried launching GSTest over X forwarding on OS X 10.7's X11.app, both with 
the cairo surface class set to XGCairoSurface and set to XGCairoXImageSurface, 
but the window transparency test didn't work in either case.

However, it revealed a bigger problem I hadn't thought of – the current NSImage 
caching code expects to be able to create an NSWindow with an alpha channel, 
regardless of the X server's abilities. 

With XGCairoXImageSurface, windows are always backed by a 32-bit ARGB cairo 
image surface, so all NSWindows's have alpha channels. With XGCairoSurface, a 
window may or may not have an alpha channel.

As a result, with XGCairoSurface and X11.app I was getting all images drawn 
with black backgrounds (because they're drawn into a cache window without an 
alpha channel, flattening the background).

Three possible solutions I can think of are:
- fix NSImage so if NSWindow's with alpha can't be created, it won't try to 
cache images with alpha channels in windows.
- use XGCairoSurface regardless of the available visuals, so windows may or may 
not support alpha channels depending on the X server.

2. use XGCairoSurface if the server supports 32-bit visuals, otherwise use 
XGCairoXImageSurface. This means we have to deal with two possible code paths 
chosen at runtime, though.

3. just leave the code as-is and always use XGCairoXImageSurface.

I think I prefer the first solution, but I'm not sure.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]