summaryrefslogtreecommitdiff
path: root/Libraries/LibGfx
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2020-11-18 09:59:20 -0500
committerAndreas Kling <kling@serenityos.org>2020-11-19 14:04:35 +0100
commit9ea709e1f304018d47c0fe3be22fae56dc2ccbe2 (patch)
treea6264dc6e6b3221e4305bfba5e7eaaff315e67ac /Libraries/LibGfx
parent964d2e0dd0662ea78f5445e092c60b6d6761a6a0 (diff)
downloadserenity-9ea709e1f304018d47c0fe3be22fae56dc2ccbe2.zip
LibGfx: Put PPM logs behind (default-off) PPM_DEBUG
Diffstat (limited to 'Libraries/LibGfx')
-rw-r--r--Libraries/LibGfx/PPMLoader.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/Libraries/LibGfx/PPMLoader.cpp b/Libraries/LibGfx/PPMLoader.cpp
index d891821877..e41a2cfb57 100644
--- a/Libraries/LibGfx/PPMLoader.cpp
+++ b/Libraries/LibGfx/PPMLoader.cpp
@@ -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;
}