From: Constantin Kaplinsky Date: Fri, 28 Dec 2007 08:44:59 +0000 (+0000) Subject: Minor code refactoring -- new flagVideoArea() function, minor naming and formatting... X-Git-Tag: v0.0.90~384^2~85 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=bd390358b9cc66de0da15816dd80be1c8d6ed801;p=tigervnc.git Minor code refactoring -- new flagVideoArea() function, minor naming and formatting changes. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2384 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- diff --git a/unix/x0vncserver/PollingManager.cxx b/unix/x0vncserver/PollingManager.cxx index da0f21bc..ad6ac424 100644 --- a/unix/x0vncserver/PollingManager.cxx +++ b/unix/x0vncserver/PollingManager.cxx @@ -297,13 +297,7 @@ bool PollingManager::handleVideo(bool *pChangeFlags) // Grab the pixels of video area. Also, exclude video rectangle from // pChangeFlags[], to prevent grabbing the same pixels twice. if (!m_videoRect.is_empty()) { - Rect r(m_videoRect.tl.x / 32, m_videoRect.tl.y / 32, - m_videoRect.br.x / 32, m_videoRect.br.y / 32); - for (int y = r.tl.y; y < r.br.y; y++) { - for (int x = r.tl.x; x < r.br.x; x++) { - pChangeFlags[y * m_widthTiles + x] = false; - } - } + flagVideoArea(pChangeFlags, false); getScreenRect(m_videoRect); return true; // we've got a video rectangle } @@ -311,6 +305,16 @@ bool PollingManager::handleVideo(bool *pChangeFlags) return false; // video rectangle is empty } +void PollingManager::flagVideoArea(bool *pChangeFlags, bool value) +{ + Rect r(m_videoRect.tl.x / 32, m_videoRect.tl.y / 32, + m_videoRect.br.x / 32, m_videoRect.br.y / 32); + + for (int y = r.tl.y; y < r.br.y; y++) + for (int x = r.tl.x; x < r.br.x; x++) + pChangeFlags[y * m_widthTiles + x] = value; +} + void PollingManager::detectVideo() { diff --git a/unix/x0vncserver/PollingManager.h b/unix/x0vncserver/PollingManager.h index e3a29b0b..fd2c2e05 100644 --- a/unix/x0vncserver/PollingManager.h +++ b/unix/x0vncserver/PollingManager.h @@ -97,14 +97,14 @@ private: m_offsetLeft + x, m_offsetTop + y, 1, h); } - int checkRow(int x, int y, int w, bool *pmxChanged); - void sendChanges(bool *pmxChanged); - bool handleVideo(bool *pmxChanged); - void detectVideo(); + int checkRow(int x, int y, int w, bool *pChangeFlags); + void sendChanges(bool *pChangeFlags); + bool handleVideo(bool *pChangeFlags); + void flagVideoArea(bool *pChangeFlags, bool value); + // Video detection functions. + void detectVideo(); void getVideoAreaRect(Rect *result); - - // Functions called by getVideoAreaRect(). void constructLengthMatrices(int **pmx_h, int **pmx_v); void destroyLengthMatrices(int *mx_h, int *mx_v); void findMaxLocalRect(Rect *r, int *mx_h, int *mx_v);