Commit a57630b3 authored by Daniel Elstner's avatar Daniel Elstner
Browse files

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.
parent 701f82d1
...@@ -840,13 +840,16 @@ gdk_wayland_window_ensure_cairo_surface (GdkWindow *window) ...@@ -840,13 +840,16 @@ gdk_wayland_window_ensure_cairo_surface (GdkWindow *window)
{ {
if (impl->staging_cairo_surface && if (impl->staging_cairo_surface &&
_gdk_wayland_is_shm_surface (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, if (!impl->staging_cairo_surface)
impl->scale, {
impl->scale); impl->staging_cairo_surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
cairo_surface_set_device_scale (impl->staging_cairo_surface, impl->scale,
impl->scale, impl->scale); impl->scale);
cairo_surface_set_device_scale (impl->staging_cairo_surface,
impl->scale, impl->scale);
} }
else if (!impl->staging_cairo_surface) else if (!impl->staging_cairo_surface)
{ {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment