Kaydet (Commit) 9a9cfb1d authored tarafından Serge Krot's avatar Serge Krot Kaydeden (comit) Thorsten Behrens

related tdf#38778 Speed-up: Do not traverse the whole array

It is known that text attributes are sorted inside SwpHints.
No need to check all entries if special position is provided.

Change-Id: Iac92cd40cd6d094d158f3b50fd768f47029ccdce
Reviewed-on: https://gerrit.libreoffice.org/43911Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 81d50fd1
...@@ -663,10 +663,16 @@ bool SwWW8AttrIter::IsTextAttr( sal_Int32 nSwPos ) ...@@ -663,10 +663,16 @@ bool SwWW8AttrIter::IsTextAttr( sal_Int32 nSwPos )
for (size_t i = 0; i < pTextAttrs->Count(); ++i) for (size_t i = 0; i < pTextAttrs->Count(); ++i)
{ {
const SwTextAttr* pHt = pTextAttrs->Get(i); const SwTextAttr* pHt = pTextAttrs->Get(i);
if ( ( pHt->HasDummyChar() || pHt->HasContent() ) if (nSwPos == pHt->GetStart())
&& (pHt->GetStart() == nSwPos) )
{ {
return true; if (pHt->HasDummyChar() || pHt->HasContent() )
{
return true;
}
}
else if (nSwPos < pHt->GetStart())
{
break; // sorted by start
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment