Get rid of getStride()
It was confusing and not properly used everywhere.
Callers should use the stride they get when they get
the buffer pointer.
diff --git a/vncviewer/FLTKPixelBuffer.cxx b/vncviewer/FLTKPixelBuffer.cxx
index 91ff787..588e2f8 100644
--- a/vncviewer/FLTKPixelBuffer.cxx
+++ b/vncviewer/FLTKPixelBuffer.cxx
@@ -25,7 +25,7 @@
FLTKPixelBuffer::FLTKPixelBuffer(int width, int height) :
PlatformPixelBuffer(rfb::PixelFormat(32, 24, false, true,
255, 255, 255, 0, 8, 16),
- width, height, NULL)
+ width, height, NULL, width)
{
data = new rdr::U8[width * height * format.bpp/8];
if (data == NULL)
@@ -43,7 +43,7 @@
const uchar *buf_start;
pixel_bytes = format.bpp/8;
- stride_bytes = pixel_bytes * getStride();
+ stride_bytes = pixel_bytes * stride;
buf_start = data +
pixel_bytes * src_x +
stride_bytes * src_y;
diff --git a/vncviewer/OSXPixelBuffer.cxx b/vncviewer/OSXPixelBuffer.cxx
index fc216a1..d196497 100644
--- a/vncviewer/OSXPixelBuffer.cxx
+++ b/vncviewer/OSXPixelBuffer.cxx
@@ -39,7 +39,7 @@
OSXPixelBuffer::OSXPixelBuffer(int width, int height) :
PlatformPixelBuffer(rfb::PixelFormat(32, 24, false, true,
255, 255, 255, 16, 8, 0),
- width, height, NULL),
+ width, height, NULL, width),
bitmap(NULL)
{
CGColorSpaceRef lut;
diff --git a/vncviewer/PlatformPixelBuffer.cxx b/vncviewer/PlatformPixelBuffer.cxx
index 8a24690..ced0446 100644
--- a/vncviewer/PlatformPixelBuffer.cxx
+++ b/vncviewer/PlatformPixelBuffer.cxx
@@ -20,7 +20,7 @@
PlatformPixelBuffer::PlatformPixelBuffer(const rfb::PixelFormat& pf,
int width, int height,
- rdr::U8* data) :
- FullFramePixelBuffer(pf, width, height, data)
+ rdr::U8* data, int stride) :
+ FullFramePixelBuffer(pf, width, height, data, stride)
{
}
diff --git a/vncviewer/PlatformPixelBuffer.h b/vncviewer/PlatformPixelBuffer.h
index 28d085a..03842ac 100644
--- a/vncviewer/PlatformPixelBuffer.h
+++ b/vncviewer/PlatformPixelBuffer.h
@@ -24,12 +24,10 @@
class PlatformPixelBuffer: public rfb::FullFramePixelBuffer {
public:
PlatformPixelBuffer(const rfb::PixelFormat& pf, int width, int height,
- rdr::U8* data);
+ rdr::U8* data, int stride);
virtual void draw(int src_x, int src_y, int x, int y, int w, int h) = 0;
-protected:
- int stride;
};
#endif
diff --git a/vncviewer/Win32PixelBuffer.cxx b/vncviewer/Win32PixelBuffer.cxx
index 429f63f..9fb0414 100644
--- a/vncviewer/Win32PixelBuffer.cxx
+++ b/vncviewer/Win32PixelBuffer.cxx
@@ -40,7 +40,7 @@
Win32PixelBuffer::Win32PixelBuffer(int width, int height) :
PlatformPixelBuffer(rfb::PixelFormat(32, 24, false, true,
255, 255, 255, 16, 8, 0),
- width, height, NULL),
+ width, height, NULL, width),
bitmap(NULL)
{
BITMAPINFOHEADER bih;
diff --git a/vncviewer/X11PixelBuffer.cxx b/vncviewer/X11PixelBuffer.cxx
index 3675eb5..c709984 100644
--- a/vncviewer/X11PixelBuffer.cxx
+++ b/vncviewer/X11PixelBuffer.cxx
@@ -94,7 +94,7 @@
}
X11PixelBuffer::X11PixelBuffer(int width, int height) :
- PlatformPixelBuffer(display_pf(), width, height, NULL),
+ PlatformPixelBuffer(display_pf(), width, height, NULL, 0),
shminfo(NULL), xim(NULL)
{
// Might not be open at this point
@@ -110,6 +110,7 @@
}
data = (rdr::U8*)xim->data;
+ stride = xim->bytes_per_line / (getPF().bpp/8);
}
@@ -139,11 +140,6 @@
}
-int X11PixelBuffer::getStride() const
-{
- return xim->bytes_per_line / (getPF().bpp/8);
-}
-
static bool caughtError;
static int XShmAttachErrorHandler(Display *dpy, XErrorEvent *error)
diff --git a/vncviewer/X11PixelBuffer.h b/vncviewer/X11PixelBuffer.h
index 6d54165..c2ffdc2 100644
--- a/vncviewer/X11PixelBuffer.h
+++ b/vncviewer/X11PixelBuffer.h
@@ -33,8 +33,6 @@
virtual void draw(int src_x, int src_y, int x, int y, int w, int h);
- int getStride() const;
-
protected:
int setupShm();