diff options
author | nyorain <nyorain@gmail.com> | 2017-08-08 18:02:14 +0200 |
---|---|---|
committer | nyorain <nyorain@gmail.com> | 2017-08-08 18:25:16 +0200 |
commit | e167f41fde7532ca453a9a70ad1e3f27d7177071 (patch) | |
tree | fb4f62dc4fcd4017db8695fc99a0e7ade8d6d80b /render/wlr_texture.c | |
parent | afd058b754e568728fbc7e2e34651dab9a8a827f (diff) |
Rename wlr_surface -> wlr_texture; attach -> upload
Diffstat (limited to 'render/wlr_texture.c')
-rw-r--r-- | render/wlr_texture.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/render/wlr_texture.c b/render/wlr_texture.c new file mode 100644 index 00000000..926ee546 --- /dev/null +++ b/render/wlr_texture.c @@ -0,0 +1,36 @@ +#include <stdlib.h> +#include <stdbool.h> +#include <wlr/render/interface.h> + +struct wlr_texture *wlr_texture_init(struct wlr_texture_state *state, + struct wlr_texture_impl *impl) { + struct wlr_texture *t = calloc(sizeof(struct wlr_texture), 1); + t->state = state; + t->impl = impl; + return t; +} + +void wlr_texture_destroy(struct wlr_texture *texture) { + texture->impl->destroy(texture->state); + free(texture); +} + +void wlr_texture_bind(struct wlr_texture *texture) { + texture->impl->bind(texture->state); +} + +bool wlr_texture_upload_pixels(struct wlr_texture *texture, uint32_t format, + int stride, int width, int height, const unsigned char *pixels) { + return texture->impl->upload_pixels(texture->state, + format, stride, width, height, pixels); +} + +bool wlr_texture_upload_shm(struct wlr_texture *texture, uint32_t format, + struct wl_shm_buffer *shm) { + return texture->impl->upload_shm(texture->state, format, shm); +} + +void wlr_texture_get_matrix(struct wlr_texture *texture, + float (*matrix)[16], const float (*projection)[16], int x, int y) { + texture->impl->get_matrix(texture->state, matrix, projection, x, y); +} |