mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Abstract the image decoding via Web::ImageDecoding::Decoder
After this change, LibWeb now expects Web::ImageDecoding::Decoder to be pre-initialized with a concrete implementation before using the webpage. The previous implementation, based on the ImageDecoder service, has been provided directly through an adapter in LibWebClient, and is now used as the default value by WebContent.
This commit is contained in:
parent
962040b49c
commit
2198091bbc
Notes:
sideshowbarker
2024-07-17 10:53:54 +09:00
Author: https://github.com/Dexesttp
Commit: 2198091bbc
Pull-request: https://github.com/SerenityOS/serenity/pull/14018
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/MacDue
11 changed files with 132 additions and 20 deletions
32
Userland/Libraries/LibWebView/ImageDecoderClientAdapter.h
Normal file
32
Userland/Libraries/LibWebView/ImageDecoderClientAdapter.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Dex♪ <dexes.ttp@gmail.com>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <LibWeb/ImageDecoding.h>
|
||||
|
||||
namespace ImageDecoderClient {
|
||||
class Client;
|
||||
}
|
||||
|
||||
namespace WebView {
|
||||
|
||||
class ImageDecoderClientAdapter : public Web::ImageDecoding::Decoder {
|
||||
public:
|
||||
static NonnullRefPtr<ImageDecoderClientAdapter> create();
|
||||
|
||||
virtual ~ImageDecoderClientAdapter() override = default;
|
||||
|
||||
virtual Optional<Web::ImageDecoding::DecodedImage> decode_image(ReadonlyBytes) override;
|
||||
|
||||
private:
|
||||
explicit ImageDecoderClientAdapter() = default;
|
||||
|
||||
RefPtr<ImageDecoderClient::Client> m_client;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue