vnc.c (31b2bd89b915d527ff907e8f3c151585e0c45d4f) vnc.c (0780ec7be82dd4781e9fd216b5d99a125882ff5a)
1/*
2 * QEMU VNC display driver
3 *
4 * Copyright (C) 2006 Anthony Liguori <anthony@codemonkey.ws>
5 * Copyright (C) 2006 Fabrice Bellard
6 * Copyright (C) 2009 Red Hat, Inc
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy

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

893 row += vnc_server_fb_stride(vd);
894 }
895 return 1;
896}
897
898int vnc_send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
899{
900 int n = 0;
1/*
2 * QEMU VNC display driver
3 *
4 * Copyright (C) 2006 Anthony Liguori <anthony@codemonkey.ws>
5 * Copyright (C) 2006 Fabrice Bellard
6 * Copyright (C) 2009 Red Hat, Inc
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy

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

893 row += vnc_server_fb_stride(vd);
894 }
895 return 1;
896}
897
898int vnc_send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
899{
900 int n = 0;
901 bool encode_raw = false;
902 size_t saved_offs = vs->output.offset;
903
904 switch(vs->vnc_encoding) {
905 case VNC_ENCODING_ZLIB:
906 n = vnc_zlib_send_framebuffer_update(vs, x, y, w, h);
907 break;
908 case VNC_ENCODING_HEXTILE:
909 vnc_framebuffer_update(vs, x, y, w, h, VNC_ENCODING_HEXTILE);
910 n = vnc_hextile_send_framebuffer_update(vs, x, y, w, h);

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

917 break;
918 case VNC_ENCODING_ZRLE:
919 n = vnc_zrle_send_framebuffer_update(vs, x, y, w, h);
920 break;
921 case VNC_ENCODING_ZYWRLE:
922 n = vnc_zywrle_send_framebuffer_update(vs, x, y, w, h);
923 break;
924 default:
901
902 switch(vs->vnc_encoding) {
903 case VNC_ENCODING_ZLIB:
904 n = vnc_zlib_send_framebuffer_update(vs, x, y, w, h);
905 break;
906 case VNC_ENCODING_HEXTILE:
907 vnc_framebuffer_update(vs, x, y, w, h, VNC_ENCODING_HEXTILE);
908 n = vnc_hextile_send_framebuffer_update(vs, x, y, w, h);

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

915 break;
916 case VNC_ENCODING_ZRLE:
917 n = vnc_zrle_send_framebuffer_update(vs, x, y, w, h);
918 break;
919 case VNC_ENCODING_ZYWRLE:
920 n = vnc_zywrle_send_framebuffer_update(vs, x, y, w, h);
921 break;
922 default:
925 encode_raw = true;
923 vnc_framebuffer_update(vs, x, y, w, h, VNC_ENCODING_RAW);
924 n = vnc_raw_send_framebuffer_update(vs, x, y, w, h);
926 break;
927 }
925 break;
926 }
928
929 /* If the client has the same pixel format as our internal buffer and
930 * a RAW encoding would need less space fall back to RAW encoding to
931 * save bandwidth and processing power in the client. */
932 if (!encode_raw && vs->write_pixels == vnc_write_pixels_copy &&
933 12 + h * w * VNC_SERVER_FB_BYTES <= (vs->output.offset - saved_offs)) {
934 vs->output.offset = saved_offs;
935 encode_raw = true;
936 }
937
938 if (encode_raw) {
939 vnc_framebuffer_update(vs, x, y, w, h, VNC_ENCODING_RAW);
940 n = vnc_raw_send_framebuffer_update(vs, x, y, w, h);
941 }
942
943 return n;
944}
945
946static void vnc_mouse_set(DisplayChangeListener *dcl,
947 int x, int y, int visible)
948{
949 /* can we ask the client(s) to move the pointer ??? */
950}

--- 3180 unchanged lines hidden ---
927 return n;
928}
929
930static void vnc_mouse_set(DisplayChangeListener *dcl,
931 int x, int y, int visible)
932{
933 /* can we ask the client(s) to move the pointer ??? */
934}

--- 3180 unchanged lines hidden ---