gdk-wayland: Do not leak dummy 1x1 surface on every draw

When using EGL, neither leak nor re-create the dummy 1x1 Cairo
surface every time gdk_wayland_window_ensure_cairo_surface()
is called.

https://bugzilla.gnome.org/show_bug.cgi?id=775126
This commit is contained in:
Daniel Elstner 2017-09-26 21:13:40 +02:00
parent ae2c645a2a
commit 08e37532b9

View File

@ -813,13 +813,16 @@ gdk_wayland_window_ensure_cairo_surface (GdkWindow *window)
{
if (impl->staging_cairo_surface &&
_gdk_wayland_is_shm_surface (impl->staging_cairo_surface))
cairo_surface_destroy (impl->staging_cairo_surface);
g_clear_pointer (&impl->staging_cairo_surface, cairo_surface_destroy);
impl->staging_cairo_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
impl->scale,
impl->scale);
cairo_surface_set_device_scale (impl->staging_cairo_surface,
impl->scale, impl->scale);
if (!impl->staging_cairo_surface)
{
impl->staging_cairo_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
impl->scale,
impl->scale);
cairo_surface_set_device_scale (impl->staging_cairo_surface,
impl->scale, impl->scale);
}
}
else if (!impl->staging_cairo_surface)
{