From 1a032112326b4a30c93c38ccde240c80fdcb4a7a Mon Sep 17 00:00:00 2001 From: Constantin Kaplinsky Date: Wed, 9 Jan 2008 10:22:42 +0000 Subject: [PATCH] If defined DEBUG_PRINT_NUM_CHANGED_TILES, print correct final number of changed tiles detected (excluding video area but including tiles found after "neighbors check"). git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2395 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- unix/x0vncserver/PollingManager.cxx | 9 ++++++--- unix/x0vncserver/PollingManager.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/unix/x0vncserver/PollingManager.cxx b/unix/x0vncserver/PollingManager.cxx index b0c0efbe..8c75b291 100644 --- a/unix/x0vncserver/PollingManager.cxx +++ b/unix/x0vncserver/PollingManager.cxx @@ -219,7 +219,7 @@ bool PollingManager::pollScreen() // Inform the server about the changes. This time, we mark the // video area as NOT changed, to prevent reading its pixels again. flagVideoArea(changeFlags, false); - sendChanges(changeFlags); + nTilesChanged = sendChanges(changeFlags); } // Cleanup. @@ -233,7 +233,6 @@ bool PollingManager::pollScreen() #endif #ifdef DEBUG - // FIXME: Move this to sendChanges(); if (nTilesChanged != 0) { fprintf(stderr, "#%d# ", nTilesChanged); } @@ -303,8 +302,10 @@ int PollingManager::checkColumn(int x, int y, int h, bool *pChangeFlags) return nTilesChanged; } -void PollingManager::sendChanges(const bool *pChangeFlags) +int PollingManager::sendChanges(const bool *pChangeFlags) { + int nTilesChanged = 0; + Rect rect; for (int y = 0; y < m_heightTiles; y++) { for (int x = 0; x < m_widthTiles; x++) { @@ -314,6 +315,7 @@ void PollingManager::sendChanges(const bool *pChangeFlags) while (x + count < m_widthTiles && *pChangeFlags++) { count++; } + nTilesChanged += count; // Compute the coordinates and the size of this band. rect.setXYWH(x * 32, y * 32, count * 32, 32); if (rect.br.x > m_width) @@ -328,6 +330,7 @@ void PollingManager::sendChanges(const bool *pChangeFlags) } } } + return nTilesChanged; } void PollingManager::handleVideo(const bool *pChangeFlags) diff --git a/unix/x0vncserver/PollingManager.h b/unix/x0vncserver/PollingManager.h index 9d62f0b4..27bbf0f5 100644 --- a/unix/x0vncserver/PollingManager.h +++ b/unix/x0vncserver/PollingManager.h @@ -99,7 +99,7 @@ private: int checkRow(int x, int y, int w, bool *pChangeFlags); int checkColumn(int x, int y, int h, bool *pChangeFlags); - void sendChanges(const bool *pChangeFlags); + int sendChanges(const bool *pChangeFlags); void handleVideo(const bool *pChangeFlags); void flagVideoArea(bool *pChangeFlags, bool value); -- 2.39.5