[xlib] _surfaces_compatible() can return true for different picture formats

_surfaces_compatible in cairo-xlib-surface returns true for surfaces with
different xrender_format when each has the same depth and no (NULL)
visual.

Common picture formats will not have the same depth, but
it is possible to create a surface with a non-standard xrender_format
having the same depth as another xrender_format with
cairo_xlib_surface_create_with_xrender_format.

Both cairo_xlib_surface_create_with_xrender_format and
_cairo_xlib_surface_create_similar_with_format create surfaces with no
visual.

The same issue exists in the xcb backend.

Fixes bug https://bugs.freedesktop.org/show_bug.cgi?id=16564.
This commit is contained in:
Karl Tomlinson 2008-09-28 17:51:23 +01:00 committed by Chris Wilson
parent b6b54e2f27
commit d52b55cb1b
3 changed files with 7 additions and 2 deletions

View file

@ -83,6 +83,7 @@ Travis Spencer <tspencer@cs.pdx.edu> XCB backend fix
Bill Spitzak <spitzak@d2.com> Build fix to find Xrender.h without xrender.pc
Zhe Su <james.su@gmail.com> Add support for fontconfig's embeddedbitmap option
Owen Taylor <otaylor@redhat.com> Font rewrite, documentation, win32 backend
Karl Tomlinson <karlt+@karlt.net>
Alp Toker <alp@atoker.com> Fix several code/comment typos
Malcolm Tredinnick <malcolm@commsecure.com.au> Documentation fixes
David Turner <david@freetype.org> Optimize gradient calculations

View file

@ -889,7 +889,9 @@ _surfaces_compatible (cairo_xcb_surface_t *dst,
return FALSE;
/* if Render is supported, match picture formats */
if (src->xrender_format.id != XCB_NONE && src->xrender_format.id == dst->xrender_format.id)
if (src->xrender_format.id != dst->xrender_format.id)
return FALSE;
else if (src->xrender_format.id != XCB_NONE)
return TRUE;
/* Without Render, match visuals instead */

View file

@ -1416,7 +1416,9 @@ _surfaces_compatible (cairo_xlib_surface_t *dst,
return FALSE;
/* if Render is supported, match picture formats */
if (src->xrender_format != NULL && src->xrender_format == dst->xrender_format)
if (src->xrender_format != dst->xrender_format)
return FALSE;
else if (src->xrender_format != NULL)
return TRUE;
/* Without Render, match visuals instead */