neuwld

patched neuwld library (tracked)
git clone https://git.daat.foo/neuwld.git
Log | Files | Refs | README | LICENSE

commit 6fb96f3797b887862ec6e00777ea2bb5c77fdedc
parent 3e011e5282c92015bc9dc9017137031322b40bb2
Author: Michael Forney <mforney@mforney.org>
Date:   Wed, 24 Jul 2013 23:56:23 -0700

Remove wld_wayland_create_buffer_from_drawables

Diffstat:
Mwayland.c | 54++++++++++++++++++++----------------------------------
Mwayland.h | 13-------------
2 files changed, 20 insertions(+), 47 deletions(-)

diff --git a/wayland.c b/wayland.c @@ -187,54 +187,40 @@ struct wld_drawable * wld_wayland_create_drawable uint32_t width, uint32_t height, enum wld_format format) { struct wayland_drawable * wayland; - struct wld_drawable * drawables[2]; - struct wl_buffer * buffers[2]; - drawables[0] = context->interface->create_drawable - (context->context, width, height, format, &buffers[0]); - drawables[1] = context->interface->create_drawable - (context->context, width, height, format, &buffers[1]); + wayland = malloc(sizeof *wayland); - wayland = (void *) wld_wayland_create_drawable_from_buffers - (surface, buffers, drawables); + if (!wayland) + goto error0; wayland->context = context; + wayland->buffers[0].drawable = context->interface->create_drawable + (context->context, width, height, format, &wayland->buffers[0].wl); - return &wayland->base; -} - -struct wld_drawable * wld_wayland_create_drawable_from_buffers - (struct wl_surface * surface, - struct wl_buffer * buffers[], struct wld_drawable * drawables[]) -{ - struct wayland_drawable * wayland; - uint32_t * data; - - if (drawables[0]->width != drawables[1]->width - || drawables[0]->height != drawables[1]->height) - { - DEBUG("Drawables aren't the same dimensions\n"); - return NULL; - } + if (!wayland->buffers[0].drawable) + goto error1; - wayland = malloc(sizeof *wayland); + wayland->buffers[1].drawable = context->interface->create_drawable + (context->context, width, height, format, &wayland->buffers[1].wl); - if (!wayland) - return NULL; + if (!wayland->buffers[1].drawable) + goto error2; - wayland->context = NULL; - wayland->buffers[0].wl = buffers[0]; - wayland->buffers[1].wl = buffers[1]; - wayland->buffers[0].drawable = drawables[0]; - wayland->buffers[1].drawable = drawables[1]; wayland->front_buffer = 0; wayland->surface = surface; wayland->base.interface = &wayland_draw; - wayland->base.width = drawables[0]->width; - wayland->base.height = drawables[0]->height; + wayland->base.width = width; + wayland->base.height = height; return &wayland->base; + + error2: + wld_destroy_drawable(wayland->buffers[0].drawable); + error1: + free(wayland); + error0: + return NULL; } int wayland_roundtrip(struct wl_display * display, diff --git a/wayland.h b/wayland.h @@ -77,18 +77,5 @@ struct wld_drawable * wld_wayland_create_drawable (struct wld_wayland_context * context, struct wl_surface * surface, uint32_t width, uint32_t height, enum wld_format format); -/** - * Create a new Wayland drawable for the given surface, using the given buffers - * and drawables as backing for the surface. - * - * You must pass exactly two buffers and drawables - * - * This method does not require a Wayland context to be created because buffers - * and drawables are passed to it explicitly. - */ -struct wld_drawable * wld_wayland_create_drawable_from_buffers - (struct wl_surface * surface, - struct wl_buffer * buffers[], struct wld_drawable * drawables[]); - #endif