Fix y-inversion in damage tracking and raw encoding

tight-png
Andri Yngvason 2019-09-19 19:21:52 +00:00
parent 40f16fe63b
commit 4c36a88cfd
2 changed files with 13 additions and 12 deletions

View File

@ -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);
}

View File

@ -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;
}