[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

xji at chromium.org xji at chromium.org
Wed Dec 22 13:53:28 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit ee74c7e3be0c7d2fddef336a343d80d91ad72d0b
Author: xji at chromium.org <xji at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Sep 28 22:42:55 2010 +0000

    Performance improvment for FontLinux
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68583 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/platform/graphics/chromium/FontLinux.cpp b/WebCore/platform/graphics/chromium/FontLinux.cpp
index a242523..e284bed 100644
--- a/WebCore/platform/graphics/chromium/FontLinux.cpp
+++ b/WebCore/platform/graphics/chromium/FontLinux.cpp
@@ -477,26 +477,37 @@ private:
     void createGlyphArrays(int size)
     {
         m_item.glyphs = new HB_Glyph[size];
-        memset(m_item.glyphs, 0, size * sizeof(HB_Glyph));
         m_item.attributes = new HB_GlyphAttributes[size];
-        memset(m_item.attributes, 0, size * sizeof(HB_GlyphAttributes));
         m_item.advances = new HB_Fixed[size];
-        memset(m_item.advances, 0, size * sizeof(HB_Fixed));
         m_item.offsets = new HB_FixedPoint[size];
-        memset(m_item.offsets, 0, size * sizeof(HB_FixedPoint));
 
         m_glyphs16 = new uint16_t[size];
         m_xPositions = new SkScalar[size];
 
         m_item.num_glyphs = size;
+        m_glyphsArraySize = size;  // Save the GlyphArrays size.
+        resetGlyphArrays(m_glyphsArraySize);
     }
 
-    void shapeGlyphs()
+    void resetGlyphArrays(int size)
     {
-        for (;;) {
-            if (HB_ShapeItem(&m_item))
-                break;
+        // All the types here don't have pointers. It is safe to reset to
+        // zero unless Harfbuzz breaks the compatibility in the future.
+        memset(m_item.glyphs, 0, size * sizeof(HB_Glyph));
+        memset(m_item.attributes, 0, size * sizeof(HB_GlyphAttributes));
+        memset(m_item.advances, 0, size * sizeof(HB_Fixed));
+        memset(m_item.offsets, 0, size * sizeof(HB_FixedPoint));
+        memset(m_glyphs16, 0, size * sizeof(uint16_t));
+        memset(m_xPositions, 0, size * sizeof(SkScalar));
+    }
 
+    void shapeGlyphs()
+    {
+        // Reset the array limit becuase HB_ShapeItem() overrides the
+        // m_item.num_glyphs.
+        m_item.num_glyphs = m_glyphsArraySize;
+        resetGlyphArrays(m_glyphsArraySize);
+        while (!HB_ShapeItem(&m_item)) {
             // We overflowed our arrays. Resize and retry.
             // HB_ShapeItem fills in m_item.num_glyphs with the needed size.
             deleteGlyphArrays();
@@ -597,6 +608,7 @@ private:
     unsigned m_offsetX; // Offset in pixels to the start of the next script run.
     unsigned m_pixelWidth; // Width (in px) of the current script run.
     unsigned m_numCodePoints; // Code points in current script run.
+    unsigned m_glyphsArraySize; // Current size of all the Harfbuzz arrays.
 
     OwnPtr<TextRun> m_normalizedRun;
     OwnArrayPtr<UChar> m_normalizedBuffer; // A buffer for normalized run.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list