2021-11-20 12:46:27 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
2022-04-30 12:21:21 +03:00
|
|
|
* Copyright (c) 2022, Dex♪ <dexes.ttp@gmail.com>
|
2021-11-20 12:46:27 +03:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <LibWeb/ImageDecoding.h>
|
|
|
|
|
2022-04-30 12:21:21 +03:00
|
|
|
namespace Web::ImageDecoding {
|
2021-11-20 12:46:27 +03:00
|
|
|
|
2022-04-30 12:21:21 +03:00
|
|
|
static RefPtr<Decoder> s_decoder;
|
|
|
|
|
|
|
|
Decoder::Decoder() = default;
|
|
|
|
|
|
|
|
Decoder::~Decoder() = default;
|
|
|
|
|
|
|
|
void Decoder::initialize(RefPtr<Decoder>&& decoder)
|
|
|
|
{
|
|
|
|
s_decoder = move(decoder);
|
|
|
|
}
|
|
|
|
|
|
|
|
Decoder& Decoder::the()
|
2021-11-20 12:46:27 +03:00
|
|
|
{
|
2022-04-30 12:21:21 +03:00
|
|
|
if (!s_decoder) [[unlikely]] {
|
|
|
|
dbgln("Web::ImageDecoding::Decoder was not initialized!");
|
|
|
|
VERIFY_NOT_REACHED();
|
2021-11-20 12:46:27 +03:00
|
|
|
}
|
2022-04-30 12:21:21 +03:00
|
|
|
return *s_decoder;
|
2021-11-20 12:46:27 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|