mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:37:44 +00:00
LibGfx/CCITT: Don't be fooled by black-starting lines
The first marker is always white in CCITT streams, so lines starting with a black pixel encodes a symbol meaning 0 white pixels. Then, the decoding would proceed with a black symbol. We used to set the symbol's color based on `column == 0`, which is wrong in this situation.
This commit is contained in:
parent
a4b2e5b27b
commit
f5e7ee8d4a
1 changed files with 3 additions and 5 deletions
|
@ -269,7 +269,9 @@ ErrorOr<void> decode_single_ccitt3_1d_line(BigEndianInputBitStream& input_bit_st
|
|||
auto const ccitt_white = Color::NamedColor::White;
|
||||
auto const ccitt_black = Color::NamedColor::Black;
|
||||
|
||||
Color current_color { ccitt_white };
|
||||
// We always flip the color when entering the loop, so let's initialize the
|
||||
// color with black to make the first marker actually be white.
|
||||
Color current_color { ccitt_black };
|
||||
u32 run_length = 0;
|
||||
u32 column = 0;
|
||||
|
||||
|
@ -284,10 +286,6 @@ ErrorOr<void> decode_single_ccitt3_1d_line(BigEndianInputBitStream& input_bit_st
|
|||
|
||||
current_color = current_color == ccitt_white ? ccitt_black : ccitt_white;
|
||||
|
||||
if (column == 0) {
|
||||
current_color = ccitt_white;
|
||||
}
|
||||
|
||||
u8 size {};
|
||||
u16 potential_code {};
|
||||
while (size < 14) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue