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(
35 const std::shared_ptr<TextFrame>& frame,
38 const std::optional<GlyphProperties>& properties) {
39 FML_DCHECK(alpha_data_.atlas ==
nullptr && color_data_.atlas ==
nullptr);
40 AtlasData& data = GetData(frame->GetAtlasType());
41 data.renderable_frames.emplace_back(
54 AtlasData& data = GetData(type);
59 if (!typographer_context_) {
60 VALIDATION_LOG <<
"Unable to render text because a TypographerContext has "
64 if (!typographer_context_->IsValid()) {
66 <<
"Unable to render text because the TypographerContext is invalid.";
70 data.atlas = typographer_context_->CreateGlyphAtlas(
71 context, type, data_host_buffer, data.context, data.renderable_frames);
72 if (!data.atlas || !data.atlas->IsValid()) {
79 LazyGlyphAtlas::AtlasData::AtlasData(std::shared_ptr<GlyphAtlasContext> context)
80 : context(
std::move(context)) {}
82 LazyGlyphAtlas::AtlasData::~AtlasData() =
default;
84 void LazyGlyphAtlas::AtlasData::reset() {
85 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.
const std::shared_ptr< GlyphAtlas > & CreateOrGetGlyphAtlas(Context &context, HostBuffer &host_buffer, GlyphAtlas::Type type)
LazyGlyphAtlas(std::shared_ptr< TypographerContext > typographer_context)
void AddTextFrame(const std::shared_ptr< TextFrame > &frame, Point position, const Matrix &transform, const std::optional< GlyphProperties > &properties)
static const std::shared_ptr< GlyphAtlas > kNullGlyphAtlas
A 4x4 matrix using column-major storage.
static constexpr Matrix MakeTranslation(const Vector3 &t)