mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 09:47:34 +00:00
Everywhere: Pass AK::ReadonlyBytes by value
This commit is contained in:
parent
8b1108e485
commit
80d4e830a0
42 changed files with 96 additions and 96 deletions
|
@ -143,7 +143,7 @@ u32 Cmap::glyph_id_for_code_point(u32 code_point) const
|
|||
return subtable.glyph_id_for_code_point(code_point);
|
||||
}
|
||||
|
||||
Optional<Cmap> Cmap::from_slice(ReadonlyBytes const& slice)
|
||||
Optional<Cmap> Cmap::from_slice(ReadonlyBytes slice)
|
||||
{
|
||||
if (slice.size() < (size_t)Sizes::TableHeader) {
|
||||
return {};
|
||||
|
|
|
@ -37,7 +37,7 @@ public:
|
|||
UnicodeFullRepertoire = 10,
|
||||
};
|
||||
|
||||
Subtable(ReadonlyBytes const& slice, u16 platform_id, u16 encoding_id)
|
||||
Subtable(ReadonlyBytes slice, u16 platform_id, u16 encoding_id)
|
||||
: m_slice(slice)
|
||||
, m_raw_platform_id(platform_id)
|
||||
, m_encoding_id(encoding_id)
|
||||
|
@ -81,7 +81,7 @@ public:
|
|||
u16 m_encoding_id { 0 };
|
||||
};
|
||||
|
||||
static Optional<Cmap> from_slice(ReadonlyBytes const&);
|
||||
static Optional<Cmap> from_slice(ReadonlyBytes);
|
||||
u32 num_subtables() const;
|
||||
Optional<Subtable> subtable(u32 index) const;
|
||||
void set_active_index(u32 index) { m_active_index = index; }
|
||||
|
@ -99,7 +99,7 @@ private:
|
|||
EncodingRecord = 8,
|
||||
};
|
||||
|
||||
Cmap(ReadonlyBytes const& slice)
|
||||
Cmap(ReadonlyBytes slice)
|
||||
: m_slice(slice)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ u32 tag_from_str(char const* str)
|
|||
return be_u32((u8 const*)str);
|
||||
}
|
||||
|
||||
Optional<Head> Head::from_slice(ReadonlyBytes const& slice)
|
||||
Optional<Head> Head::from_slice(ReadonlyBytes slice)
|
||||
{
|
||||
if (slice.size() < (size_t)Sizes::Table) {
|
||||
return {};
|
||||
|
@ -108,7 +108,7 @@ IndexToLocFormat Head::index_to_loc_format() const
|
|||
}
|
||||
}
|
||||
|
||||
Optional<Hhea> Hhea::from_slice(ReadonlyBytes const& slice)
|
||||
Optional<Hhea> Hhea::from_slice(ReadonlyBytes slice)
|
||||
{
|
||||
if (slice.size() < (size_t)Sizes::Table) {
|
||||
return {};
|
||||
|
@ -141,7 +141,7 @@ u16 Hhea::number_of_h_metrics() const
|
|||
return be_u16(m_slice.offset_pointer((u32)Offsets::NumberOfHMetrics));
|
||||
}
|
||||
|
||||
Optional<Maxp> Maxp::from_slice(ReadonlyBytes const& slice)
|
||||
Optional<Maxp> Maxp::from_slice(ReadonlyBytes slice)
|
||||
{
|
||||
if (slice.size() < (size_t)Sizes::TableV0p5) {
|
||||
return {};
|
||||
|
@ -154,7 +154,7 @@ u16 Maxp::num_glyphs() const
|
|||
return be_u16(m_slice.offset_pointer((u32)Offsets::NumGlyphs));
|
||||
}
|
||||
|
||||
Optional<Hmtx> Hmtx::from_slice(ReadonlyBytes const& slice, u32 num_glyphs, u32 number_of_h_metrics)
|
||||
Optional<Hmtx> Hmtx::from_slice(ReadonlyBytes slice, u32 num_glyphs, u32 number_of_h_metrics)
|
||||
{
|
||||
if (slice.size() < number_of_h_metrics * (u32)Sizes::LongHorMetric + (num_glyphs - number_of_h_metrics) * (u32)Sizes::LeftSideBearing) {
|
||||
return {};
|
||||
|
@ -162,7 +162,7 @@ Optional<Hmtx> Hmtx::from_slice(ReadonlyBytes const& slice, u32 num_glyphs, u32
|
|||
return Hmtx(slice, num_glyphs, number_of_h_metrics);
|
||||
}
|
||||
|
||||
Optional<Name> Name::from_slice(ReadonlyBytes const& slice)
|
||||
Optional<Name> Name::from_slice(ReadonlyBytes slice)
|
||||
{
|
||||
return Name(slice);
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
Gfx::FloatPoint point;
|
||||
};
|
||||
|
||||
PointIterator(ReadonlyBytes const& slice, u16 num_points, u32 flags_offset, u32 x_offset, u32 y_offset, Gfx::AffineTransform affine)
|
||||
PointIterator(ReadonlyBytes slice, u16 num_points, u32 flags_offset, u32 x_offset, u32 y_offset, Gfx::AffineTransform affine)
|
||||
: m_slice(slice)
|
||||
, m_points_remaining(num_points)
|
||||
, m_flags_offset(flags_offset)
|
||||
|
@ -322,7 +322,7 @@ void Rasterizer::draw_line(Gfx::FloatPoint p0, Gfx::FloatPoint p1)
|
|||
}
|
||||
}
|
||||
|
||||
Optional<Loca> Loca::from_slice(ReadonlyBytes const& slice, u32 num_glyphs, IndexToLocFormat index_to_loc_format)
|
||||
Optional<Loca> Loca::from_slice(ReadonlyBytes slice, u32 num_glyphs, IndexToLocFormat index_to_loc_format)
|
||||
{
|
||||
switch (index_to_loc_format) {
|
||||
case IndexToLocFormat::Offset16:
|
||||
|
@ -352,7 +352,7 @@ u32 Loca::get_glyph_offset(u32 glyph_id) const
|
|||
}
|
||||
}
|
||||
|
||||
static void get_ttglyph_offsets(ReadonlyBytes const& slice, u32 num_points, u32 flags_offset, u32* x_offset, u32* y_offset)
|
||||
static void get_ttglyph_offsets(ReadonlyBytes slice, u32 num_points, u32 flags_offset, u32* x_offset, u32* y_offset)
|
||||
{
|
||||
u32 flags_size = 0;
|
||||
u32 x_size = 0;
|
||||
|
|
|
@ -30,11 +30,11 @@ private:
|
|||
|
||||
class Loca {
|
||||
public:
|
||||
static Optional<Loca> from_slice(ReadonlyBytes const&, u32 num_glyphs, IndexToLocFormat);
|
||||
static Optional<Loca> from_slice(ReadonlyBytes, u32 num_glyphs, IndexToLocFormat);
|
||||
u32 get_glyph_offset(u32 glyph_id) const;
|
||||
|
||||
private:
|
||||
Loca(ReadonlyBytes const& slice, u32 num_glyphs, IndexToLocFormat index_to_loc_format)
|
||||
Loca(ReadonlyBytes slice, u32 num_glyphs, IndexToLocFormat index_to_loc_format)
|
||||
: m_slice(slice)
|
||||
, m_num_glyphs(num_glyphs)
|
||||
, m_index_to_loc_format(index_to_loc_format)
|
||||
|
@ -50,7 +50,7 @@ class Glyf {
|
|||
public:
|
||||
class Glyph {
|
||||
public:
|
||||
Glyph(ReadonlyBytes const& slice, i16 xmin, i16 ymin, i16 xmax, i16 ymax, i16 num_contours = -1)
|
||||
Glyph(ReadonlyBytes slice, i16 xmin, i16 ymin, i16 xmax, i16 ymax, i16 num_contours = -1)
|
||||
: m_xmin(xmin)
|
||||
, m_ymin(ymin)
|
||||
, m_xmax(xmax)
|
||||
|
@ -89,7 +89,7 @@ public:
|
|||
Gfx::AffineTransform affine;
|
||||
};
|
||||
|
||||
ComponentIterator(ReadonlyBytes const& slice)
|
||||
ComponentIterator(ReadonlyBytes slice)
|
||||
: m_slice(slice)
|
||||
{
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ public:
|
|||
ReadonlyBytes m_slice;
|
||||
};
|
||||
|
||||
Glyf(ReadonlyBytes const& slice)
|
||||
Glyf(ReadonlyBytes slice)
|
||||
: m_slice(slice)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ enum class IndexToLocFormat {
|
|||
|
||||
class Head {
|
||||
public:
|
||||
static Optional<Head> from_slice(ReadonlyBytes const&);
|
||||
static Optional<Head> from_slice(ReadonlyBytes);
|
||||
u16 units_per_em() const;
|
||||
i16 xmin() const;
|
||||
i16 ymin() const;
|
||||
|
@ -43,7 +43,7 @@ private:
|
|||
Table = 54,
|
||||
};
|
||||
|
||||
Head(ReadonlyBytes const& slice)
|
||||
Head(ReadonlyBytes slice)
|
||||
: m_slice(slice)
|
||||
{
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ private:
|
|||
|
||||
class Hhea {
|
||||
public:
|
||||
static Optional<Hhea> from_slice(ReadonlyBytes const&);
|
||||
static Optional<Hhea> from_slice(ReadonlyBytes);
|
||||
i16 ascender() const;
|
||||
i16 descender() const;
|
||||
i16 line_gap() const;
|
||||
|
@ -72,7 +72,7 @@ private:
|
|||
Table = 36,
|
||||
};
|
||||
|
||||
Hhea(ReadonlyBytes const& slice)
|
||||
Hhea(ReadonlyBytes slice)
|
||||
: m_slice(slice)
|
||||
{
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ private:
|
|||
|
||||
class Maxp {
|
||||
public:
|
||||
static Optional<Maxp> from_slice(ReadonlyBytes const&);
|
||||
static Optional<Maxp> from_slice(ReadonlyBytes);
|
||||
u16 num_glyphs() const;
|
||||
|
||||
private:
|
||||
|
@ -93,7 +93,7 @@ private:
|
|||
TableV0p5 = 6,
|
||||
};
|
||||
|
||||
Maxp(ReadonlyBytes const& slice)
|
||||
Maxp(ReadonlyBytes slice)
|
||||
: m_slice(slice)
|
||||
{
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ struct GlyphHorizontalMetrics {
|
|||
|
||||
class Hmtx {
|
||||
public:
|
||||
static Optional<Hmtx> from_slice(ReadonlyBytes const&, u32 num_glyphs, u32 number_of_h_metrics);
|
||||
static Optional<Hmtx> from_slice(ReadonlyBytes, u32 num_glyphs, u32 number_of_h_metrics);
|
||||
GlyphHorizontalMetrics get_glyph_horizontal_metrics(u32 glyph_id) const;
|
||||
|
||||
private:
|
||||
|
@ -117,7 +117,7 @@ private:
|
|||
LeftSideBearing = 2
|
||||
};
|
||||
|
||||
Hmtx(ReadonlyBytes const& slice, u32 num_glyphs, u32 number_of_h_metrics)
|
||||
Hmtx(ReadonlyBytes slice, u32 num_glyphs, u32 number_of_h_metrics)
|
||||
: m_slice(slice)
|
||||
, m_num_glyphs(num_glyphs)
|
||||
, m_number_of_h_metrics(number_of_h_metrics)
|
||||
|
@ -143,7 +143,7 @@ public:
|
|||
i16 typographic_descender() const;
|
||||
i16 typographic_line_gap() const;
|
||||
|
||||
explicit OS2(ReadonlyBytes const& slice)
|
||||
explicit OS2(ReadonlyBytes slice)
|
||||
: m_slice(slice)
|
||||
{
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ public:
|
|||
enum class WindowsLanguage {
|
||||
EnglishUnitedStates = 0x0409,
|
||||
};
|
||||
static Optional<Name> from_slice(ReadonlyBytes const&);
|
||||
static Optional<Name> from_slice(ReadonlyBytes);
|
||||
|
||||
String family_name() const { return string_for_id(NameId::FamilyName); }
|
||||
String subfamily_name() const { return string_for_id(NameId::SubfamilyName); }
|
||||
|
@ -189,7 +189,7 @@ private:
|
|||
TypographicSubfamilyName = 17,
|
||||
};
|
||||
|
||||
Name(ReadonlyBytes const& slice)
|
||||
Name(ReadonlyBytes slice)
|
||||
: m_slice(slice)
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue