From 63add2cd1931b01b928b73d574397c792791d6a1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 24 May 2018 15:47:08 +0200 Subject: [PATCH] Don't call AdjustPagebreak() in a loop, this seems useless There doesn't seem to be any reason to call this function more than once on the same cell as the existing implementations are idempotent and it's difficult to see why this should ever not be the case. --- include/wx/html/htmlcell.h | 1 - interface/wx/html/htmlcell.h | 10 ++-------- src/html/htmprint.cpp | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/include/wx/html/htmlcell.h b/include/wx/html/htmlcell.h index 6f726b2795..80535d39f3 100644 --- a/include/wx/html/htmlcell.h +++ b/include/wx/html/htmlcell.h @@ -286,7 +286,6 @@ public: // few pixels up. // // Returned value : true if pagebreak was modified, false otherwise - // Usage : while (container->AdjustPagebreak(&p)) {} virtual bool AdjustPagebreak(int *pagebreak, const wxArrayInt& known_pagebreaks, int pageHeight) const; diff --git a/interface/wx/html/htmlcell.h b/interface/wx/html/htmlcell.h index 665de5f5b4..1ad5aa7382 100644 --- a/interface/wx/html/htmlcell.h +++ b/interface/wx/html/htmlcell.h @@ -198,19 +198,13 @@ public: Returns @true if pagebreak was modified, @false otherwise. @param pagebreak - position in pixel of the pagebreak. + position in pixels of the pagebreak. @param known_pagebreaks the list of the previous pagebreaks @param pageHeight - the height in pixel of the page drawable area - - Usage: - @code - while (container->AdjustPagebreak(&p, kp, ph)) {} - @endcode - + the height in pixels of the page drawable area */ virtual bool AdjustPagebreak(int* pagebreak, const wxArrayInt& known_pagebreaks, diff --git a/src/html/htmprint.cpp b/src/html/htmprint.cpp index a65ccb524b..5a1e4d0c87 100644 --- a/src/html/htmprint.cpp +++ b/src/html/htmprint.cpp @@ -152,7 +152,7 @@ int wxHtmlDCRenderer::FindNextPageBreak(const wxArrayInt& known_pagebreaks, return wxNOT_FOUND; pos += m_Height; - while (m_Cells->AdjustPagebreak(&pos, known_pagebreaks, m_Height)) {} + m_Cells->AdjustPagebreak(&pos, known_pagebreaks, m_Height); return pos; }