コード例 #1
0
ファイル: cairo-xcb-surface.c プロジェクト: mrobinson/cairo
static cairo_status_t
_put_shm_image (cairo_xcb_surface_t    *surface,
		xcb_gcontext_t		gc,
		cairo_image_surface_t  *image)
{
#if CAIRO_HAS_XCB_SHM_FUNCTIONS
    cairo_xcb_shm_info_t *shm_info;

    shm_info = _cairo_user_data_array_get_data (&image->base.user_data,
						(const cairo_user_data_key_t *) surface->connection);
    if (shm_info == NULL)
	return CAIRO_INT_STATUS_UNSUPPORTED;

    _cairo_xcb_connection_shm_put_image (surface->connection,
					 surface->drawable,
					 gc,
					 surface->width, surface->height,
					 0, 0,
					 image->width, image->height,
					 image->base.device_transform_inverse.x0,
					 image->base.device_transform_inverse.y0,
					 image->depth,
					 shm_info->shm,
					 shm_info->offset);

    return CAIRO_STATUS_SUCCESS;
#else
    return CAIRO_INT_STATUS_UNSUPPORTED;
#endif
}
コード例 #2
0
/**
 * cairo_font_face_get_user_data:
 * @font_face: a #cairo_font_face_t
 * @key: the address of the #cairo_user_data_key_t the user data was
 * attached to
 *
 * Return user data previously attached to @font_face using the specified
 * key.  If no user data has been attached with the given key this
 * function returns %NULL.
 *
 * Return value: the user data previously attached or %NULL.
 **/
void *
cairo_font_face_get_user_data (cairo_font_face_t	   *font_face,
			       const cairo_user_data_key_t *key)
{
    return _cairo_user_data_array_get_data (&font_face->user_data,
					    key);
}
コード例 #3
0
ファイル: cairo-xcb-surface.c プロジェクト: mrobinson/cairo
static cairo_int_status_t
_put_shm_image_boxes (cairo_xcb_surface_t    *surface,
		      cairo_image_surface_t  *image,
		      xcb_gcontext_t gc,
		      cairo_boxes_t *boxes)
{
#if CAIRO_HAS_XCB_SHM_FUNCTIONS
    cairo_xcb_shm_info_t *shm_info;

    shm_info = _cairo_user_data_array_get_data (&image->base.user_data,
						(const cairo_user_data_key_t *) surface->connection);
    if (shm_info != NULL) {
	struct _cairo_boxes_chunk *chunk;

	for (chunk = &boxes->chunks; chunk; chunk = chunk->next) {
	    int i;

	    for (i = 0; i < chunk->count; i++) {
		cairo_box_t *b = &chunk->base[i];
		int x = _cairo_fixed_integer_part (b->p1.x);
		int y = _cairo_fixed_integer_part (b->p1.y);
		int width = _cairo_fixed_integer_part (b->p2.x - b->p1.x);
		int height = _cairo_fixed_integer_part (b->p2.y - b->p1.y);

		_cairo_xcb_connection_shm_put_image (surface->connection,
						     surface->drawable,
						     gc,
						     surface->width, surface->height,
						     x, y,
						     width, height,
						     x, y,
						     image->depth,
						     shm_info->shm,
						     shm_info->offset);
	    }
	}
    }

    return CAIRO_INT_STATUS_SUCCESS;
#endif

    return CAIRO_INT_STATUS_UNSUPPORTED;
}