]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed cell visibility test that was causing refresh glitches
authorJulian Smart <julian@anthemion.co.uk>
Wed, 18 Dec 2002 18:17:40 +0000 (18:17 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Wed, 18 Dec 2002 18:17:40 +0000 (18:17 +0000)
in tables (since these were large enough cells to break the
original test)

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

src/html/htmlcell.cpp

index 94edca7b6472579252a133dcb0f338e1237de473..02e2a4c8532c783540fe492b5737fc113cc8a6cc 100644 (file)
@@ -407,8 +407,22 @@ void wxHtmlContainerCell::Layout(int w)
 
 void wxHtmlContainerCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
 {
-    // container visible, draw it:
-    if ((y + m_PosY < view_y2) && (y + m_PosY + m_Height > view_y1))
+    int y1 = y + m_PosY;
+    int y2 = y + m_PosY + m_Height;
+
+    // If the container is visible, draw it.
+    // This calculation checks for:
+    // (1) the cell is wholly within the view, OR
+    // (2) the cell overlaps, above the view, OR
+    // (3) the cell overlaps, below the view, OR
+    // (4) the cell overlaps, above and below the view.
+    if ((y1 <= view_y2 && y1 >= view_y1) ||
+        (y2 <= view_y2 && y2 >= view_y1) ||
+        (y1 <= view_y2 && y1 >= view_y1) ||
+        (y1 <= view_y1 && y2 >= view_y2))
+
+    // Old calculation, which I believe is wrong (JACS).
+//    if ((y + m_PosY < view_y2) && (y + m_PosY + m_Height > view_y1))
     {
 
         if (m_UseBkColour)
@@ -428,12 +442,18 @@ void wxHtmlContainerCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
             wxPen mypen1(m_BorderColour1, 1, wxSOLID);
             wxPen mypen2(m_BorderColour2, 1, wxSOLID);
 
+            int subtractMe = 1;
+            // Check on other platforms whether we should be subtracting
+            // 1. On wxMSW, we get a notch if we do.
+#ifdef __WXMSW__
+            subtractMe = 0;
+#endif
             dc.SetPen(mypen1);
             dc.DrawLine(x + m_PosX, y + m_PosY, x + m_PosX, y + m_PosY + m_Height - 1);
-            dc.DrawLine(x + m_PosX, y + m_PosY, x + m_PosX + m_Width - 1, y + m_PosY);
+            dc.DrawLine(x + m_PosX, y + m_PosY, x + m_PosX + m_Width - subtractMe, y + m_PosY);
             dc.SetPen(mypen2);
             dc.DrawLine(x + m_PosX + m_Width - 1, y + m_PosY, x + m_PosX +  m_Width - 1, y + m_PosY + m_Height - 1);
-            dc.DrawLine(x + m_PosX, y + m_PosY + m_Height - 1, x + m_PosX + m_Width - 1, y + m_PosY + m_Height - 1);
+            dc.DrawLine(x + m_PosX, y + m_PosY + m_Height - 1, x + m_PosX + m_Width - subtractMe, y + m_PosY + m_Height - 1);
         }
 
         if (m_Cells)