mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:24:57 +00:00
ImageDecoder: Add plumbing to allow a client to request an ideal size
This is only used for vector graphics format where requesting the true displayed size leads to visual enhancement.
This commit is contained in:
parent
4c23f0e142
commit
e56eb11dee
7 changed files with 13 additions and 13 deletions
|
@ -20,7 +20,7 @@ void Client::die()
|
|||
on_death();
|
||||
}
|
||||
|
||||
Optional<DecodedImage> Client::decode_image(ReadonlyBytes encoded_data, Optional<ByteString> mime_type)
|
||||
Optional<DecodedImage> Client::decode_image(ReadonlyBytes encoded_data, Optional<Gfx::IntSize> ideal_size, Optional<ByteString> mime_type)
|
||||
{
|
||||
if (encoded_data.is_empty())
|
||||
return {};
|
||||
|
@ -33,7 +33,7 @@ Optional<DecodedImage> Client::decode_image(ReadonlyBytes encoded_data, Optional
|
|||
auto encoded_buffer = encoded_buffer_or_error.release_value();
|
||||
|
||||
memcpy(encoded_buffer.data<void>(), encoded_data.data(), encoded_data.size());
|
||||
auto response_or_error = try_decode_image(move(encoded_buffer), mime_type);
|
||||
auto response_or_error = try_decode_image(move(encoded_buffer), ideal_size, mime_type);
|
||||
|
||||
if (response_or_error.is_error()) {
|
||||
dbgln("ImageDecoder died heroically");
|
||||
|
|
|
@ -32,7 +32,7 @@ class Client final
|
|||
public:
|
||||
Client(NonnullOwnPtr<Core::LocalSocket>);
|
||||
|
||||
Optional<DecodedImage> decode_image(ReadonlyBytes, Optional<ByteString> mime_type = {});
|
||||
Optional<DecodedImage> decode_image(ReadonlyBytes, Optional<Gfx::IntSize> ideal_size = {}, Optional<ByteString> mime_type = {});
|
||||
|
||||
Function<void()> on_death;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue