[mutter/wayland] wayland-surface: Allow setting a NULL buffer to effectively unmap
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wayland] wayland-surface: Allow setting a NULL buffer to effectively unmap
- Date: Tue, 19 Nov 2013 18:11:00 +0000 (UTC)
commit f0280a88685deaab17e3fce8b95c537883f9d55e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Nov 19 12:47:50 2013 -0500
wayland-surface: Allow setting a NULL buffer to effectively unmap
src/wayland/meta-wayland-surface.c | 58 ++++++++++++++++++------------------
1 files changed, 29 insertions(+), 29 deletions(-)
---
diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c
index 50ebe85..0bfd7b1 100644
--- a/src/wayland/meta-wayland-surface.c
+++ b/src/wayland/meta-wayland-surface.c
@@ -261,6 +261,28 @@ surface_ensure_window (MetaWaylandSurface *surface)
}
static void
+ensure_buffer_texture (MetaWaylandBuffer *buffer)
+{
+ CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
+ CoglError *catch_error = NULL;
+ CoglTexture *texture;
+
+ texture = COGL_TEXTURE (cogl_wayland_texture_2d_new_from_buffer (ctx,
+ buffer->resource,
+ &catch_error));
+ if (!texture)
+ {
+ cogl_error_free (catch_error);
+ meta_warning ("Could not import pending buffer, ignoring commit\n");
+ return;
+ }
+
+ buffer->texture = texture;
+ buffer->width = cogl_texture_get_width (texture);
+ buffer->height = cogl_texture_get_height (texture);
+}
+
+static void
meta_wayland_surface_commit (struct wl_client *client,
struct wl_resource *resource)
{
@@ -278,37 +300,15 @@ meta_wayland_surface_commit (struct wl_client *client,
surface->buffer_ref.buffer != surface->pending.buffer)
{
MetaWaylandBuffer *buffer = surface->pending.buffer;
- CoglContext *ctx =
- clutter_backend_get_cogl_context (clutter_get_default_backend ());
- CoglError *catch_error = NULL;
- CoglTexture *texture =
- COGL_TEXTURE (cogl_wayland_texture_2d_new_from_buffer (ctx,
- buffer->resource,
- &catch_error));
- if (!texture)
- {
- cogl_error_free (catch_error);
- meta_warning ("Could not import pending buffer, ignoring commit\n");
- return;
- }
- else
+
+ if (buffer)
{
- buffer->texture = texture;
- buffer->width = cogl_texture_get_width (texture);
- buffer->height = cogl_texture_get_height (texture);
+ /* Note: we set this before informing any window-actor since the
+ * window actor will expect to find the new buffer within the
+ * surface. */
+ ensure_buffer_texture (buffer);
+ meta_wayland_buffer_reference (&surface->buffer_ref, buffer);
}
-
- /* Note: we set this before informing any window-actor since the
- * window actor will expect to find the new buffer within the
- * surface. */
- meta_wayland_buffer_reference (&surface->buffer_ref,
- surface->pending.buffer);
- }
-
- if (!surface->buffer_ref.buffer)
- {
- meta_warning ("Commit without a buffer? Ignoring\n");
- return;
}
surface_ensure_window (surface);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]