mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:28:12 +00:00
Ladybird: Rename classes ending with Ladybird
Now that all the classes for Ladybird are in the Ladybird namespace, we don't need them named as Ladybird::FooBarLadybird. For the Qt-specific classes, we can tack on a Qt at the end for clarity, but FontPlugin and ImageCodecPlugin no longer have anything to do with Qt.
This commit is contained in:
parent
506b03740c
commit
88ccaae11e
13 changed files with 76 additions and 76 deletions
40
Ladybird/ImageCodecPlugin.cpp
Normal file
40
Ladybird/ImageCodecPlugin.cpp
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Dex♪ <dexes.ttp@gmail.com>
|
||||
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "ImageCodecPlugin.h"
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/ImageFormats/ImageDecoder.h>
|
||||
|
||||
namespace Ladybird {
|
||||
|
||||
ImageCodecPlugin::~ImageCodecPlugin() = default;
|
||||
|
||||
Optional<Web::Platform::DecodedImage> ImageCodecPlugin::decode_image(ReadonlyBytes data)
|
||||
{
|
||||
auto decoder = Gfx::ImageDecoder::try_create_for_raw_bytes(data);
|
||||
|
||||
if (!decoder || !decoder->frame_count()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
Vector<Web::Platform::Frame> frames;
|
||||
for (size_t i = 0; i < decoder->frame_count(); ++i) {
|
||||
auto frame_or_error = decoder->frame(i);
|
||||
if (frame_or_error.is_error())
|
||||
return {};
|
||||
auto frame = frame_or_error.release_value();
|
||||
frames.append({ move(frame.image), static_cast<size_t>(frame.duration) });
|
||||
}
|
||||
|
||||
return Web::Platform::DecodedImage {
|
||||
decoder->is_animated(),
|
||||
static_cast<u32>(decoder->loop_count()),
|
||||
move(frames),
|
||||
};
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue