aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/wlr/render/pixman.h3
-rw-r--r--render/pixman/renderer.c13
2 files changed, 16 insertions, 0 deletions
diff --git a/include/wlr/render/pixman.h b/include/wlr/render/pixman.h
index 436ff1a7..206dd78c 100644
--- a/include/wlr/render/pixman.h
+++ b/include/wlr/render/pixman.h
@@ -16,6 +16,9 @@ struct wlr_renderer *wlr_pixman_renderer_create(void);
bool wlr_renderer_is_pixman(struct wlr_renderer *wlr_renderer);
bool wlr_texture_is_pixman(struct wlr_texture *texture);
+
+pixman_image_t *wlr_pixman_renderer_get_buffer_image(
+ struct wlr_renderer *wlr_renderer, struct wlr_buffer *wlr_buffer);
pixman_image_t *wlr_pixman_texture_get_image(struct wlr_texture *wlr_texture);
#endif
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;