From 8aa6fb9523957c7f4a3f14fb2c90ea9f9292a41f Mon Sep 17 00:00:00 2001 From: runge Date: Sun, 17 Dec 2006 23:34:25 +0000 Subject: x11vnc: first pass at client-side caching, -ncache option. --- x11vnc/screen.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'x11vnc/screen.c') diff --git a/x11vnc/screen.c b/x11vnc/screen.c index 45e951d..57244a5 100644 --- a/x11vnc/screen.c +++ b/x11vnc/screen.c @@ -2033,6 +2033,23 @@ void initialize_screen(int *argc, char **argv, XImage *fb) { } } +#ifndef NO_NCACHE + if (ncache > 0) { + char *new_fb; + int sz = fb->height * fb->bytes_per_line; + + new_fb = (char *) calloc((size_t) (sz * (1+ncache)), 1); + if (fb->data) { + memcpy(new_fb, fb->data, sz); + free(fb->data); + } + fb->data = new_fb; + fb->height *= (1+ncache); + height *= (1+ncache); + ncache0 = ncache; + } +#endif + if (cmap8to24 && depth == 8) { rfb_bytes_per_line *= 4; rot_bytes_per_line *= 4; -- cgit v1.2.1