| 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
8 #include "impeller/geometry/rational.h"
9 #include "impeller/renderer/context.h"
10 #include "impeller/typographer/glyph_atlas.h"
11 #include "impeller/typographer/text_frame.h"
12 #include "impeller/typographer/typographer_context.h"
13
14 namespace impeller {
15
16 class LazyGlyphAtlas {
17 public:
18 explicit LazyGlyphAtlas(
19 std::shared_ptr<TypographerContext> typographer_context);
20
21 ~LazyGlyphAtlas();
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_
type
GLenum type
Definition: blit_command_gles.cc:153
impeller::Context
To do anything rendering related with Impeller, you need a context.
Definition: context.h:65
impeller::GlyphAtlas::Type
Type
Describes how the glyphs are represented in the texture.
Definition: glyph_atlas.h:41
impeller::HostBuffer
Definition: host_buffer.h:26
impeller::LazyGlyphAtlas
Definition: lazy_glyph_atlas.h:16
impeller::LazyGlyphAtlas::CreateOrGetGlyphAtlas
const std::shared_ptr< GlyphAtlas > & CreateOrGetGlyphAtlas(Context &context, HostBuffer &host_buffer, GlyphAtlas::Type type) const
Definition: lazy_glyph_atlas.cc:55
impeller::LazyGlyphAtlas::~LazyGlyphAtlas
~LazyGlyphAtlas()
impeller::LazyGlyphAtlas::ResetTextFrames
void ResetTextFrames()
Definition: lazy_glyph_atlas.cc:48
impeller::LazyGlyphAtlas::LazyGlyphAtlas
LazyGlyphAtlas(std::shared_ptr< TypographerContext > typographer_context)
Definition: lazy_glyph_atlas.cc:20
impeller::LazyGlyphAtlas::AddTextFrame
void AddTextFrame(const std::shared_ptr< TextFrame > &frame, Rational scale, Point offset, const Matrix &transform, std::optional< GlyphProperties > properties)
Definition: lazy_glyph_atlas.cc:34
impeller::Rational
Definition: rational.h:13
transform
Matrix transform
Definition: gaussian_blur_filter_contents.cc:312
glyph_atlas.h
impeller
Definition: allocation.cc:12
rational.h
context.h
impeller::Matrix
A 4x4 matrix using column-major storage.
Definition: matrix.h:37
impeller::TPoint< Scalar >
text_frame.h
typographer_context.h