summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGfx
diff options
context:
space:
mode:
authorasynts <asynts@gmail.com>2021-01-23 23:59:27 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-25 09:47:36 +0100
commit8465683dcf1ede4dbab46915113dd2ce4e4b7dfb (patch)
tree392cdf423fabec6af5550d831e07217fd0e3287b /Userland/Libraries/LibGfx
parentbb483f7ef4693582d34aa7a30fa2916fdcc8b6f4 (diff)
downloadserenity-8465683dcf1ede4dbab46915113dd2ce4e4b7dfb.zip
Everywhere: Debug macros instead of constexpr.
This was done with the following script: find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/dbgln<debug_([a-z_]+)>/dbgln<\U\1_DEBUG>/' {} \; find . \( -name '*.cpp' -o -name '*.h' -o -name '*.in' \) -not -path './Toolchain/*' -not -path './Build/*' -exec sed -i -E 's/if constexpr \(debug_([a-z0-9_]+)/if constexpr \(\U\1_DEBUG/' {} \;
Diffstat (limited to 'Userland/Libraries/LibGfx')
-rw-r--r--Userland/Libraries/LibGfx/BMPLoader.cpp32
-rw-r--r--Userland/Libraries/LibGfx/GIFLoader.cpp8
-rw-r--r--Userland/Libraries/LibGfx/JPGLoader.cpp74
-rw-r--r--Userland/Libraries/LibGfx/PNGLoader.cpp4
-rw-r--r--Userland/Libraries/LibGfx/Painter.cpp4
-rw-r--r--Userland/Libraries/LibGfx/PortableImageLoaderCommon.h8
6 files changed, 65 insertions, 65 deletions
diff --git a/Userland/Libraries/LibGfx/BMPLoader.cpp b/Userland/Libraries/LibGfx/BMPLoader.cpp
index b84bab5c0a..7954142800 100644
--- a/Userland/Libraries/LibGfx/BMPLoader.cpp
+++ b/Userland/Libraries/LibGfx/BMPLoader.cpp
@@ -317,7 +317,7 @@ static u8 get_scaled_color(u32 data, u8 mask_size, i8 mask_shift)
// to scale the values in order to reach the proper value of 255.
static u32 int_to_scaled_rgb(BMPLoadingContext& context, u32 data)
{
- dbgln<debug_bmp>("DIB info sizes before access: #masks={}, #mask_sizes={}, #mask_shifts={}",
+ dbgln<BMP_DEBUG>("DIB info sizes before access: #masks={}, #mask_sizes={}, #mask_shifts={}",
context.dib.info.masks.size(),
context.dib.info.mask_sizes.size(),
context.dib.info.mask_shifts.size());
@@ -465,7 +465,7 @@ static bool decode_bmp_header(BMPLoadingContext& context)
return true;
if (!context.file_bytes || context.file_size < bmp_header_size) {
- dbgln<debug_bmp>("Missing BMP header");
+ dbgln<BMP_DEBUG>("Missing BMP header");
context.state = BMPLoadingContext::State::Error;
return false;
}
@@ -474,7 +474,7 @@ static bool decode_bmp_header(BMPLoadingContext& context)
u16 header = streamer.read_u16();
if (header != 0x4d42) {
- dbgln<debug_bmp>("BMP has invalid magic header number: {:#04x}", header);
+ dbgln<BMP_DEBUG>("BMP has invalid magic header number: {:#04x}", header);
context.state = BMPLoadingContext::State::Error;
return false;
}
@@ -490,13 +490,13 @@ static bool decode_bmp_header(BMPLoadingContext& context)
streamer.drop_bytes(4);
context.data_offset = streamer.read_u32();
- if constexpr (debug_bmp) {
+ if constexpr (BMP_DEBUG) {
dbgln("BMP file size: {}", context.file_size);
dbgln("BMP data offset: {}", context.data_offset);
}
if (context.data_offset >= context.file_size) {
- dbgln<debug_bmp>("BMP data offset is beyond file end?!");
+ dbgln<BMP_DEBUG>("BMP data offset is beyond file end?!");
return false;
}
@@ -549,7 +549,7 @@ static bool decode_bmp_core_dib(BMPLoadingContext& context, Streamer& streamer)
return false;
}
- if constexpr (debug_bmp) {
+ if constexpr (BMP_DEBUG) {
dbgln("BMP width: {}", core.width);
dbgln("BMP height: {}", core.height);
dbgln("BMP bits_per_pixel: {}", core.bpp);
@@ -598,7 +598,7 @@ static bool decode_bmp_osv2_dib(BMPLoadingContext& context, Streamer& streamer,
return false;
}
- if constexpr (debug_bmp) {
+ if constexpr (BMP_DEBUG) {
dbgln("BMP width: {}", core.width);
dbgln("BMP height: {}", core.height);
dbgln("BMP bits_per_pixel: {}", core.bpp);
@@ -638,7 +638,7 @@ static bool decode_bmp_osv2_dib(BMPLoadingContext& context, Streamer& streamer,
// ColorEncoding (4) + Identifier (4)
streamer.drop_bytes(8);
- if constexpr (debug_bmp) {
+ if constexpr (BMP_DEBUG) {
dbgln("BMP compression: {}", info.compression);
dbgln("BMP image size: {}", info.image_size);
dbgln("BMP horizontal res: {}", info.horizontal_resolution);
@@ -678,7 +678,7 @@ static bool decode_bmp_info_dib(BMPLoadingContext& context, Streamer& streamer)
if (info.number_of_important_palette_colors == 0)
info.number_of_important_palette_colors = info.number_of_palette_colors;
- if constexpr (debug_bmp) {
+ if constexpr (BMP_DEBUG) {
dbgln("BMP compression: {}", info.compression);
dbgln("BMP image size: {}", info.image_size);
dbgln("BMP horizontal res: {}", info.horizontal_resolution);
@@ -699,7 +699,7 @@ static bool decode_bmp_v2_dib(BMPLoadingContext& context, Streamer& streamer)
context.dib.info.masks.append(streamer.read_u32());
context.dib.info.masks.append(streamer.read_u32());
- if constexpr (debug_bmp) {
+ if constexpr (BMP_DEBUG) {
dbgln("BMP red mask: {:#08x}", context.dib.info.masks[0]);
dbgln("BMP green mask: {:#08x}", context.dib.info.masks[1]);
dbgln("BMP blue mask: {:#08x}", context.dib.info.masks[2]);
@@ -719,12 +719,12 @@ static bool decode_bmp_v3_dib(BMPLoadingContext& context, Streamer& streamer)
// suite results.
if (context.dib.info.compression == Compression::ALPHABITFIELDS) {
context.dib.info.masks.append(streamer.read_u32());
- dbgln<debug_bmp>("BMP alpha mask: {:#08x}", context.dib.info.masks[3]);
+ dbgln<BMP_DEBUG>("BMP alpha mask: {:#08x}", context.dib.info.masks[3]);
} else if (context.dib_size() >= 56 && context.dib.core.bpp >= 16) {
auto mask = streamer.read_u32();
if ((context.dib.core.bpp == 32 && mask != 0) || context.dib.core.bpp == 16) {
context.dib.info.masks.append(mask);
- dbgln<debug_bmp>("BMP alpha mask: {:#08x}", mask);
+ dbgln<BMP_DEBUG>("BMP alpha mask: {:#08x}", mask);
}
} else {
streamer.drop_bytes(4);
@@ -745,7 +745,7 @@ static bool decode_bmp_v4_dib(BMPLoadingContext& context, Streamer& streamer)
v4.blue_endpoint = { streamer.read_i32(), streamer.read_i32(), streamer.read_i32() };
v4.gamma_endpoint = { streamer.read_u32(), streamer.read_u32(), streamer.read_u32() };
- if constexpr (debug_bmp) {
+ if constexpr (BMP_DEBUG) {
dbgln("BMP color space: {}", v4.color_space);
dbgln("BMP red endpoint: {}", v4.red_endpoint);
dbgln("BMP green endpoint: {}", v4.green_endpoint);
@@ -766,7 +766,7 @@ static bool decode_bmp_v5_dib(BMPLoadingContext& context, Streamer& streamer)
v5.profile_data = streamer.read_u32();
v5.profile_size = streamer.read_u32();
- if constexpr (debug_bmp) {
+ if constexpr (BMP_DEBUG) {
dbgln("BMP intent: {}", v5.intent);
dbgln("BMP profile data: {}", v5.profile_data);
dbgln("BMP profile size: {}", v5.profile_size);
@@ -801,7 +801,7 @@ static bool decode_bmp_dib(BMPLoadingContext& context)
streamer = Streamer(context.file_bytes + bmp_header_size + 4, context.data_offset - bmp_header_size - 4);
- dbgln<debug_bmp>("BMP dib size: {}", dib_size);
+ dbgln<BMP_DEBUG>("BMP dib size: {}", dib_size);
bool error = false;
@@ -931,7 +931,7 @@ static bool uncompress_bmp_rle_data(BMPLoadingContext& context, ByteBuffer& buff
{
// RLE-compressed images cannot be stored top-down
if (context.dib.core.height < 0) {
- dbgln<debug_bmp>("BMP is top-down and RLE compressed");
+ dbgln<BMP_DEBUG>("BMP is top-down and RLE compressed");
context.state = BMPLoadingContext::State::Error;
return false;
}
diff --git a/Userland/Libraries/LibGfx/GIFLoader.cpp b/Userland/Libraries/LibGfx/GIFLoader.cpp
index 0418244d93..76d2b0adcd 100644
--- a/Userland/Libraries/LibGfx/GIFLoader.cpp
+++ b/Userland/Libraries/LibGfx/GIFLoader.cpp
@@ -212,13 +212,13 @@ public:
}
if (m_current_code > m_code_table.size()) {
- dbgln<debug_gif>("Corrupted LZW stream, invalid code: {} at bit index {}, code table size: {}",
+ dbgln<GIF_DEBUG>("Corrupted LZW stream, invalid code: {} at bit index {}, code table size: {}",
m_current_code,
m_current_bit_index,
m_code_table.size());
return {};
} else if (m_current_code == m_code_table.size() && m_output.is_empty()) {
- dbgln<debug_gif>("Corrupted LZW stream, valid new code but output buffer is empty: {} at bit index {}, code table size: {}",
+ dbgln<GIF_DEBUG>("Corrupted LZW stream, valid new code but output buffer is empty: {} at bit index {}, code table size: {}",
m_current_code,
m_current_bit_index,
m_code_table.size());
@@ -527,12 +527,12 @@ static bool load_gif_frame_descriptors(GIFLoadingContext& context)
if (extension_type == 0xFF) {
if (sub_block.size() != 14) {
- dbgln<debug_gif>("Unexpected application extension size: {}", sub_block.size());
+ dbgln<GIF_DEBUG>("Unexpected application extension size: {}", sub_block.size());
continue;
}
if (sub_block[11] != 1) {
- dbgln<debug_gif>("Unexpected application extension format");
+ dbgln<GIF_DEBUG>("Unexpected application extension format");
continue;
}
diff --git a/Userland/Libraries/LibGfx/JPGLoader.cpp b/Userland/Libraries/LibGfx/JPGLoader.cpp
index 33f03daeeb..8de60841db 100644
--- a/Userland/Libraries/LibGfx/JPGLoader.cpp
+++ b/Userland/Libraries/LibGfx/JPGLoader.cpp
@@ -230,13 +230,13 @@ static void generate_huffman_codes(HuffmanTableSpec& table)
static Optional<size_t> read_huffman_bits(HuffmanStreamState& hstream, size_t count = 1)
{
if (count > (8 * sizeof(size_t))) {
- dbgln<debug_jpg>("Can't read {} bits at once!", count);
+ dbgln<JPG_DEBUG>("Can't read {} bits at once!", count);
return {};
}
size_t value = 0;
while (count--) {
if (hstream.byte_offset >= hstream.stream.size()) {
- dbgln<debug_jpg>("Huffman stream exhausted. This could be an error!");
+ dbgln<JPG_DEBUG>("Huffman stream exhausted. This could be an error!");
return {};
}
u8 current_byte = hstream.stream[hstream.byte_offset];
@@ -313,7 +313,7 @@ static bool build_macroblocks(JPGLoadingContext& context, Vector<Macroblock>& ma
// For DC coefficients, symbol encodes the length of the coefficient.
auto dc_length = symbol_or_error.release_value();
if (dc_length > 11) {
- dbgln<debug_jpg>("DC coefficient too long: {}!", dc_length);
+ dbgln<JPG_DEBUG>("DC coefficient too long: {}!", dc_length);
return false;
}
@@ -350,13 +350,13 @@ static bool build_macroblocks(JPGLoadingContext& context, Vector<Macroblock>& ma
j += run_length;
if (j >= 64) {
- dbgln<debug_jpg>("Run-length exceeded boundaries. Cursor: {}, Skipping: {}!", j, run_length);
+ dbgln<JPG_DEBUG>("Run-length exceeded boundaries. Cursor: {}, Skipping: {}!", j, run_length);
return false;
}
u8 coeff_length = ac_symbol & 0x0F;
if (coeff_length > 10) {
- dbgln<debug_jpg>("AC coefficient too long: {}!", coeff_length);
+ dbgln<JPG_DEBUG>("AC coefficient too long: {}!", coeff_length);
return false;
}
@@ -383,7 +383,7 @@ static Optional<Vector<Macroblock>> decode_huffman_stream(JPGLoadingContext& con
Vector<Macroblock> macroblocks;
macroblocks.resize(context.mblock_meta.padded_total);
- if constexpr (debug_jpg) {
+ if constexpr (JPG_DEBUG) {
dbgln("Image width: {}", context.frame.width);
dbgln("Image height: {}", context.frame.height);
dbgln("Macroblocks in a row: {}", context.mblock_meta.hpadded_count);
@@ -422,7 +422,7 @@ static Optional<Vector<Macroblock>> decode_huffman_stream(JPGLoadingContext& con
}
if (!build_macroblocks(context, macroblocks, hcursor, vcursor)) {
- if constexpr (debug_jpg) {
+ if constexpr (JPG_DEBUG) {
dbgln("Failed to build Macroblock {}", i);
dbgln("Huffman stream byte offset {}", context.huffman_stream.byte_offset);
dbgln("Huffman stream bit offset {}", context.huffman_stream.bit_offset);
@@ -445,7 +445,7 @@ static inline bool is_valid_marker(const Marker marker)
if (marker >= JPG_APPN0 && marker <= JPG_APPNF) {
if (marker != JPG_APPN0)
- dbgln<debug_jpg>("{:#04x} not supported yet. The decoder may fail!", marker);
+ dbgln<JPG_DEBUG>("{:#04x} not supported yet. The decoder may fail!", marker);
return true;
}
if (marker >= JPG_RESERVED1 && marker <= JPG_RESERVEDD)
@@ -467,7 +467,7 @@ static inline bool is_valid_marker(const Marker marker)
if (marker >= 0xFFC0 && marker <= 0xFFCF) {
if (marker != 0xFFC4 && marker != 0xFFC8 && marker != 0xFFCC) {
- dbgln<debug_jpg>("Decoding this frame-type (SOF{}) is not currently supported. Decoder will fail!", marker & 0xf);
+ dbgln<JPG_DEBUG>("Decoding this frame-type (SOF{}) is not currently supported. Decoder will fail!", marker & 0xf);
return false;
}
}
@@ -504,7 +504,7 @@ static inline Marker read_marker_at_cursor(InputMemoryStream& stream)
static bool read_start_of_scan(InputMemoryStream& stream, JPGLoadingContext& context)
{
if (context.state < JPGLoadingContext::State::FrameDecoded) {
- dbgln<debug_jpg>("{}: SOS found before reading a SOF!", stream.offset());
+ dbgln<JPG_DEBUG>("{}: SOS found before reading a SOF!", stream.offset());
return false;
}
@@ -519,7 +519,7 @@ static bool read_start_of_scan(InputMemoryStream& stream, JPGLoadingContext& con
if (stream.handle_any_error())
return false;
if (component_count != context.component_count) {
- dbgln<debug_jpg>("{}: Unsupported number of components: {}!", stream.offset(), component_count);
+ dbgln<JPG_DEBUG>("{}: Unsupported number of components: {}!", stream.offset(), component_count);
return false;
}
@@ -538,7 +538,7 @@ static bool read_start_of_scan(InputMemoryStream& stream, JPGLoadingContext& con
return false;
}
} else {
- dbgln<debug_jpg>("{}: Unsupported component id: {}!", stream.offset(), component_id);
+ dbgln<JPG_DEBUG>("{}: Unsupported component id: {}!", stream.offset(), component_id);
return false;
}
@@ -551,17 +551,17 @@ static bool read_start_of_scan(InputMemoryStream& stream, JPGLoadingContext& con
component->ac_destination_id = table_ids & 0x0F;
if (context.dc_tables.size() != context.ac_tables.size()) {
- dbgln<debug_jpg>("{}: DC & AC table count mismatch!", stream.offset());
+ dbgln<JPG_DEBUG>("{}: DC & AC table count mismatch!", stream.offset());
return false;
}
if (!context.dc_tables.contains(component->dc_destination_id)) {
- dbgln<debug_jpg>("DC table (id: {}) does not exist!", component->dc_destination_id);
+ dbgln<JPG_DEBUG>("DC table (id: {}) does not exist!", component->dc_destination_id);
return false;
}
if (!context.ac_tables.contains(component->ac_destination_id)) {
- dbgln<debug_jpg>("AC table (id: {}) does not exist!", component->ac_destination_id);
+ dbgln<JPG_DEBUG>("AC table (id: {}) does not exist!", component->ac_destination_id);
return false;
}
}
@@ -580,7 +580,7 @@ static bool read_start_of_scan(InputMemoryStream& stream, JPGLoadingContext& con
return false;
// The three values should be fixed for baseline JPEGs utilizing sequential DCT.
if (spectral_selection_start != 0 || spectral_selection_end != 63 || successive_approximation != 0) {
- dbgln<debug_jpg>("{}: ERROR! Start of Selection: {}, End of Selection: {}, Successive Approximation: {}!",
+ dbgln<JPG_DEBUG>("{}: ERROR! Start of Selection: {}, End of Selection: {}, Successive Approximation: {}!",
stream.offset(),
spectral_selection_start,
spectral_selection_end,
@@ -597,7 +597,7 @@ static bool read_reset_marker(InputMemoryStream& stream, JPGLoadingContext& cont
return false;
bytes_to_read -= 2;
if (bytes_to_read != 2) {
- dbgln<debug_jpg>("{}: Malformed reset marker found!", stream.offset());
+ dbgln<JPG_DEBUG>("{}: Malformed reset marker found!", stream.offset());
return false;
}
context.dc_reset_interval = read_be_word(stream);
@@ -623,11 +623,11 @@ static bool read_huffman_table(InputMemoryStream& stream, JPGLoadingContext& con
u8 table_type = table_info >> 4;
u8 table_destination_id = table_info & 0x0F;
if (table_type > 1) {
- dbgln<debug_jpg>("{}: Unrecognized huffman table: {}!", stream.offset(), table_type);
+ dbgln<JPG_DEBUG>("{}: Unrecognized huffman table: {}!", stream.offset(), table_type);
return false;
}
if (table_destination_id > 1) {
- dbgln<debug_jpg>("{}: Invalid huffman table destination id: {}!", stream.offset(), table_destination_id);
+ dbgln<JPG_DEBUG>("{}: Invalid huffman table destination id: {}!", stream.offset(), table_destination_id);
return false;
}
@@ -667,7 +667,7 @@ static bool read_huffman_table(InputMemoryStream& stream, JPGLoadingContext& con
}
if (bytes_to_read != 0) {
- dbgln<debug_jpg>("{}: Extra bytes detected in huffman header!", stream.offset());
+ dbgln<JPG_DEBUG>("{}: Extra bytes detected in huffman header!", stream.offset());
return false;
}
return true;
@@ -683,7 +683,7 @@ static inline bool validate_luma_and_modify_context(const ComponentSpec& luma, J
context.hsample_factor = luma.hsample_factor;
context.vsample_factor = luma.vsample_factor;
- if constexpr (debug_jpg) {
+ if constexpr (JPG_DEBUG) {
dbgln("Horizontal Subsampling Factor: {}", luma.hsample_factor);
dbgln("Vertical Subsampling Factor: {}", luma.vsample_factor);
}
@@ -705,7 +705,7 @@ static inline void set_macroblock_metadata(JPGLoadingContext& context)
static bool read_start_of_frame(InputMemoryStream& stream, JPGLoadingContext& context)
{
if (context.state == JPGLoadingContext::FrameDecoded) {
- dbgln<debug_jpg>("{}: SOF repeated!", stream.offset());
+ dbgln<JPG_DEBUG>("{}: SOF repeated!", stream.offset());
return false;
}
@@ -721,7 +721,7 @@ static bool read_start_of_frame(InputMemoryStream& stream, JPGLoadingContext& co
if (stream.handle_any_error())
return false;
if (context.frame.precision != 8) {
- dbgln<debug_jpg>("{}: SOF precision != 8!", stream.offset());
+ dbgln<JPG_DEBUG>("{}: SOF precision != 8!", stream.offset());
return false;
}
@@ -732,7 +732,7 @@ static bool read_start_of_frame(InputMemoryStream& stream, JPGLoadingContext& co
if (stream.handle_any_error())
return false;
if (!context.frame.width || !context.frame.height) {
- dbgln<debug_jpg>("{}: ERROR! Image height: {}, Image width: {}!", stream.offset(), context.frame.height, context.frame.width);
+ dbgln<JPG_DEBUG>("{}: ERROR! Image height: {}, Image width: {}!", stream.offset(), context.frame.height, context.frame.width);
return false;
}
@@ -747,7 +747,7 @@ static bool read_start_of_frame(InputMemoryStream& stream, JPGLoadingContext& co
if (stream.handle_any_error())
return false;
if (context.component_count != 1 && context.component_count != 3) {
- dbgln<debug_jpg>("{}: Unsupported number of components in SOF: {}!", stream.offset(), context.component_count);
+ dbgln<JPG_DEBUG>("{}: Unsupported number of components in SOF: {}!", stream.offset(), context.component_count);
return false;
}
@@ -770,7 +770,7 @@ static bool read_start_of_frame(InputMemoryStream& stream, JPGLoadingContext& co
// By convention, downsampling is applied only on chroma components. So we should
// hope to see the maximum sampling factor in the luma component.
if (!validate_luma_and_modify_context(component, context)) {
- dbgln<debug_jpg>("{}: Unsupported luma subsampling factors: horizontal: {}, vertical: {}",
+ dbgln<JPG_DEBUG>("{}: Unsupported luma subsampling factors: horizontal: {}, vertical: {}",
stream.offset(),
component.hsample_factor,
component.vsample_factor);
@@ -778,7 +778,7 @@ static bool read_start_of_frame(InputMemoryStream& stream, JPGLoadingContext& co
}
} else {
if (component.hsample_factor != 1 || component.vsample_factor != 1) {
- dbgln<debug_jpg>("{}: Unsupported chroma subsampling factors: horizontal: {}, vertical: {}",
+ dbgln<JPG_DEBUG>("{}: Unsupported chroma subsampling factors: horizontal: {}, vertical: {}",
stream.offset(),
component.hsample_factor,
component.vsample_factor);
@@ -790,7 +790,7 @@ static bool read_start_of_frame(InputMemoryStream& stream, JPGLoadingContext& co
if (stream.handle_any_error())
return false;
if (component.qtable_id > 1) {
- dbgln<debug_jpg>("{}: Unsupported quantization table id: {}!", stream.offset(), component.qtable_id);
+ dbgln<JPG_DEBUG>("{}: Unsupported quantization table id: {}!", stream.offset(), component.qtable_id);
return false;
}
@@ -815,12 +815,12 @@ static bool read_quantization_table(InputMemoryStream& stream, JPGLoadingContext
return false;
u8 element_unit_hint = info_byte >> 4;
if (element_unit_hint > 1) {
- dbgln<debug_jpg>("{}: Unsupported unit hint in quantization table: {}!", stream.offset(), element_unit_hint);
+ dbgln<JPG_DEBUG>("{}: Unsupported unit hint in quantization table: {}!", stream.offset(), element_unit_hint);
return false;
}
u8 table_id = info_byte & 0x0F;
if (table_id > 1) {
- dbgln<debug_jpg>("{}: Unsupported quantization table id: {}!", stream.offset(), table_id);
+ dbgln<JPG_DEBUG>("{}: Unsupported quantization table id: {}!", stream.offset(), table_id);
return false;
}
u32* table = table_id == 0 ? context.luma_table : context.chroma_table;
@@ -843,7 +843,7 @@ static bool read_quantization_table(InputMemoryStream& stream, JPGLoadingContext
bytes_to_read -= 1 + (element_unit_hint == 0 ? 64 : 128);
}
if (bytes_to_read != 0) {
- dbgln<debug_jpg>("{}: Invalid length for one or more quantization tables!", stream.offset());
+ dbgln<JPG_DEBUG>("{}: Invalid length for one or more quantization tables!", stream.offset());
return false;
}
@@ -1109,7 +1109,7 @@ static bool parse_header(InputMemoryStream& stream, JPGLoadingContext& context)
if (stream.handle_any_error())
return false;
if (marker != JPG_SOI) {
- dbgln<debug_jpg>("{}: SOI not found: {:x}!", stream.offset(), marker);
+ dbgln<JPG_DEBUG>("{}: SOI not found: {:x}!", stream.offset(), marker);
return false;
}
for (;;) {
@@ -1137,7 +1137,7 @@ static bool parse_header(InputMemoryStream& stream, JPGLoadingContext& context)
case JPG_RST7:
case JPG_SOI:
case JPG_EOI:
- dbgln<debug_jpg>("{}: Unexpected marker {:x}!", stream.offset(), marker);
+ dbgln<JPG_DEBUG>("{}: Unexpected marker {:x}!", stream.offset(), marker);
return false;
case JPG_SOF0:
if (!read_start_of_frame(stream, context))
@@ -1160,7 +1160,7 @@ static bool parse_header(InputMemoryStream& stream, JPGLoadingContext& context)
return read_start_of_scan(stream, context);
default:
if (!skip_marker_with_length(stream)) {
- dbgln<debug_jpg>("{}: Error skipping marker: {:x}!", stream.offset(), marker);
+ dbgln<JPG_DEBUG>("{}: Error skipping marker: {:x}!", stream.offset(), marker);
return false;
}
break;
@@ -1182,7 +1182,7 @@ static bool scan_huffman_stream(InputMemoryStream& stream, JPGLoadingContext& co
last_byte = current_byte;
stream >> current_byte;
if (stream.handle_any_error()) {
- dbgln<debug_jpg>("{}: EOI not found!", stream.offset());
+ dbgln<JPG_DEBUG>("{}: EOI not found!", stream.offset());
return false;
}
@@ -1206,7 +1206,7 @@ static bool scan_huffman_stream(InputMemoryStream& stream, JPGLoadingContext& co
return false;
continue;
}
- dbgln<debug_jpg>("{}: Invalid marker: {:x}!", stream.offset(), marker);
+ dbgln<JPG_DEBUG>("{}: Invalid marker: {:x}!", stream.offset(), marker);
return false;
} else {
context.huffman_stream.stream.append(last_byte);
@@ -1227,7 +1227,7 @@ static bool decode_jpg(JPGLoadingContext& context)
auto result = decode_huffman_stream(context);
if (!result.has_value()) {
- dbgln<debug_jpg>("{}: Failed to decode Macroblocks!", stream.offset());
+ dbgln<JPG_DEBUG>("{}: Failed to decode Macroblocks!", stream.offset());
return false;
}
diff --git a/Userland/Libraries/LibGfx/PNGLoader.cpp b/Userland/Libraries/LibGfx/PNGLoader.cpp
index 868cf1f0ab..904f51e109 100644
--- a/Userland/Libraries/LibGfx/PNGLoader.cpp
+++ b/Userland/Libraries/LibGfx/PNGLoader.cpp
@@ -613,7 +613,7 @@ static bool decode_png_bitmap_simple(PNGLoadingContext& context)
}
if (filter > 4) {
- dbgln<debug_png>("Invalid PNG filter: {}", filter);
+ dbgln<PNG_DEBUG>("Invalid PNG filter: {}", filter);
context.state = PNGLoadingContext::State::Error;
return false;
}
@@ -715,7 +715,7 @@ static bool decode_adam7_pass(PNGLoadingContext& context, Streamer& streamer, in
}
if (filter > 4) {
- dbgln<debug_png>("Invalid PNG filter: {}", filter);
+ dbgln<PNG_DEBUG>("Invalid PNG filter: {}", filter);
context.state = PNGLoadingContext::State::Error;
return false;
}
diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp
index b38eb1b4eb..e1fe64c78e 100644
--- a/Userland/Libraries/LibGfx/Painter.cpp
+++ b/Userland/Libraries/LibGfx/Painter.cpp
@@ -925,7 +925,7 @@ void Painter::draw_glyph_or_emoji(const IntPoint& point, u32 code_point, const F
// Perhaps it's an emoji?
auto* emoji = Emoji::emoji_for_code_point(code_point);
if (emoji == nullptr) {
- dbgln<debug_emoji>("Failed to find an emoji for code_point {}", code_point);
+ dbgln<EMOJI_DEBUG>("Failed to find an emoji for code_point {}", code_point);
draw_glyph(point, '?', font, color);
return;
}
@@ -1639,7 +1639,7 @@ void Painter::fill_path(Path& path, Color color, WindingRule winding_rule)
// The points between this segment and the previous are
// inside the shape
- dbgln<debug_fill_path>("y={}: {} at {}: {} -- {}", scanline, winding_number, i, from, to);
+ dbgln<FILL_PATH_DEBUG>("y={}: {} at {}: {} -- {}", scanline, winding_number, i, from, to);
draw_line(from, to, color, 1);
}
diff --git a/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h b/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h
index 4417d053a7..dc6f3b3826 100644
--- a/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h
+++ b/Userland/Libraries/LibGfx/PortableImageLoaderCommon.h
@@ -104,14 +104,14 @@ static bool read_magic_number(TContext& context, Streamer& streamer)
if (!context.data || context.data_size < 2) {
context.state = TContext::State::Error;
- dbgln<debug_portable_image_loader>("There is no enough data for {}", TContext::image_type);
+ dbgln<PORTABLE_IMAGE_LOADER_DEBUG>("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;
- dbgln<debug_portable_image_loader>("We can't read magic number for {}", TContext::image_type);
+ dbgln<PORTABLE_IMAGE_LOADER_DEBUG>("We can't read magic number for {}", TContext::image_type);
return false;
}
@@ -128,7 +128,7 @@ static bool read_magic_number(TContext& context, Streamer& streamer)
}
context.state = TContext::State::Error;
- dbgln<debug_portable_image_loader>("Magic number is not valid for {}{}{}", magic_number[0], magic_number[1], TContext::image_type);
+ dbgln<PORTABLE_IMAGE_LOADER_DEBUG>("Magic number is not valid for {}{}{}", magic_number[0], magic_number[1], TContext::image_type);
return false;
}
@@ -186,7 +186,7 @@ static bool read_max_val(TContext& context, Streamer& streamer)
}
if (context.max_val > 255) {
- dbgln<debug_portable_image_loader>("We can't parse 2 byte color for {}", TContext::image_type);
+ dbgln<PORTABLE_IMAGE_LOADER_DEBUG>("We can't parse 2 byte color for {}", TContext::image_type);
context.state = TContext::Error;
return false;
}