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 
12 
13 namespace impeller {
14 
16  public:
17  explicit LazyGlyphAtlas(
18  std::shared_ptr<TypographerContext> typographer_context);
19 
21 
22  void AddTextFrame(const std::shared_ptr<TextFrame>& frame,
23  Scalar scale,
24  Point offset,
25  const Matrix& transform,
26  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) const;
34 
35  private:
36  std::shared_ptr<TypographerContext> typographer_context_;
37 
38  std::vector<std::shared_ptr<TextFrame>> alpha_text_frames_;
39  std::vector<std::shared_ptr<TextFrame>> color_text_frames_;
40  std::shared_ptr<GlyphAtlasContext> alpha_context_;
41  std::shared_ptr<GlyphAtlasContext> color_context_;
42  mutable std::shared_ptr<GlyphAtlas> alpha_atlas_;
43  mutable std::shared_ptr<GlyphAtlas> color_atlas_;
44 
45  LazyGlyphAtlas(const LazyGlyphAtlas&) = delete;
46 
47  LazyGlyphAtlas& operator=(const LazyGlyphAtlas&) = delete;
48 };
49 
50 } // namespace impeller
51 
52 #endif // FLUTTER_IMPELLER_TYPOGRAPHER_LAZY_GLYPH_ATLAS_H_
GLenum type
To do anything rendering related with Impeller, you need a context.
Definition: context.h:46
Type
Describes how the glyphs are represented in the texture.
Definition: glyph_atlas.h:74
const std::shared_ptr< GlyphAtlas > & CreateOrGetGlyphAtlas(Context &context, HostBuffer &host_buffer, GlyphAtlas::Type type) const
void AddTextFrame(const std::shared_ptr< TextFrame > &frame, Scalar scale, Point offset, const Matrix &transform, std::optional< GlyphProperties > properties)
LazyGlyphAtlas(std::shared_ptr< TypographerContext > typographer_context)
float Scalar
Definition: scalar.h:18
const Scalar scale
SeparatedVector2 offset
A 4x4 matrix using column-major storage.
Definition: matrix.h:37