summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGfx
diff options
context:
space:
mode:
authorasynts <asynts@gmail.com>2021-01-23 23:29:11 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-25 09:47:36 +0100
commit1a3a0836c017ab5e5672472033f3ff369dc33c39 (patch)
tree354552e5dae4f7baf2b8ee05eb33e2f7587826f6 /Userland/Libraries/LibGfx
parent76f29184162e35d570034a8438a683695faa273f (diff)
downloadserenity-1a3a0836c017ab5e5672472033f3ff369dc33c39.zip
Everywhere: Use CMake to generate AK/Debug.h.
This was done with the help of several scripts, I dump them here to easily find them later: awk '/#ifdef/ { print "#cmakedefine01 "$2 }' AK/Debug.h.in for debug_macro in $(awk '/#ifdef/ { print $2 }' AK/Debug.h.in) do find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/#ifdef '$debug_macro'/#if '$debug_macro'/' {} \; done # Remember to remove WRAPPER_GERNERATOR_DEBUG from the list. awk '/#cmake/ { print "set("$2" ON)" }' AK/Debug.h.in
Diffstat (limited to 'Userland/Libraries/LibGfx')
-rw-r--r--Userland/Libraries/LibGfx/GIFLoader.cpp4
-rw-r--r--Userland/Libraries/LibGfx/JPGLoader.cpp2
-rw-r--r--Userland/Libraries/LibGfx/PNGLoader.cpp18
-rw-r--r--Userland/Libraries/LibGfx/Painter.cpp4
4 files changed, 14 insertions, 14 deletions
diff --git a/Userland/Libraries/LibGfx/GIFLoader.cpp b/Userland/Libraries/LibGfx/GIFLoader.cpp
index 1e625986e9..0418244d93 100644
--- a/Userland/Libraries/LibGfx/GIFLoader.cpp
+++ b/Userland/Libraries/LibGfx/GIFLoader.cpp
@@ -355,7 +355,7 @@ static bool decode_frame(GIFLoadingContext& context, size_t frame_index)
while (true) {
Optional<u16> code = decoder.next_code();
if (!code.has_value()) {
-#ifdef GIF_DEBUG
+#if GIF_DEBUG
dbgln("Unexpectedly reached end of gif frame data");
#endif
return false;
@@ -504,7 +504,7 @@ static bool load_gif_frame_descriptors(GIFLoadingContext& context)
if (extension_type == 0xF9) {
if (sub_block.size() != 4) {
-#ifdef GIF_DEBUG
+#if GIF_DEBUG
dbgln("Unexpected graphic control size");
#endif
continue;
diff --git a/Userland/Libraries/LibGfx/JPGLoader.cpp b/Userland/Libraries/LibGfx/JPGLoader.cpp
index 8994b3c26d..33f03daeeb 100644
--- a/Userland/Libraries/LibGfx/JPGLoader.cpp
+++ b/Userland/Libraries/LibGfx/JPGLoader.cpp
@@ -267,7 +267,7 @@ static Optional<u8> get_next_symbol(HuffmanStreamState& hstream, const HuffmanTa
}
}
-#ifdef JPG_DEBUG
+#if JPG_DEBUG
dbgln("If you're seeing this...the jpeg decoder needs to support more kinds of JPEGs!");
#endif
return {};
diff --git a/Userland/Libraries/LibGfx/PNGLoader.cpp b/Userland/Libraries/LibGfx/PNGLoader.cpp
index fd0b32fdd0..868cf1f0ab 100644
--- a/Userland/Libraries/LibGfx/PNGLoader.cpp
+++ b/Userland/Libraries/LibGfx/PNGLoader.cpp
@@ -526,7 +526,7 @@ static bool decode_png_header(PNGLoadingContext& context)
return true;
if (!context.data || context.data_size < sizeof(png_header)) {
-#ifdef PNG_DEBUG
+#if PNG_DEBUG
dbgln("Missing PNG header");
#endif
context.state = PNGLoadingContext::State::Error;
@@ -534,7 +534,7 @@ static bool decode_png_header(PNGLoadingContext& context)
}
if (memcmp(context.data, png_header, sizeof(png_header)) != 0) {
-#ifdef PNG_DEBUG
+#if PNG_DEBUG
dbgln("Invalid PNG header");
#endif
context.state = PNGLoadingContext::State::Error;
@@ -874,7 +874,7 @@ static bool process_IHDR(ReadonlyBytes data, PNGLoadingContext& context)
context.filter_method = ihdr.filter_method;
context.interlace_method = ihdr.interlace_method;
-#ifdef PNG_DEBUG
+#if PNG_DEBUG
printf("PNG: %dx%d (%d bpp)\n", context.width, context.height, context.bit_depth);
printf(" Color type: %d\n", context.color_type);
printf("Compress Method: %d\n", context.compression_method);
@@ -883,7 +883,7 @@ static bool process_IHDR(ReadonlyBytes data, PNGLoadingContext& context)
#endif
if (context.interlace_method != PngInterlaceMethod::Null && context.interlace_method != PngInterlaceMethod::Adam7) {
-#ifdef PNG_DEBUG
+#if PNG_DEBUG
dbgln("PNGLoader::process_IHDR: unknown interlace method: {}", context.interlace_method);
#endif
return false;
@@ -947,7 +947,7 @@ static bool process_chunk(Streamer& streamer, PNGLoadingContext& context)
{
u32 chunk_size;
if (!streamer.read(chunk_size)) {
-#ifdef PNG_DEBUG
+#if PNG_DEBUG
printf("Bail at chunk_size\n");
#endif
return false;
@@ -955,26 +955,26 @@ static bool process_chunk(Streamer& streamer, PNGLoadingContext& context)
u8 chunk_type[5];
chunk_type[4] = '\0';
if (!streamer.read_bytes(chunk_type, 4)) {
-#ifdef PNG_DEBUG
+#if PNG_DEBUG
printf("Bail at chunk_type\n");
#endif
return false;
}
ReadonlyBytes chunk_data;
if (!streamer.wrap_bytes(chunk_data, chunk_size)) {
-#ifdef PNG_DEBUG
+#if PNG_DEBUG
printf("Bail at chunk_data\n");
#endif
return false;
}
u32 chunk_crc;
if (!streamer.read(chunk_crc)) {
-#ifdef PNG_DEBUG
+#if PNG_DEBUG
printf("Bail at chunk_crc\n");
#endif
return false;
}
-#ifdef PNG_DEBUG
+#if PNG_DEBUG
printf("Chunk type: '%s', size: %u, crc: %x\n", chunk_type, chunk_size, chunk_crc);
#endif
diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp
index e98cec2c8a..89dc36b6e9 100644
--- a/Userland/Libraries/LibGfx/Painter.cpp
+++ b/Userland/Libraries/LibGfx/Painter.cpp
@@ -1620,7 +1620,7 @@ void Painter::fill_path(Path& path, Color color, WindingRule winding_rule)
quick_sort(active_list, [](const auto& line0, const auto& line1) {
return line1.x < line0.x;
});
-#ifdef FILL_PATH_DEBUG
+#if FILL_PATH_DEBUG
if ((int)scanline % 10 == 0) {
draw_text(IntRect(active_list.last().x - 20, scanline, 20, 10), String::number((int)scanline));
}
@@ -1692,7 +1692,7 @@ void Painter::fill_path(Path& path, Color color, WindingRule winding_rule)
}
}
-#ifdef FILL_PATH_DEBUG
+#if FILL_PATH_DEBUG
size_t i { 0 };
for (auto& segment : segments) {
draw_line(Point<int>(segment.from), Point<int>(segment.to), Color::from_hsv(i++ * 360.0 / segments.size(), 1.0, 1.0), 1);