aboutsummaryrefslogtreecommitdiff
path: root/include/wlr/render/wlr_texture.h
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-04-02 15:57:04 -0400
committeremersion <contact@emersion.fr>2018-04-02 15:57:04 -0400
commit8836b4f024f957971cae28a0fdc567ff16c8fbc8 (patch)
tree23be1fc669c4fc721a521691ce182041cc7c5237 /include/wlr/render/wlr_texture.h
parentcadfccf1fde164646b175401a3fb1d3108b4af9a (diff)
parentd466cc117f95d34e239049a5af701b7ba696d336 (diff)
Merge branch 'master' into xwayland-dnd
Diffstat (limited to 'include/wlr/render/wlr_texture.h')
-rw-r--r--include/wlr/render/wlr_texture.h63
1 files changed, 25 insertions, 38 deletions
diff --git a/include/wlr/render/wlr_texture.h b/include/wlr/render/wlr_texture.h
index 095097e6..239fc51b 100644
--- a/include/wlr/render/wlr_texture.h
+++ b/include/wlr/render/wlr_texture.h
@@ -5,62 +5,49 @@
#include <EGL/eglext.h>
#include <stdint.h>
#include <wayland-server-protocol.h>
+#include <wlr/types/wlr_linux_dmabuf.h>
+struct wlr_renderer;
struct wlr_texture_impl;
struct wlr_texture {
const struct wlr_texture_impl *impl;
-
- bool valid;
- uint32_t format;
- int width, height;
- bool inverted_y;
- struct wl_signal destroy_signal;
- struct wl_resource *resource;
};
/**
- * Copies pixels to this texture. The buffer is not accessed after this function
- * returns.
+ * Create a new texture from raw pixel data. `stride` is in bytes. The returned
+ * texture is mutable.
*/
-bool wlr_texture_upload_pixels(struct wlr_texture *tex,
- enum wl_shm_format format, int stride, int width, int height,
- const unsigned char *pixels);
+struct wlr_texture *wlr_texture_from_pixels(struct wlr_renderer *renderer,
+ enum wl_shm_format wl_fmt, uint32_t stride, uint32_t width, uint32_t height,
+ const void *data);
+
/**
- * Copies pixels to this texture. The buffer is not accessed after this function
- * returns. Under some circumstances, this function may re-upload the entire
- * buffer - therefore, the entire buffer must be valid.
+ * Create a new texture from a wl_drm resource. The returned texture is
+ * immutable.
*/
-bool wlr_texture_update_pixels(struct wlr_texture *surf,
- enum wl_shm_format format, int stride, int x, int y,
- int width, int height, const unsigned char *pixels);
+struct wlr_texture *wlr_texture_from_wl_drm(struct wlr_renderer *renderer,
+ struct wl_resource *data);
+
/**
- * Copies pixels from a wl_shm_buffer into this texture. The buffer is not
- * accessed after this function returns.
+ * Create a new texture from a DMA-BUF. The returned texture is immutable.
*/
-bool wlr_texture_upload_shm(struct wlr_texture *tex, uint32_t format,
- struct wl_shm_buffer *shm);
+struct wlr_texture *wlr_texture_from_dmabuf(struct wlr_renderer *renderer,
+ struct wlr_dmabuf_buffer_attribs *attribs);
+
/**
- * Attaches the contents from the given wl_drm wl_buffer resource onto the
- * texture. The wl_resource is not used after this call.
- * Will fail (return false) if the given resource is no drm buffer.
+ * Get the texture width and height.
*/
-bool wlr_texture_upload_drm(struct wlr_texture *tex,
- struct wl_resource *drm_buffer);
-
-bool wlr_texture_upload_eglimage(struct wlr_texture *tex,
- EGLImageKHR image, uint32_t width, uint32_t height);
+void wlr_texture_get_size(struct wlr_texture *texture, int *width, int *height);
-bool wlr_texture_upload_dmabuf(struct wlr_texture *tex,
- struct wl_resource *dmabuf_resource);
/**
- * Copies a rectangle of pixels from a wl_shm_buffer onto the texture. The
- * buffer is not accessed after this function returns. Under some circumstances,
- * this function may re-upload the entire buffer - therefore, the entire buffer
- * must be valid.
+ * Update a texture with raw pixels. The texture must be mutable.
*/
-bool wlr_texture_update_shm(struct wlr_texture *surf, uint32_t format,
- int x, int y, int width, int height, struct wl_shm_buffer *shm);
+bool wlr_texture_write_pixels(struct wlr_texture *texture,
+ enum wl_shm_format wl_fmt, uint32_t stride, uint32_t width, uint32_t height,
+ uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y,
+ const void *data);
+
/**
* Destroys this wlr_texture.
*/