buffer: Leave pixman out of buffers

pixman-rendering
Andri Yngvason 2020-06-20 21:43:35 +00:00
parent 4740967bfd
commit 47a8dc8040
2 changed files with 1 additions and 14 deletions

View File

@ -3,8 +3,8 @@
#include "sys/queue.h" #include "sys/queue.h"
#include <unistd.h> #include <unistd.h>
#include <pixman.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
struct wl_buffer; struct wl_buffer;
@ -13,7 +13,6 @@ struct wv_buffer {
struct wl_buffer* wl_buffer; struct wl_buffer* wl_buffer;
void* pixels; void* pixels;
size_t size; size_t size;
pixman_image_t* image;
int width, height, stride; int width, height, stride;
uint32_t format; uint32_t format;
bool y_inverted; bool y_inverted;

View File

@ -5,7 +5,6 @@
#include <assert.h> #include <assert.h>
#include <sys/mman.h> #include <sys/mman.h>
#include <libdrm/drm_fourcc.h> #include <libdrm/drm_fourcc.h>
#include <pixman.h>
#include <wayland-client.h> #include <wayland-client.h>
#include "shm.h" #include "shm.h"
@ -20,9 +19,6 @@ struct wv_buffer* wv_buffer_create(int width, int height, int stride,
{ {
assert(wl_shm); assert(wl_shm);
enum wl_shm_format wl_fmt = fourcc_to_wl_shm(fourcc); enum wl_shm_format wl_fmt = fourcc_to_wl_shm(fourcc);
pixman_format_code_t pixman_fmt = 0;
if (!fourcc_to_pixman_fmt(&pixman_fmt, fourcc))
return NULL;
struct wv_buffer* self = calloc(1, sizeof(*self)); struct wv_buffer* self = calloc(1, sizeof(*self));
if (!self) if (!self)
@ -43,11 +39,6 @@ struct wv_buffer* wv_buffer_create(int width, int height, int stride,
if (!self->pixels) if (!self->pixels)
goto mmap_failure; goto mmap_failure;
self->image = pixman_image_create_bits(pixman_fmt, width, height,
self->pixels, stride);
if (!self->image)
goto pixman_failure;
struct wl_shm_pool* pool = wl_shm_create_pool(wl_shm, fd, self->size); struct wl_shm_pool* pool = wl_shm_create_pool(wl_shm, fd, self->size);
if (!pool) if (!pool)
goto pool_failure; goto pool_failure;
@ -63,8 +54,6 @@ struct wv_buffer* wv_buffer_create(int width, int height, int stride,
shm_failure: shm_failure:
pool_failure: pool_failure:
pixman_image_unref(self->image);
pixman_failure:
munmap(self->pixels, self->size); munmap(self->pixels, self->size);
mmap_failure: mmap_failure:
close(fd); close(fd);
@ -76,7 +65,6 @@ failure:
void wv_buffer_destroy(struct wv_buffer* self) void wv_buffer_destroy(struct wv_buffer* self)
{ {
wl_buffer_destroy(self->wl_buffer); wl_buffer_destroy(self->wl_buffer);
pixman_image_unref(self->image);
munmap(self->pixels, self->size); munmap(self->pixels, self->size);
free(self); free(self);
} }