LibGfx/JBIG2: Simplify non-transposed text region coordinate math

If the origin is on the right, we need to subtract width - 1 from s,
if it's on top bottom, we need to subtract height - 1 from t.

No behavior change.
This commit is contained in:
Nico Weber 2024-03-30 19:20:40 -07:00 committed by Andreas Kling
commit ca6ebedf58
Notes: sideshowbarker 2024-07-17 08:35:21 +09:00

View file

@ -1442,20 +1442,10 @@ static ErrorOr<NonnullOwnPtr<BitBuffer>> text_region_decoding_procedure(TextRegi
// Implementor's note: The spec means "ignore this part of IBI in step 3 c) x)" in 3c viii)'s last sentence.
// FIXME: Support all reference corners and transpose values.
if (!inputs.is_transposed) {
switch (inputs.reference_corner) {
case TopLeft:
break;
case TopRight:
if (inputs.reference_corner == TopRight || inputs.reference_corner == BottomRight)
s_instance -= symbol.width() - 1;
break;
case BottomLeft:
if (inputs.reference_corner == BottomLeft || inputs.reference_corner == BottomRight)
t_instance -= symbol.height() - 1;
break;
case BottomRight:
s_instance -= symbol.width() - 1;
t_instance -= symbol.height() - 1;
break;
}
} else {
TODO();
}