Unbreak raw encoding
parent
aa917decf3
commit
4e919c69ce
|
@ -27,11 +27,20 @@ int raw_encode_box(struct vec* dst, const struct rfb_pixel_format* dst_fmt,
|
|||
|
||||
uint32_t* b = fb->addr;
|
||||
|
||||
int bytes_per_pixel = dst_fmt->depth / 8;
|
||||
int bpp = dst_fmt->bits_per_pixel / 8;
|
||||
|
||||
for (int y = y_start; y < y_start + height; ++y)
|
||||
pixel32_to_cpixel(dst->data, dst_fmt, b + y * stride, src_fmt,
|
||||
bytes_per_pixel, width);
|
||||
rc = vec_reserve(dst, width * height * bpp + dst->len);
|
||||
if (rc < 0)
|
||||
return -1;
|
||||
|
||||
uint8_t* d = dst->data;
|
||||
|
||||
for (int y = y_start; y < y_start + height; ++y) {
|
||||
pixel32_to_cpixel(d + dst->len, dst_fmt,
|
||||
b + x_start + y * stride, src_fmt,
|
||||
bpp, width);
|
||||
dst->len += width * bpp;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -55,7 +64,7 @@ int raw_encode_frame(struct vec* dst, const struct rfb_pixel_format* dst_fmt,
|
|||
.n_rects = htons(n_rects),
|
||||
};
|
||||
|
||||
rc = vec_reserve(dst, src->width * src->height * 4 + 256);
|
||||
rc = vec_reserve(dst, src->width * src->height * 4);
|
||||
if (rc < 0)
|
||||
return -1;
|
||||
|
||||
|
|
Loading…
Reference in New Issue