Code refactoring: passing geometry to XPixelBuffer as a Rect instead of four
int values.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2574 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/unix/x0vncserver/XPixelBuffer.cxx b/unix/x0vncserver/XPixelBuffer.cxx
index 7e515b2..ed22508 100644
--- a/unix/x0vncserver/XPixelBuffer.cxx
+++ b/unix/x0vncserver/XPixelBuffer.cxx
@@ -28,18 +28,14 @@
using namespace rfb;
XPixelBuffer::XPixelBuffer(Display *dpy, ImageFactory &factory,
- int offsetLeft, int offsetTop,
- int width, int height,
- ColourMap* cm)
+ const Rect &rect, ColourMap* cm)
: FullFramePixelBuffer(),
m_dpy(dpy),
- m_image(0),
- m_offsetLeft(offsetLeft),
- m_offsetTop(offsetTop),
+ m_image(factory.newImage(dpy, rect.width(), rect.height())),
+ m_offsetLeft(rect.tl.x),
+ m_offsetTop(rect.tl.y),
m_stride(0)
{
- m_image = factory.newImage(dpy, width, height);
-
// Fill in the PixelFormat structure of the parent class.
format.bpp = m_image->xim->bits_per_pixel;
format.depth = m_image->xim->depth;
@@ -53,13 +49,13 @@
format.blueMax = m_image->xim->blue_mask >> format.blueShift;
// Set up the remaining data of the parent class.
- width_ = width;
- height_ = height;
+ width_ = rect.width();
+ height_ = rect.height();
data = (rdr::U8 *)m_image->xim->data;
colourmap = cm;
// Calculate the distance in pixels between two subsequent scan
- // lines of the framebuffer.
+ // lines of the framebuffer. This may differ from image width.
m_stride = m_image->xim->bytes_per_line * 8 / m_image->xim->bits_per_pixel;
// Get initial screen image from the X display.