diff options
author | Uli Schlachter <psychon@znc.in> | 2011-12-05 22:48:56 +0100 |
---|---|---|
committer | Uli Schlachter <psychon@znc.in> | 2011-12-05 22:48:56 +0100 |
commit | 9ec5e9fee64cb9dd835477e3565170c522863ea9 (patch) | |
tree | e5da7858994bec346b440a2f8f961155f3e0d3e3 /src/cairo-xcb-surface.c | |
parent | 3dbb0f17a74e98ecf790e9d2c9fb8622e3928486 (diff) | |
download | cairo-9ec5e9fee64cb9dd835477e3565170c522863ea9.tar.gz |
xcb: Fixup some internal state in set_{drawable,size}
Signed-off-by: Uli Schlachter <psychon@znc.in>
Diffstat (limited to 'src/cairo-xcb-surface.c')
-rw-r--r-- | src/cairo-xcb-surface.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c index fd8251497..282b8f86f 100644 --- a/src/cairo-xcb-surface.c +++ b/src/cairo-xcb-surface.c @@ -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); |