Skip to content

Commit

Permalink
LibGfx: Remove ILBM image format support
Browse files Browse the repository at this point in the history
This format is not supported by other browsers.
  • Loading branch information
awesomekling committed Jun 17, 2024
1 parent b6daddb commit a34a5af
Show file tree
Hide file tree
Showing 23 changed files with 0 additions and 618 deletions.
4 changes: 0 additions & 4 deletions AK/Debug.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@
# cmakedefine01 IDL_DEBUG
#endif

#ifndef ILBM_DEBUG
# cmakedefine01 ILBM_DEBUG
#endif

#ifndef IMAGE_DECODER_DEBUG
# cmakedefine01 IMAGE_DECODER_DEBUG
#endif
Expand Down
1 change: 0 additions & 1 deletion Meta/CMake/all_the_debug_macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ set(HTTPJOB_DEBUG ON)
set(HUNKS_DEBUG ON)
set(ICO_DEBUG ON)
set(IDL_DEBUG ON)
set(ILBM_DEBUG ON)
set(IMAGE_DECODER_DEBUG ON)
set(IMAGE_LOADER_DEBUG ON)
set(JOB_DEBUG ON)
Expand Down
19 changes: 0 additions & 19 deletions Meta/Lagom/Fuzzers/FuzzILBMLoader.cpp

This file was deleted.

2 changes: 0 additions & 2 deletions Meta/Lagom/Fuzzers/fuzzers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ set(FUZZER_TARGETS
HttpRequest
ICCProfile
ICOLoader
ILBMLoader
JPEG2000Loader
JPEGLoader
Js
Expand Down Expand Up @@ -71,7 +70,6 @@ set(FUZZER_DEPENDENCIES_GzipRoundtrip LibCompress)
set(FUZZER_DEPENDENCIES_HttpRequest LibHTTP)
set(FUZZER_DEPENDENCIES_ICCProfile LibGfx)
set(FUZZER_DEPENDENCIES_ICOLoader LibGfx)
set(FUZZER_DEPENDENCIES_ILBMLoader LibGfx)
set(FUZZER_DEPENDENCIES_JPEG2000Loader LibGfx)
set(FUZZER_DEPENDENCIES_JPEGLoader LibGfx)
set(FUZZER_DEPENDENCIES_Js LibJS)
Expand Down
1 change: 0 additions & 1 deletion Meta/gn/secondary/AK/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ write_cmake_config("ak_debug_gen") {
"HUNKS_DEBUG=",
"ICO_DEBUG=",
"IDL_DEBUG=",
"ILBM_DEBUG=",
"IMAGE_DECODER_DEBUG=",
"IMAGE_LOADER_DEBUG=",
"JOB_DEBUG=",
Expand Down
1 change: 0 additions & 1 deletion Meta/gn/secondary/Userland/Libraries/LibGfx/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ shared_library("LibGfx") {
"ImageFormats/CCITTDecoder.cpp",
"ImageFormats/GIFLoader.cpp",
"ImageFormats/ICOLoader.cpp",
"ImageFormats/ILBMLoader.cpp",
"ImageFormats/ISOBMFF/Boxes.cpp",
"ImageFormats/ISOBMFF/JPEG2000Boxes.cpp",
"ImageFormats/ISOBMFF/Reader.cpp",
Expand Down
118 changes: 0 additions & 118 deletions Tests/LibGfx/TestImageDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <LibGfx/ImageFormats/BMPLoader.h>
#include <LibGfx/ImageFormats/GIFLoader.h>
#include <LibGfx/ImageFormats/ICOLoader.h>
#include <LibGfx/ImageFormats/ILBMLoader.h>
#include <LibGfx/ImageFormats/ImageDecoder.h>
#include <LibGfx/ImageFormats/JPEG2000Loader.h>
#include <LibGfx/ImageFormats/JPEGLoader.h>
Expand Down Expand Up @@ -195,123 +194,6 @@ TEST_CASE(test_malformed_maskless_ico)
EXPECT_EQ(frame.image->get_pixel(7, 4), Gfx::Color(161, 0, 0));
}

TEST_CASE(test_ilbm)
{
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("ilbm/gradient.iff"sv)));
EXPECT(Gfx::ILBMImageDecoderPlugin::sniff(file->bytes()));
auto plugin_decoder = TRY_OR_FAIL(Gfx::ILBMImageDecoderPlugin::create(file->bytes()));

auto frame = TRY_OR_FAIL(expect_single_frame_of_size(*plugin_decoder, { 320, 200 }));

EXPECT_EQ(frame.image->get_pixel(8, 0), Gfx::Color(0xee, 0xbb, 0, 255));
}

TEST_CASE(test_ilbm_uncompressed)
{
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("ilbm/gradient-uncompressed.iff"sv)));
EXPECT(Gfx::ILBMImageDecoderPlugin::sniff(file->bytes()));
auto plugin_decoder = TRY_OR_FAIL(Gfx::ILBMImageDecoderPlugin::create(file->bytes()));

auto frame = TRY_OR_FAIL(expect_single_frame_of_size(*plugin_decoder, { 320, 200 }));

EXPECT_EQ(frame.image->get_pixel(8, 0), Gfx::Color(0xee, 0xbb, 0, 255));
}

TEST_CASE(test_ilbm_ham6)
{
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("ilbm/ham6.iff"sv)));
EXPECT(Gfx::ILBMImageDecoderPlugin::sniff(file->bytes()));
auto plugin_decoder = TRY_OR_FAIL(Gfx::ILBMImageDecoderPlugin::create(file->bytes()));

auto frame = TRY_OR_FAIL(expect_single_frame_of_size(*plugin_decoder, { 256, 256 }));

