| 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 TextFrame& frame,
23 Scalar scale,
24 Point offset,
25 const GlyphProperties& properties);
26
27 void ResetTextFrames();
28
29 const std::shared_ptr<GlyphAtlas>& CreateOrGetGlyphAtlas(
30 Context& context,
31 HostBuffer& host_buffer,
32 GlyphAtlas::Type type) const;
33
34 private:
35 std::shared_ptr<TypographerContext> typographer_context_;
36
37 FontGlyphMap alpha_glyph_map_;
38 FontGlyphMap color_glyph_map_;
39 std::shared_ptr<GlyphAtlasContext> alpha_context_;
40 std::shared_ptr<GlyphAtlasContext> color_context_;
41 mutable std::shared_ptr<GlyphAtlas> alpha_atlas_;
42 mutable std::shared_ptr<GlyphAtlas> color_atlas_;
43
44 LazyGlyphAtlas(const LazyGlyphAtlas&) = delete;
45
46 LazyGlyphAtlas& operator=(const LazyGlyphAtlas&) = delete;
47 };
48
49 } // namespace impeller
50
51 #endif // FLUTTER_IMPELLER_TYPOGRAPHER_LAZY_GLYPH_ATLAS_H_
impeller::LazyGlyphAtlas::~LazyGlyphAtlas
~LazyGlyphAtlas()
impeller::LazyGlyphAtlas::AddTextFrame
void AddTextFrame(const TextFrame &frame, Scalar scale, Point offset, const GlyphProperties &properties)
Definition: lazy_glyph_atlas.cc:33
impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::LazyGlyphAtlas::ResetTextFrames
void ResetTextFrames()
Definition: lazy_glyph_atlas.cc:47
impeller::GlyphProperties
Definition: font_glyph_pair.h:19
impeller::TextFrame
Represents a collection of shaped text runs.
Definition: text_frame.h:19
impeller::HostBuffer
Definition: host_buffer.h:28
typographer_context.h
impeller::LazyGlyphAtlas::CreateOrGetGlyphAtlas
const std::shared_ptr< GlyphAtlas > & CreateOrGetGlyphAtlas(Context &context, HostBuffer &host_buffer, GlyphAtlas::Type type) const
Definition: lazy_glyph_atlas.cc:54
offset
SeparatedVector2 offset
Definition: stroke_path_geometry.cc:311
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:31
impeller::FontGlyphMap
std::unordered_map< ScaledFont, std::unordered_set< SubpixelGlyph > > FontGlyphMap
Definition: font_glyph_pair.h:54
type
GLenum type
Definition: blit_command_gles.cc:126
impeller::Context
To do anything rendering related with Impeller, you need a context.
Definition: context.h:45
impeller::TPoint< Scalar >
scale
const Scalar scale
Definition: stroke_path_geometry.cc:308
context.h
glyph_atlas.h
text_frame.h
impeller::LazyGlyphAtlas
Definition: lazy_glyph_atlas.h:15
impeller
Definition: aiks_blend_unittests.cc:18