Преглед на файлове

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.
Nico Weber преди 1 година
родител
ревизия
ca6ebedf58
променени са 1 файла, в които са добавени 2 реда и са изтрити 12 реда
  1. 2 12
      Userland/Libraries/LibGfx/ImageFormats/JBIG2Loader.cpp

+ 2 - 12
Userland/Libraries/LibGfx/ImageFormats/JBIG2Loader.cpp

@@ -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:
-                    s_instance -= symbol.width() - 1;
-                    break;
-                case BottomLeft:
-                    t_instance -= symbol.height() - 1;
-                    break;
-                case BottomRight:
+                if (inputs.reference_corner == TopRight || inputs.reference_corner == BottomRight)
                     s_instance -= symbol.width() - 1;
+                if (inputs.reference_corner == BottomLeft || inputs.reference_corner == BottomRight)
                     t_instance -= symbol.height() - 1;
-                    break;
-                }
             } else {
                 TODO();
             }