raw-encoding: Do proper pixel conversion
parent
a43bb5d3d4
commit
de1f63573b
|
@ -32,7 +32,7 @@ void pixel32_to_cpixel(uint8_t *restrict dst,
|
|||
assert(dst_fmt->true_colour_flag);
|
||||
assert(dst_fmt->bits_per_pixel <= 32);
|
||||
assert(dst_fmt->depth <= 24);
|
||||
assert(bytes_per_cpixel <= 3 && bytes_per_cpixel >= 1);
|
||||
assert(bytes_per_cpixel <= 4 && bytes_per_cpixel >= 1);
|
||||
|
||||
uint32_t src_red_shift = src_fmt->red_shift;
|
||||
uint32_t src_green_shift = src_fmt->green_shift;
|
||||
|
@ -86,6 +86,8 @@ void pixel32_to_cpixel(uint8_t *restrict dst,
|
|||
dst_blue_shift -= min_dst_shift;
|
||||
}
|
||||
|
||||
/* fallthrough */
|
||||
case 4:
|
||||
dst_endian_correction = dst_fmt->big_endian_flag ? 16 : 0;
|
||||
|
||||
while (len--) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "rfb-proto.h"
|
||||
#include "vec.h"
|
||||
#include "fb.h"
|
||||
#include "pixels.h"
|
||||
|
||||
#include <pixman.h>
|
||||
|
||||
|
@ -26,9 +27,11 @@ 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;
|
||||
|
||||
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]);
|
||||
pixel32_to_cpixel(dst->data, dst_fmt, b + y * stride, src_fmt,
|
||||
bytes_per_pixel, width);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue