aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/rfb/EncodeManager.cxx39
-rw-r--r--common/rfb/EncodeManager.h5
2 files changed, 25 insertions, 19 deletions
diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx
index 4526c0b3..67a32f5b 100644
--- a/common/rfb/EncodeManager.cxx
+++ b/common/rfb/EncodeManager.cxx
@@ -881,13 +881,24 @@ void EncodeManager::writeSubRect(const Rect& rect, const PixelBuffer *pb)
bool EncodeManager::checkSolidTile(const Rect& r, const uint8_t* colourValue,
const PixelBuffer *pb)
{
+ const uint8_t* buffer;
+ int stride;
+
+ buffer = pb->getBuffer(r, &stride);
+
switch (pb->getPF().bpp) {
case 32:
- return checkSolidTile(r, *(const uint32_t*)colourValue, pb);
+ return checkSolidTile(r.width(), r.height(),
+ (const uint32_t*)buffer, stride,
+ *(const uint32_t*)colourValue);
case 16:
- return checkSolidTile(r, *(const uint16_t*)colourValue, pb);
+ return checkSolidTile(r.width(), r.height(),
+ (const uint16_t*)buffer, stride,
+ *(const uint16_t*)colourValue);
default:
- return checkSolidTile(r, *(const uint8_t*)colourValue, pb);
+ return checkSolidTile(r.width(), r.height(),
+ (const uint8_t*)buffer, stride,
+ *(const uint8_t*)colourValue);
}
}
@@ -1058,23 +1069,17 @@ uint8_t* EncodeManager::OffsetPixelBuffer::getBufferRW(const Rect& /*r*/, int* /
}
template<class T>
-inline bool EncodeManager::checkSolidTile(const Rect& r,
- const T colourValue,
- const PixelBuffer *pb)
+inline bool EncodeManager::checkSolidTile(int width, int height,
+ const T* buffer, int stride,
+ const T colourValue)
{
- int w, h;
- const T* buffer;
- int stride, pad;
-
- w = r.width();
- h = r.height();
+ int pad;
- buffer = (const T*)pb->getBuffer(r, &stride);
- pad = stride - w;
+ pad = stride - width;
- while (h--) {
- int w_ = w;
- while (w_--) {
+ while (height--) {
+ int width_ = width;
+ while (width_--) {
if (*buffer != colourValue)
return false;
buffer++;
diff --git a/common/rfb/EncodeManager.h b/common/rfb/EncodeManager.h
index a01a1614..7ae9b5b8 100644
--- a/common/rfb/EncodeManager.h
+++ b/common/rfb/EncodeManager.h
@@ -100,8 +100,9 @@ namespace rfb {
protected:
// Templated, optimised methods
template<class T>
- inline bool checkSolidTile(const Rect& r, const T,
- const PixelBuffer *pb);
+ inline bool checkSolidTile(int width, int height,
+ const T* buffer, int stride,
+ const T colourValue);
template<class T>
inline bool analyseRect(int width, int height,
const T* buffer, int stride,