[Cocoa] Improve performance of glyph advance metrics gathering
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Sep 2016 08:33:44 +0000 (08:33 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Sep 2016 08:33:44 +0000 (08:33 +0000)
commitfedbc7d291b272abc0822ddc85a0f0d32fcdc523
tree996764756db899608f13aceb445e48f288821b7b
parentb87bee84ee3b80d0c661a9f2f0cc3cda608967a1
[Cocoa] Improve performance of glyph advance metrics gathering
https://bugs.webkit.org/show_bug.cgi?id=161119

Reviewed by Simon Fraser.

Most of the glyphs in a GlyphPage are never read from. Therefore, we can get a performance boost
by not populating as many items in the GlyphPage. Because of the performance characteristics of
CTFontGetGlyphsForCharacters(), a better size for a GlyphPage is 16 items. This, coupled with
using CTFontGetUnsummedAdvancesForGlyphsAndStyle(), causes between a 0.01%-0.5% speedup on PLT.

No new tests because there is no behavior change.

* platform/graphics/Font.cpp:
(WebCore::Font::initCharWidths):
(WebCore::Font::platformGlyphInit):
(WebCore::createAndFillGlyphPage):
* platform/graphics/Font.h:
(WebCore::Font::widthForGlyph):
* platform/graphics/GlyphMetricsMap.h:
* platform/graphics/GlyphPage.h:
* platform/graphics/cocoa/FontCocoa.mm:
* platform/spi/cocoa/CoreTextSPI.h:
(WebCore::Font::platformWidthForGlyph):
(WebCore::canUseFastGlyphAdvanceGetter): Deleted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205703 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/Font.cpp
Source/WebCore/platform/graphics/Font.h
Source/WebCore/platform/graphics/FontCascadeFonts.cpp
Source/WebCore/platform/graphics/GlyphMetricsMap.h
Source/WebCore/platform/graphics/GlyphPage.h
Source/WebCore/platform/graphics/cocoa/FontCocoa.mm
Source/WebCore/platform/spi/cocoa/CoreTextSPI.h