From: Constantin Kaplinsky Date: Wed, 9 Jan 2008 10:25:34 +0000 (+0000) Subject: Checking neighbor pixels above and below changed tiles, as well as pixels at the... X-Git-Tag: v0.0.90~384^2~73 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=474b12f7b2476830c76bab455f06dcbc23748561;p=tigervnc.git Checking neighbor pixels above and below changed tiles, as well as pixels at the left and at the right. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2396 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- diff --git a/unix/x0vncserver/PollingManager.cxx b/unix/x0vncserver/PollingManager.cxx index 8c75b291..325bed1f 100644 --- a/unix/x0vncserver/PollingManager.cxx +++ b/unix/x0vncserver/PollingManager.cxx @@ -364,19 +364,61 @@ void PollingManager::flagVideoArea(bool *pChangeFlags, bool value) void PollingManager::checkNeighbors(bool *pChangeFlags) { - // Check neighboring pixels at the right of changed tiles. - for (int x = 0; x < m_widthTiles - 1; x++) { - for (int y = 0; y < m_heightTiles; y++) { + int x, y; + + // Check neighboring pixels above and below changed tiles. + // FIXME: Fast skip to the first changed tile (and to the last, too). + // FIXME: Check the full-width line above the first changed tile? + for (y = 0; y < m_heightTiles; y++) { + bool doneAbove = false; + bool doneBelow = false; + for (x = 0; x < m_widthTiles; x++) { + if (!doneAbove && y > 0 && + pChangeFlags[y * m_widthTiles + x] && + !pChangeFlags[(y - 1) * m_widthTiles + x]) { + // FIXME: Check pChangeFlags[] to decrease height of the row. + checkRow(x * 32, y * 32 - 1, m_width - x * 32, + &pChangeFlags[(y - 1) * m_widthTiles + x]); + doneAbove = true; + } + if (!doneBelow && y < m_heightTiles - 1 && + pChangeFlags[y * m_widthTiles + x] && + !pChangeFlags[(y + 1) * m_widthTiles + x]) { + // FIXME: Check pChangeFlags[] to decrease height of the row. + checkRow(x * 32, (y + 1) * 32, m_width - x * 32, + &pChangeFlags[(y + 1) * m_widthTiles + x]); + doneBelow = true; + } + if (doneBelow && doneAbove) + break; + } + } + + // Check neighboring pixels at the right side of changed tiles. + for (x = 0; x < m_widthTiles - 1; x++) { + for (y = 0; y < m_heightTiles; y++) { if (pChangeFlags[y * m_widthTiles + x] && !pChangeFlags[y * m_widthTiles + x + 1]) { // FIXME: Check pChangeFlags[] to decrease height of the column. - // FIXME: Check _only_ the tiles neighboring to changed tiles? checkColumn((x + 1) * 32, y * 32, m_height - y * 32, &pChangeFlags[y * m_widthTiles + x + 1]); break; } } } + + // Check neighboring pixels at the left side of changed tiles. + for (x = m_widthTiles - 1; x > 0; x--) { + for (y = 0; y < m_heightTiles; y++) { + if (pChangeFlags[y * m_widthTiles + x] && + !pChangeFlags[y * m_widthTiles + x - 1]) { + // FIXME: Check pChangeFlags[] to decrease height of the column. + checkColumn(x * 32 - 1, y * 32, m_height - y * 32, + &pChangeFlags[y * m_widthTiles + x - 1]); + break; + } + } + } } void