7 #include "fml/logging.h"
21 std::shared_ptr<TypographerContext> typographer_context)
22 : typographer_context_(
std::move(typographer_context)),
23 alpha_data_(typographer_context_
24 ? typographer_context_->CreateGlyphAtlasContext(
27 color_data_(typographer_context_
28 ? typographer_context_->CreateGlyphAtlasContext(
38 FML_DCHECK(alpha_data_.atlas ==
nullptr && color_data_.atlas ==
nullptr);
39 AtlasData& data = GetData(frame->GetAtlasType());
40 data.renderable_frames.emplace_back(
53 AtlasData& data = GetData(type);
58 if (!typographer_context_) {
59 VALIDATION_LOG <<
"Unable to render text because a TypographerContext has "
63 if (!typographer_context_->IsValid()) {
65 <<
"Unable to render text because the TypographerContext is invalid.";
69 data.atlas = typographer_context_->CreateGlyphAtlas(
70 context, type, data_host_buffer, data.context, data.renderable_frames);
71 if (!data.atlas || !data.atlas->IsValid()) {
78 LazyGlyphAtlas::AtlasData::AtlasData(std::shared_ptr<GlyphAtlasContext>
context)
81 LazyGlyphAtlas::AtlasData::~AtlasData() =
default;
83 void LazyGlyphAtlas::AtlasData::reset() {
84 renderable_frames.clear();
To do anything rendering related with Impeller, you need a context.
A texture containing the bitmap representation of glyphs in different fonts along with the ability to...
Type
Describes how the glyphs are represented in the texture.
void AddTextFrame(const std::shared_ptr< TextFrame > &frame, Point position, const Matrix &transform, const GlyphProperties &properties)
const std::shared_ptr< GlyphAtlas > & CreateOrGetGlyphAtlas(Context &context, HostBuffer &host_buffer, GlyphAtlas::Type type)
LazyGlyphAtlas(std::shared_ptr< TypographerContext > typographer_context)
static const std::shared_ptr< GlyphAtlas > kNullGlyphAtlas
std::shared_ptr< ContextGLES > context
A 4x4 matrix using column-major storage.
static constexpr Matrix MakeTranslation(const Vector3 &t)