1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#include "qemu/osdep.h"
28#include "vnc.h"
29
30static void hextile_enc_cord(uint8_t *ptr, int x, int y, int w, int h)
31{
32 ptr[0] = ((x & 0x0F) << 4) | (y & 0x0F);
33 ptr[1] = (((w - 1) & 0x0F) << 4) | ((h - 1) & 0x0F);
34}
35
36#define BPP 32
37#include "vnc-enc-hextile-template.h"
38#undef BPP
39
40#define GENERIC
41#define BPP 32
42#include "vnc-enc-hextile-template.h"
43#undef BPP
44#undef GENERIC
45
46int vnc_hextile_send_framebuffer_update(VncState *vs, int x,
47 int y, int w, int h)
48{
49 int i, j;
50 int has_fg, has_bg;
51 uint8_t *last_fg, *last_bg;
52
53 last_fg = (uint8_t *) g_malloc(VNC_SERVER_FB_BYTES);
54 last_bg = (uint8_t *) g_malloc(VNC_SERVER_FB_BYTES);
55 has_fg = has_bg = 0;
56 for (j = y; j < (y + h); j += 16) {
57 for (i = x; i < (x + w); i += 16) {
58 vs->hextile.send_tile(vs, i, j,
59 MIN(16, x + w - i), MIN(16, y + h - j),
60 last_bg, last_fg, &has_bg, &has_fg);
61 }
62 }
63 g_free(last_fg);
64 g_free(last_bg);
65
66 return 1;
67}
68
69void vnc_hextile_set_pixel_conversion(VncState *vs, int generic)
70{
71 if (!generic) {
72 switch (VNC_SERVER_FB_BITS) {
73 case 32:
74 vs->hextile.send_tile = send_hextile_tile_32;
75 break;
76 }
77 } else {
78 switch (VNC_SERVER_FB_BITS) {
79 case 32:
80 vs->hextile.send_tile = send_hextile_tile_generic_32;
81 break;
82 }
83 }
84}
85