mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:17:45 +00:00
LibGfx: Replace if constexpr (PNG_DEBUG) printf() with dbgln_if()
The debug console seems more appropriate than stdout here.
This commit is contained in:
parent
b5aaae7b40
commit
634db18809
1 changed files with 10 additions and 17 deletions
|
@ -837,13 +837,11 @@ static bool process_IHDR(ReadonlyBytes data, PNGLoadingContext& context)
|
||||||
context.filter_method = ihdr.filter_method;
|
context.filter_method = ihdr.filter_method;
|
||||||
context.interlace_method = ihdr.interlace_method;
|
context.interlace_method = ihdr.interlace_method;
|
||||||
|
|
||||||
if constexpr (PNG_DEBUG) {
|
dbgln_if(PNG_DEBUG, "PNG: {}x{} ({} bpp)", context.width, context.height, context.bit_depth);
|
||||||
printf("PNG: %dx%d (%d bpp)\n", context.width, context.height, context.bit_depth);
|
dbgln_if(PNG_DEBUG, " Color type: {}", context.color_type);
|
||||||
printf(" Color type: %d\n", context.color_type);
|
dbgln_if(PNG_DEBUG, "Compress Method: {}", context.compression_method);
|
||||||
printf("Compress Method: %d\n", context.compression_method);
|
dbgln_if(PNG_DEBUG, " Filter Method: {}", context.filter_method);
|
||||||
printf(" Filter Method: %d\n", context.filter_method);
|
dbgln_if(PNG_DEBUG, " Interlace type: {}", context.interlace_method);
|
||||||
printf(" Interlace type: %d\n", context.interlace_method);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (context.interlace_method != PngInterlaceMethod::Null && context.interlace_method != PngInterlaceMethod::Adam7) {
|
if (context.interlace_method != PngInterlaceMethod::Null && context.interlace_method != PngInterlaceMethod::Adam7) {
|
||||||
dbgln_if(PNG_DEBUG, "PNGLoader::process_IHDR: unknown interlace method: {}", context.interlace_method);
|
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;
|
u32 chunk_size;
|
||||||
if (!streamer.read(chunk_size)) {
|
if (!streamer.read(chunk_size)) {
|
||||||
if constexpr (PNG_DEBUG)
|
dbgln_if(PNG_DEBUG, "Bail at chunk_size");
|
||||||
printf("Bail at chunk_size\n");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
u8 chunk_type[5];
|
u8 chunk_type[5];
|
||||||
chunk_type[4] = '\0';
|
chunk_type[4] = '\0';
|
||||||
if (!streamer.read_bytes(chunk_type, 4)) {
|
if (!streamer.read_bytes(chunk_type, 4)) {
|
||||||
if constexpr (PNG_DEBUG)
|
dbgln_if(PNG_DEBUG, "Bail at chunk_type");
|
||||||
printf("Bail at chunk_type\n");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ReadonlyBytes chunk_data;
|
ReadonlyBytes chunk_data;
|
||||||
if (!streamer.wrap_bytes(chunk_data, chunk_size)) {
|
if (!streamer.wrap_bytes(chunk_data, chunk_size)) {
|
||||||
if constexpr (PNG_DEBUG)
|
dbgln_if(PNG_DEBUG, "Bail at chunk_data");
|
||||||
printf("Bail at chunk_data\n");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
u32 chunk_crc;
|
u32 chunk_crc;
|
||||||
if (!streamer.read(chunk_crc)) {
|
if (!streamer.read(chunk_crc)) {
|
||||||
if constexpr (PNG_DEBUG)
|
dbgln_if(PNG_DEBUG, "Bail at chunk_crc");
|
||||||
printf("Bail at chunk_crc\n");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if constexpr (PNG_DEBUG)
|
dbgln_if(PNG_DEBUG, "Chunk type: '{}', size: {}, crc: {:x}", chunk_type, chunk_size, chunk_crc);
|
||||||
printf("Chunk type: '%s', size: %u, crc: %x\n", chunk_type, chunk_size, chunk_crc);
|
|
||||||
|
|
||||||
if (!strcmp((const char*)chunk_type, "IHDR"))
|
if (!strcmp((const char*)chunk_type, "IHDR"))
|
||||||
return process_IHDR(chunk_data, context);
|
return process_IHDR(chunk_data, context);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue