summaryrefslogtreecommitdiffstats
path: root/unix/x0vncserver
diff options
context:
space:
mode:
Diffstat (limited to 'unix/x0vncserver')
-rw-r--r--unix/x0vncserver/PollingManager.cxx2
-rw-r--r--unix/x0vncserver/XPixelBuffer.cxx24
-rw-r--r--unix/x0vncserver/XPixelBuffer.h23
-rw-r--r--unix/x0vncserver/x0vncserver.cxx8
4 files changed, 42 insertions, 15 deletions
diff --git a/unix/x0vncserver/PollingManager.cxx b/unix/x0vncserver/PollingManager.cxx
index 841ce0f7..da0f21bc 100644
--- a/unix/x0vncserver/PollingManager.cxx
+++ b/unix/x0vncserver/PollingManager.cxx
@@ -50,6 +50,8 @@ IntParameter PollingManager::m_videoPriority("VideoPriority",
// Note that dpy and image should remain valid during the object
// lifetime, while factory is used only in the constructor itself.
//
+// FIXME: Pass XPixelBuffer* instead of Image*.
+//
PollingManager::PollingManager(Display *dpy, Image *image,
ImageFactory *factory,
diff --git a/unix/x0vncserver/XPixelBuffer.cxx b/unix/x0vncserver/XPixelBuffer.cxx
index def090ce..29470073 100644
--- a/unix/x0vncserver/XPixelBuffer.cxx
+++ b/unix/x0vncserver/XPixelBuffer.cxx
@@ -20,9 +20,31 @@
// XPixelBuffer.cxx
//
+#include <X11/Xlib.h>
#include <x0vncserver/XPixelBuffer.h>
-void XPixelBuffer::grabRegion(const Region& region)
+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),
+ 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)
+{
+}
+
+XPixelBuffer::~XPixelBuffer()
+{
+}
+
+void
+XPixelBuffer::grabRegion(const rfb::Region& region)
{
+ // m_image->get(DefaultRootWindow(m_dpy), m_offsetLeft, m_offsetTop);
}
diff --git a/unix/x0vncserver/XPixelBuffer.h b/unix/x0vncserver/XPixelBuffer.h
index 29b82f52..010763bb 100644
--- a/unix/x0vncserver/XPixelBuffer.h
+++ b/unix/x0vncserver/XPixelBuffer.h
@@ -24,30 +24,35 @@
#define __XPIXELBUFFER_H__
#include <rfb/PixelBuffer.h>
+#include <x0vncserver/Image.h>
using namespace rfb;
//
-// XPixelBuffer is a modification of FullFramePixelBuffer that does
-// not always return buffer width in getStride().
+// XPixelBuffer is an Image-based implementation of FullFramePixelBuffer.
//
class XPixelBuffer : public FullFramePixelBuffer
{
public:
- XPixelBuffer(const PixelFormat& pf, int width, int height,
- rdr::U8* data_, ColourMap* cm, int stride_) :
- FullFramePixelBuffer(pf, width, height, data_, cm), stride(stride_)
- {
- }
+ XPixelBuffer(Display *dpy, Image* image,
+ int offsetLeft, int offsetTop,
+ const PixelFormat& pf, ColourMap* cm);
+ virtual ~XPixelBuffer();
- virtual int getStride() const { return stride; }
+ virtual int getStride() const { return m_stride; }
// Override PixelBuffer's function.
virtual void grabRegion(const rfb::Region& region);
protected:
- int stride;
+ Display *m_dpy;
+ Image* m_image;
+ int m_offsetLeft;
+ int m_offsetTop;
+
+ // The number of pixels in a row, with padding included.
+ int m_stride;
};
#endif // __XPIXELBUFFER_H__
diff --git a/unix/x0vncserver/x0vncserver.cxx b/unix/x0vncserver/x0vncserver.cxx
index da0874f4..4eb6b226 100644
--- a/unix/x0vncserver/x0vncserver.cxx
+++ b/unix/x0vncserver/x0vncserver.cxx
@@ -198,12 +198,10 @@ public:
pf.greenMax = image->xim->green_mask >> pf.greenShift;
pf.blueMax = image->xim->blue_mask >> pf.blueShift;
- // Calculate the number of pixels in a row, with padding included.
- int stride = image->xim->bytes_per_line * 8 / image->xim->bits_per_pixel;
-
// Provide pixel buffer to the server object.
- pb = new XPixelBuffer(pf, geometry->width(), geometry->height(),
- (rdr::U8*)image->xim->data, this, stride);
+ pb = new XPixelBuffer(dpy, image,
+ geometry->offsetLeft(), geometry->offsetTop(),
+ pf, this);
server = vs;
server->setPixelBuffer(pb);