summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h
diff options
context:
space:
mode:
authorasynts <asynts@gmail.com>2021-01-16 15:51:56 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-22 22:14:30 +0100
commit6dc2c38fd0457ee59f3080199c34abcce043d8b8 (patch)
tree1c46faa7cb5397d0d9ceb3c1728070ec533b9a73 /Userland/Libraries/LibGfx/PortableImageLoaderCommon.h
parent7dc3a5ce3f4902f1d0bdbc4b50ba974648392eda (diff)
downloadserenity-6dc2c38fd0457ee59f3080199c34abcce043d8b8.zip
Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
Diffstat (limited to 'Userland/Libraries/LibGfx/PortableImageLoaderCommon.h')
-rw-r--r--Userland/Libraries/LibGfx/PortableImageLoaderCommon.h20
1 files changed, 5 insertions, 15 deletions
diff --git a/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h b/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h
index 5f3c51679c..4417d053a7 100644
--- a/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h
+++ b/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h
@@ -28,6 +28,7 @@
#pragma once
#include <AK/Array.h>
+#include <AK/Debug.h>
#include <AK/Endian.h>
#include <AK/LexicalPath.h>
#include <AK/MappedFile.h>
@@ -41,8 +42,6 @@
#include <LibGfx/ImageDecoder.h>
#include <LibGfx/Streamer.h>
-//#define PORTABLE_IMAGE_LOADER_DEBUG
-
namespace Gfx {
static constexpr Color adjust_color(u16 max_val, Color color)
@@ -105,18 +104,14 @@ static bool read_magic_number(TContext& context, Streamer& streamer)
if (!context.data || context.data_size < 2) {
context.state = TContext::State::Error;
-#ifdef PORTABLE_IMAGE_LOADER_DEBUG
- dbg() << "There is no enough data for " << TContext::image_type;
-#endif
+ dbgln<debug_portable_image_loader>("There is no enough data for {}", TContext::image_type);
return false;
}
u8 magic_number[2] {};
if (!streamer.read_bytes(magic_number, 2)) {
context.state = TContext::State::Error;
-#ifdef PORTABLE_IMAGE_LOADER_DEBUG
- dbg() << "We can't read magic number for " << TContext::image_type;
-#endif
+ dbgln<debug_portable_image_loader>("We can't read magic number for {}", TContext::image_type);
return false;
}
@@ -133,10 +128,7 @@ static bool read_magic_number(TContext& context, Streamer& streamer)
}
context.state = TContext::State::Error;
-#ifdef PORTABLE_IMAGE_LOADER_DEBUG
- dbg() << "Magic number is not valid for "
- << magic_number[0] << magic_number[1] << TContext::image_type;
-#endif
+ dbgln<debug_portable_image_loader>("Magic number is not valid for {}{}{}", magic_number[0], magic_number[1], TContext::image_type);
return false;
}
@@ -194,9 +186,7 @@ static bool read_max_val(TContext& context, Streamer& streamer)
}
if (context.max_val > 255) {
-#ifdef PORTABLE_IMAGE_LOADER_DEBUG
- dbg() << "We can't parse 2 byte color for " << TContext::image_type;
-#endif
+ dbgln<debug_portable_image_loader>("We can't parse 2 byte color for {}", TContext::image_type);
context.state = TContext::Error;
return false;
}