summaryrefslogtreecommitdiffstats
path: root/unix/x0vncserver
diff options
context:
space:
mode:
authorConstantin Kaplinsky <const@tightvnc.com>2008-06-03 11:21:42 +0000
committerConstantin Kaplinsky <const@tightvnc.com>2008-06-03 11:21:42 +0000
commit1d2967f9063d2afeb80086630d4bb933e8e73f80 (patch)
treef2433745866600367adfe0b0b1cb54a527ad2abd /unix/x0vncserver
parent455ad979f95ac5084a5de02aefc9a4bc2686ba7c (diff)
downloadtigervnc-1d2967f9063d2afeb80086630d4bb933e8e73f80.tar.gz
tigervnc-1d2967f9063d2afeb80086630d4bb933e8e73f80.zip
Code refactoring: setting pixel format in XPixelBuffer instead of XDesktop.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2571 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'unix/x0vncserver')
-rw-r--r--unix/x0vncserver/XPixelBuffer.cxx25
-rw-r--r--unix/x0vncserver/XPixelBuffer.h2
-rw-r--r--unix/x0vncserver/x0vncserver.cxx14
3 files changed, 23 insertions, 18 deletions
diff --git a/unix/x0vncserver/XPixelBuffer.cxx b/unix/x0vncserver/XPixelBuffer.cxx
index 2692c18a..164c7042 100644
--- a/unix/x0vncserver/XPixelBuffer.cxx
+++ b/unix/x0vncserver/XPixelBuffer.cxx
@@ -29,16 +29,33 @@ using namespace rfb;
XPixelBuffer::XPixelBuffer(Display *dpy, Image* image,
int offsetLeft, int offsetTop,
- const PixelFormat& pf, ColourMap* cm)
- : FullFramePixelBuffer(pf, image->xim->width, image->xim->height,
- (rdr::U8 *)image->xim->data, cm),
+ ColourMap* cm)
+ : FullFramePixelBuffer(),
m_dpy(dpy),
m_image(image),
m_offsetLeft(offsetLeft),
m_offsetTop(offsetTop),
m_stride(image->xim->bytes_per_line * 8 / image->xim->bits_per_pixel)
{
- // Get initial screen image.
+ // Fill in the PixelFormat structure of the parent class.
+ format.bpp = image->xim->bits_per_pixel;
+ format.depth = image->xim->depth;
+ format.bigEndian = (image->xim->byte_order == MSBFirst);
+ format.trueColour = image->isTrueColor();
+ format.redShift = ffs(image->xim->red_mask) - 1;
+ format.greenShift = ffs(image->xim->green_mask) - 1;
+ format.blueShift = ffs(image->xim->blue_mask) - 1;
+ format.redMax = image->xim->red_mask >> format.redShift;
+ format.greenMax = image->xim->green_mask >> format.greenShift;
+ format.blueMax = image->xim->blue_mask >> format.blueShift;
+
+ // Set up the remaining data of the parent class.
+ width_ = image->xim->width;
+ height_ = image->xim->height;
+ data = (rdr::U8 *)image->xim->data;
+ colourmap = cm;
+
+ // Get initial screen image from the X display.
m_image->get(DefaultRootWindow(m_dpy), m_offsetLeft, m_offsetTop);
}
diff --git a/unix/x0vncserver/XPixelBuffer.h b/unix/x0vncserver/XPixelBuffer.h
index b909bb8a..75cd552d 100644
--- a/unix/x0vncserver/XPixelBuffer.h
+++ b/unix/x0vncserver/XPixelBuffer.h
@@ -37,7 +37,7 @@ class XPixelBuffer : public FullFramePixelBuffer
public:
XPixelBuffer(Display *dpy, Image* image,
int offsetLeft, int offsetTop,
- const PixelFormat& pf, ColourMap* cm);
+ 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 edaf1a8c..9331cf56 100644
--- a/unix/x0vncserver/x0vncserver.cxx
+++ b/unix/x0vncserver/x0vncserver.cxx
@@ -180,21 +180,10 @@ public:
image = factory.newImage(dpy, geometry->width(), geometry->height());
vlog.info("Allocated %s", image->classDesc());
- pf.bpp = image->xim->bits_per_pixel;
- pf.depth = image->xim->depth;
- pf.bigEndian = (image->xim->byte_order == MSBFirst);
- pf.trueColour = image->isTrueColor();
- pf.redShift = ffs(image->xim->red_mask) - 1;
- pf.greenShift = ffs(image->xim->green_mask) - 1;
- pf.blueShift = ffs(image->xim->blue_mask) - 1;
- pf.redMax = image->xim->red_mask >> pf.redShift;
- pf.greenMax = image->xim->green_mask >> pf.greenShift;
- pf.blueMax = image->xim->blue_mask >> pf.blueShift;
-
// Provide pixel buffer to the server object.
pb = new XPixelBuffer(dpy, image,
geometry->offsetLeft(), geometry->offsetTop(),
- pf, this);
+ this);
server = vs;
server->setPixelBuffer(pb);
@@ -282,7 +271,6 @@ public:
protected:
Display* dpy;
Geometry* geometry;
- PixelFormat pf;
XPixelBuffer* pb;
VNCServer* server;
Image* image;