diff options
author | Constantin Kaplinsky <const@tightvnc.com> | 2006-05-23 06:33:03 +0000 |
---|---|---|
committer | Constantin Kaplinsky <const@tightvnc.com> | 2006-05-23 06:33:03 +0000 |
commit | b9c734930e73ef27b21b02d9e40f738ba79d08ed (patch) | |
tree | 5c8617b661d6ffd5eaa0a2df017e7289f1d07ebd | |
parent | bfc4e8cbed28d2bff27403d4aec818dfaa7ae900 (diff) | |
download | tigervnc-b9c734930e73ef27b21b02d9e40f738ba79d08ed.tar.gz tigervnc-b9c734930e73ef27b21b02d9e40f738ba79d08ed.zip |
Fixed the problem with framebuffer data not always aligned properly.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@578 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r-- | x0vncserver/x0vncserver.cxx | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/x0vncserver/x0vncserver.cxx b/x0vncserver/x0vncserver.cxx index d3423830..80483bf8 100644 --- a/x0vncserver/x0vncserver.cxx +++ b/x0vncserver/x0vncserver.cxx @@ -131,6 +131,27 @@ private: }; +// +// XPixelBuffer is a modification of FullFramePixelBuffer that does +// not always return buffer width in getStride(). +// + +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_) + { + } + + virtual int getStride() const { return stride; } + +protected: + int stride; +}; + + class XDesktop : public SDesktop, public ColourMap { public: @@ -195,8 +216,12 @@ public: pf.greenMax = image->xim->green_mask >> pf.greenShift; pf.blueMax = image->xim->blue_mask >> pf.blueShift; - pb = new FullFramePixelBuffer(pf, geometry->width(), geometry->height(), - (rdr::U8*)image->xim->data, this); + // 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); server = vs; server->setPixelBuffer(pb); |