mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 12:25:08 +00:00

The conversion to AK::Stream makes everything much more straightforward and understandable now, because we remove the custom reader we had. Because AK::Stream is more tested, it means that the code should be now more robust against bugs as well.
34 lines
853 B
C++
34 lines
853 B
C++
/*
|
|
* Copyright (c) 2022, Tom Needham <06needhamt@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibGfx/ImageFormats/ImageDecoder.h>
|
|
|
|
namespace Gfx {
|
|
|
|
struct TGALoadingContext;
|
|
|
|
class TGAImageDecoderPlugin final : public ImageDecoderPlugin {
|
|
public:
|
|
static ErrorOr<bool> validate_before_create(ReadonlyBytes);
|
|
static ErrorOr<NonnullOwnPtr<ImageDecoderPlugin>> create(ReadonlyBytes);
|
|
|
|
virtual ~TGAImageDecoderPlugin() override;
|
|
|
|
virtual IntSize size() override;
|
|
|
|
virtual ErrorOr<ImageFrameDescriptor> frame(size_t index, Optional<IntSize> ideal_size = {}) override;
|
|
virtual ErrorOr<Optional<ReadonlyBytes>> icc_data() override;
|
|
|
|
private:
|
|
TGAImageDecoderPlugin(NonnullOwnPtr<TGALoadingContext>);
|
|
|
|
ErrorOr<void> decode_tga_header();
|
|
NonnullOwnPtr<TGALoadingContext> m_context;
|
|
};
|
|
|
|
}
|