Fixed a problem with copying discontinuous pixel data to IRIX JPEG ompressor.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2335 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/rfb/IrixDMIC_RawToJpeg.cxx b/common/rfb/IrixDMIC_RawToJpeg.cxx
index 6b76304..b3378a7 100644
--- a/common/rfb/IrixDMIC_RawToJpeg.cxx
+++ b/common/rfb/IrixDMIC_RawToJpeg.cxx
@@ -312,6 +312,32 @@
}
//
+// Fill in a DMbuffer with data.
+//
+// NOTE: The caller must make sure that the buffer size is no less
+// than (nRows * rowSize).
+//
+
+bool
+IrixDMIC_RawToJpeg::copyToBuffer(DMbuffer buf, const void *data,
+ int rowSize, int nRows, int stride)
+{
+ char *dataBytes = (char *)data;
+ char *bufPtr = (char *)dmBufferMapData(buf);
+ for (int i = 0; i < nRows; i++) {
+ memcpy(bufPtr, &dataBytes[i * stride], rowSize);
+ bufPtr += rowSize;
+ }
+
+ if (dmBufferSetSize(buf, nRows * rowSize) != DM_SUCCESS) {
+ reportError("dmBufferSetSize");
+ return false;
+ }
+
+ return true;
+}
+
+//
// Map DMbuffer to physical memory.
//