summaryrefslogtreecommitdiffstats
path: root/vncviewer
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2014-01-30 17:57:27 +0100
committerPierre Ossman <ossman@cendio.se>2014-07-07 14:50:29 +0200
commit2e5a10608394186fd1324c97b17d7f08e0c0aaf6 (patch)
treebdd76744f7d2d68bceb9b662c7ab85478510cdd7 /vncviewer
parentff9eb5a949f7af0198db8c563a7d9d735ad083c3 (diff)
downloadtigervnc-2e5a10608394186fd1324c97b17d7f08e0c0aaf6.tar.gz
tigervnc-2e5a10608394186fd1324c97b17d7f08e0c0aaf6.zip
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.
Diffstat (limited to 'vncviewer')
-rw-r--r--vncviewer/FLTKPixelBuffer.cxx4
-rw-r--r--vncviewer/OSXPixelBuffer.cxx2
-rw-r--r--vncviewer/PlatformPixelBuffer.cxx4
-rw-r--r--vncviewer/PlatformPixelBuffer.h4
-rw-r--r--vncviewer/Win32PixelBuffer.cxx2
-rw-r--r--vncviewer/X11PixelBuffer.cxx8
-rw-r--r--vncviewer/X11PixelBuffer.h2
7 files changed, 9 insertions, 17 deletions
diff --git a/vncviewer/FLTKPixelBuffer.cxx b/vncviewer/FLTKPixelBuffer.cxx
index 91ff787e..588e2f83 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 @@ void FLTKPixelBuffer::draw(int src_x, int src_y, int x, int y, int w, int h)
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 fc216a12..d196497f 100644
--- a/vncviewer/OSXPixelBuffer.cxx
+++ b/vncviewer/OSXPixelBuffer.cxx
@@ -39,7 +39,7 @@ static rfb::LogWriter vlog("OSXPixelBuffer");
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 8a24690c..ced04467 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 28d085aa..03842ac8 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 429f63f1..9fb04145 100644
--- a/vncviewer/Win32PixelBuffer.cxx
+++ b/vncviewer/Win32PixelBuffer.cxx
@@ -40,7 +40,7 @@ static rfb::LogWriter vlog("Win32PixelBuffer");
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 3675eb57..c709984b 100644
--- a/vncviewer/X11PixelBuffer.cxx
+++ b/vncviewer/X11PixelBuffer.cxx
@@ -94,7 +94,7 @@ static PixelFormat display_pf()
}
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 @@ X11PixelBuffer::X11PixelBuffer(int width, int height) :
}
data = (rdr::U8*)xim->data;
+ stride = xim->bytes_per_line / (getPF().bpp/8);
}
@@ -139,11 +140,6 @@ void X11PixelBuffer::draw(int src_x, int src_y, int x, int y, int w, int h)
}
-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 6d54165f..c2ffdc28 100644
--- a/vncviewer/X11PixelBuffer.h
+++ b/vncviewer/X11PixelBuffer.h
@@ -33,8 +33,6 @@ public:
virtual void draw(int src_x, int src_y, int x, int y, int w, int h);
- int getStride() const;
-
protected:
int setupShm();