diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.h')
-rw-r--r-- | Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.h | 39 |
1 files changed, 14 insertions, 25 deletions
diff --git a/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.h b/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.h index 5747e4304..593c87cd2 100644 --- a/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.h +++ b/Source/WebCore/platform/graphics/harfbuzz/HarfBuzzShaper.h @@ -37,15 +37,13 @@ #include "hb.h" #include <memory> #include <wtf/HashSet.h> -#include <wtf/OwnPtr.h> -#include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> #include <wtf/unicode/CharacterNames.h> namespace WebCore { class Font; -class SimpleFontData; +class FontCascade; class HarfBuzzShaper { public: @@ -54,49 +52,43 @@ public: NormalizeMirrorChars }; - HarfBuzzShaper(const Font*, const TextRun&); + HarfBuzzShaper(const FontCascade*, const TextRun&); virtual ~HarfBuzzShaper(); - void setDrawRange(int from, int to); bool shape(GlyphBuffer* = 0); FloatPoint adjustStartPoint(const FloatPoint&); float totalWidth() { return m_totalWidth; } int offsetForPosition(float targetX); - FloatRect selectionRect(const FloatPoint&, int height, int from, int to); + FloatRect selectionRect(const FloatPoint&, int height, unsigned from, unsigned to); private: class HarfBuzzRun { public: - static PassOwnPtr<HarfBuzzRun> create(const SimpleFontData* fontData, unsigned startIndex, unsigned numCharacters, TextDirection direction, hb_script_t script) - { - return adoptPtr(new HarfBuzzRun(fontData, startIndex, numCharacters, direction, script)); - } + HarfBuzzRun(const Font*, unsigned startIndex, unsigned numCharacters, TextDirection, hb_script_t); void applyShapeResult(hb_buffer_t*); void setGlyphAndPositions(unsigned index, uint16_t glyphId, float advance, float offsetX, float offsetY); void setWidth(float width) { m_width = width; } - int characterIndexForXPosition(float targetX); + unsigned characterIndexForXPosition(float targetX); float xPositionForOffset(unsigned offset); - const SimpleFontData* fontData() { return m_fontData; } + const Font* fontData() { return m_fontData; } unsigned startIndex() const { return m_startIndex; } unsigned numCharacters() const { return m_numCharacters; } unsigned numGlyphs() const { return m_numGlyphs; } - uint16_t* glyphs() { return &m_glyphs[0]; } - float* advances() { return &m_advances[0]; } - FloatPoint* offsets() { return &m_offsets[0]; } - uint16_t* glyphToCharacterIndexes() { return &m_glyphToCharacterIndexes[0]; } + uint16_t* glyphs() { return m_glyphs.data(); } + float* advances() { return m_advances.data(); } + FloatPoint* offsets() { return m_offsets.data(); } + uint16_t* glyphToCharacterIndexes() { return m_glyphToCharacterIndexes.data(); } float width() { return m_width; } bool rtl() { return m_direction == RTL; } hb_script_t script() { return m_script; } private: - HarfBuzzRun(const SimpleFontData*, unsigned startIndex, unsigned numCharacters, TextDirection, hb_script_t); - - const SimpleFontData* m_fontData; + const Font* m_fontData; unsigned m_startIndex; - size_t m_numCharacters; + unsigned m_numCharacters; unsigned m_numGlyphs; TextDirection m_direction; hb_script_t m_script; @@ -128,7 +120,7 @@ private: GlyphBufferAdvance createGlyphBufferAdvance(float, float); - const Font* m_font; + const FontCascade* m_font; std::unique_ptr<UChar[]> m_normalizedBuffer; unsigned m_normalizedBufferLength; const TextRun& m_run; @@ -140,13 +132,10 @@ private: int m_letterSpacing; // Pixels to be added after each glyph. Vector<hb_feature_t, 4> m_features; - Vector<OwnPtr<HarfBuzzRun>, 16> m_harfBuzzRuns; + Vector<std::unique_ptr<HarfBuzzRun>, 16> m_harfBuzzRuns; FloatPoint m_startOffset; - int m_fromIndex; - int m_toIndex; - float m_totalWidth; }; |