aboutsummaryrefslogtreecommitdiff
path: root/render/pixman/renderer.c
diff options
context:
space:
mode:
authorzccrs <zccrs@live.com>2021-05-28 14:15:40 +0800
committerSimon Ser <contact@emersion.fr>2021-06-19 10:04:35 +0200
commitdc17ecd2365eaf9b5cb8f0193cdcb3991e788b4e (patch)
treef2f4e7c2b2eef29e5ab65928cd1f7fd9891e35c7 /render/pixman/renderer.c
parentfdc40e071ed103d6bdc03fa6181dedef296b0509 (diff)
render/pixman: add wlr_*_is_pixman and wlr_pixman_texture_get_image
Add the following functions: - wlr_renderer_is_pixman - wlr_texture_is_pixman - wlr_pixman_texture_get_image
Diffstat (limited to 'render/pixman/renderer.c')
-rw-r--r--render/pixman/renderer.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/render/pixman/renderer.c b/render/pixman/renderer.c
index 85df25a0..56960fc2 100644
--- a/render/pixman/renderer.c
+++ b/render/pixman/renderer.c
@@ -12,9 +12,13 @@
static const struct wlr_renderer_impl renderer_impl;
+bool wlr_renderer_is_pixman(struct wlr_renderer *wlr_renderer) {
+ return wlr_renderer->impl == &renderer_impl;
+}
+
static struct wlr_pixman_renderer *get_renderer(
struct wlr_renderer *wlr_renderer) {
- assert(wlr_renderer->impl == &renderer_impl);
+ assert(wlr_renderer_is_pixman(wlr_renderer));
return (struct wlr_pixman_renderer *)wlr_renderer;
}
@@ -31,9 +35,13 @@ static struct wlr_pixman_buffer *get_buffer(
static const struct wlr_texture_impl texture_impl;
+bool wlr_texture_is_pixman(struct wlr_texture *texture) {
+ return texture->impl == &texture_impl;
+}
+
static struct wlr_pixman_texture *get_texture(
struct wlr_texture *wlr_texture) {
- assert(wlr_texture->impl == &texture_impl);
+ assert(wlr_texture_is_pixman(wlr_texture));
return (struct wlr_pixman_texture *)wlr_texture;
}
@@ -554,3 +562,8 @@ struct wlr_renderer *wlr_pixman_renderer_create(void) {
return &renderer->wlr_renderer;
}
+
+pixman_image_t *wlr_pixman_texture_get_image(struct wlr_texture *wlr_texture) {
+ struct wlr_pixman_texture *texture = get_texture(wlr_texture);
+ return texture->image;
+}