vnc-enc-tight.c (63e3555e80c31776285accbb4d0c14ae91c457dc) vnc-enc-tight.c (d39fa6d86d07646e3481e5c3e45a984bff590642)
1/*
2 * QEMU VNC display driver: tight encoding
3 *
4 * From libvncserver/libvncserver/tight.c
5 * Copyright (C) 2000, 2001 Const Kaplinsky. All Rights Reserved.
6 * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
7 *
8 * Copyright (C) 2010 Corentin Chary <corentin.chary@gmail.com>

--- 109 unchanged lines hidden (view full) ---

118 VncPalette *palette);
119
120static bool tight_can_send_png_rect(VncState *vs, int w, int h)
121{
122 if (vs->tight.type != VNC_ENCODING_TIGHT_PNG) {
123 return false;
124 }
125
1/*
2 * QEMU VNC display driver: tight encoding
3 *
4 * From libvncserver/libvncserver/tight.c
5 * Copyright (C) 2000, 2001 Const Kaplinsky. All Rights Reserved.
6 * Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
7 *
8 * Copyright (C) 2010 Corentin Chary <corentin.chary@gmail.com>

--- 109 unchanged lines hidden (view full) ---

118 VncPalette *palette);
119
120static bool tight_can_send_png_rect(VncState *vs, int w, int h)
121{
122 if (vs->tight.type != VNC_ENCODING_TIGHT_PNG) {
123 return false;
124 }
125
126 if (ds_get_bytes_per_pixel(vs->ds) == 1 ||
126 if (surface_bytes_per_pixel(vs->vd->ds) == 1 ||
127 vs->client_pf.bytes_per_pixel == 1) {
128 return false;
129 }
130
131 return true;
132}
133#endif
134

--- 161 unchanged lines hidden (view full) ---

296 unsigned int errors;
297 int compression = vs->tight.compression;
298 int quality = vs->tight.quality;
299
300 if (!vs->vd->lossy) {
301 return 0;
302 }
303
127 vs->client_pf.bytes_per_pixel == 1) {
128 return false;
129 }
130
131 return true;
132}
133#endif
134

--- 161 unchanged lines hidden (view full) ---

296 unsigned int errors;
297 int compression = vs->tight.compression;
298 int quality = vs->tight.quality;
299
300 if (!vs->vd->lossy) {
301 return 0;
302 }
303
304 if (ds_get_bytes_per_pixel(vs->ds) == 1 ||
304 if (surface_bytes_per_pixel(vs->vd->ds) == 1 ||
305 vs->client_pf.bytes_per_pixel == 1 ||
306 w < VNC_TIGHT_DETECT_MIN_WIDTH || h < VNC_TIGHT_DETECT_MIN_HEIGHT) {
307 return 0;
308 }
309
310 if (vs->tight.quality != (uint8_t)-1) {
311 if (w * h < VNC_TIGHT_JPEG_MIN_RECT_SIZE) {
312 return 0;

--- 866 unchanged lines hidden (view full) ---

1179 struct jpeg_compress_struct cinfo;
1180 struct jpeg_error_mgr jerr;
1181 struct jpeg_destination_mgr manager;
1182 pixman_image_t *linebuf;
1183 JSAMPROW row[1];
1184 uint8_t *buf;
1185 int dy;
1186
305 vs->client_pf.bytes_per_pixel == 1 ||
306 w < VNC_TIGHT_DETECT_MIN_WIDTH || h < VNC_TIGHT_DETECT_MIN_HEIGHT) {
307 return 0;
308 }
309
310 if (vs->tight.quality != (uint8_t)-1) {
311 if (w * h < VNC_TIGHT_JPEG_MIN_RECT_SIZE) {
312 return 0;

--- 866 unchanged lines hidden (view full) ---

1179 struct jpeg_compress_struct cinfo;
1180 struct jpeg_error_mgr jerr;
1181 struct jpeg_destination_mgr manager;
1182 pixman_image_t *linebuf;
1183 JSAMPROW row[1];
1184 uint8_t *buf;
1185 int dy;
1186
1187 if (ds_get_bytes_per_pixel(vs->ds) == 1)
1187 if (surface_bytes_per_pixel(vs->vd->ds) == 1) {
1188 return send_full_color_rect(vs, x, y, w, h);
1188 return send_full_color_rect(vs, x, y, w, h);
1189 }
1189
1190 buffer_reserve(&vs->tight.jpeg, 2048);
1191
1192 cinfo.err = jpeg_std_error(&jerr);
1193 jpeg_create_compress(&cinfo);
1194
1195 cinfo.client_data = vs;
1196 cinfo.image_width = w;

--- 499 unchanged lines hidden ---
1190
1191 buffer_reserve(&vs->tight.jpeg, 2048);
1192
1193 cinfo.err = jpeg_std_error(&jerr);
1194 jpeg_create_compress(&cinfo);
1195
1196 cinfo.client_data = vs;
1197 cinfo.image_width = w;

--- 499 unchanged lines hidden ---