summaryrefslogtreecommitdiffstats
path: root/unix/x0vncserver
diff options
context:
space:
mode:
authorConstantin Kaplinsky <const@tightvnc.com>2008-06-04 04:30:10 +0000
committerConstantin Kaplinsky <const@tightvnc.com>2008-06-04 04:30:10 +0000
commitf773a8e2db032ce518632514f7229f25f6de99ad (patch)
treed025e71bca21951997b940e27ab6693f8e57c683 /unix/x0vncserver
parent23c60222f2d481166230788c87df801ec2902678 (diff)
downloadtigervnc-f773a8e2db032ce518632514f7229f25f6de99ad.tar.gz
tigervnc-f773a8e2db032ce518632514f7229f25f6de99ad.zip
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
Diffstat (limited to 'unix/x0vncserver')
-rw-r--r--unix/x0vncserver/XPixelBuffer.cxx18
-rw-r--r--unix/x0vncserver/XPixelBuffer.h4
-rw-r--r--unix/x0vncserver/x0vncserver.cxx5
3 files changed, 9 insertions, 18 deletions
diff --git a/unix/x0vncserver/XPixelBuffer.cxx b/unix/x0vncserver/XPixelBuffer.cxx
index 7e515b25..ed22508d 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 @@ XPixelBuffer::XPixelBuffer(Display *dpy, ImageFactory &factory,
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.
diff --git a/unix/x0vncserver/XPixelBuffer.h b/unix/x0vncserver/XPixelBuffer.h
index 7829038c..25a3d844 100644
--- a/unix/x0vncserver/XPixelBuffer.h
+++ b/unix/x0vncserver/XPixelBuffer.h
@@ -36,9 +36,7 @@ class XPixelBuffer : public FullFramePixelBuffer
{
public:
XPixelBuffer(Display *dpy, ImageFactory &factory,
- int offsetLeft, int offsetTop,
- int width, int height,
- ColourMap* cm);
+ const Rect &rect, ColourMap* cm);
virtual ~XPixelBuffer();
// We allow public access to the underlying Image object.
diff --git a/unix/x0vncserver/x0vncserver.cxx b/unix/x0vncserver/x0vncserver.cxx
index 5016d12c..2d387618 100644
--- a/unix/x0vncserver/x0vncserver.cxx
+++ b/unix/x0vncserver/x0vncserver.cxx
@@ -180,10 +180,7 @@ public:
// Provide pixel buffer to the server object.
// FIXME: Pass coordinates in a structure?
- pb = new XPixelBuffer(dpy, factory,
- geometry->offsetLeft(), geometry->offsetTop(),
- geometry->width(), geometry->height(),
- this);
+ pb = new XPixelBuffer(dpy, factory, geometry->getRect(), this);
vlog.info("Allocated %s", pb->getImage()->classDesc());
server = vs;