| 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 const 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::shared_ptr<GlyphAtlas> alpha_atlas_;
41 mutable std::shared_ptr<GlyphAtlas> color_atlas_;
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:40
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:31
impeller::FontGlyphMap
std::unordered_map< ScaledFont, std::unordered_set< Glyph > > FontGlyphMap
Definition: font_glyph_pair.h:29
typographer_context.h
impeller::LazyGlyphAtlas::CreateOrGetGlyphAtlas
const std::shared_ptr< GlyphAtlas > & CreateOrGetGlyphAtlas(Context &context, GlyphAtlas::Type type) const
Definition: lazy_glyph_atlas.cc:47
impeller::LazyGlyphAtlas::LazyGlyphAtlas
LazyGlyphAtlas(std::shared_ptr< TypographerContext > typographer_context)
Definition: lazy_glyph_atlas.cc:19
impeller::GlyphAtlas::Type
Type
Describes how the glyphs are represented in the texture.
Definition: glyph_atlas.h:32
impeller::Context
To do anything rendering related with Impeller, you need a context.
Definition: context.h:46
scale
const Scalar scale
Definition: stroke_path_geometry.cc:297
context.h
glyph_atlas.h
text_frame.h
impeller::LazyGlyphAtlas
Definition: lazy_glyph_atlas.h:18
impeller
Definition: aiks_blur_unittests.cc:20