SVN:(VZ)[71575] No changes, just refactor wxGrid::DrawAllGridLines().

0 views
Skip to first unread message

nor...@wxsite.net

unread,
May 27, 2012, 9:00:09 AM5/27/12
to wx-commi...@googlegroups.com
Revision
71575
Author
VZ
Date
2012-05-27 06:00:09 -0700 (Sun, 27 May 2012)

Log Message

No changes, just refactor wxGrid::DrawAllGridLines().

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.

Modified Paths

Diff

Modified: wxWidgets/trunk/include/wx/generic/grid.h (71574 => 71575)


--- wxWidgets/trunk/include/wx/generic/grid.h	2012-05-27 13:00:04 UTC (rev 71574)
+++ wxWidgets/trunk/include/wx/generic/grid.h	2012-05-27 13:00:09 UTC (rev 71575)
@@ -2133,6 +2133,16 @@
     // 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);
 

Modified: wxWidgets/trunk/src/generic/grid.cpp (71574 => 71575)


--- wxWidgets/trunk/src/generic/grid.cpp	2012-05-27 13:00:04 UTC (rev 71574)
+++ wxWidgets/trunk/src/generic/grid.cpp	2012-05-27 13:00:09 UTC (rev 71575)
@@ -5417,9 +5417,22 @@
 
     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 @@
     }
 
     // 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 @@
             dc.DrawLine( colRight, top, colRight, bottom );
         }
     }
-
-    dc.DestroyClippingRegion();
 }
 
 void wxGrid::DrawRowLabels( wxDC& dc, const wxArrayInt& rows)
Reply all
Reply to author
Forward
0 new messages