[PATCH 4/5] shm: fill in base buffer layout.
Gwenole Beauchesne
gb.devel at gmail.com
Fri Apr 20 07:39:55 PDT 2012
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne at intel.com>
---
src/wayland-shm.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/src/wayland-shm.c b/src/wayland-shm.c
index 7900ba1..bda1628 100644
--- a/src/wayland-shm.c
+++ b/src/wayland-shm.c
@@ -88,10 +88,15 @@ shm_pool_create_buffer(struct wl_client *client, struct wl_resource *resource,
{
struct wl_shm_pool *pool = resource->data;
struct wl_shm_buffer *buffer;
+ struct wl_buffer_layout *layout;
+ uint32_t base_format;
switch (format) {
case WL_SHM_FORMAT_ARGB8888:
+ base_format = WL_BUFFER_FORMAT_ARGB32;
+ break;
case WL_SHM_FORMAT_XRGB8888:
+ base_format = WL_BUFFER_FORMAT_XRGB32;
break;
default:
wl_resource_post_error(resource,
@@ -124,6 +129,14 @@ shm_pool_create_buffer(struct wl_client *client, struct wl_resource *resource,
buffer->pool = pool;
pool->refcount++;
+ layout = &buffer->buffer.layout;
+ layout->format = base_format;
+ layout->width = width;
+ layout->height = height;
+ layout->num_planes = 1;
+ layout->offsets[0] = 0;
+ layout->pitches[0] = stride;
+
buffer->buffer.resource.object.id = id;
buffer->buffer.resource.object.interface = &wl_buffer_interface;
buffer->buffer.resource.object.implementation = (void (**)(void))
--
1.7.5.4
More information about the wayland-devel
mailing list