mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-08 12:56:23 +03:00
LibPDF: In Filter::decode_jbig2(), invert bits
See included comment.
This commit is contained in:
parent
54dcb17062
commit
be9a6caa0a
Notes:
sideshowbarker
2024-07-17 05:13:53 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/be9a6caa0a Pull-request: https://github.com/SerenityOS/serenity/pull/23534 Reviewed-by: https://github.com/LucasChollet
@ -346,7 +346,14 @@ PDFErrorOr<ByteBuffer> Filter::decode_jbig2(Document* document, ReadonlyBytes by
|
||||
}
|
||||
|
||||
segments.append(bytes);
|
||||
return TRY(Gfx::JBIG2ImageDecoderPlugin::decode_embedded(segments));
|
||||
auto decoded = TRY(Gfx::JBIG2ImageDecoderPlugin::decode_embedded(segments));
|
||||
|
||||
// JBIG2 treats `1` as "ink present" (black) and `0` as "no ink" (white).
|
||||
// PDF treats `1` as "light present" (white) and `1` as "no light" (black).
|
||||
// So we have to invert.
|
||||
invert_bits(decoded);
|
||||
|
||||
return decoded;
|
||||
}
|
||||
|
||||
PDFErrorOr<ByteBuffer> Filter::decode_dct(ReadonlyBytes bytes)
|
||||
|
Loading…
Reference in New Issue
Block a user