summaryrefslogtreecommitdiff
path: root/Userland/Libraries
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-05-31 15:04:23 +0100
committerLinus Groh <mail@linusgroh.de>2021-05-31 17:43:54 +0100
commit634db1880956319bc2e4d74e68c75f4c8772ca0d (patch)
treea82f96d9d623ef1a040c64ad60e5b0c59a1733e6 /Userland/Libraries
parentb5aaae7b40a52c99decc0c147170d16fa397dd96 (diff)
downloadserenity-634db1880956319bc2e4d74e68c75f4c8772ca0d.zip
LibGfx: Replace if constexpr (PNG_DEBUG) printf() with dbgln_if()
The debug console seems more appropriate than stdout here.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r--Userland/Libraries/LibGfx/PNGLoader.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/Userland/Libraries/LibGfx/PNGLoader.cpp b/Userland/Libraries/LibGfx/PNGLoader.cpp
index 31d62d9e5d..8dee3b1d4c 100644
--- a/Userland/Libraries/LibGfx/PNGLoader.cpp
+++ b/Userland/Libraries/LibGfx/PNGLoader.cpp
@@ -837,13 +837,11 @@ static bool process_IHDR(ReadonlyBytes data, PNGLoadingContext& context)
context.filter_method = ihdr.filter_method;
context.interlace_method = ihdr.interlace_method;
- if constexpr (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);
- printf(" Filter Method: %d\n", context.filter_method);
- printf(" Interlace type: %d\n", context.interlace_method);
- }
+ dbgln_if(PNG_DEBUG, "PNG: {}x{} ({} bpp)", context.width, context.height, context.bit_depth);
+ dbgln_if(PNG_DEBUG, " Color type: {}", context.color_type);
+ dbgln_if(PNG_DEBUG, "Compress Method: {}", context.compression_method);
+ dbgln_if(PNG_DEBUG, " Filter Method: {}", context.filter_method);
+ dbgln_if(PNG_DEBUG, " Interlace type: {}", context.interlace_method);
if (context.interlace_method != PngInterlaceMethod::Null && context.interlace_method != PngInterlaceMethod::Adam7) {
dbgln_if(PNG_DEBUG, "PNGLoader::process_IHDR: unknown interlace method: {}", context.interlace_method);
@@ -908,31 +906,26 @@ static bool process_chunk(Streamer& streamer, PNGLoadingContext& context)
{
u32 chunk_size;
if (!streamer.read(chunk_size)) {
- if constexpr (PNG_DEBUG)
- printf("Bail at chunk_size\n");
+ dbgln_if(PNG_DEBUG, "Bail at chunk_size");
return false;
}
u8 chunk_type[5];
chunk_type[4] = '\0';
if (!streamer.read_bytes(chunk_type, 4)) {
- if constexpr (PNG_DEBUG)
- printf("Bail at chunk_type\n");
+ dbgln_if(PNG_DEBUG, "Bail at chunk_type");
return false;
}
ReadonlyBytes chunk_data;
if (!streamer.wrap_bytes(chunk_data, chunk_size)) {
- if constexpr (PNG_DEBUG)
- printf("Bail at chunk_data\n");
+ dbgln_if(PNG_DEBUG, "Bail at chunk_data");
return false;
}
u32 chunk_crc;
if (!streamer.read(chunk_crc)) {
- if constexpr (PNG_DEBUG)
- printf("Bail at chunk_crc\n");
+ dbgln_if(PNG_DEBUG, "Bail at chunk_crc");
return false;
}
- if constexpr (PNG_DEBUG)
- printf("Chunk type: '%s', size: %u, crc: %x\n", chunk_type, chunk_size, chunk_crc);
+ dbgln_if(PNG_DEBUG, "Chunk type: '{}', size: {}, crc: {:x}", chunk_type, chunk_size, chunk_crc);
if (!strcmp((const char*)chunk_type, "IHDR"))
return process_IHDR(chunk_data, context);