Flutter Impeller
lazy_glyph_atlas.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_IMPELLER_TYPOGRAPHER_LAZY_GLYPH_ATLAS_H_
6 #define FLUTTER_IMPELLER_TYPOGRAPHER_LAZY_GLYPH_ATLAS_H_
7 
13 
14 namespace impeller {
15 
17  public:
18  explicit LazyGlyphAtlas(
19  std::shared_ptr<TypographerContext> typographer_context);
20 
22 
23  void AddTextFrame(const std::shared_ptr<TextFrame>& frame,
24  Point position,
25  const Matrix& transform,
26  const std::optional<GlyphProperties>& properties);
27 
28  void ResetTextFrames();
29 
30  const std::shared_ptr<GlyphAtlas>& CreateOrGetGlyphAtlas(
31  Context& context,
32  HostBuffer& host_buffer,
33  GlyphAtlas::Type type);
34 
35  private:
36  std::shared_ptr<TypographerContext> typographer_context_;
37 
38  struct AtlasData {
39  explicit AtlasData(std::shared_ptr<GlyphAtlasContext> context);
40 
41  ~AtlasData();
42 
43  std::vector<RenderableText> renderable_frames;
44  std::shared_ptr<GlyphAtlasContext> context;
45  std::shared_ptr<GlyphAtlas> atlas;
46 
47  void reset();
48  };
49 
50  AtlasData alpha_data_;
51  AtlasData color_data_;
52 
53  AtlasData& GetData(GlyphAtlas::Type type);
54 
55  LazyGlyphAtlas(const LazyGlyphAtlas&) = delete;
56 
57  LazyGlyphAtlas& operator=(const LazyGlyphAtlas&) = delete;
58 };
59 
60 } // namespace impeller
61 
62 #endif // FLUTTER_IMPELLER_TYPOGRAPHER_LAZY_GLYPH_ATLAS_H_
To do anything rendering related with Impeller, you need a context.
Definition: context.h:65
Type
Describes how the glyphs are represented in the texture.
Definition: glyph_atlas.h:41
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)
A 4x4 matrix using column-major storage.
Definition: matrix.h:37