Revision 3512779a vnchextile.h
b/vnchextile.h | ||
---|---|---|
1 | 1 |
#define CONCAT_I(a, b) a ## b |
2 | 2 |
#define CONCAT(a, b) CONCAT_I(a, b) |
3 | 3 |
#define pixel_t CONCAT(uint, CONCAT(BPP, _t)) |
4 |
|
|
5 |
static void CONCAT(send_hextile_tile_, BPP)(VncState *vs, |
|
6 |
int x, int y, int w, int h, |
|
7 |
pixel_t *last_bg, pixel_t *last_fg, |
|
8 |
int *has_bg, int *has_fg) |
|
4 |
#ifdef GENERIC |
|
5 |
#define NAME generic |
|
6 |
#else |
|
7 |
#define NAME BPP |
|
8 |
#endif |
|
9 |
|
|
10 |
static void CONCAT(send_hextile_tile_, NAME)(VncState *vs, |
|
11 |
int x, int y, int w, int h, |
|
12 |
uint32_t *last_bg32, |
|
13 |
uint32_t *last_fg32, |
|
14 |
int *has_bg, int *has_fg) |
|
9 | 15 |
{ |
10 | 16 |
char *row = (vs->ds->data + y * vs->ds->linesize + x * vs->depth); |
11 | 17 |
pixel_t *irow = (pixel_t *)row; |
12 | 18 |
int j, i; |
19 |
pixel_t *last_bg = (pixel_t *)last_bg32; |
|
20 |
pixel_t *last_fg = (pixel_t *)last_fg32; |
|
13 | 21 |
pixel_t bg = 0; |
14 | 22 |
pixel_t fg = 0; |
15 | 23 |
int n_colors = 0; |
... | ... | |
122 | 130 |
has_color = 1; |
123 | 131 |
} else if (irow[i] != color) { |
124 | 132 |
has_color = 0; |
125 |
|
|
133 |
#ifdef GENERIC |
|
134 |
vnc_convert_pixel(vs, data + n_data, color); |
|
135 |
n_data += vs->pix_bpp; |
|
136 |
#else |
|
126 | 137 |
memcpy(data + n_data, &color, sizeof(color)); |
127 |
hextile_enc_cord(data + n_data + sizeof(pixel_t), min_x, j, i - min_x, 1); |
|
128 |
n_data += 2 + sizeof(pixel_t); |
|
138 |
n_data += sizeof(pixel_t); |
|
139 |
#endif |
|
140 |
hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1); |
|
141 |
n_data += 2; |
|
129 | 142 |
n_subtiles++; |
130 | 143 |
|
131 | 144 |
min_x = -1; |
... | ... | |
137 | 150 |
} |
138 | 151 |
} |
139 | 152 |
if (has_color) { |
140 |
memcpy(data + n_data, &color, sizeof(color)); |
|
141 |
hextile_enc_cord(data + n_data + sizeof(pixel_t), min_x, j, i - min_x, 1); |
|
142 |
n_data += 2 + sizeof(pixel_t); |
|
153 |
#ifdef GENERIC |
|
154 |
vnc_convert_pixel(vs, data + n_data, color); |
|
155 |
n_data += vs->pix_bpp; |
|
156 |
#else |
|
157 |
memcpy(data + n_data, &color, sizeof(color)); |
|
158 |
n_data += sizeof(pixel_t); |
|
159 |
#endif |
|
160 |
hextile_enc_cord(data + n_data, min_x, j, i - min_x, 1); |
|
161 |
n_data += 2; |
|
143 | 162 |
n_subtiles++; |
144 | 163 |
} |
145 | 164 |
irow += vs->ds->linesize / sizeof(pixel_t); |
... | ... | |
169 | 188 |
vnc_write_u8(vs, flags); |
170 | 189 |
if (n_colors < 4) { |
171 | 190 |
if (flags & 0x02) |
172 |
vnc_write(vs, last_bg, sizeof(pixel_t));
|
|
191 |
vs->write_pixels(vs, last_bg, sizeof(pixel_t));
|
|
173 | 192 |
if (flags & 0x04) |
174 |
vnc_write(vs, last_fg, sizeof(pixel_t));
|
|
193 |
vs->write_pixels(vs, last_fg, sizeof(pixel_t));
|
|
175 | 194 |
if (n_subtiles) { |
176 | 195 |
vnc_write_u8(vs, n_subtiles); |
177 | 196 |
vnc_write(vs, data, n_data); |
178 | 197 |
} |
179 | 198 |
} else { |
180 | 199 |
for (j = 0; j < h; j++) { |
181 |
vnc_write(vs, row, w * vs->depth);
|
|
200 |
vs->write_pixels(vs, row, w * vs->depth);
|
|
182 | 201 |
row += vs->ds->linesize; |
183 | 202 |
} |
184 | 203 |
} |
185 | 204 |
} |
186 | 205 |
|
206 |
#undef NAME |
|
187 | 207 |
#undef pixel_t |
188 | 208 |
#undef CONCAT_I |
189 | 209 |
#undef CONCAT |
Also available in: Unified diff