Fix transparency handling with non-double-buffered drawing

Sometimes we need to read back the window content into our double
buffer due to rendering a window with alpha when there is
no implicit paint or it has been flushed due to non-db drawing
before.

However, in this case we can't use gdk_cairo_set_source_window as
it might trigger an implicit paint flush as we detect what we
think is a direct non-double buffered window draw operation, which
will flush the implicit paint operation that we're just setting up.

To fix this we use the raw gdk_window_ref_impl_surface operation
to get the source surface.
This commit is contained in:
Alexander Larsson 2012-02-09 21:09:44 +01:00
parent 5d9736fe13
commit 251cffb638

View File

@ -2971,9 +2971,14 @@ gdk_window_begin_paint_region (GdkWindow *window,
(implicit_paint && implicit_paint->flushed)))
{
cairo_t *cr = cairo_create (paint->surface);
gdk_cairo_set_source_window (cr, impl_window,
- (window->abs_x + clip_box.x),
- (window->abs_y + clip_box.y));
/* We can't use gdk_cairo_set_source_window here, as that might
flush the implicit paint at an unfortunate time, since this
would be detected as a draw during non-expose time */
cairo_surface_t *source_surface = gdk_window_ref_impl_surface (impl_window);
cairo_set_source_surface (cr, source_surface,
- (window->abs_x + clip_box.x),
- (window->abs_y + clip_box.y));
cairo_surface_destroy (source_surface);
cairo_paint (cr);
cairo_destroy (cr);
}