vnc.c (3d861a01093f8eedfac9889746ccafcfd32039b7) vnc.c (de3f7de7f4e257ce44cdabb90f5f17ee99624557)
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

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

835 row += vnc_server_fb_stride(vd);
836 }
837 return 1;
838}
839
840int vnc_send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
841{
842 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

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

835 row += vnc_server_fb_stride(vd);
836 }
837 return 1;
838}
839
840int vnc_send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
841{
842 int n = 0;
843 bool encode_raw = false;
844 size_t saved_offs = vs->output.offset;
843
844 switch(vs->vnc_encoding) {
845 case VNC_ENCODING_ZLIB:
846 n = vnc_zlib_send_framebuffer_update(vs, x, y, w, h);
847 break;
848 case VNC_ENCODING_HEXTILE:
849 vnc_framebuffer_update(vs, x, y, w, h, VNC_ENCODING_HEXTILE);
850 n = vnc_hextile_send_framebuffer_update(vs, x, y, w, h);

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

857 break;
858 case VNC_ENCODING_ZRLE:
859 n = vnc_zrle_send_framebuffer_update(vs, x, y, w, h);
860 break;
861 case VNC_ENCODING_ZYWRLE:
862 n = vnc_zywrle_send_framebuffer_update(vs, x, y, w, h);
863 break;
864 default:
845
846 switch(vs->vnc_encoding) {
847 case VNC_ENCODING_ZLIB:
848 n = vnc_zlib_send_framebuffer_update(vs, x, y, w, h);
849 break;
850 case VNC_ENCODING_HEXTILE:
851 vnc_framebuffer_update(vs, x, y, w, h, VNC_ENCODING_HEXTILE);
852 n = vnc_hextile_send_framebuffer_update(vs, x, y, w, h);

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

859 break;
860 case VNC_ENCODING_ZRLE:
861 n = vnc_zrle_send_framebuffer_update(vs, x, y, w, h);
862 break;
863 case VNC_ENCODING_ZYWRLE:
864 n = vnc_zywrle_send_framebuffer_update(vs, x, y, w, h);
865 break;
866 default:
865 vnc_framebuffer_update(vs, x, y, w, h, VNC_ENCODING_RAW);
866 n = vnc_raw_send_framebuffer_update(vs, x, y, w, h);
867 encode_raw = true;
867 break;
868 }
868 break;
869 }
870
871 /* If the client has the same pixel format as our internal buffer and
872 * a RAW encoding would need less space fall back to RAW encoding to
873 * save bandwidth and processing power in the client. */
874 if (!encode_raw && vs->write_pixels == vnc_write_pixels_copy &&
875 12 + h * w * VNC_SERVER_FB_BYTES <= (vs->output.offset - saved_offs)) {
876 vs->output.offset = saved_offs;
877 encode_raw = true;
878 }
879
880 if (encode_raw) {
881 vnc_framebuffer_update(vs, x, y, w, h, VNC_ENCODING_RAW);
882 n = vnc_raw_send_framebuffer_update(vs, x, y, w, h);
883 }
884
869 return n;
870}
871
872static void vnc_copy(VncState *vs, int src_x, int src_y, int dst_x, int dst_y, int w, int h)
873{
874 /* send bitblit op to the vnc client */
875 vnc_lock_output(vs);
876 vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);

--- 2997 unchanged lines hidden ---
885 return n;
886}
887
888static void vnc_copy(VncState *vs, int src_x, int src_y, int dst_x, int dst_y, int w, int h)
889{
890 /* send bitblit op to the vnc client */
891 vnc_lock_output(vs);
892 vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE);

--- 2997 unchanged lines hidden ---