aboutsummaryrefslogtreecommitdiffstats
path: root/common/rfb/DecodeManager.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2015-11-12 13:17:42 +0100
committerPierre Ossman <ossman@cendio.se>2015-11-27 11:09:38 +0100
commit1412789e1264b73f7f4d05242bcfbf960f618b15 (patch)
treeca367d336ac697a30bc3f12037eff8add48543e7 /common/rfb/DecodeManager.cxx
parent570cd5c478da3a8dfd2d7f728671f0171fd3893a (diff)
downloadtigervnc-1412789e1264b73f7f4d05242bcfbf960f618b15.tar.gz
tigervnc-1412789e1264b73f7f4d05242bcfbf960f618b15.zip
Decode overlapping rectangles in order
Diffstat (limited to 'common/rfb/DecodeManager.cxx')
-rw-r--r--common/rfb/DecodeManager.cxx23
1 files changed, 20 insertions, 3 deletions
diff --git a/common/rfb/DecodeManager.cxx b/common/rfb/DecodeManager.cxx
index a444eb7b..ddebf0a3 100644
--- a/common/rfb/DecodeManager.cxx
+++ b/common/rfb/DecodeManager.cxx
@@ -22,6 +22,7 @@
#include <rfb/CConnection.h>
#include <rfb/DecodeManager.h>
#include <rfb/Decoder.h>
+#include <rfb/Region.h>
#include <rfb/LogWriter.h>
@@ -129,6 +130,10 @@ void DecodeManager::decodeRect(const Rect& r, int encoding,
entry->pb = pb;
entry->bufferStream = bufferStream;
+ decoder->getAffectedRegion(r, bufferStream->data(),
+ bufferStream->length(), conn->cp,
+ &entry->affectedRegion);
+
queueMutex->lock();
// The workers add buffers to the end so it's safe to assume
@@ -233,6 +238,7 @@ void DecodeManager::DecodeThread::worker()
DecodeManager::QueueEntry* DecodeManager::DecodeThread::findEntry()
{
std::list<DecodeManager::QueueEntry*>::iterator iter;
+ Region lockedRegion;
if (manager->workQueue.empty())
return NULL;
@@ -243,13 +249,24 @@ DecodeManager::QueueEntry* DecodeManager::DecodeThread::findEntry()
for (iter = manager->workQueue.begin();
iter != manager->workQueue.end();
++iter) {
+ DecodeManager::QueueEntry* entry;
+
+ entry = *iter;
+
// Another thread working on this?
- if ((*iter)->active)
- continue;
+ if (entry->active)
+ goto next;
+
+ // Check overlap with earlier rectangles
+ if (!lockedRegion.intersect(entry->affectedRegion).is_empty())
+ goto next;
// FIXME: check dependencies between rects
- return *iter;
+ return entry;
+
+next:
+ lockedRegion.assign_union(entry->affectedRegion);
}
return NULL;