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:
@ -2971,9 +2971,14 @@ gdk_window_begin_paint_region (GdkWindow *window,
|
|||||||
(implicit_paint && implicit_paint->flushed)))
|
(implicit_paint && implicit_paint->flushed)))
|
||||||
{
|
{
|
||||||
cairo_t *cr = cairo_create (paint->surface);
|
cairo_t *cr = cairo_create (paint->surface);
|
||||||
gdk_cairo_set_source_window (cr, impl_window,
|
/* We can't use gdk_cairo_set_source_window here, as that might
|
||||||
- (window->abs_x + clip_box.x),
|
flush the implicit paint at an unfortunate time, since this
|
||||||
- (window->abs_y + clip_box.y));
|
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_paint (cr);
|
||||||
cairo_destroy (cr);
|
cairo_destroy (cr);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user