Lines 18-23
T* advance_by_byte_size(T* p, unsigned byte_size) {
Link Here
|
18 |
return reinterpret_cast<T*>(reinterpret_cast<uint8_t*>(p) + byte_size); |
18 |
return reinterpret_cast<T*>(reinterpret_cast<uint8_t*>(p) + byte_size); |
19 |
} |
19 |
} |
20 |
|
20 |
|
|
|
21 |
template <class T> |
22 |
T* advance_by_byte_size_const(T* p, unsigned byte_size) { |
23 |
return reinterpret_cast<T*>(reinterpret_cast<const uint8_t*>(p) + byte_size); |
24 |
} |
25 |
|
21 |
} // namespace |
26 |
} // namespace |
22 |
|
27 |
|
23 |
SkiaTextMetrics::SkiaTextMetrics(const SkPaint* paint) : paint_(paint) { |
28 |
SkiaTextMetrics::SkiaTextMetrics(const SkPaint* paint) : paint_(paint) { |
Lines 39-45
void SkiaTextMetrics::GetGlyphWidthForHarfBuzz(hb_codepoint_t codepoint,
Link Here
|
39 |
} |
44 |
} |
40 |
|
45 |
|
41 |
void SkiaTextMetrics::GetGlyphWidthForHarfBuzz(unsigned count, |
46 |
void SkiaTextMetrics::GetGlyphWidthForHarfBuzz(unsigned count, |
42 |
hb_codepoint_t* glyphs, |
47 |
const hb_codepoint_t* glyphs, |
43 |
unsigned glyph_stride, |
48 |
unsigned glyph_stride, |
44 |
hb_position_t* advances, |
49 |
hb_position_t* advances, |
45 |
unsigned advance_stride) { |
50 |
unsigned advance_stride) { |
Lines 48-54
void SkiaTextMetrics::GetGlyphWidthForHarfBuzz(unsigned count,
Link Here
|
48 |
// array that copy them to a regular array. |
53 |
// array that copy them to a regular array. |
49 |
Vector<Glyph, 256> glyph_array(count); |
54 |
Vector<Glyph, 256> glyph_array(count); |
50 |
for (unsigned i = 0; i < count; |
55 |
for (unsigned i = 0; i < count; |
51 |
i++, glyphs = advance_by_byte_size(glyphs, glyph_stride)) { |
56 |
i++, glyphs = advance_by_byte_size_const(glyphs, glyph_stride)) { |
52 |
glyph_array[i] = *glyphs; |
57 |
glyph_array[i] = *glyphs; |
53 |
} |
58 |
} |
54 |
Vector<SkScalar, 256> sk_width_array(count); |
59 |
Vector<SkScalar, 256> sk_width_array(count); |