1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 09:34:57 +09:00

LibGfx: Rename WOFF[2]::try_load_from_externally_owned_memory()

Typeface::try_load_from_externally_owned_memory() relies on that
external owner keeping the memory around. However, neither WOFF nor
WOFF2 do so - they both create separate ByteBuffers to hold the TTF
data. So, rename them to make it clearer that they don't have any
requirements on the byte owner.
This commit is contained in:
Sam Atkins 2025-05-02 17:46:51 +01:00
parent 23009779e1
commit 6b762331df
Notes: github-actions[bot] 2025-05-03 11:03:42 +00:00
10 changed files with 14 additions and 14 deletions

View file

@ -70,7 +70,7 @@ static u16 pow_2_less_than_or_equal(u16 x)
ErrorOr<NonnullRefPtr<Gfx::Typeface>> try_load_from_resource(Core::Resource const& resource, unsigned index)
{
return try_load_from_externally_owned_memory(resource.data(), index);
return try_load_from_bytes(resource.data(), index);
}
using Uint8 = u8;
@ -102,7 +102,7 @@ struct [[gnu::packed]] TableRecord {
};
static_assert(AssertSize<TableRecord, 16>());
ErrorOr<NonnullRefPtr<Gfx::Typeface>> try_load_from_externally_owned_memory(ReadonlyBytes buffer, unsigned int index)
ErrorOr<NonnullRefPtr<Gfx::Typeface>> try_load_from_bytes(ReadonlyBytes buffer, unsigned int index)
{
FixedMemoryStream stream(buffer);
auto header = TRY(stream.read_value<Header>());

View file

@ -14,6 +14,6 @@
namespace WOFF {
ErrorOr<NonnullRefPtr<Gfx::Typeface>> try_load_from_resource(Core::Resource const&, unsigned index = 0);
ErrorOr<NonnullRefPtr<Gfx::Typeface>> try_load_from_externally_owned_memory(ReadonlyBytes bytes, unsigned index = 0);
ErrorOr<NonnullRefPtr<Gfx::Typeface>> try_load_from_bytes(ReadonlyBytes bytes, unsigned index = 0);
}

View file

@ -53,7 +53,7 @@ private:
ByteBuffer& m_buffer;
};
ErrorOr<NonnullRefPtr<Gfx::Typeface>> try_load_from_externally_owned_memory(ReadonlyBytes bytes)
ErrorOr<NonnullRefPtr<Gfx::Typeface>> try_load_from_bytes(ReadonlyBytes bytes)
{
auto ttf_buffer = TRY(ByteBuffer::create_uninitialized(0));
auto output = WOFF2ByteBufferOut { ttf_buffer };

View file

@ -13,6 +13,6 @@
namespace WOFF2 {
ErrorOr<NonnullRefPtr<Gfx::Typeface>> try_load_from_externally_owned_memory(ReadonlyBytes);
ErrorOr<NonnullRefPtr<Gfx::Typeface>> try_load_from_bytes(ReadonlyBytes);
}