MCPcopy Create free account
hub / github.com/Tencent/libpag / computeStyleKey

Method computeStyleKey

src/rendering/graphics/Glyph.cpp:107–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107void Glyph::computeStyleKey(tgfx::BytesKey* styleKey) const {
108 auto m = getTotalMatrix();
109 styleKey->write(m.getScaleX());
110 styleKey->write(m.getSkewX());
111 styleKey->write(m.getSkewY());
112 styleKey->write(m.getScaleY());
113 uint8_t fillValues[] = {fillColor.red, fillColor.green, fillColor.blue,
114 static_cast<uint8_t>(alpha * 255)};
115 styleKey->write(fillValues);
116 uint8_t strokeValues[] = {strokeColor.red, strokeColor.green, strokeColor.blue,
117 static_cast<uint8_t>(textStyle)};
118 styleKey->write(strokeValues);
119 styleKey->write(strokeWidth);
120 auto typeface = getFont().getTypeface();
121 styleKey->write(typeface ? typeface->uniqueID() : 0);
122}
123
124bool Glyph::isVisible() const {
125 return matrix.invertible() && alpha != 0.0f && !getBounds().isEmpty();

Callers 1

MakeFromMethod · 0.80

Calls 3

writeMethod · 0.80
getTypefaceMethod · 0.80
uniqueIDMethod · 0.45

Tested by

no test coverage detected