From 3531007b75a173ab0bd8152efb0a982f72140acb Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Mon, 11 Dec 2023 17:06:04 +0100 Subject: render/pixman: add wlr_pixman_renderer_get_buffer_image() This is similar to wlr_pixman_texture_get_image and can be useful for compositors to access the rendering data. --- render/pixman/renderer.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'render') diff --git a/render/pixman/renderer.c b/render/pixman/renderer.c index b9acef40..27cde939 100644 --- a/render/pixman/renderer.c +++ b/render/pixman/renderer.c @@ -343,6 +343,19 @@ struct wlr_renderer *wlr_pixman_renderer_create(void) { return &renderer->wlr_renderer; } +pixman_image_t *wlr_pixman_renderer_get_buffer_image( + struct wlr_renderer *wlr_renderer, struct wlr_buffer *wlr_buffer) { + struct wlr_pixman_renderer *renderer = get_renderer(wlr_renderer); + struct wlr_pixman_buffer *buffer = get_buffer(renderer, wlr_buffer); + if (!buffer) { + buffer = create_buffer(renderer, wlr_buffer); + } + if (!buffer) { + return NULL; + } + return buffer->image; +} + 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; -- cgit v1.2.3