Skip to content

Truly independent web browser

781 B
Raw Blame
/*
 * Copyright (c) 2020, Paul Roukema <[email protected]>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibGfx/ImageFormats/ImageDecoder.h>

namespace Gfx {

struct ICOLoadingContext;

class ICOImageDecoderPlugin final : public ImageDecoderPlugin {
public:
    static bool sniff(ReadonlyBytes);
    static ErrorOr<NonnullOwnPtr<ImageDecoderPlugin>> create(ReadonlyBytes);

    virtual ~ICOImageDecoderPlugin() override;

    virtual IntSize size() override;

    virtual ErrorOr<ImageFrameDescriptor> frame(size_t index, Optional<IntSize> ideal_size = {}) override;

private:
    explicit ICOImageDecoderPlugin(NonnullOwnPtr<ICOLoadingContext>);
    ErrorOr<NonnullRefPtr<Bitmap>> decode_image();

    NonnullOwnPtr<ICOLoadingContext> m_context;
};

}