Consistent use of stride vs pitch
Consistently use the term stride rather than pitch. Also
consistently represent the stride in number of pixels rather
than number of bytes. There is so much code that assumes
proper alignment already that we do not need the extra resolution.
diff --git a/common/rfb/JpegCompressor.cxx b/common/rfb/JpegCompressor.cxx
index 7dbb7d9..c1ef3c7 100644
--- a/common/rfb/JpegCompressor.cxx
+++ b/common/rfb/JpegCompressor.cxx
@@ -142,7 +142,7 @@
delete cinfo;
}
-void JpegCompressor::compress(const rdr::U8 *buf, int pitch, const Rect& r,
+void JpegCompressor::compress(const rdr::U8 *buf, int stride, const Rect& r,
const PixelFormat& pf, int quality, int subsamp)
{
int w = r.width();
@@ -196,13 +196,14 @@
}
#endif
- if (pitch == 0) pitch = w * pf.bpp / 8;
+ if (stride == 0)
+ stride = w;
if (cinfo->in_color_space == JCS_RGB) {
srcBuf = new rdr::U8[w * h * pixelsize];
srcBufIsTemp = true;
- pf.rgbFromBuffer(srcBuf, (const rdr::U8 *)buf, w, pitch, h);
- pitch = w * pixelsize;
+ pf.rgbFromBuffer(srcBuf, (const rdr::U8 *)buf, w, stride, h);
+ stride = w;
}
cinfo->input_components = pixelsize;
@@ -238,7 +239,7 @@
rowPointer = new JSAMPROW[h];
for (int dy = 0; dy < h; dy++)
- rowPointer[dy] = (JSAMPROW)(&srcBuf[dy * pitch]);
+ rowPointer[dy] = (JSAMPROW)(&srcBuf[dy * stride * pixelsize]);
jpeg_start_compress(cinfo, TRUE);
while (cinfo->next_scanline < cinfo->image_height)