static cairo_status_t _get_shm_image (cairo_xcb_surface_t *surface, cairo_image_surface_t **image_out) { #if CAIRO_HAS_XCB_SHM_FUNCTIONS cairo_image_surface_t *image; cairo_xcb_shm_info_t *shm_info; cairo_status_t status; status = _cairo_xcb_surface_create_shm_image (surface, &image, &shm_info); if (unlikely (status)) return status; if (! surface->base.is_clear) { status = _cairo_xcb_connection_shm_get_image (surface->connection, surface->drawable, 0, 0, surface->width, surface->height, shm_info->shm, shm_info->offset); if (unlikely (status)) return status; } else { memset (image->data, 0, image->stride * image->height); } *image_out = image; return CAIRO_STATUS_SUCCESS; #else return CAIRO_INT_STATUS_UNSUPPORTED; #endif }
static cairo_surface_t * _get_shm_image (cairo_xcb_surface_t *surface, int x, int y, int width, int height) { #if CAIRO_HAS_XCB_SHM_FUNCTIONS cairo_xcb_shm_info_t *shm_info; cairo_surface_t *image; cairo_status_t status; if ((surface->connection->flags & CAIRO_XCB_HAS_SHM) == 0) return NULL; image = _cairo_xcb_surface_create_shm_image (surface->connection, surface->pixman_format, width, height, TRUE, &shm_info); if (unlikely (image == NULL || image->status)) goto done; status = _cairo_xcb_connection_shm_get_image (surface->connection, surface->drawable, x, y, width, height, shm_info->shm, shm_info->offset); if (unlikely (status)) { cairo_surface_destroy (image); image = _cairo_surface_create_in_error (status); } done: return image; #else return NULL; #endif }