[cairo] 16bpp patch

Carl Worth cworth at cworth.org
Tue Feb 14 11:08:03 PST 2006


On Tue, 14 Feb 2006 17:51:58 +0100, David Reveman wrote:
>
> It seams like libpixman is sometimes getting the the depth wrong in
> 16bpp images.

I don't think this is necessarily a problem in pixman. I think
cairo-xlib-surface has a bunch of improper depth handling.

> I don't know exactly where it goes wrong but the attached
> patch avoids the problem by changing so that we don't rely on
> libpixman's depth value when calling XPutImage.

Frankly I'm a bit surprised the patch works. It's definitely not the
right fix. Obviously to use XPutImage we need to have ximage.depth ==
surface->depth, but just setting it to that isn't what we
want. Instead, we need to make sure the image is getting created with
the correct depth in the first place.

There are currently two separate paths to _draw_image_surface.

The first is through acquire/release_dest_image. This path starts with
an Xlib surface and creates an image surface to match. The actual
creation happens in _get_image_surface. Note the "XXX: This can't
work" comment in that function as well as this existing bug report
specific to a depth-8 server:

	Crash inside _get_image_surface() on 8-bit pseudocolor display Xlib surface
	https://bugs.freedesktop.org/show_bug.cgi?id=5846

The second path is through _cairo_xlib_surface_clone_similar where we
are starting with an image surface and creating an Xlib surface to
match.

So the right fix is to fix these two surface creation things to ensure
that by the time _draw_image_surface is called, image->depth ==
surface->depth. For the clone_similar case, we've got an easy way out
since if there is any "hard" case, we can just identify that and
return UNSUPPORTED. It's the _get_image_surface case that may force us
to do "hard" work.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060214/a4f47b2e/attachment.pgp


More information about the cairo mailing list