Skip to content

Commit c163163

Browse files
committed
LibPDF: Pass the EndOfBlock parameter to the CCITT Group4 decoder
1 parent 24e679f commit c163163

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Userland/Libraries/LibPDF/Filter.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,16 +314,15 @@ PDFErrorOr<ByteBuffer> Filter::decode_ccitt(ReadonlyBytes bytes, RefPtr<DictObje
314314
damaged_rows_before_error = decode_parms->get_value(CommonNames::DamagedRowsBeforeError).get<int>();
315315
}
316316

317-
// FIXME: This parameter seems crucial when reading its description, but we still
318-
// achieve to decode images that have it. Figure out what to do with it.
319-
(void)end_of_block;
320-
321317
if (require_end_of_line || (encoded_byte_align && k != 0) || damaged_rows_before_error > 0)
322318
return Error::rendering_unsupported_error("Unimplemented option for the CCITTFaxDecode Filter");
323319

324320
ByteBuffer decoded {};
325321
if (k < 0) {
326-
decoded = TRY(Gfx::CCITT::decode_ccitt_group4(bytes, columns, rows));
322+
Gfx::CCITT::Group4Options options {
323+
.has_end_of_block = end_of_block ? Gfx::CCITT::Group4Options::HasEndOfBlock::Yes : Gfx::CCITT::Group4Options::HasEndOfBlock::No
324+
};
325+
decoded = TRY(Gfx::CCITT::decode_ccitt_group4(bytes, columns, rows, options));
327326
} else if (k == 0) {
328327
Gfx::CCITT::Group3Options options {
329328
.require_end_of_line = require_end_of_line ? Gfx::CCITT::Group3Options::RequireEndOfLine::Yes : Gfx::CCITT::Group3Options::RequireEndOfLine::No,

0 commit comments

Comments
 (0)