[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:55:07 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 5551cf9afbfe50acb9e8535139e3b74c95048da7
Author: xji at chromium.org <xji at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Sep 29 17:32:43 2010 +0000
2010-09-29 Xiaomei Ji <xji at chromium.org>
Reviewed by David Levin.
Performance improvement for FontLinux.
https://bugs.webkit.org/show_bug.cgi?id=46374
Reduce new/delete operations by storing the maximum capacity of the glyph
array and use that value in subsequent HB_ShapeItem calls. (Note that a
call to HB_ShapeItem may reduce the value of m_item.num_glyphs below the
capacity.)
Also be consistent with zero'ing the glyph arrays before calling
HB_ShapeItem.
There is no functionality changes so no new tests are added.
* platform/graphics/chromium/FontLinux.cpp:
(WebCore::TextRunWalker::createGlyphArrays):
(WebCore::TextRunWalker::resetGlyphArrays):
(WebCore::TextRunWalker::shapeGlyphs):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@68660 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 396afe0..d604bad 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2010-09-29 Xiaomei Ji <xji at chromium.org>
+
+ Reviewed by David Levin.
+
+ Performance improvement for FontLinux.
+ https://bugs.webkit.org/show_bug.cgi?id=46374
+
+ Reduce new/delete operations by storing the maximum capacity of the glyph
+ array and use that value in subsequent HB_ShapeItem calls. (Note that a
+ call to HB_ShapeItem may reduce the value of m_item.num_glyphs below the
+ capacity.)
+
+ Also be consistent with zero'ing the glyph arrays before calling
+ HB_ShapeItem.
+
+ There is no functionality changes so no new tests are added.
+
+ * platform/graphics/chromium/FontLinux.cpp:
+ (WebCore::TextRunWalker::createGlyphArrays):
+ (WebCore::TextRunWalker::resetGlyphArrays):
+ (WebCore::TextRunWalker::shapeGlyphs):
+
2010-09-29 Pavel Podivilov <podivilov at chromium.org>
Reviewed by Pavel Feldman.
diff --git a/WebCore/platform/graphics/chromium/FontLinux.cpp b/WebCore/platform/graphics/chromium/FontLinux.cpp
index a242523..4d984c4 100644
--- a/WebCore/platform/graphics/chromium/FontLinux.cpp
+++ b/WebCore/platform/graphics/chromium/FontLinux.cpp
@@ -477,26 +477,40 @@ 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_glyphsArrayCapacity = size; // Save the GlyphArrays size.
+ resetGlyphArrays();
}
- void shapeGlyphs()
+ void resetGlyphArrays()
{
- for (;;) {
- if (HB_ShapeItem(&m_item))
- break;
+ int size = m_item.num_glyphs;
+ // 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()
+ {
+ // HB_ShapeItem() resets m_item.num_glyphs. If the previous call to
+ // HB_ShapeItem() used less space than was available, the capacity of
+ // the array may be larger than the current value of m_item.num_glyphs.
+ // So, we need to reset the num_glyphs to the capacity of the array.
+ m_item.num_glyphs = m_glyphsArrayCapacity;
+ resetGlyphArrays();
+ 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 +611,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_glyphsArrayCapacity; // 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