Extended Image::get() methods with a version that can write pixel data at a given offset in the destination image.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2333 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/unix/x0vncserver/Image.cxx b/unix/x0vncserver/Image.cxx
index fc66c5a..12da549 100644
--- a/unix/x0vncserver/Image.cxx
+++ b/unix/x0vncserver/Image.cxx
@@ -100,9 +100,10 @@
get(wnd, x, y, xim->width, xim->height);
}
-void Image::get(Window wnd, int x, int y, int w, int h)
+void Image::get(Window wnd, int x, int y, int w, int h,
+ int dst_x, int dst_y)
{
- XGetSubImage(dpy, wnd, x, y, w, h, AllPlanes, ZPixmap, xim, 0, 0);
+ XGetSubImage(dpy, wnd, x, y, w, h, AllPlanes, ZPixmap, xim, dst_x, dst_y);
}
//
@@ -314,10 +315,11 @@
XShmGetImage(dpy, wnd, xim, x, y, AllPlanes);
}
-void ShmImage::get(Window wnd, int x, int y, int w, int h)
+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, 0, 0);
+ XGetSubImage(dpy, wnd, x, y, w, h, AllPlanes, ZPixmap, xim, dst_x, dst_y);
}
#ifdef HAVE_READDISPLAY
@@ -408,7 +410,8 @@
get(wnd, x, y, xim->width, xim->height);
}
-void IrixOverlayShmImage::get(Window wnd, int x, int y, int w, int h)
+void IrixOverlayShmImage::get(Window wnd, int x, int y, int w, int h,
+ int dst_x, int dst_y)
{
XRectangle rect;
unsigned long hints = XRD_TRANSPARENT | XRD_READ_POINTER;
@@ -419,7 +422,8 @@
rect.height = h;
XShmReadDisplayRects(dpy, wnd,
- &rect, 1, readDisplayBuf, -x, -y,
+ &rect, 1, readDisplayBuf,
+ dst_x - x, dst_y - y,
hints, &hints);
}
@@ -464,13 +468,14 @@
get(wnd, x, y, xim->width, xim->height);
}
-void SolarisOverlayImage::get(Window wnd, int x, int y, int w, int h)
+void SolarisOverlayImage::get(Window wnd, int x, int y, int w, int h,
+ int dst_x, int dst_y)
{
XImage *tmp_xim = XReadScreen(dpy, wnd, x, y, w, h, True);
if (tmp_xim == NULL)
return;
- updateRect(tmp_xim, 0, 0);
+ updateRect(tmp_xim, dst_x, dst_y);
XDestroyImage(tmp_xim);
}
diff --git a/unix/x0vncserver/Image.h b/unix/x0vncserver/Image.h
index 535cee6..43c0b0b 100644
--- a/unix/x0vncserver/Image.h
+++ b/unix/x0vncserver/Image.h
@@ -48,9 +48,10 @@
}
virtual void get(Window wnd, int x = 0, int y = 0);
- virtual void get(Window wnd, int x, int y, int w, int h);
+ virtual void get(Window wnd, int x, int y, int w, int h,
+ int dst_x = 0, int dst_y = 0);
-// Copying pixels from one image to another.
+ // Copying pixels from one image to another.
virtual void updateRect(XImage *src, int dst_x = 0, int dst_y = 0);
virtual void updateRect(Image *src, int dst_x = 0, int dst_y = 0);
virtual void updateRect(XImage *src, int dst_x, int dst_y, int w, int h);
@@ -104,7 +105,8 @@
}
virtual void get(Window wnd, int x = 0, int y = 0);
- virtual void get(Window wnd, int x, int y, int w, int h);
+ virtual void get(Window wnd, int x, int y, int w, int h,
+ int dst_x = 0, int dst_y = 0);
protected:
@@ -140,7 +142,8 @@
}
virtual void get(Window wnd, int x = 0, int y = 0);
- virtual void get(Window wnd, int x, int y, int w, int h);
+ virtual void get(Window wnd, int x, int y, int w, int h,
+ int dst_x = 0, int dst_y = 0);
protected:
@@ -185,7 +188,8 @@
}
virtual void get(Window wnd, int x = 0, int y = 0);
- virtual void get(Window wnd, int x, int y, int w, int h);
+ virtual void get(Window wnd, int x, int y, int w, int h,
+ int dst_x = 0, int dst_y = 0);
protected: