Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
impeller
typographer
backends
stb
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
5
#include "
impeller/typographer/backends/stb/glyph_atlas_context_stb.h
"
6
7
namespace
impeller
{
8
9
BitmapSTB::BitmapSTB
() =
default
;
10
11
BitmapSTB::~BitmapSTB
() =
default
;
12
13
BitmapSTB::BitmapSTB
(
size_t
width
,
size_t
height
,
size_t
bytes_per_pixel
)
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
19
uint8_t*
BitmapSTB::GetPixels
() {
20
return
pixels_.data();
21
}
22
23
uint8_t*
BitmapSTB::GetPixelAddress
(
TPoint<size_t>
coords) {
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
30
size_t
BitmapSTB::GetRowBytes
()
const
{
31
return
width_ * bytes_per_pixel_;
32
}
33
34
size_t
BitmapSTB::GetWidth
()
const
{
35
return
width_;
36
}
37
38
size_t
BitmapSTB::GetHeight
()
const
{
39
return
height_;
40
}
41
42
size_t
BitmapSTB::GetSize
()
const
{
43
return
width_ * height_ * bytes_per_pixel_;
44
}
45
46
GlyphAtlasContextSTB::GlyphAtlasContextSTB
() =
default
;
47
48
GlyphAtlasContextSTB::~GlyphAtlasContextSTB
() =
default
;
49
50
std::shared_ptr<BitmapSTB>
GlyphAtlasContextSTB::GetBitmap
()
const
{
51
return
bitmap_;
52
}
53
54
void
GlyphAtlasContextSTB::UpdateBitmap
(std::shared_ptr<BitmapSTB>
bitmap
) {
55
bitmap_ = std::move(
bitmap
);
56
}
57
58
}
// namespace impeller
impeller::BitmapSTB::GetPixelAddress
uint8_t * GetPixelAddress(TPoint< size_t > coords)
Definition
glyph_atlas_context_stb.cc:23
impeller::BitmapSTB::GetPixels
uint8_t * GetPixels()
Definition
glyph_atlas_context_stb.cc:19
impeller::BitmapSTB::BitmapSTB
BitmapSTB()
impeller::BitmapSTB::GetWidth
size_t GetWidth() const
Definition
glyph_atlas_context_stb.cc:34
impeller::BitmapSTB::~BitmapSTB
~BitmapSTB()
impeller::BitmapSTB::GetSize
size_t GetSize() const
Definition
glyph_atlas_context_stb.cc:42
impeller::BitmapSTB::GetHeight
size_t GetHeight() const
Definition
glyph_atlas_context_stb.cc:38
impeller::BitmapSTB::GetRowBytes
size_t GetRowBytes() const
Definition
glyph_atlas_context_stb.cc:30
impeller::GlyphAtlasContextSTB::GlyphAtlasContextSTB
GlyphAtlasContextSTB()
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::GlyphAtlasContextSTB::~GlyphAtlasContextSTB
~GlyphAtlasContextSTB() override
FML_DCHECK
#define FML_DCHECK(condition)
Definition
logging.h:103
glyph_atlas_context_stb.h
bitmap
Definition
bitmap.py:1
impeller
Definition
texture.h:18
std
Definition
ref_ptr.h:256
height
int32_t height
Definition
serialization_callbacks.cc:1
width
int32_t width
Definition
serialization_callbacks.cc:0
bytes_per_pixel
static size_t bytes_per_pixel(skcms_PixelFormat fmt)
Definition
skcms.cc:2449
impeller::TPoint
Definition
point.h:27
impeller::TPoint::y
Type y
Definition
point.h:31
impeller::TPoint::x
Type x
Definition
point.h:30
Generated on Fri Apr 26 2024 06:14:15 for Flutter Engine by
1.9.8