OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 ShapeResultBloberizer_h | 5 #ifndef ShapeResultBloberizer_h |
6 #define ShapeResultBloberizer_h | 6 #define ShapeResultBloberizer_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "platform/fonts/Glyph.h" | 9 #include "platform/fonts/Glyph.h" |
10 #include "platform/fonts/SimpleFontData.h" | 10 #include "platform/fonts/SimpleFontData.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 Type GetType() const { return type_; } | 32 Type GetType() const { return type_; } |
33 | 33 |
34 float FillGlyphs(const TextRunPaintInfo&, const ShapeResultBuffer&); | 34 float FillGlyphs(const TextRunPaintInfo&, const ShapeResultBuffer&); |
35 float FillGlyphs(const StringView&, | 35 float FillGlyphs(const StringView&, |
36 unsigned from, | 36 unsigned from, |
37 unsigned to, | 37 unsigned to, |
38 const ShapeResult*); | 38 const ShapeResult*); |
39 void FillTextEmphasisGlyphs(const TextRunPaintInfo&, | 39 void FillTextEmphasisGlyphs(const TextRunPaintInfo&, |
40 const GlyphData& emphasis_data, | 40 const GlyphData& emphasis_data, |
41 const ShapeResultBuffer&); | 41 const ShapeResultBuffer&); |
| 42 void FillTextEmphasisGlyphs(const StringView&, |
| 43 TextDirection, |
| 44 unsigned from, |
| 45 unsigned to, |
| 46 const GlyphData& emphasis_data, |
| 47 const ShapeResult*); |
42 | 48 |
43 void Add(Glyph glyph, const SimpleFontData* font_data, float h_offset) { | 49 void Add(Glyph glyph, const SimpleFontData* font_data, float h_offset) { |
44 // cannot mix x-only/xy offsets | 50 // cannot mix x-only/xy offsets |
45 DCHECK(!HasPendingVerticalOffsets()); | 51 DCHECK(!HasPendingVerticalOffsets()); |
46 | 52 |
47 if (UNLIKELY(font_data != pending_font_data_)) { | 53 if (UNLIKELY(font_data != pending_font_data_)) { |
48 CommitPendingRun(); | 54 CommitPendingRun(); |
49 pending_font_data_ = font_data; | 55 pending_font_data_ = font_data; |
50 DCHECK_EQ(GetBlobRotation(font_data), BlobRotation::kNoRotation); | 56 DCHECK_EQ(GetBlobRotation(font_data), BlobRotation::kNoRotation); |
51 } | 57 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 109 |
104 // Whether the FillFastHorizontalGlyphs can be used. Only applies for full | 110 // Whether the FillFastHorizontalGlyphs can be used. Only applies for full |
105 // runs with no vertical offsets and no text intercepts. | 111 // runs with no vertical offsets and no text intercepts. |
106 bool CanUseFastPath(unsigned from, | 112 bool CanUseFastPath(unsigned from, |
107 unsigned to, | 113 unsigned to, |
108 unsigned length, | 114 unsigned length, |
109 bool has_vertical_offsets); | 115 bool has_vertical_offsets); |
110 float FillFastHorizontalGlyphs(const ShapeResultBuffer&, TextDirection); | 116 float FillFastHorizontalGlyphs(const ShapeResultBuffer&, TextDirection); |
111 float FillFastHorizontalGlyphs(const ShapeResult*, float advance = 0); | 117 float FillFastHorizontalGlyphs(const ShapeResult*, float advance = 0); |
112 | 118 |
| 119 template <typename TextContainerType> |
113 float FillTextEmphasisGlyphsForRun(const ShapeResult::RunInfo*, | 120 float FillTextEmphasisGlyphsForRun(const ShapeResult::RunInfo*, |
114 const TextRunPaintInfo&, | 121 const TextContainerType&, |
| 122 unsigned text_length, |
| 123 TextDirection, |
| 124 unsigned from, |
| 125 unsigned to, |
115 const GlyphData& emphasis_data, | 126 const GlyphData& emphasis_data, |
116 float initial_advance, | 127 float initial_advance, |
117 unsigned run_offset); | 128 unsigned run_offset); |
118 | 129 |
119 void CommitPendingRun(); | 130 void CommitPendingRun(); |
120 void CommitPendingBlob(); | 131 void CommitPendingBlob(); |
121 | 132 |
122 bool HasPendingVerticalOffsets() const; | 133 bool HasPendingVerticalOffsets() const; |
123 static BlobRotation GetBlobRotation(const SimpleFontData*); | 134 static BlobRotation GetBlobRotation(const SimpleFontData*); |
124 | 135 |
(...skipping 12 matching lines...) Expand all Loading... |
137 Vector<float, 1024> pending_offsets_; | 148 Vector<float, 1024> pending_offsets_; |
138 float pending_vertical_baseline_x_offset_ = 0; | 149 float pending_vertical_baseline_x_offset_ = 0; |
139 | 150 |
140 // Constructed blobs. | 151 // Constructed blobs. |
141 BlobBuffer blobs_; | 152 BlobBuffer blobs_; |
142 }; | 153 }; |
143 | 154 |
144 } // namespace blink | 155 } // namespace blink |
145 | 156 |
146 #endif // ShapeResultBloberizer_h | 157 #endif // ShapeResultBloberizer_h |
OLD | NEW |