From e9f200f4cc3e9f2674e737b92029507dc38b065c Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Tue, 8 Oct 2019 17:58:35 +0000 Subject: [PATCH] Excise y-inversion code --- include/neatvnc.h | 4 ---- src/raw-encoding.c | 12 +++--------- src/zrle.c | 14 ++++---------- 3 files changed, 7 insertions(+), 23 deletions(-) diff --git a/include/neatvnc.h b/include/neatvnc.h index 0030a71..55d66bd 100644 --- a/include/neatvnc.h +++ b/include/neatvnc.h @@ -32,10 +32,6 @@ enum nvnc_button_mask { NVNC_SCROLL_DOWN = 1 << 4, }; -enum nvnc_modifier { - NVNC_MOD_Y_INVERT = 1 << 0, -}; - typedef void (*nvnc_key_fn)(struct nvnc_client*, uint32_t keysym, bool is_pressed); typedef void (*nvnc_pointer_fn)(struct nvnc_client*, uint16_t x, uint16_t y, enum nvnc_button_mask); diff --git a/src/raw-encoding.c b/src/raw-encoding.c index 2ba06c9..f43be85 100644 --- a/src/raw-encoding.c +++ b/src/raw-encoding.c @@ -26,15 +26,9 @@ int raw_encode_box(struct vec *dst, const struct rfb_pixel_format *dst_fmt, uint32_t* b = fb->addr; - if (false) { - for (int y = y_start; y < y_start + height; ++y) - for (int x = x_start; x < x_start + width; ++x) - vec_fast_append_32(dst, b[x + (fb->height - y - 1) * stride]); - } else { - for (int y = y_start; y < y_start + height; ++y) - for (int x = x_start; x < x_start + width; ++x) - vec_fast_append_32(dst, b[x + y * stride]); - } + for (int y = y_start; y < y_start + height; ++y) + for (int x = x_start; x < x_start + width; ++x) + vec_fast_append_32(dst, b[x + y * stride]); return 0; } diff --git a/src/zrle.c b/src/zrle.c index a35274c..676a340 100644 --- a/src/zrle.c +++ b/src/zrle.c @@ -139,15 +139,10 @@ void zrle_encode_packed_tile(struct vec *dst, } void zrle_copy_tile(uint32_t *dst, const uint32_t *src, int stride, - int width, int height, enum nvnc_modifier mod) + int width, int height) { - for (int y = 0; y < height; ++y) { - if (!(mod & NVNC_MOD_Y_INVERT)) - memcpy(dst + y * width, src + y * stride, width * 4); - else - memcpy(dst + (height - y - 1) * width, src + y * stride, - width * 4); - } + for (int y = 0; y < height; ++y) + memcpy(dst + y * width, src + y * stride, width * 4); } void zrle_encode_tile(struct vec *dst, const struct rfb_pixel_format *dst_fmt, @@ -255,8 +250,7 @@ int zrle_encode_box(struct vec* out, const struct rfb_pixel_format *dst_fmt, zrle_copy_tile(tile, ((uint32_t*)fb->addr) + x + tile_x + y_off * stride, - stride, tile_width, tile_height, - 0); + stride, tile_width, tile_height); zrle_encode_tile(&in, dst_fmt, tile, src_fmt, tile_width * tile_height);