LibGfx/JBIG2: Add some debug logging to decode_page_information()

This commit is contained in:
Nico Weber 2024-03-21 09:09:12 -04:00 committed by Andreas Kling
parent 9af966f87d
commit 7035c2a2ff
Notes: sideshowbarker 2024-07-17 16:23:55 +09:00

View File

@ -1933,10 +1933,13 @@ static ErrorOr<void> decode_page_information(JBIG2LoadingContext& context, Segme
if (page_information.bitmap_height == 0xffff'ffff && !page_is_striped)
return Error::from_string_literal("JBIG2ImageDecoderPlugin: Non-striped bitmaps of indeterminate height not allowed");
u16 maximum_stripe_height = page_information.striping_information & 0x7F;
u8 default_color = (page_information.flags >> 2) & 1;
u8 default_combination_operator = (page_information.flags >> 3) & 3;
context.page.default_combination_operator = static_cast<CombinationOperator>(default_combination_operator);
dbgln_if(JBIG2_DEBUG, "Page information: width={}, height={}, is_striped={}, max_stripe_height={}, default_color={}, default_combination_operator={}", page_information.bitmap_width, page_information.bitmap_height, page_is_striped, maximum_stripe_height, default_color, default_combination_operator);
// FIXME: Do something with the other fields in page_information.
// "2) Create the page buffer, of the size given in the page information segment.
@ -1946,7 +1949,7 @@ static ErrorOr<void> decode_page_information(JBIG2LoadingContext& context, Segme
// equal to this maximum stripe height."
size_t height = page_information.bitmap_height;
if (height == 0xffff'ffff)
height = page_information.striping_information & 0x7F;
height = maximum_stripe_height;
context.page.bits = TRY(BitBuffer::create(page_information.bitmap_width, height));
// "3) Fill the page buffer with the page's default pixel value."