소스 검색

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

Nico Weber 1 년 전
부모
커밋
7035c2a2ff
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      Userland/Libraries/LibGfx/ImageFormats/JBIG2Loader.cpp

+ 4 - 1
Userland/Libraries/LibGfx/ImageFormats/JBIG2Loader.cpp

@@ -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."