| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ShapeResultBuffer_h | 5 #ifndef ShapeResultBuffer_h |
| 6 #define ShapeResultBuffer_h | 6 #define ShapeResultBuffer_h |
| 7 | 7 |
| 8 #include "platform/fonts/shaping/ShapeResult.h" | 8 #include "platform/fonts/shaping/ShapeResult.h" |
| 9 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
| 10 #include "wtf/RefPtr.h" | 10 #include "wtf/RefPtr.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 { | 27 { |
| 28 m_hasVerticalOffsets |= result->hasVerticalOffsets(); | 28 m_hasVerticalOffsets |= result->hasVerticalOffsets(); |
| 29 m_results.append(result); | 29 m_results.append(result); |
| 30 } | 30 } |
| 31 | 31 |
| 32 bool hasVerticalOffsets() const { return m_hasVerticalOffsets; } | 32 bool hasVerticalOffsets() const { return m_hasVerticalOffsets; } |
| 33 | 33 |
| 34 float fillGlyphBuffer(GlyphBuffer*, const TextRun&, unsigned from, unsigned
to) const; | 34 float fillGlyphBuffer(GlyphBuffer*, const TextRun&, unsigned from, unsigned
to) const; |
| 35 float fillGlyphBufferForTextEmphasis(GlyphBuffer*, const TextRun&, | 35 float fillGlyphBufferForTextEmphasis(GlyphBuffer*, const TextRun&, |
| 36 const GlyphData* emphasisData, unsigned from, unsigned to) const; | 36 const GlyphData* emphasisData, unsigned from, unsigned to) const; |
| 37 int offsetForPosition(const TextRun&, float targetX) const; | 37 int offsetForPosition(const TextRun&, float targetX, bool includePartialGlyp
hs) const; |
| 38 CharacterRange getCharacterRange(TextDirection, float totalWidth, | 38 CharacterRange getCharacterRange(TextDirection, float totalWidth, |
| 39 unsigned from, unsigned to) const; | 39 unsigned from, unsigned to) const; |
| 40 Vector<CharacterRange> individualCharacterRanges(TextDirection, | 40 Vector<CharacterRange> individualCharacterRanges(TextDirection, |
| 41 float totalWidth) const; | 41 float totalWidth) const; |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 float fillFastHorizontalGlyphBuffer(GlyphBuffer*, TextDirection) const; | 44 float fillFastHorizontalGlyphBuffer(GlyphBuffer*, TextDirection) const; |
| 45 | 45 |
| 46 template<TextDirection> | 46 template<TextDirection> |
| 47 static float fillGlyphBufferForRun(GlyphBuffer*, const ShapeResult::RunInfo*
, | 47 static float fillGlyphBufferForRun(GlyphBuffer*, const ShapeResult::RunInfo*
, |
| 48 float initialAdvance, unsigned from, unsigned to, unsigned runOffset); | 48 float initialAdvance, unsigned from, unsigned to, unsigned runOffset); |
| 49 static float fillGlyphBufferForTextEmphasisRun(GlyphBuffer*, const ShapeResu
lt::RunInfo*, | 49 static float fillGlyphBufferForTextEmphasisRun(GlyphBuffer*, const ShapeResu
lt::RunInfo*, |
| 50 const TextRun&, const GlyphData*, float initialAdvance, unsigned from, u
nsigned to, | 50 const TextRun&, const GlyphData*, float initialAdvance, unsigned from, u
nsigned to, |
| 51 unsigned runOffset); | 51 unsigned runOffset); |
| 52 | 52 |
| 53 static void addRunInfoRanges(const ShapeResult::RunInfo&, float offset, | 53 static void addRunInfoRanges(const ShapeResult::RunInfo&, float offset, |
| 54 Vector<CharacterRange>&); | 54 Vector<CharacterRange>&); |
| 55 | 55 |
| 56 // Empirically, cases where we get more than 50 ShapeResults are extremely r
are. | 56 // Empirically, cases where we get more than 50 ShapeResults are extremely r
are. |
| 57 Vector<RefPtr<const ShapeResult>, 64>m_results; | 57 Vector<RefPtr<const ShapeResult>, 64>m_results; |
| 58 bool m_hasVerticalOffsets; | 58 bool m_hasVerticalOffsets; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace blink | 61 } // namespace blink |
| 62 | 62 |
| 63 #endif // ShapeResultBuffer_h | 63 #endif // ShapeResultBuffer_h |
| OLD | NEW |