aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--unix/x0vncserver/Image.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/unix/x0vncserver/Image.cxx b/unix/x0vncserver/Image.cxx
index ca3d6429..f1a45933 100644
--- a/unix/x0vncserver/Image.cxx
+++ b/unix/x0vncserver/Image.cxx
@@ -315,8 +315,13 @@ void ShmImage::get(Window wnd, int x, int y)
void ShmImage::get(Window wnd, int x, int y, int w, int h,
int dst_x, int dst_y)
{
- // FIXME: Use SHM for this as well?
- XGetSubImage(dpy, wnd, x, y, w, h, AllPlanes, ZPixmap, xim, dst_x, dst_y);
+ // XShmGetImage is faster, but can only retrieve the entire
+ // window. Use it for large reads.
+ if (x == dst_x && y == dst_y && (long)w * h > (long)xim->width * xim->height / 4) {
+ XShmGetImage(dpy, wnd, xim, 0, 0, AllPlanes);
+ } else {
+ XGetSubImage(dpy, wnd, x, y, w, h, AllPlanes, ZPixmap, xim, dst_x, dst_y);
+ }
}
//