Flutter Impeller
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 #pragma once
6 
9 
10 namespace impeller {
11 
12 class BitmapSTB {
13  public:
14  BitmapSTB();
15 
16  ~BitmapSTB();
17 
18  BitmapSTB(size_t width, size_t height, size_t bytes_per_pixel);
19 
20  uint8_t* GetPixels();
21 
22  uint8_t* GetPixelAddress(TPoint<size_t> coords);
23 
24  size_t GetRowBytes() const;
25 
26  size_t GetWidth() const;
27 
28  size_t GetHeight() const;
29 
30  size_t GetSize() const;
31 
32  private:
33  size_t width_ = 0;
34  size_t height_ = 0;
35  size_t bytes_per_pixel_ = 0;
36  std::vector<uint8_t> pixels_;
37 };
38 
40  : public GlyphAtlasContext,
41  public BackendCast<GlyphAtlasContextSTB, GlyphAtlasContext> {
42  public:
44 
45  ~GlyphAtlasContextSTB() override;
46 
47  //----------------------------------------------------------------------------
48  /// @brief Retrieve the previous (if any) BitmapSTB instance.
49  std::shared_ptr<BitmapSTB> GetBitmap() const;
50 
51  void UpdateBitmap(std::shared_ptr<BitmapSTB> bitmap);
52 
53  private:
54  std::shared_ptr<BitmapSTB> bitmap_;
55 
56  FML_DISALLOW_COPY_AND_ASSIGN(GlyphAtlasContextSTB);
57 };
58 
59 } // namespace impeller
impeller::BitmapSTB::BitmapSTB
BitmapSTB()
impeller::GlyphAtlasContextSTB
Definition: glyph_atlas_context_stb.h:39
impeller::GlyphAtlasContextSTB::UpdateBitmap
void UpdateBitmap(std::shared_ptr< BitmapSTB > bitmap)
Definition: glyph_atlas_context_stb.cc:54
impeller::GlyphAtlasContextSTB::GetBitmap
std::shared_ptr< BitmapSTB > GetBitmap() const
Retrieve the previous (if any) BitmapSTB instance.
Definition: glyph_atlas_context_stb.cc:50
impeller::BitmapSTB::GetPixels
uint8_t * GetPixels()
Definition: glyph_atlas_context_stb.cc:19
impeller::BitmapSTB::GetWidth
size_t GetWidth() const
Definition: glyph_atlas_context_stb.cc:34
impeller::BitmapSTB::GetPixelAddress
uint8_t * GetPixelAddress(TPoint< size_t > coords)
Definition: glyph_atlas_context_stb.cc:23
impeller::BitmapSTB
Definition: glyph_atlas_context_stb.h:12
impeller::BitmapSTB::~BitmapSTB
~BitmapSTB()
impeller::BitmapSTB::GetSize
size_t GetSize() const
Definition: glyph_atlas_context_stb.cc:42
impeller::GlyphAtlasContextSTB::~GlyphAtlasContextSTB
~GlyphAtlasContextSTB() override
impeller::BitmapSTB::GetRowBytes
size_t GetRowBytes() const
Definition: glyph_atlas_context_stb.cc:30
impeller::GlyphAtlasContextSTB::GlyphAtlasContextSTB
GlyphAtlasContextSTB()
backend_cast.h
impeller::GlyphAtlasContext
A container for caching a glyph atlas across frames.
Definition: glyph_atlas.h:142
impeller::BitmapSTB::GetHeight
size_t GetHeight() const
Definition: glyph_atlas_context_stb.cc:38
impeller::BackendCast
Definition: backend_cast.h:12
impeller::TPoint
Definition: point.h:20
glyph_atlas.h
impeller
Definition: aiks_context.cc:10