Remove "known_pagebreaks" from wxHtmlCell::AdjustPagebreak()

This parameter is not actually needed for any reasonable page breaking
algorithm, as it shouldn't care about any previous page breaks except
for the last one, which is already known as "*pagebreak - pageHeight" in
this function.

Removing it will allow to stop using wxArrayInt in the code using this
method and switch to an std::vector<int> instead.

This is not a backwards compatible change, but it seems that there is
very little code actually overriding this function (none could be found
in any open source repositories) and updating it should be as simple as
removing the now unneeded argument.
This commit is contained in:
Vadim Zeitlin
2018-05-24 18:05:58 +02:00
parent c58d81d32d
commit b9b6ccb804
7 changed files with 44 additions and 45 deletions

View File

@@ -140,8 +140,7 @@ void wxHtmlDCRenderer::SetStandardFonts(int size,
// else: SetHtmlText() not yet called, no need for relayout
}
int wxHtmlDCRenderer::FindNextPageBreak(const wxArrayInt& known_pagebreaks,
int pos)
int wxHtmlDCRenderer::FindNextPageBreak(int pos)
{
// Stop looking for page breaks if the previous one was already at the end
// of the last page.
@@ -152,7 +151,7 @@ int wxHtmlDCRenderer::FindNextPageBreak(const wxArrayInt& known_pagebreaks,
return wxNOT_FOUND;
int posNext = pos + m_Height;
if ( m_Cells->AdjustPagebreak(&posNext, known_pagebreaks, m_Height) )
if ( m_Cells->AdjustPagebreak(&posNext, m_Height) )
{
// Check that AdjustPagebreak() returns the page break at a strictly
// greater position than that of the previous page, otherwise
@@ -486,7 +485,7 @@ void wxHtmlPrintout::CountPages()
for ( int pos = 0; pos != wxNOT_FOUND; )
{
m_PageBreaks.Add( pos);
pos = m_Renderer.FindNextPageBreak(m_PageBreaks, pos);
pos = m_Renderer.FindNextPageBreak(pos);
}
}