diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-04-07 23:25:57 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-04-08 07:52:47 +0100 |
commit | f6afba8f5453b8e3af9101fa2cde4c05a67f6d4b (patch) | |
tree | 82a8b4063e57380e8a488a4c5105442f809f0095 | |
parent | 922fefdde4af28f9fc1e42fcba1b315980b01dc7 (diff) |
[cairo-xlib] Create Pixmap using depth from xrender_format.
Use the depth as specified by the xrender_format when creating the
pixmap (as opposed to a guess based on the cairo_format_t).
-rw-r--r-- | src/cairo-xlib-surface.c | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index 90cfc8a8d..bc5aa1a2b 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -117,22 +117,6 @@ static const XTransform identity = { { #define CAIRO_SURFACE_RENDER_HAS_PICTURE_TRANSFORM(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6) #define CAIRO_SURFACE_RENDER_HAS_FILTERS(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6) -static int -_CAIRO_FORMAT_DEPTH (cairo_format_t format) -{ - switch (format) { - case CAIRO_FORMAT_A1: - return 1; - case CAIRO_FORMAT_A8: - return 8; - case CAIRO_FORMAT_RGB24: - return 24; - case CAIRO_FORMAT_ARGB32: - default: - return 32; - } -} - static XRenderPictFormat * _CAIRO_FORMAT_TO_XRENDER_FORMAT(Display *dpy, cairo_format_t format) { @@ -161,7 +145,6 @@ _cairo_xlib_surface_create_similar_with_format (void *abstract_src, Display *dpy = src->dpy; Pixmap pix; cairo_xlib_surface_t *surface; - int depth = _CAIRO_FORMAT_DEPTH (format); XRenderPictFormat *xrender_format = _CAIRO_FORMAT_TO_XRENDER_FORMAT (dpy, format); @@ -175,14 +158,14 @@ _cairo_xlib_surface_create_similar_with_format (void *abstract_src, pix = XCreatePixmap (dpy, src->drawable, width <= 0 ? 1 : width, height <= 0 ? 1 : height, - depth); + xrender_format->depth); surface = (cairo_xlib_surface_t *) _cairo_xlib_surface_create_internal (dpy, pix, src->screen, src->visual, xrender_format, width, height, - depth); + xrender_format->depth); if (surface->base.status) { XFreePixmap (dpy, pix); return &surface->base; |