LibGfx/JBIG2: Call decode_immediate_text_region for lossless text region

It seems to do the right thing already, and nothing in the spec says
not to do this as far as I can tell.

With this, we can finally decode the test input from #23659.

See f391c7822d for a similar change for generic regions and
lossless generic regions.
This commit is contained in:
Nico Weber 2024-03-20 22:34:20 -04:00 committed by Tim Flynn
parent b15e1d2b2a
commit ced21d8419
Notes: sideshowbarker 2024-07-17 01:55:29 +09:00

View File

@ -1665,11 +1665,6 @@ static ErrorOr<void> decode_immediate_text_region(JBIG2LoadingContext& context,
return {};
}
static ErrorOr<void> decode_immediate_lossless_text_region(JBIG2LoadingContext&, SegmentData const&)
{
return Error::from_string_literal("JBIG2ImageDecoderPlugin: Cannot decode immediate lossless text region yet");
}
static ErrorOr<void> decode_pattern_dictionary(JBIG2LoadingContext&, SegmentData const&)
{
return Error::from_string_literal("JBIG2ImageDecoderPlugin: Cannot decode pattern dictionary yet");
@ -1943,10 +1938,13 @@ static ErrorOr<void> decode_data(JBIG2LoadingContext& context)
TRY(decode_intermediate_text_region(context, segment));
break;
case SegmentType::ImmediateTextRegion:
TRY(decode_immediate_text_region(context, segment));
break;
case SegmentType::ImmediateLosslessTextRegion:
TRY(decode_immediate_lossless_text_region(context, segment));
// 7.4.3 Text region segment syntax
// "The data parts of all three of the text region segment types ("intermediate text region", "immediate text region" and
// "immediate lossless text region") are coded identically, but are acted upon differently, see 8.2."
// But 8.2 only describes a difference between intermediate and immediate regions as far as I can tell,
// and calling the immediate text region handler for immediate lossless text regions seems to do the right thing (?).
TRY(decode_immediate_text_region(context, segment));
break;
case SegmentType::PatternDictionary:
TRY(decode_pattern_dictionary(context, segment));