diff options
author | Stefan Agner <stefan@agner.ch> | 2019-06-16 21:24:21 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-08-16 07:51:20 +0000 |
commit | 2b2c9a6f7f81cf218c579c846c63098f28cd8088 (patch) | |
tree | 16ab5f0fc9e98ccbf1c78519521cb72c6f13665a | |
parent | 45f5e536ecc4a2b3d51434eeae698ab2ab7df697 (diff) | |
download | weston-2b2c9a6f7f81cf218c579c846c63098f28cd8088.tar.gz |
screen-share: align read_pixels call with screenshooter
Calculate y_orig separately first makes it easer to understand the
code and aligns with how pixels are read in screenshooter.c.
Signed-off-by: Stefan Agner <stefan@agner.ch>
-rw-r--r-- | compositor/screen-share.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/compositor/screen-share.c b/compositor/screen-share.c index 4decbaae..070d3938 100644 --- a/compositor/screen-share.c +++ b/compositor/screen-share.c @@ -818,7 +818,7 @@ shared_output_repainted(struct wl_listener *listener, void *data) pixman_region32_t damage; struct ss_shm_buffer *sb; int32_t x, y, width, height, stride; - int i, nrects, do_yflip; + int i, nrects, do_yflip, y_orig; pixman_box32_t *r; uint32_t *cache_data; @@ -876,19 +876,19 @@ shared_output_repainted(struct wl_listener *listener, void *data) width = r[i].x2 - r[i].x1; height = r[i].y2 - r[i].y1; - if (do_yflip) { - so->output->compositor->renderer->read_pixels( - so->output, PIXMAN_a8r8g8b8, so->tmp_data, - x, so->output->current_mode->height - r[i].y2, - width, height); + if (do_yflip) + y_orig = so->output->current_mode->height - r[i].y2; + else + y_orig = y; + + so->output->compositor->renderer->read_pixels( + so->output, PIXMAN_a8r8g8b8, so->tmp_data, + x, y_orig, width, height); + if (do_yflip) { pixman_blt(so->tmp_data, cache_data, -width, stride, 32, 32, 0, 1 - height, x, y, width, height); } else { - so->output->compositor->renderer->read_pixels( - so->output, PIXMAN_a8r8g8b8, so->tmp_data, - x, y, width, height); - pixman_blt(so->tmp_data, cache_data, width, stride, 32, 32, 0, 0, x, y, width, height); } |