Changeset 148750 in webkit
- Timestamp:
- Apr 19, 2013 9:17:42 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r148749 r148750 1 2013-04-19 Andreas Kling <akling@apple.com> 2 3 [Mac] ComplexTextController is slow with large numbers of text runs. 4 <http://webkit.org/b/114875> 5 <rdar://problem/13337036> 6 7 Reviewed by Dan Bernstein. 8 9 Instead of iterating over the text runs in indexOfCurrentRun() to figure out the leftmost glyph, 10 create a lookup table of [run# -> distance in glyphs] at ComplexTextController construction time. 11 12 This avoids O(n^2) behavior in indexOfCurrentRun(). 13 14 * platform/graphics/mac/ComplexTextController.cpp: 15 (WebCore::ComplexTextController::ComplexTextController): 16 (WebCore::ComplexTextController::indexOfCurrentRun): 17 * platform/graphics/mac/ComplexTextController.h: 18 (ComplexTextController): 19 1 20 2013-04-19 Mario Sanchez Prada <mario.prada@samsung.com> 2 21 -
trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp
r142206 r148750 160 160 adjustGlyphsAndAdvances(); 161 161 162 if (!m_isLTROnly) 162 if (!m_isLTROnly) { 163 163 m_runIndices.reserveInitialCapacity(m_complexTextRuns.size()); 164 165 m_glyphCountFromStartToIndex.reserveInitialCapacity(m_complexTextRuns.size()); 166 unsigned glyphCountSoFar = 0; 167 for (unsigned i = 0; i < m_complexTextRuns.size(); ++i) { 168 m_glyphCountFromStartToIndex.uncheckedAppend(glyphCountSoFar); 169 glyphCountSoFar += m_complexTextRuns[i]->glyphCount(); 170 } 171 } 164 172 165 173 m_runWidthSoFar = m_leadingExpansion; … … 449 457 450 458 unsigned currentRunIndex = m_runIndices[m_currentRun]; 451 for (unsigned i = 0; i < currentRunIndex; ++i) 452 leftmostGlyph += m_complexTextRuns[i]->glyphCount(); 459 leftmostGlyph = m_glyphCountFromStartToIndex[currentRunIndex]; 453 460 return currentRunIndex; 454 461 } -
trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.h
r131703 r148750 133 133 unsigned incrementCurrentRun(unsigned& leftmostGlyph); 134 134 135 // The default size of this vectorwas selected as being the smallest power of two greater than135 // The initial capacity of these vectors was selected as being the smallest power of two greater than 136 136 // the average (3.5) plus one standard deviation (7.5) of nonzero sizes used on Arabic Wikipedia. 137 137 Vector<unsigned, 16> m_runIndices; 138 Vector<unsigned, 16> m_glyphCountFromStartToIndex; 138 139 139 140 const Font& m_font;
Note: See TracChangeset
for help on using the changeset viewer.