1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 08:18:12 +00:00

LibGfx: Put PPM logs behind (default-off) PPM_DEBUG

This commit is contained in:
Nico Weber 2020-11-18 09:59:20 -05:00 committed by Andreas Kling
parent 964d2e0dd0
commit 9ea709e1f3

View file

@ -32,6 +32,8 @@
#include <AK/StringBuilder.h>
#include <string.h>
//#define PPM_DEBUG
namespace Gfx {
struct PPMLoadingContext {
@ -168,14 +170,18 @@ static bool read_magic_number(PPMLoadingContext& context, Streamer& streamer)
if (!context.data || context.data_size < 2) {
context.state = PPMLoadingContext::State::Error;
dbg() << "There is no enough data.";
#ifdef PPM_DEBUG
dbg() << "There is not enough data.";
#endif
return false;
}
u8 magic_number[2];
if (!streamer.read_bytes(magic_number, 2)) {
context.state = PPMLoadingContext::State::Error;
#ifdef PPM_DEBUG
dbg() << "We can't read magic number.";
#endif
return false;
}
@ -192,7 +198,9 @@ static bool read_magic_number(PPMLoadingContext& context, Streamer& streamer)
}
context.state = PPMLoadingContext::State::Error;
#ifdef PPM_DEBUG
dbg() << "Magic number is not valid." << (char)magic_number[0] << (char)magic_number[1];
#endif
return false;
}
@ -255,7 +263,9 @@ static bool read_max_val(PPMLoadingContext& context, Streamer& streamer)
}
if (context.max_val > 255) {
dbg() << "We can't pars 2 byte color.";
#ifdef PPM_DEBUG
dbg() << "We can't parse 2 byte color.";
#endif
context.state = PPMLoadingContext::Error;
return false;
}