Loading ui/vnc-enc-tight.c +55 −25 Original line number Diff line number Diff line Loading @@ -1452,34 +1452,39 @@ static void vnc_tight_stop(VncState *vs) vs->output = vs->tight.tmp; } static int send_sub_rect(VncState *vs, int x, int y, int w, int h) static int send_sub_rect_nojpeg(VncState *vs, int x, int y, int w, int h, int bg, int fg, int colors, VncPalette *palette) { VncPalette *palette = NULL; uint32_t bg = 0, fg = 0; int colors; int ret = 0; vnc_framebuffer_update(vs, x, y, w, h, vs->tight.type); vnc_tight_start(vs); vnc_raw_send_framebuffer_update(vs, x, y, w, h); vnc_tight_stop(vs); colors = tight_fill_palette(vs, x, y, w * h, &fg, &bg, &palette); int ret; if (colors == 0) { if (tight_detect_smooth_image(vs, w, h)) { if (vs->tight.quality == -1) { ret = send_gradient_rect(vs, x, y, w, h); } else { ret = send_full_color_rect(vs, x, y, w, h); } } else if (colors == 1) { ret = send_solid_rect(vs); } else if (colors == 2) { ret = send_mono_rect(vs, x, y, w, h, bg, fg); } else if (colors <= 256) { ret = send_palette_rect(vs, x, y, w, h, palette); } return ret; } #ifdef CONFIG_VNC_JPEG static int send_sub_rect_jpeg(VncState *vs, int x, int y, int w, int h, int bg, int fg, int colors, VncPalette *palette) { int ret; if (colors == 0) { if (tight_detect_smooth_image(vs, w, h)) { int quality = tight_conf[vs->tight.quality].jpeg_quality; ret = send_jpeg_rect(vs, x, y, w, h, quality); #else ret = send_full_color_rect(vs, x, y, w, h); #endif } } else { ret = send_full_color_rect(vs, x, y, w, h); } Loading @@ -1488,8 +1493,7 @@ static int send_sub_rect(VncState *vs, int x, int y, int w, int h) } else if (colors == 2) { ret = send_mono_rect(vs, x, y, w, h, bg, fg); } else if (colors <= 256) { #ifdef CONFIG_VNC_JPEG if (colors > 96 && vs->tight.quality != -1 && vs->tight.quality <= 3 && if (colors > 96 && tight_detect_smooth_image(vs, w, h)) { int quality = tight_conf[vs->tight.quality].jpeg_quality; Loading @@ -1497,10 +1501,36 @@ static int send_sub_rect(VncState *vs, int x, int y, int w, int h) } else { ret = send_palette_rect(vs, x, y, w, h, palette); } #else ret = send_palette_rect(vs, x, y, w, h, palette); } return ret; } #endif static int send_sub_rect(VncState *vs, int x, int y, int w, int h) { VncPalette *palette = NULL; uint32_t bg = 0, fg = 0; int colors; int ret = 0; vnc_framebuffer_update(vs, x, y, w, h, vs->tight.type); vnc_tight_start(vs); vnc_raw_send_framebuffer_update(vs, x, y, w, h); vnc_tight_stop(vs); colors = tight_fill_palette(vs, x, y, w * h, &fg, &bg, &palette); #ifdef CONFIG_VNC_JPEG if (vs->tight.quality != -1) { ret = send_sub_rect_jpeg(vs, x, y, w, h, bg, fg, colors, palette); } else { ret = send_sub_rect_nojpeg(vs, x, y, w, h, bg, fg, colors, palette); } #else ret = send_sub_rect_nojpeg(vs, x, y, w, h, bg, fg, colors, palette); #endif palette_destroy(palette); return ret; } Loading Loading
ui/vnc-enc-tight.c +55 −25 Original line number Diff line number Diff line Loading @@ -1452,34 +1452,39 @@ static void vnc_tight_stop(VncState *vs) vs->output = vs->tight.tmp; } static int send_sub_rect(VncState *vs, int x, int y, int w, int h) static int send_sub_rect_nojpeg(VncState *vs, int x, int y, int w, int h, int bg, int fg, int colors, VncPalette *palette) { VncPalette *palette = NULL; uint32_t bg = 0, fg = 0; int colors; int ret = 0; vnc_framebuffer_update(vs, x, y, w, h, vs->tight.type); vnc_tight_start(vs); vnc_raw_send_framebuffer_update(vs, x, y, w, h); vnc_tight_stop(vs); colors = tight_fill_palette(vs, x, y, w * h, &fg, &bg, &palette); int ret; if (colors == 0) { if (tight_detect_smooth_image(vs, w, h)) { if (vs->tight.quality == -1) { ret = send_gradient_rect(vs, x, y, w, h); } else { ret = send_full_color_rect(vs, x, y, w, h); } } else if (colors == 1) { ret = send_solid_rect(vs); } else if (colors == 2) { ret = send_mono_rect(vs, x, y, w, h, bg, fg); } else if (colors <= 256) { ret = send_palette_rect(vs, x, y, w, h, palette); } return ret; } #ifdef CONFIG_VNC_JPEG static int send_sub_rect_jpeg(VncState *vs, int x, int y, int w, int h, int bg, int fg, int colors, VncPalette *palette) { int ret; if (colors == 0) { if (tight_detect_smooth_image(vs, w, h)) { int quality = tight_conf[vs->tight.quality].jpeg_quality; ret = send_jpeg_rect(vs, x, y, w, h, quality); #else ret = send_full_color_rect(vs, x, y, w, h); #endif } } else { ret = send_full_color_rect(vs, x, y, w, h); } Loading @@ -1488,8 +1493,7 @@ static int send_sub_rect(VncState *vs, int x, int y, int w, int h) } else if (colors == 2) { ret = send_mono_rect(vs, x, y, w, h, bg, fg); } else if (colors <= 256) { #ifdef CONFIG_VNC_JPEG if (colors > 96 && vs->tight.quality != -1 && vs->tight.quality <= 3 && if (colors > 96 && tight_detect_smooth_image(vs, w, h)) { int quality = tight_conf[vs->tight.quality].jpeg_quality; Loading @@ -1497,10 +1501,36 @@ static int send_sub_rect(VncState *vs, int x, int y, int w, int h) } else { ret = send_palette_rect(vs, x, y, w, h, palette); } #else ret = send_palette_rect(vs, x, y, w, h, palette); } return ret; } #endif static int send_sub_rect(VncState *vs, int x, int y, int w, int h) { VncPalette *palette = NULL; uint32_t bg = 0, fg = 0; int colors; int ret = 0; vnc_framebuffer_update(vs, x, y, w, h, vs->tight.type); vnc_tight_start(vs); vnc_raw_send_framebuffer_update(vs, x, y, w, h); vnc_tight_stop(vs); colors = tight_fill_palette(vs, x, y, w * h, &fg, &bg, &palette); #ifdef CONFIG_VNC_JPEG if (vs->tight.quality != -1) { ret = send_sub_rect_jpeg(vs, x, y, w, h, bg, fg, colors, palette); } else { ret = send_sub_rect_nojpeg(vs, x, y, w, h, bg, fg, colors, palette); } #else ret = send_sub_rect_nojpeg(vs, x, y, w, h, bg, fg, colors, palette); #endif palette_destroy(palette); return ret; } Loading