aboutsummaryrefslogtreecommitdiff
path: root/render/wlr_surface.c
blob: 4e4f4101193058ad0a42797cd8ab28276028e853 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <stdlib.h>
#include <stdbool.h>
#include <wlr/render/interface.h>

struct wlr_surface *wlr_surface_init(struct wlr_surface_state *state,
		struct wlr_surface_impl *impl) {
	struct wlr_surface *s = calloc(sizeof(struct wlr_surface), 1);
	s->state = state;
	s->impl = impl;
	return s;
}

void wlr_surface_destroy(struct wlr_surface *surface) {
	surface->impl->destroy(surface->state);
	free(surface);
}

void wlr_surface_bind(struct wlr_surface *surface) {
	surface->impl->bind(surface->state);
}

bool wlr_surface_attach_pixels(struct wlr_surface *surface, uint32_t format,
		int stride, int width, int height, const unsigned char *pixels) {
	return surface->impl->attach_pixels(surface->state,
			format, stride, width, height, pixels);
}

bool wlr_surface_attach_shm(struct wlr_surface *surface, uint32_t format,
		struct wl_shm_buffer *shm) {
	return surface->impl->attach_shm(surface->state, format, shm);
}

void wlr_surface_get_matrix(struct wlr_surface *surface,
		float (*matrix)[16], const float (*projection)[16], int x, int y) {
	surface->impl->get_matrix(surface->state, matrix, projection, x, y);
}