[gtk+] gdk-wayland: Do not leak dummy 1x1 surface on every draw
- From: Daniel Elstner <daniel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gdk-wayland: Do not leak dummy 1x1 surface on every draw
- Date: Tue, 26 Sep 2017 19:14:52 +0000 (UTC)
commit 08e37532b9b46d566246e1275e2eeb492ba2c5d7
Author: Daniel Elstner <daniel kitta gmail com>
Date: Tue Sep 26 21:13:40 2017 +0200
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
gdk/wayland/gdkwindow-wayland.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 5395e84..50d6bd3 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -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)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]