aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Orzechowski <alex@ozal.ski>2023-08-02 11:45:17 -0400
committerSimon Ser <contact@emersion.fr>2023-08-12 10:16:51 +0000
commitaee31edaadf90f14569d8cf844df76ef003d1c30 (patch)
tree6e1c57e4ce891bf561ed8f1ff796bdac239f4032
parentb4cbaa4549ada0eb009c9f5299a8bbc9917dc00e (diff)
screencopy_v1: Implement copy regions with gpu blit path
-rw-r--r--types/wlr_screencopy_v1.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/types/wlr_screencopy_v1.c b/types/wlr_screencopy_v1.c
index ceb3c686..bb90d35a 100644
--- a/types/wlr_screencopy_v1.c
+++ b/types/wlr_screencopy_v1.c
@@ -227,10 +227,9 @@ static bool frame_dma_copy(struct wlr_screencopy_frame_v1 *frame,
struct wlr_renderer *renderer = output->renderer;
assert(renderer);
- // TODO: add support for copying regions with DMA-BUFs
- if (frame->box.x != 0 || frame->box.y != 0 ||
- src_buffer->width != frame->box.width ||
- src_buffer->height != frame->box.height) {
+ if (frame->box.x < 0 || frame->box.y < 0 ||
+ frame->box.x + frame->box.width > src_buffer->width ||
+ frame->box.y + frame->box.height > src_buffer->height) {
return false;
}
@@ -251,6 +250,12 @@ static bool frame_dma_copy(struct wlr_screencopy_frame_v1 *frame,
wlr_render_pass_add_texture(pass, &(struct wlr_render_texture_options) {
.texture = src_tex,
.blend_mode = WLR_RENDER_BLEND_MODE_NONE,
+ .src_box = (struct wlr_fbox){
+ .x = frame->box.x,
+ .y = frame->box.y,
+ .width = frame->box.width,
+ .height = frame->box.height,
+ },
});
ok = wlr_render_pass_submit(pass);