Prechádzať zdrojové kódy

LibGfx/JBIG2: Fix rendering of transposed text

The current code was incorrect for non-TopRight reference corners.
Fixes rendering of ghostpdl/tests/jbig2/042_19.jb2.
Nico Weber 1 rok pred
rodič
commit
7b5852bf91

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

@@ -1437,12 +1437,12 @@ static ErrorOr<NonnullOwnPtr<BitBuffer>> text_region_decoding_procedure(TextRegi
             //          If any part of IBI, when placed at this location, lies outside the bounds of SBREG, then ignore
             //          this part of IBI in step 3 c) ix)."
             // Implementor's note: The spec means "ignore this part of IBI in step 3 c) x)" in 3c viii)'s last sentence.
+            if (inputs.is_transposed)
+                swap(s_instance, t_instance);
             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;
-            if (inputs.is_transposed)
-                swap(s_instance, t_instance);
 
             //     "ix) If COLEXTFLAG is 1, set the colour specified by SBCOLS[SBFGCOLID[NINSTANCES]]
             //          to the foreground colour of the symbol instance bitmap IBI."