Allow PixelBuffers to be const
diff --git a/common/rfb/PixelBuffer.cxx b/common/rfb/PixelBuffer.cxx
index 3f7f301..b1359c2 100644
--- a/common/rfb/PixelBuffer.cxx
+++ b/common/rfb/PixelBuffer.cxx
@@ -42,7 +42,7 @@
void
-PixelBuffer::getImage(void* imageBuf, const Rect& r, int outStride) {
+PixelBuffer::getImage(void* imageBuf, const Rect& r, int outStride) const {
int inStride;
const U8* data = getBuffer(r, &inStride);
// We assume that the specified rectangle is pre-clipped to the buffer
@@ -61,7 +61,7 @@
}
void PixelBuffer::getImage(const PixelFormat& pf, void* imageBuf,
- const Rect& r, int stride)
+ const Rect& r, int stride) const
{
const rdr::U8* srcBuffer;
int srcStride;
@@ -332,6 +332,12 @@
{
}
+const rdr::U8* FullFramePixelBuffer::getBuffer(const Rect& r, int* stride_) const
+{
+ *stride_ = stride;
+ return &data[(r.tl.x + (r.tl.y * stride)) * format.bpp/8];
+}
+
// -=- Managed pixel buffer class
// Automatically allocates enough space for the specified format & area