From b6ca7aff8c62f3469d083fd46399a73fa606178b Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Sat, 28 Mar 2020 14:09:29 +0000 Subject: [PATCH] Join process_frame() and update_vnc() --- src/main.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/src/main.c b/src/main.c index df464bb..3c4dfcc 100644 --- a/src/main.c +++ b/src/main.c @@ -465,10 +465,17 @@ static void on_damage_check_done(struct pixman_region16* damage, void* userdata) } } -void wayvnc_update_vnc(struct wayvnc* self, struct nvnc_fb* fb) +void wayvnc_process_frame(struct wayvnc* self) { - uint32_t width = nvnc_fb_get_width(fb); - uint32_t height = nvnc_fb_get_height(fb); + uint32_t format = fourcc_from_gl_format(self->renderer.read_format); + uint32_t width = output_get_transformed_width(self->selected_output); + uint32_t height = output_get_transformed_height(self->selected_output); + + struct nvnc_fb* fb = nvnc_fb_new(width, height, format); + void* addr = nvnc_fb_get_addr(fb); + + frame_capture_render(self->capture_backend, &self->renderer, fb); + renderer_read_frame(&self->renderer, addr, 0, height); if (self->last_fb) nvnc_fb_unref(self->last_fb); @@ -514,22 +521,6 @@ void wayvnc_update_vnc(struct wayvnc* self, struct nvnc_fb* fb) } } -void wayvnc_process_frame(struct wayvnc* self) -{ - uint32_t format = fourcc_from_gl_format(self->renderer.read_format); - uint32_t fb_width = output_get_transformed_width(self->selected_output); - uint32_t fb_height = - output_get_transformed_height(self->selected_output); - - struct nvnc_fb* fb = nvnc_fb_new(fb_width, fb_height, format); - void* addr = nvnc_fb_get_addr(fb); - - frame_capture_render(self->capture_backend, &self->renderer, fb); - renderer_read_frame(&self->renderer, addr, 0, fb_height); - - wayvnc_update_vnc(self, fb); -} - void on_capture_done(struct frame_capture* capture) { struct wayvnc* self = capture->userdata;