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) { x += TILE_SIDE_LENGTH) {
int tile_width = MIN(TILE_SIDE_LENGTH, width - x); int tile_width = MIN(TILE_SIDE_LENGTH, width - x);
if (are_tiles_equal(b0 + x + y * width, int offset = y_invert ? x + (height - y - tile_height) * width
b1 + x + y * width, : x + y * width;
if (are_tiles_equal(b0 + offset, b1 + offset,
width, tile_width, tile_height)) width, tile_width, tile_height))
continue; continue;
if (y_invert)
y = height - y - tile_height;
pixman_region_union_rect(damage, damage, x, y, pixman_region_union_rect(damage, damage, x, y,
tile_width, tile_height); 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; uint32_t* b = fb->addr;
if (fb->nvnc_modifier & NVNC_MOD_Y_INVERT) if (fb->nvnc_modifier & NVNC_MOD_Y_INVERT) {
y_start = fb->height - y_start - height; for (int y = y_start; y < y_start + height; ++y)
for (int x = x_start; x < x_start + width; ++x)
/* TODO: Pixel format conversion */ 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 y = y_start; y < y_start + height; ++y)
for (int x = x_start; x < x_start + width; ++x) for (int x = x_start; x < x_start + width; ++x)
vec_fast_append_32(dst, b[x + y * stride]); vec_fast_append_32(dst, b[x + y * stride]);
}
return 0; return 0;
} }