From: Pierre Ossman Date: Mon, 18 Jun 2018 14:29:55 +0000 (+0200) Subject: Move copy rect handling to EncodeManager X-Git-Tag: v1.9.90~48^2~18 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a114c343bc63a8fb11bc78ba5e40dd0963d24357;p=tigervnc.git Move copy rect handling to EncodeManager No need to spread things out. Keep all of the handling in a single place to make things clearer. --- diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx index 7589cb6a..92886684 100644 --- a/common/rfb/EncodeManager.cxx +++ b/common/rfb/EncodeManager.cxx @@ -325,6 +325,9 @@ void EncodeManager::doUpdate(bool allowLossy, const Region& changed_, changed = changed_; + if (!conn->client.useCopyRect) + changed.assign_union(copied); + /* * We need to render the cursor seperately as it has its own * magical pixel buffer, so split it out from the changed region. @@ -344,7 +347,8 @@ void EncodeManager::doUpdate(bool allowLossy, const Region& changed_, conn->writer()->writeFramebufferUpdateStart(nRects); - writeCopyRects(copied, copyDelta); + if (conn->client.useCopyRect) + writeCopyRects(copied, copyDelta); /* * We start by searching for solid rects, which are then removed diff --git a/common/rfb/UpdateTracker.cxx b/common/rfb/UpdateTracker.cxx index b53b8509..28e916d5 100644 --- a/common/rfb/UpdateTracker.cxx +++ b/common/rfb/UpdateTracker.cxx @@ -60,32 +60,17 @@ void ClippingUpdateTracker::add_copied(const Region &dest, const Point &delta) { // SimpleUpdateTracker -SimpleUpdateTracker::SimpleUpdateTracker(bool use_copyrect) { - copy_enabled = use_copyrect; +SimpleUpdateTracker::SimpleUpdateTracker() { } SimpleUpdateTracker::~SimpleUpdateTracker() { } -void SimpleUpdateTracker::enable_copyrect(bool enable) { - if (!enable && copy_enabled) { - add_changed(copied); - copied.clear(); - } - copy_enabled=enable; -} - void SimpleUpdateTracker::add_changed(const Region ®ion) { changed.assign_union(region); } void SimpleUpdateTracker::add_copied(const Region &dest, const Point &delta) { - // Do we support copyrect? - if (!copy_enabled) { - add_changed(dest); - return; - } - // Is there anything to do? if (dest.is_empty()) return; diff --git a/common/rfb/UpdateTracker.h b/common/rfb/UpdateTracker.h index 8e96d55e..8983b378 100644 --- a/common/rfb/UpdateTracker.h +++ b/common/rfb/UpdateTracker.h @@ -68,11 +68,9 @@ namespace rfb { class SimpleUpdateTracker : public UpdateTracker { public: - SimpleUpdateTracker(bool use_copyrect=true); + SimpleUpdateTracker(); virtual ~SimpleUpdateTracker(); - virtual void enable_copyrect(bool enable); - virtual void add_changed(const Region ®ion); virtual void add_copied(const Region &dest, const Point &delta); virtual void subtract(const Region& region); @@ -94,7 +92,6 @@ namespace rfb { Region changed; Region copied; Point copy_delta; - bool copy_enabled; }; } diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx index f01b248c..34bb1e82 100644 --- a/common/rfb/VNCSConnectionST.cxx +++ b/common/rfb/VNCSConnectionST.cxx @@ -49,7 +49,7 @@ VNCSConnectionST::VNCSConnectionST(VNCServerST* server_, network::Socket *s, inProcessMessages(false), pendingSyncFence(false), syncFence(false), fenceFlags(0), fenceDataLen(0), fenceData(NULL), congestionTimer(this), - losslessTimer(this), server(server_), updates(false), + losslessTimer(this), server(server_), updateRenderedCursor(false), removeRenderedCursor(false), continuousUpdates(false), encodeManager(this), pointerEventTime(0), clientHasCursor(false), @@ -972,8 +972,6 @@ void VNCSConnectionST::writeDataUpdate() bool needNewUpdateInfo; const RenderedCursor *cursor; - updates.enable_copyrect(client.useCopyRect); - // See what the client has requested (if anything) if (continuousUpdates) req = cuRegion.union_(requested);