[HarfBuzz][Cairo] harfBuzzGetGlyph is slow and hot
authordominik.rottsches@intel.com <dominik.rottsches@intel.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Feb 2013 19:38:19 +0000 (19:38 +0000)
committerdominik.rottsches@intel.com <dominik.rottsches@intel.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Feb 2013 19:38:19 +0000 (19:38 +0000)
commit11c220263031a7072daa77cace64d10b293d0b9c
treefd0818d37e70421d19298713f3afd068f64f0b76
parent27f1bbfe6ee5f398b988da38c7853b69e87c3185
[HarfBuzz][Cairo] harfBuzzGetGlyph is slow and hot
https://bugs.webkit.org/show_bug.cgi?id=108941

Reviewed by Kenneth Rohde Christiansen.

The text to glyph conversion using Cairo is slow
due to expensive text codec conversion to UTF-8.
Additionally, the glyph lookup itself is expensive.

Inspired by the approach taken in HarfBuzzFaceSkia.cpp
I suggest to implement a similar caching mechanism to
accelerate this conversion.

Arabic line breaking test, under review in
bug 108948 shows about 58% improvement on my system
with this patch.

* platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp:
(WebCore::HarfBuzzFontData::HarfBuzzFontData):
    New container structure that keeps pointers
    to the cairo scaled font as well as the glyph cache.
(HarfBuzzFontData):
(WebCore):
(WebCore::harfBuzzGetGlyph): Using the new container structure for accessing the cache.
(WebCore::harfBuzzGetGlyphHorizontalAdvance): Using the new container structure for accessing the scaled font.
(WebCore::harfBuzzGetGlyphExtents): Ditto.
(WebCore::destroyHarfBuzzFontData): Destroying the container that held the pointers.
(WebCore::HarfBuzzFace::createFont):
    Initializing the container structure with the pointers
    to the cache that is held in HarfBuzzFace and the cairo scaled font.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141908 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/harfbuzz/HarfBuzzFaceCairo.cpp