]> source.dussan.org Git - tigervnc.git/commitdiff
Minor code enhancement: using an inline function instead of inline arithmetic.
authorConstantin Kaplinsky <const@tightvnc.com>
Fri, 18 Jan 2008 15:37:15 +0000 (15:37 +0000)
committerConstantin Kaplinsky <const@tightvnc.com>
Fri, 18 Jan 2008 15:37:15 +0000 (15:37 +0000)
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2412 3789f03b-4d11-0410-bbf8-ca57d06f2519

unix/x0vncserver/PollingManager.cxx
unix/x0vncserver/PollingManager.h

index 0c35c400eaf2cb38cb79682995fc00a1b44c92e8..b3934a25847c22ff19e6188db32b51d57e684cb7 100644 (file)
@@ -257,10 +257,6 @@ int PollingManager::checkRow(int x, int y, int w)
     w += correction;
   }
 
-  // Compute a pointer to the corresponding element of m_changeFlags.
-  // FIXME: Provide an inline function for that?
-  bool *pChangeFlags = &m_changeFlags[(y / 32) * m_widthTiles + (x / 32)];
-
   // Read a row from the screen. Note that getFullRow() may be more
   // efficient than getRow() which is more general.
   // FIXME: Move the logic to getRow()?
@@ -270,7 +266,10 @@ int PollingManager::checkRow(int x, int y, int w)
     getRow(x, y, w);
   }
 
-  // Compute pointers to images to be compared.
+  // Compute a pointer to the initial element of m_changeFlags.
+  bool *pChangeFlags = &m_changeFlags[getTileIndex(x, y)];
+
+  // Compute pointers to image data to be compared.
   char *ptr_old = m_image->locatePixel(x, y);
   char *ptr_new = m_rowImage->xim->data;
 
index 9f3ff88377c9f9b9b0cf845e9325236ade1dad77..e54494e625d1e49f6cd30152d35ca55041979ce4 100644 (file)
@@ -97,6 +97,12 @@ private:
                        m_offsetLeft + x, m_offsetTop + y, 1, h);
   }
 
+  inline int getTileIndex(int x, int y) {
+    int tile_x = x / 32;
+    int tile_y = y / 32;
+    return tile_y * m_widthTiles + tile_x;
+  }
+
   int checkRow(int x, int y, int w);
   int checkColumn(int x, int y, int h, bool *pChangeFlags);
   int sendChanges();