mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 09:07:35 +00:00
LibGfx: Put PPM logs behind (default-off) PPM_DEBUG
This commit is contained in:
parent
964d2e0dd0
commit
9ea709e1f3
1 changed files with 12 additions and 2 deletions
|
@ -32,6 +32,8 @@
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
//#define PPM_DEBUG
|
||||||
|
|
||||||
namespace Gfx {
|
namespace Gfx {
|
||||||
|
|
||||||
struct PPMLoadingContext {
|
struct PPMLoadingContext {
|
||||||
|
@ -168,14 +170,18 @@ static bool read_magic_number(PPMLoadingContext& context, Streamer& streamer)
|
||||||
|
|
||||||
if (!context.data || context.data_size < 2) {
|
if (!context.data || context.data_size < 2) {
|
||||||
context.state = PPMLoadingContext::State::Error;
|
context.state = PPMLoadingContext::State::Error;
|
||||||
dbg() << "There is no enough data.";
|
#ifdef PPM_DEBUG
|
||||||
|
dbg() << "There is not enough data.";
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 magic_number[2];
|
u8 magic_number[2];
|
||||||
if (!streamer.read_bytes(magic_number, 2)) {
|
if (!streamer.read_bytes(magic_number, 2)) {
|
||||||
context.state = PPMLoadingContext::State::Error;
|
context.state = PPMLoadingContext::State::Error;
|
||||||
|
#ifdef PPM_DEBUG
|
||||||
dbg() << "We can't read magic number.";
|
dbg() << "We can't read magic number.";
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,7 +198,9 @@ static bool read_magic_number(PPMLoadingContext& context, Streamer& streamer)
|
||||||
}
|
}
|
||||||
|
|
||||||
context.state = PPMLoadingContext::State::Error;
|
context.state = PPMLoadingContext::State::Error;
|
||||||
|
#ifdef PPM_DEBUG
|
||||||
dbg() << "Magic number is not valid." << (char)magic_number[0] << (char)magic_number[1];
|
dbg() << "Magic number is not valid." << (char)magic_number[0] << (char)magic_number[1];
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +263,9 @@ static bool read_max_val(PPMLoadingContext& context, Streamer& streamer)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context.max_val > 255) {
|
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;
|
context.state = PPMLoadingContext::Error;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue