2022-09-16 15:15:14 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Dex♪ <dexes.ttp@gmail.com>
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
|
2022-09-16 15:15:14 +02:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2023-09-08 06:30:50 -04:00
|
|
|
#include <LibImageDecoderClient/Client.h>
|
2022-09-16 15:15:14 +02:00
|
|
|
#include <LibWeb/Platform/ImageCodecPlugin.h>
|
2025-07-01 20:55:11 -07:00
|
|
|
#include <LibWebView/Forward.h>
|
2022-09-16 15:15:14 +02:00
|
|
|
|
2024-11-10 09:53:15 -05:00
|
|
|
namespace WebView {
|
2022-09-16 15:15:14 +02:00
|
|
|
|
2025-07-01 20:55:11 -07:00
|
|
|
class WEBVIEW_API ImageCodecPlugin final : public Web::Platform::ImageCodecPlugin {
|
2022-09-16 15:15:14 +02:00
|
|
|
public:
|
2024-06-26 13:44:42 -06:00
|
|
|
explicit ImageCodecPlugin(NonnullRefPtr<ImageDecoderClient::Client>);
|
2023-08-02 12:01:17 -06:00
|
|
|
virtual ~ImageCodecPlugin() override;
|
2022-09-16 15:15:14 +02:00
|
|
|
|
2024-04-19 15:02:12 -06:00
|
|
|
virtual NonnullRefPtr<Core::Promise<Web::Platform::DecodedImage>> decode_image(ReadonlyBytes, Function<ErrorOr<void>(Web::Platform::DecodedImage&)> on_resolved, Function<void(Error&)> on_rejected) override;
|
2023-09-08 06:30:50 -04:00
|
|
|
|
2024-06-26 13:44:42 -06:00
|
|
|
void set_client(NonnullRefPtr<ImageDecoderClient::Client>);
|
|
|
|
|
2023-09-08 06:30:50 -04:00
|
|
|
private:
|
|
|
|
RefPtr<ImageDecoderClient::Client> m_client;
|
2022-09-16 15:15:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|