diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp
index 5ea2d4b802..8064a7c543 100644
--- a/src/html/htmlcell.cpp
+++ b/src/html/htmlcell.cpp
@@ -376,7 +376,7 @@ static void SwitchSelState(wxDC& dc, wxHtmlRenderingInfo& info,
void wxHtmlWordCell::Draw(wxDC& dc, int x, int y,
- int WXUNUSED(view_y1), int WXUNUSED(view_y2),
+ int WXUNUSED(view_y1), int view_y2,
wxHtmlRenderingInfo& info)
{
#if 0 // useful for debugging
@@ -384,6 +384,8 @@ void wxHtmlWordCell::Draw(wxDC& dc, int x, int y,
dc.DrawRectangle(x+m_PosX,y+m_PosY,m_Width /* VZ: +1? */ ,m_Height);
#endif
+ if (y+m_PosY+m_Height > view_y2) return;
+
bool drawSelectionAfterCell = false;
if ( info.GetState().GetSelectionState() == wxHTML_SEL_CHANGING )
diff --git a/src/html/htmprint.cpp b/src/html/htmprint.cpp
index ca47879878..c094e0ead3 100644
--- a/src/html/htmprint.cpp
+++ b/src/html/htmprint.cpp
@@ -124,18 +124,17 @@ int wxHtmlDCRenderer::Render(int x, int y, int from, int dont_render, int to, in
if(to < hght)
hght = to;
+
if (!dont_render)
{
wxHtmlRenderingInfo rinfo;
wxDefaultHtmlRenderingStyle rstyle;
rinfo.SetStyle(&rstyle);
m_DC->SetBrush(*wxWHITE_BRUSH);
- m_DC->SetClippingRegion(x, y, m_Width, hght);
m_Cells->Draw(*m_DC,
x, (y - from),
- y, pbreak + (y /*- from*/),
+ y, y + hght,
rinfo);
- m_DC->DestroyClippingRegion();
}
if (pbreak < m_Cells->GetHeight()) return pbreak;
diff --git a/src/html/m_hline.cpp b/src/html/m_hline.cpp
index d629fda7bc..76a8db4aec 100644
--- a/src/html/m_hline.cpp
+++ b/src/html/m_hline.cpp
@@ -56,9 +56,11 @@ class wxHtmlLineCell : public wxHtmlCell
void wxHtmlLineCell::Draw(wxDC& dc, int x, int y,
- int WXUNUSED(view_y1), int WXUNUSED(view_y2),
+ int WXUNUSED(view_y1), int view_y2,
wxHtmlRenderingInfo& WXUNUSED(info))
{
+ if (y+m_PosY+m_Height > view_y2) return;
+
wxBrush mybrush(wxT("GREY"), (m_HasShading) ? wxTRANSPARENT : wxSOLID);
wxPen mypen(wxT("GREY"), 1, wxSOLID);
dc.SetBrush(mybrush);
diff --git a/src/html/m_image.cpp b/src/html/m_image.cpp
index a850abcf37..b42f7780be 100644
--- a/src/html/m_image.cpp
+++ b/src/html/m_image.cpp
@@ -539,9 +539,11 @@ wxHtmlImageCell::~wxHtmlImageCell()
void wxHtmlImageCell::Draw(wxDC& dc, int x, int y,
- int WXUNUSED(view_y1), int WXUNUSED(view_y2),
+ int WXUNUSED(view_y1), int view_y2,
wxHtmlRenderingInfo& WXUNUSED(info))
{
+ if (y+m_PosY+m_Height > view_y2) return;
+
if ( m_showFrame )
{
dc.SetBrush(*wxTRANSPARENT_BRUSH);
diff --git a/src/html/m_list.cpp b/src/html/m_list.cpp
index e441b0ebd1..9669682592 100644
--- a/src/html/m_list.cpp
+++ b/src/html/m_list.cpp
@@ -59,9 +59,11 @@ wxHtmlListmarkCell::wxHtmlListmarkCell(wxDC* dc, const wxColour& clr) : wxHtmlCe
void wxHtmlListmarkCell::Draw(wxDC& dc, int x, int y,
- int WXUNUSED(view_y1), int WXUNUSED(view_y2),
+ int WXUNUSED(view_y1), int view_y2,
wxHtmlRenderingInfo& WXUNUSED(info))
{
+ if (y+m_PosY+m_Height > view_y2) return;
+
dc.SetBrush(m_Brush);
dc.DrawEllipse(x + m_PosX + m_Width / 3, y + m_PosY + m_Height / 3,
(m_Width / 3), (m_Width / 3));