diff --git a/src/damage.c b/src/damage.c index 3d27db0..c529749 100644 --- a/src/damage.c +++ b/src/damage.c @@ -73,14 +73,13 @@ int check_damage_linear(struct pixman_region16 *damage, x += TILE_SIDE_LENGTH) { int tile_width = MIN(TILE_SIDE_LENGTH, width - x); - if (are_tiles_equal(b0 + x + y * width, - b1 + x + y * width, + int offset = y_invert ? x + (height - y - tile_height) * width + : x + y * width; + + if (are_tiles_equal(b0 + offset, b1 + offset, width, tile_width, tile_height)) continue; - if (y_invert) - y = height - y - tile_height; - pixman_region_union_rect(damage, damage, x, y, tile_width, tile_height); } diff --git a/src/raw-encoding.c b/src/raw-encoding.c index a4ea18a..4f2e2c1 100644 --- a/src/raw-encoding.c +++ b/src/raw-encoding.c @@ -29,13 +29,15 @@ int raw_encode_box(struct vec *dst, const struct rfb_pixel_format *dst_fmt, uint32_t* b = fb->addr; - if (fb->nvnc_modifier & NVNC_MOD_Y_INVERT) - y_start = fb->height - y_start - height; - - /* TODO: Pixel format conversion */ - 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]); + if (fb->nvnc_modifier & NVNC_MOD_Y_INVERT) { + 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]); + } return 0; }