| 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 <unordered_map>
9
10 #include "flutter/fml/macros.h"
11 #include "impeller/renderer/context.h"
12 #include "impeller/typographer/glyph_atlas.h"
13 #include "impeller/typographer/text_frame.h"
14 #include "impeller/typographer/typographer_context.h"
15
16 namespace impeller {
17
18 class LazyGlyphAtlas {
19 public:
20 explicit LazyGlyphAtlas(
21 std::shared_ptr<TypographerContext> typographer_context);
22
23 ~LazyGlyphAtlas();
24
25 void AddTextFrame(const TextFrame& frame, Scalar scale);
26
27 void ResetTextFrames();
28
29 std::shared_ptr<GlyphAtlas> CreateOrGetGlyphAtlas(
30 Context& context,
31 GlyphAtlas::Type type) const;
32
33 private:
34 std::shared_ptr<TypographerContext> typographer_context_;
35
36 FontGlyphMap alpha_glyph_map_;
37 FontGlyphMap color_glyph_map_;
38 std::shared_ptr<GlyphAtlasContext> alpha_context_;
39 std::shared_ptr<GlyphAtlasContext> color_context_;
40 mutable std::unordered_map<GlyphAtlas::Type, std::shared_ptr<GlyphAtlas>>
41 atlas_map_;
42
43 LazyGlyphAtlas(const LazyGlyphAtlas&) = delete;
44
45 LazyGlyphAtlas& operator=(const LazyGlyphAtlas&) = delete;
46 };
47
48 } // namespace impeller
49
50 #endif // FLUTTER_IMPELLER_TYPOGRAPHER_LAZY_GLYPH_ATLAS_H_
impeller::LazyGlyphAtlas::~LazyGlyphAtlas
~LazyGlyphAtlas()
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::LazyGlyphAtlas::ResetTextFrames
void ResetTextFrames()
Definition: lazy_glyph_atlas.cc:35
impeller::TextFrame
Represents a collection of shaped text runs.
Definition: text_frame.h:20
impeller::LazyGlyphAtlas::AddTextFrame
void AddTextFrame(const TextFrame &frame, Scalar scale)
Definition: lazy_glyph_atlas.cc:26
impeller::FontGlyphMap
std::unordered_map< ScaledFont, std::unordered_set< Glyph > > FontGlyphMap
Definition: font_glyph_pair.h:29
typographer_context.h
impeller::LazyGlyphAtlas::CreateOrGetGlyphAtlas
std::shared_ptr< GlyphAtlas > CreateOrGetGlyphAtlas(Context &context, GlyphAtlas::Type type) const
Definition: lazy_glyph_atlas.cc:41
impeller::LazyGlyphAtlas::LazyGlyphAtlas
LazyGlyphAtlas(std::shared_ptr< TypographerContext > typographer_context)
Definition: lazy_glyph_atlas.cc:14
impeller::GlyphAtlas::Type
Type
Describes how the glyphs are represented in the texture.
Definition: glyph_atlas.h:33
impeller::Context
To do anything rendering related with Impeller, you need a context.
Definition: context.h:47
context.h
glyph_atlas.h
text_frame.h
impeller::LazyGlyphAtlas
Definition: lazy_glyph_atlas.h:18
impeller
Definition: aiks_context.cc:10