Commit 689f6507 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Avoid searching three times in the hash

parent 99b39065
...@@ -1893,25 +1893,19 @@ void TextPagePrivate::breakWordIntoCharacters(const QHash<QRect, RegionText> &wo ...@@ -1893,25 +1893,19 @@ void TextPagePrivate::breakWordIntoCharacters(const QHash<QRect, RegionText> &wo
tmp.append( new TinyTextEntity(ent->text(),ent->area) ); tmp.append( new TinyTextEntity(ent->text(),ent->area) );
else else
{ {
RegionText word_text = word_chars_map.value(rect); RegionText word_text;
TextList list = word_text.text();
const int count = word_chars_map.count(rect); QHash<QRect, RegionText>::const_iterator it = word_chars_map.find(rect);
if(count > 1) while( it != word_chars_map.end() && it.key() == rect )
{ {
QHash<QRect, RegionText>::const_iterator it = word_chars_map.find(rect); word_text = it.value();
while( it != word_chars_map.end() && it.key() == rect )
{
word_text = it.value();
list = word_text.text();
if(word_text.area() == rect && ent->text() == word_text.string()) if (ent->text() == word_text.string())
break; break;
++it; ++it;
}
} }
tmp.append(list); tmp.append(word_text.text());
} }
} }
setWordList(tmp); setWordList(tmp);
......
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