Flutter Engine
The Flutter Engine
glyph_atlas_context_stb.cc
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
6
7namespace impeller {
8
9BitmapSTB::BitmapSTB() = default;
10
11BitmapSTB::~BitmapSTB() = default;
12
14 : width_(width),
15 height_(height),
16 bytes_per_pixel_(bytes_per_pixel),
17 pixels_(std::vector<uint8_t>(width * height * bytes_per_pixel, 0)) {}
18
20 return pixels_.data();
21}
22
24 FML_DCHECK(coords.x < width_);
25 FML_DCHECK(coords.x < height_);
26
27 return &pixels_.data()[(coords.x + width_ * coords.y) * bytes_per_pixel_];
28}
29
30size_t BitmapSTB::GetRowBytes() const {
31 return width_ * bytes_per_pixel_;
32}
33
34size_t BitmapSTB::GetWidth() const {
35 return width_;
36}
37
38size_t BitmapSTB::GetHeight() const {
39 return height_;
40}
41
42size_t BitmapSTB::GetSize() const {
43 return width_ * height_ * bytes_per_pixel_;
44}
45
48
50
51std::shared_ptr<BitmapSTB> GlyphAtlasContextSTB::GetBitmap() const {
52 return bitmap_;
53}
54
55void GlyphAtlasContextSTB::UpdateBitmap(std::shared_ptr<BitmapSTB> bitmap) {
56 bitmap_ = std::move(bitmap);
57}
58
59} // namespace impeller
GLenum type
uint8_t * GetPixelAddress(TPoint< size_t > coords)
void UpdateBitmap(std::shared_ptr< BitmapSTB > bitmap)
GlyphAtlasContextSTB(GlyphAtlas::Type type)
std::shared_ptr< BitmapSTB > GetBitmap() const
Retrieve the previous (if any) BitmapSTB instance.
A container for caching a glyph atlas across frames.
Definition: glyph_atlas.h:149
Type
Describes how the glyphs are represented in the texture.
Definition: glyph_atlas.h:31
#define FML_DCHECK(condition)
Definition: logging.h:103
Definition: bitmap.py:1
Definition: ref_ptr.h:256
int32_t height
int32_t width
static size_t bytes_per_pixel(skcms_PixelFormat fmt)
Definition: skcms.cc:2449