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