aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-06-16 14:43:24 +0200
committerSimon Ser <contact@emersion.fr>2022-06-16 14:43:24 +0200
commit29291cb47cdaa72d1142a008fef3301dcb86dfac (patch)
tree77616ce5285dea16bc1ebe1a41e02b1ed3b80ce6 /include
parentf28c0e2046c59aeb9f014ef4c22d4517e38f4721 (diff)
render/texture: drop wlr_texture_is_opaque
Whether a texture is opaque or not doesn't depend on the renderer at all, it just depends on the source buffer. Instead of forcing all renderers to implement wlr_texture_impl.is_opaque, let's move this in common code and use the wlr_buffer format to know whether a texture will be opaque.
Diffstat (limited to 'include')
-rw-r--r--include/types/wlr_buffer.h9
-rw-r--r--include/wlr/render/interface.h1
-rw-r--r--include/wlr/render/wlr_texture.h5
-rw-r--r--include/wlr/types/wlr_compositor.h2
4 files changed, 11 insertions, 6 deletions
diff --git a/include/types/wlr_buffer.h b/include/types/wlr_buffer.h
index bdb6e5b7..e7097ae2 100644
--- a/include/types/wlr_buffer.h
+++ b/include/types/wlr_buffer.h
@@ -69,4 +69,13 @@ struct wlr_dmabuf_buffer *dmabuf_buffer_create(
*/
bool dmabuf_buffer_drop(struct wlr_dmabuf_buffer *buffer);
+/**
+ * Check whether a buffer is fully opaque.
+ *
+ * When true is returned, the buffer is guaranteed to be fully opaque, but the
+ * reverse is not true: false may be returned in cases where the buffer is fully
+ * opaque.
+ */
+bool buffer_is_opaque(struct wlr_buffer *buffer);
+
#endif
diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h
index 4207bd30..7e923353 100644
--- a/include/wlr/render/interface.h
+++ b/include/wlr/render/interface.h
@@ -54,7 +54,6 @@ void wlr_renderer_init(struct wlr_renderer *renderer,
const struct wlr_renderer_impl *impl);
struct wlr_texture_impl {
- bool (*is_opaque)(struct wlr_texture *texture);
bool (*write_pixels)(struct wlr_texture *texture,
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,
diff --git a/include/wlr/render/wlr_texture.h b/include/wlr/render/wlr_texture.h
index 93fc221c..0f39b8a8 100644
--- a/include/wlr/render/wlr_texture.h
+++ b/include/wlr/render/wlr_texture.h
@@ -37,11 +37,6 @@ struct wlr_texture *wlr_texture_from_dmabuf(struct wlr_renderer *renderer,
struct wlr_dmabuf_attributes *attribs);
/**
- * Returns true if this texture is using a fully opaque format.
- */
-bool wlr_texture_is_opaque(struct wlr_texture *texture);
-
-/**
* Update a texture with raw pixels. The texture must be mutable, and the input
* data must have the same pixel format that the texture was created with.
*/
diff --git a/include/wlr/types/wlr_compositor.h b/include/wlr/types/wlr_compositor.h
index bff6bc83..034b075b 100644
--- a/include/wlr/types/wlr_compositor.h
+++ b/include/wlr/types/wlr_compositor.h
@@ -162,6 +162,8 @@ struct wlr_surface {
int width, height;
int buffer_width, buffer_height;
} previous;
+
+ bool opaque;
};
struct wlr_renderer;