Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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
47
49
50std::shared_ptr<BitmapSTB> GlyphAtlasContextSTB::GetBitmap() const {
51 return bitmap_;
52}
53
54void GlyphAtlasContextSTB::UpdateBitmap(std::shared_ptr<BitmapSTB> bitmap) {
55 bitmap_ = std::move(bitmap);
56}
57
58} // namespace impeller
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.
#define FML_DCHECK(condition)
Definition logging.h:103
Definition ref_ptr.h:256
int32_t height
int32_t width
static size_t bytes_per_pixel(skcms_PixelFormat fmt)
Definition skcms.cc:2449