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  Rational scale,
25  Point offset,
26  const Matrix& transform,
27  std::optional<GlyphProperties> properties);
28 
29  void ResetTextFrames();
30 
31  const std::shared_ptr<GlyphAtlas>& CreateOrGetGlyphAtlas(
32  Context& context,
33  HostBuffer& host_buffer,
34  GlyphAtlas::Type type) const;
35 
36  private:
37  std::shared_ptr<TypographerContext> typographer_context_;
38 
39  std::vector<std::shared_ptr<TextFrame>> alpha_text_frames_;
40  std::vector<std::shared_ptr<TextFrame>> color_text_frames_;
41  std::shared_ptr<GlyphAtlasContext> alpha_context_;
42  std::shared_ptr<GlyphAtlasContext> color_context_;
43  mutable std::shared_ptr<GlyphAtlas> alpha_atlas_;
44  mutable std::shared_ptr<GlyphAtlas> color_atlas_;
45 
46  LazyGlyphAtlas(const LazyGlyphAtlas&) = delete;
47 
48  LazyGlyphAtlas& operator=(const LazyGlyphAtlas&) = delete;
49 };
50 
51 } // namespace impeller
52 
53 #endif // FLUTTER_IMPELLER_TYPOGRAPHER_LAZY_GLYPH_ATLAS_H_
GLenum type
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:74
const std::shared_ptr< GlyphAtlas > & CreateOrGetGlyphAtlas(Context &context, HostBuffer &host_buffer, GlyphAtlas::Type type) const
LazyGlyphAtlas(std::shared_ptr< TypographerContext > typographer_context)
void AddTextFrame(const std::shared_ptr< TextFrame > &frame, Rational scale, Point offset, const Matrix &transform, std::optional< GlyphProperties > properties)
A 4x4 matrix using column-major storage.
Definition: matrix.h:37