vcl/source/text/textlayout.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
New commits: commit 0db0662376dd9e89e1ad1e0a5764c69f94f9a059 Author: Chris Sherlock <chris.sherloc...@gmail.com> AuthorDate: Wed Oct 25 06:15:37 2023 +1100 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Tue Dec 12 10:45:05 2023 +0100 vcl: move bClipping closer to first use Change-Id: Iad480c82cce99f14448588154bf96ae4ec5605f1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158404 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/vcl/source/text/textlayout.cxx b/vcl/source/text/textlayout.cxx index b6f90c6b972d..8e2ddeb55875 100644 --- a/vcl/source/text/textlayout.cxx +++ b/vcl/source/text/textlayout.cxx @@ -393,8 +393,6 @@ namespace vcl if (rStr.isEmpty()) return 0; - const bool bClipping = (nStyle & DrawTextFlags::Clip) && !(nStyle & DrawTextFlags::EndEllipsis); - tools::Long nMaxLineWidth = 0; const bool bHyphenate = (nStyle & DrawTextFlags::WordBreakHyphenation) == DrawTextFlags::WordBreakHyphenation; css::uno::Reference< css::linguistic2::XHyphenator > xHyph; @@ -410,6 +408,7 @@ namespace vcl sal_Int32 nPos = 0; sal_Int32 nLen = rStr.getLength(); sal_Int32 nCurrentTextY = 0; + while ( nPos < nLen ) { sal_Int32 nBreakPos = lcl_GetEndOfLine(rStr, nPos, nLen); @@ -437,6 +436,7 @@ namespace vcl if ( nBreakPos == nPos ) nBreakPos++; + nPos = nBreakPos; if ( nPos < nLen && ( ( rStr[ nPos ] == '\r' ) || ( rStr[ nPos ] == '\n' ) ) ) @@ -447,6 +447,9 @@ namespace vcl nPos++; } nCurrentTextY += nTextHeight; + + const bool bClipping = (nStyle & DrawTextFlags::Clip) && !(nStyle & DrawTextFlags::EndEllipsis); + if (bClipping && nCurrentTextY > rRect.GetHeight()) break; }