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 #pragma once
6 
7 #include <unordered_map>
8 
9 #include "flutter/fml/macros.h"
14 
15 namespace impeller {
16 
18  public:
19  explicit LazyGlyphAtlas(
20  std::shared_ptr<TypographerContext> typographer_context);
21 
23 
24  void AddTextFrame(const TextFrame& frame, Scalar scale);
25 
26  void ResetTextFrames();
27 
28  std::shared_ptr<GlyphAtlas> CreateOrGetGlyphAtlas(
29  Context& context,
30  GlyphAtlas::Type type) const;
31 
32  private:
33  std::shared_ptr<TypographerContext> typographer_context_;
34 
35  FontGlyphMap alpha_glyph_map_;
36  FontGlyphMap color_glyph_map_;
37  std::shared_ptr<GlyphAtlasContext> alpha_context_;
38  std::shared_ptr<GlyphAtlasContext> color_context_;
39  mutable std::unordered_map<GlyphAtlas::Type, std::shared_ptr<GlyphAtlas>>
40  atlas_map_;
41 
42  FML_DISALLOW_COPY_AND_ASSIGN(LazyGlyphAtlas);
43 };
44 
45 } // namespace impeller
impeller::LazyGlyphAtlas::~LazyGlyphAtlas
~LazyGlyphAtlas()
impeller::Scalar
float Scalar
Definition: scalar.h:15
impeller::LazyGlyphAtlas::ResetTextFrames
void ResetTextFrames()
Definition: lazy_glyph_atlas.cc:35
impeller::TextFrame
Represents a collection of shaped text runs.
Definition: text_frame.h:19
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:28
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:32
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:17
impeller
Definition: aiks_context.cc:10