EXPECT_EQ(frame.image->get_pixel(77, 107), Gfx::Color(0xf0, 0x40, 0x40, 0xff));
}

TEST_CASE(test_ilbm_dos)
{
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("ilbm/serenity.lbm"sv)));
EXPECT(Gfx::ILBMImageDecoderPlugin::sniff(file->bytes()));
auto plugin_decoder = TRY_OR_FAIL(Gfx::ILBMImageDecoderPlugin::create(file->bytes()));

auto frame = TRY_OR_FAIL(expect_single_frame_of_size(*plugin_decoder, { 640, 480 }));

EXPECT_EQ(frame.image->get_pixel(315, 134), Gfx::Color::NamedColor::Red);
}

TEST_CASE(test_24bit)
{
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("ilbm/serenity-24bit.iff"sv)));
EXPECT(Gfx::ILBMImageDecoderPlugin::sniff(file->bytes()));
auto plugin_decoder = TRY_OR_FAIL(Gfx::ILBMImageDecoderPlugin::create(file->bytes()));

auto frame = TRY_OR_FAIL(expect_single_frame_of_size(*plugin_decoder, { 640, 640 }));

EXPECT_EQ(frame.image->get_pixel(158, 270), Gfx::Color(0xee, 0x3d, 0x3c, 255));
}

TEST_CASE(test_brush_transparent_color)
{
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("ilbm/brush-transparent-color.iff"sv)));
EXPECT(Gfx::ILBMImageDecoderPlugin::sniff(file->bytes()));
auto plugin_decoder = TRY_OR_FAIL(Gfx::ILBMImageDecoderPlugin::create(file->bytes()));

auto frame = TRY_OR_FAIL(expect_single_frame_of_size(*plugin_decoder, { 266, 309 }));

EXPECT_EQ(frame.image->get_pixel(114, 103), Gfx::Color::NamedColor::Black);
}

TEST_CASE(test_small_24bit)
{
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("ilbm/small-24bit.iff"sv)));
EXPECT(Gfx::ILBMImageDecoderPlugin::sniff(file->bytes()));
auto plugin_decoder = TRY_OR_FAIL(Gfx::ILBMImageDecoderPlugin::create(file->bytes()));

auto frame = TRY_OR_FAIL(expect_single_frame_of_size(*plugin_decoder, { 10, 10 }));

EXPECT_EQ(frame.image->get_pixel(0, 4), Gfx::Color(1, 0, 1, 255));
}

TEST_CASE(test_stencil_mask)
{
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("ilbm/test-stencil.iff"sv)));
EXPECT(Gfx::ILBMImageDecoderPlugin::sniff(file->bytes()));
auto plugin_decoder = TRY_OR_FAIL(Gfx::ILBMImageDecoderPlugin::create(file->bytes()));

auto frame = TRY_OR_FAIL(expect_single_frame_of_size(*plugin_decoder, { 320, 200 }));

EXPECT_EQ(frame.image->get_pixel(0, 4), Gfx::Color(0, 0, 0, 255));
}

TEST_CASE(test_ilbm_malformed_header)
{
Array test_inputs = {
TEST_INPUT("ilbm/truncated-bmhd-chunk.iff"sv)
};

for (auto test_input : test_inputs) {
auto file = TRY_OR_FAIL(Core::MappedFile::map(test_input));
auto plugin_decoder_or_error = Gfx::ILBMImageDecoderPlugin::create(file->bytes());
EXPECT(plugin_decoder_or_error.is_error());
}
}

TEST_CASE(test_ilbm_malformed_frame)
{
Array test_inputs = {
TEST_INPUT("ilbm/incorrect-cmap-size.iff"sv),
TEST_INPUT("ilbm/incorrect-uncompressed-size.iff"sv),
TEST_INPUT("ilbm/missing-body-chunk.iff"sv)
};

for (auto test_input : test_inputs) {
auto file = TRY_OR_FAIL(Core::MappedFile::map(test_input));
auto plugin_decoder = TRY_OR_FAIL(Gfx::ILBMImageDecoderPlugin::create(file->bytes()));
auto frame_or_error = plugin_decoder->frame(0);
EXPECT(frame_or_error.is_error());
}
}

TEST_CASE(test_jpeg_sof0_one_scan)
{
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("jpg/rgb24.jpg"sv)));
Expand Down
Binary file not shown.
Binary file not shown.
Binary file removed Tests/LibGfx/test-inputs/ilbm/gradient.iff
Binary file not shown.
Binary file removed Tests/LibGfx/test-inputs/ilbm/ham6.iff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed Tests/LibGfx/test-inputs/ilbm/missing-body-chunk.iff
Binary file not shown.
Binary file removed Tests/LibGfx/test-inputs/ilbm/serenity-24bit.iff
Binary file not shown.
Binary file removed Tests/LibGfx/test-inputs/ilbm/serenity.lbm
Binary file not shown.
Binary file removed Tests/LibGfx/test-inputs/ilbm/small-24bit.iff
Binary file not shown.
Binary file removed Tests/LibGfx/test-inputs/ilbm/test-stencil.iff
Binary file not shown.
Binary file removed Tests/LibGfx/test-inputs/ilbm/truncated-bmhd-chunk.iff
Binary file not shown.
1 change: 0 additions & 1 deletion Userland/Libraries/LibGfx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ set(SOURCES
ImageFormats/GIFLoader.cpp
ImageFormats/GIFWriter.cpp
ImageFormats/ICOLoader.cpp
ImageFormats/ILBMLoader.cpp
ImageFormats/ImageDecoder.cpp
ImageFormats/ISOBMFF/Boxes.cpp
ImageFormats/ISOBMFF/JPEG2000Boxes.cpp
Expand Down
Loading

0 comments on commit a34a5af

Please sign in to comment.