mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 00:38:06 +02:00
xcb: Fixup some internal state in set_{drawable,size}
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
3dbb0f17a7
commit
9ec5e9fee6
4 changed files with 37 additions and 4 deletions
|
|
@ -380,7 +380,7 @@ _cairo_surface_has_snapshot (cairo_surface_t *surface,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
_cairo_surface_begin_modification (cairo_surface_t *surface)
|
||||
{
|
||||
assert (surface->status == CAIRO_STATUS_SUCCESS);
|
||||
|
|
|
|||
|
|
@ -1379,6 +1379,18 @@ cairo_xcb_surface_create_with_xrender_format (xcb_connection_t *connection,
|
|||
slim_hidden_def (cairo_xcb_surface_create_with_xrender_format);
|
||||
#endif
|
||||
|
||||
/* This does the necessary fixup when a surface's drawable or size changed. */
|
||||
static void
|
||||
_drawable_changed (cairo_xcb_surface_t *surface)
|
||||
{
|
||||
_cairo_surface_begin_modification (&surface->base);
|
||||
_cairo_boxes_clear (&surface->fallback_damage);
|
||||
cairo_surface_destroy (&surface->fallback->base);
|
||||
|
||||
surface->deferred_clear = FALSE;
|
||||
surface->fallback = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* cairo_xcb_surface_set_size:
|
||||
* @surface: a #cairo_surface_t for the XCB backend
|
||||
|
|
@ -1394,6 +1406,9 @@ slim_hidden_def (cairo_xcb_surface_create_with_xrender_format);
|
|||
*
|
||||
* A pixmap can never change size, so it is never necessary to call
|
||||
* this function on a surface created for a pixmap.
|
||||
*
|
||||
* If cairo_surface_flush() wasn't called, some pending operations
|
||||
* might be discarded.
|
||||
**/
|
||||
void
|
||||
cairo_xcb_surface_set_size (cairo_surface_t *abstract_surface,
|
||||
|
|
@ -1424,6 +1439,8 @@ cairo_xcb_surface_set_size (cairo_surface_t *abstract_surface,
|
|||
}
|
||||
|
||||
surface = (cairo_xcb_surface_t *) abstract_surface;
|
||||
|
||||
_drawable_changed(surface);
|
||||
surface->width = width;
|
||||
surface->height = height;
|
||||
}
|
||||
|
|
@ -1441,11 +1458,13 @@ slim_hidden_def (cairo_xcb_surface_set_size);
|
|||
* Informs cairo of the new drawable and size of the XCB drawable underlying the
|
||||
* surface.
|
||||
*
|
||||
* If cairo_surface_flush() wasn't called, some pending operations
|
||||
* might be discarded.
|
||||
**/
|
||||
void
|
||||
cairo_xcb_surface_set_drawable (cairo_surface_t *abstract_surface,
|
||||
xcb_drawable_t drawable,
|
||||
int width,
|
||||
cairo_xcb_surface_set_drawable (cairo_surface_t *abstract_surface,
|
||||
xcb_drawable_t drawable,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
cairo_xcb_surface_t *surface;
|
||||
|
|
@ -1473,9 +1492,12 @@ cairo_xcb_surface_set_drawable (cairo_surface_t *abstract_surface,
|
|||
|
||||
surface = (cairo_xcb_surface_t *) abstract_surface;
|
||||
|
||||
/* XXX: and what about this case? */
|
||||
if (surface->owns_pixmap)
|
||||
return;
|
||||
|
||||
_drawable_changed (surface);
|
||||
|
||||
if (surface->drawable != drawable) {
|
||||
cairo_status_t status;
|
||||
status = _cairo_xcb_connection_acquire (surface->connection);
|
||||
|
|
|
|||
|
|
@ -1374,6 +1374,9 @@ _cairo_surface_has_snapshot (cairo_surface_t *surface,
|
|||
cairo_private void
|
||||
_cairo_surface_detach_snapshot (cairo_surface_t *snapshot);
|
||||
|
||||
cairo_private void
|
||||
_cairo_surface_begin_modification (cairo_surface_t *surface);
|
||||
|
||||
cairo_private_no_warn cairo_bool_t
|
||||
_cairo_surface_get_extents (cairo_surface_t *surface,
|
||||
cairo_rectangle_int_t *extents);
|
||||
|
|
|
|||
|
|
@ -561,6 +561,13 @@ test_cairo_xcb_surface_set_size (cairo_surface_t *surface)
|
|||
return CAIRO_TEST_SUCCESS;
|
||||
}
|
||||
|
||||
static cairo_test_status_t
|
||||
test_cairo_xcb_surface_set_drawable (cairo_surface_t *surface)
|
||||
{
|
||||
cairo_xcb_surface_set_drawable (surface, 0, 5, 5);
|
||||
return CAIRO_TEST_SUCCESS;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if CAIRO_HAS_XLIB_SURFACE
|
||||
|
|
@ -704,6 +711,7 @@ struct {
|
|||
#endif
|
||||
#if CAIRO_HAS_XCB_SURFACE
|
||||
TEST (cairo_xcb_surface_set_size, CAIRO_SURFACE_TYPE_XCB, TRUE),
|
||||
TEST (cairo_xcb_surface_set_drawable, CAIRO_SURFACE_TYPE_XCB, TRUE),
|
||||
#endif
|
||||
#if CAIRO_HAS_XLIB_SURFACE
|
||||
TEST (cairo_xlib_surface_set_size, CAIRO_SURFACE_TYPE_XLIB, TRUE),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue