Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
glyph_atlas_context_stb.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_BACKENDS_STB_GLYPH_ATLAS_CONTEXT_STB_H_
6#define FLUTTER_IMPELLER_TYPOGRAPHER_BACKENDS_STB_GLYPH_ATLAS_CONTEXT_STB_H_
7
10
11namespace impeller {
12
13class BitmapSTB {
14 public:
16
18
19 BitmapSTB(size_t width, size_t height, size_t bytes_per_pixel);
20
21 uint8_t* GetPixels();
22
23 uint8_t* GetPixelAddress(TPoint<size_t> coords);
24
25 size_t GetRowBytes() const;
26
27 size_t GetWidth() const;
28
29 size_t GetHeight() const;
30
31 size_t GetSize() const;
32
33 private:
34 size_t width_ = 0;
35 size_t height_ = 0;
36 size_t bytes_per_pixel_ = 0;
37 std::vector<uint8_t> pixels_;
38};
39
41 : public GlyphAtlasContext,
42 public BackendCast<GlyphAtlasContextSTB, GlyphAtlasContext> {
43 public:
45
47
48 //----------------------------------------------------------------------------
49 /// @brief Retrieve the previous (if any) BitmapSTB instance.
50 std::shared_ptr<BitmapSTB> GetBitmap() const;
51
52 void UpdateBitmap(std::shared_ptr<BitmapSTB> bitmap);
53
54 private:
55 std::shared_ptr<BitmapSTB> bitmap_;
56
58
59 GlyphAtlasContextSTB& operator=(const GlyphAtlasContextSTB&) = delete;
60};
61
62} // namespace impeller
63
64#endif // FLUTTER_IMPELLER_TYPOGRAPHER_BACKENDS_STB_GLYPH_ATLAS_CONTEXT_STB_H_
uint8_t * GetPixelAddress(TPoint< size_t > coords)
void UpdateBitmap(std::shared_ptr< BitmapSTB > bitmap)
std::shared_ptr< BitmapSTB > GetBitmap() const
Retrieve the previous (if any) BitmapSTB instance.
A container for caching a glyph atlas across frames.
int32_t height
int32_t width
static size_t bytes_per_pixel(skcms_PixelFormat fmt)
Definition skcms.cc:2449