MCPcopy Create free account
hub / github.com/Snapchat/Valdi / generateGlyphVec

Function generateGlyphVec

snap_drawing/test/src/TextShaperCache_tests.cpp:19–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19static std::vector<ShapedGlyph> generateGlyphVec(const Character* characters, size_t length) {
20 std::vector<ShapedGlyph> out;
21 out.resize(length);
22
23 auto* data = out.data();
24 for (size_t i = 0; i < length; i++) {
25 auto& glyph = data[i];
26 glyph.offsetX = static_cast<Scalar>(i);
27 glyph.offsetY = -static_cast<Scalar>(i);
28 glyph.advanceX = static_cast<Scalar>(i) * 2.0f;
29 glyph.glyphID = static_cast<uint32_t>(i);
30
31 glyph.setCharacter(characters[i], false);
32 }
33
34 return out;
35}
36
37static TextShaperCacheKey makeCacheKey(FontId fontId, const std::vector<Character>& characters) {
38 return TextShaperCacheKey(fontId, 0.0f, TextScript::invalid(), false, characters.data(), characters.size());

Callers 1

TESTFunction · 0.85

Calls 3

setCharacterMethod · 0.80
resizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected