]> git.saurik.com Git - wxWidgets.git/commitdiff
No changes, just refactor wxGrid::DrawAllGridLines().
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 27 May 2012 13:00:09 +0000 (13:00 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 27 May 2012 13:00:09 +0000 (13:00 +0000)
Extract the actual drawing of the lines into a new DoDrawGridLines() method.

This will be used by the upcoming commits for drawing grid lines for a part of
the grid only, see #14294.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71575 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/generic/grid.h
src/generic/grid.cpp

index 4f59d2678448d609d8e13070dfc8fa44a109e2e7..bee18f2a5c905c43dbe87b54c7ea78bec746442e 100644 (file)
@@ -2133,6 +2133,16 @@ private:
     // redraw the grid lines, should be called after changing their attributes
     void RedrawGridLines();
 
+    // draw all lines from top to bottom row and left to right column in the
+    // rectangle determined by (top, left)-(bottom, right) -- but notice that
+    // the caller must have set up the clipping correctly, this rectangle is
+    // only used here for optimization
+    void DoDrawGridLines(wxDC& dc,
+                         int top, int left,
+                         int bottom, int right,
+                         int topRow, int leftCol,
+                         int bottomRight, int rightCol);
+
     // common part of Clip{Horz,Vert}GridLines
     void DoClipGridLines(bool& var, bool clip);
 
index 494b74f2cc6bb7e4261dabac74aea6cb09cd6d5a..695499108a216e1be632118aaab57a7de200eee0 100644 (file)
@@ -5417,9 +5417,22 @@ void wxGrid::DrawAllGridLines( wxDC& dc, const wxRegion & WXUNUSED(reg) )
 
     dc.SetDeviceClippingRegion( clippedcells );
 
+    DoDrawGridLines(dc,
+                    top, left, bottom, right,
+                    topRow, leftCol, m_numRows, m_numCols);
 
+    dc.DestroyClippingRegion();
+}
+
+void
+wxGrid::DoDrawGridLines(wxDC& dc,
+                        int top, int left,
+                        int bottom, int right,
+                        int topRow, int leftCol,
+                        int bottomRow, int rightCol)
+{
     // horizontal grid lines
-    for ( int i = internalYToRow(top); i < m_numRows; i++ )
+    for ( int i = topRow; i < bottomRow; i++ )
     {
         int bot = GetRowBottom(i) - 1;
 
@@ -5434,7 +5447,7 @@ void wxGrid::DrawAllGridLines( wxDC& dc, const wxRegion & WXUNUSED(reg) )
     }
 
     // vertical grid lines
-    for ( int colPos = leftCol; colPos < m_numCols; colPos++ )
+    for ( int colPos = leftCol; colPos < rightCol; colPos++ )
     {
         int i = GetColAt( colPos );
 
@@ -5453,8 +5466,6 @@ void wxGrid::DrawAllGridLines( wxDC& dc, const wxRegion & WXUNUSED(reg) )
             dc.DrawLine( colRight, top, colRight, bottom );
         }
     }
-
-    dc.DestroyClippingRegion();
 }
 
 void wxGrid::DrawRowLabels( wxDC& dc, const wxArrayInt& rows)