aboutsummaryrefslogtreecommitdiffstats
path: root/common/rfb/PixelBuffer.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'common/rfb/PixelBuffer.cxx')
-rw-r--r--common/rfb/PixelBuffer.cxx54
1 files changed, 28 insertions, 26 deletions
diff --git a/common/rfb/PixelBuffer.cxx b/common/rfb/PixelBuffer.cxx
index 1b534b7b..c8b5f3d7 100644
--- a/common/rfb/PixelBuffer.cxx
+++ b/common/rfb/PixelBuffer.cxx
@@ -26,6 +26,8 @@
#include <config.h>
#endif
+#include <string.h>
+
#include <rfb/Exception.h>
#include <rfb/LogWriter.h>
#include <rfb/PixelBuffer.h>
@@ -63,10 +65,10 @@ void
PixelBuffer::getImage(void* imageBuf, const Rect& r, int outStride) const
{
int inStride;
- const U8* data;
+ const uint8_t* data;
int bytesPerPixel, inBytesPerRow, outBytesPerRow, bytesPerMemCpy;
- U8* imageBufPos;
- const U8* end;
+ uint8_t* imageBufPos;
+ const uint8_t* end;
if (!r.enclosed_by(getRect()))
throw rfb::Exception("Source rect %dx%d at %d,%d exceeds framebuffer %dx%d",
@@ -83,7 +85,7 @@ PixelBuffer::getImage(void* imageBuf, const Rect& r, int outStride) const
outBytesPerRow = outStride * bytesPerPixel;
bytesPerMemCpy = r.width() * bytesPerPixel;
- imageBufPos = (U8*)imageBuf;
+ imageBufPos = (uint8_t*)imageBuf;
end = data + (inBytesPerRow * r.height());
while (data < end) {
@@ -96,10 +98,10 @@ PixelBuffer::getImage(void* imageBuf, const Rect& r, int outStride) const
void PixelBuffer::getImage(const PixelFormat& pf, void* imageBuf,
const Rect& r, int stride) const
{
- const rdr::U8* srcBuffer;
+ const uint8_t* srcBuffer;
int srcStride;
- if (format.equal(pf)) {
+ if (format == pf) {
getImage(imageBuf, r, stride);
return;
}
@@ -114,8 +116,8 @@ void PixelBuffer::getImage(const PixelFormat& pf, void* imageBuf,
srcBuffer = getBuffer(r, &srcStride);
- pf.bufferFromBuffer((U8*)imageBuf, format, srcBuffer, r.width(), r.height(),
- stride, srcStride);
+ pf.bufferFromBuffer((uint8_t*)imageBuf, format, srcBuffer,
+ r.width(), r.height(), stride, srcStride);
}
void PixelBuffer::setSize(int width, int height)
@@ -148,7 +150,7 @@ ModifiablePixelBuffer::~ModifiablePixelBuffer()
void ModifiablePixelBuffer::fillRect(const Rect& r, const void* pix)
{
int stride;
- U8 *buf;
+ uint8_t *buf;
int w, h, b;
if (!r.enclosed_by(getRect()))
@@ -166,11 +168,11 @@ void ModifiablePixelBuffer::fillRect(const Rect& r, const void* pix)
if (b == 1) {
while (h--) {
- memset(buf, *(const U8*)pix, w);
+ memset(buf, *(const uint8_t*)pix, w);
buf += stride * b;
}
} else {
- U8 *start;
+ uint8_t *start;
int w1;
start = buf;
@@ -195,11 +197,11 @@ void ModifiablePixelBuffer::fillRect(const Rect& r, const void* pix)
void ModifiablePixelBuffer::imageRect(const Rect& r,
const void* pixels, int srcStride)
{
- U8* dest;
+ uint8_t* dest;
int destStride;
int bytesPerPixel, bytesPerDestRow, bytesPerSrcRow, bytesPerFill;
- const U8* src;
- U8* end;
+ const uint8_t* src;
+ uint8_t* end;
if (!r.enclosed_by(getRect()))
throw rfb::Exception("Destination rect %dx%d at %d,%d exceeds framebuffer %dx%d",
@@ -217,7 +219,7 @@ void ModifiablePixelBuffer::imageRect(const Rect& r,
bytesPerSrcRow = bytesPerPixel * srcStride;
bytesPerFill = bytesPerPixel * r.width();
- src = (const U8*)pixels;
+ src = (const uint8_t*)pixels;
end = dest + (bytesPerDestRow * r.height());
while (dest < end) {
@@ -234,8 +236,8 @@ void ModifiablePixelBuffer::copyRect(const Rect &rect,
{
int srcStride, dstStride;
int bytesPerPixel;
- const U8* srcData;
- U8* dstData;
+ const uint8_t* srcData;
+ uint8_t* dstData;
Rect drect, srect;
@@ -290,15 +292,15 @@ void ModifiablePixelBuffer::copyRect(const Rect &rect,
void ModifiablePixelBuffer::fillRect(const PixelFormat& pf, const Rect &dest,
const void* pix)
{
- rdr::U8 buf[4];
- format.bufferFromBuffer(buf, pf, (const rdr::U8*)pix, 1);
+ uint8_t buf[4];
+ format.bufferFromBuffer(buf, pf, (const uint8_t*)pix, 1);
fillRect(dest, buf);
}
void ModifiablePixelBuffer::imageRect(const PixelFormat& pf, const Rect &dest,
const void* pixels, int stride)
{
- rdr::U8* dstBuffer;
+ uint8_t* dstBuffer;
int dstStride;
if (!dest.enclosed_by(getRect()))
@@ -310,7 +312,7 @@ void ModifiablePixelBuffer::imageRect(const PixelFormat& pf, const Rect &dest,
stride = dest.width();
dstBuffer = getBufferRW(dest, &dstStride);
- format.bufferFromBuffer(dstBuffer, pf, (const rdr::U8*)pixels,
+ format.bufferFromBuffer(dstBuffer, pf, (const uint8_t*)pixels,
dest.width(), dest.height(),
dstStride, stride);
commitBufferRW(dest);
@@ -319,7 +321,7 @@ void ModifiablePixelBuffer::imageRect(const PixelFormat& pf, const Rect &dest,
// -=- Simple pixel buffer with a continuous block of memory
FullFramePixelBuffer::FullFramePixelBuffer(const PixelFormat& pf, int w, int h,
- rdr::U8* data_, int stride_)
+ uint8_t* data_, int stride_)
: ModifiablePixelBuffer(pf, w, h), data(data_), stride(stride_)
{
}
@@ -328,7 +330,7 @@ FullFramePixelBuffer::FullFramePixelBuffer() : data(0) {}
FullFramePixelBuffer::~FullFramePixelBuffer() {}
-rdr::U8* FullFramePixelBuffer::getBufferRW(const Rect& r, int* stride_)
+uint8_t* FullFramePixelBuffer::getBufferRW(const Rect& r, int* stride_)
{
if (!r.enclosed_by(getRect()))
throw rfb::Exception("Pixel buffer request %dx%d at %d,%d exceeds framebuffer %dx%d",
@@ -343,7 +345,7 @@ void FullFramePixelBuffer::commitBufferRW(const Rect& /*r*/)
{
}
-const rdr::U8* FullFramePixelBuffer::getBuffer(const Rect& r, int* stride_) const
+const uint8_t* FullFramePixelBuffer::getBuffer(const Rect& r, int* stride_) const
{
if (!r.enclosed_by(getRect()))
throw rfb::Exception("Pixel buffer request %dx%d at %d,%d exceeds framebuffer %dx%d",
@@ -355,7 +357,7 @@ const rdr::U8* FullFramePixelBuffer::getBuffer(const Rect& r, int* stride_) cons
}
void FullFramePixelBuffer::setBuffer(int width, int height,
- rdr::U8* data_, int stride_)
+ uint8_t* data_, int stride_)
{
if ((width < 0) || (width > maxPixelBufferWidth))
throw rfb::Exception("Invalid PixelBuffer width of %d pixels requested", width);
@@ -415,7 +417,7 @@ void ManagedPixelBuffer::setSize(int w, int h)
datasize = 0;
}
if (new_datasize) {
- data_ = new U8[new_datasize];
+ data_ = new uint8_t[new_datasize];
datasize = new_datasize;
}
}