Minor code enhancement: using an inline function instead of inline arithmetic.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@2412 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/unix/x0vncserver/PollingManager.cxx b/unix/x0vncserver/PollingManager.cxx
index 0c35c40..b3934a2 100644
--- a/unix/x0vncserver/PollingManager.cxx
+++ b/unix/x0vncserver/PollingManager.cxx
@@ -257,10 +257,6 @@
     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 @@
     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;
 
diff --git a/unix/x0vncserver/PollingManager.h b/unix/x0vncserver/PollingManager.h
index 9f3ff88..e54494e 100644
--- a/unix/x0vncserver/PollingManager.h
+++ b/unix/x0vncserver/PollingManager.h
@@ -97,6 +97,12 @@
                        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();