Bug 142571

Summary: [EMF] PolyLineTo16 and probably other "*16" EMRs have swapped coordinates
Product: LibreOffice Reporter: Valek Filippov <frob>
Component: graphics stackAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED WONTFIX    
Severity: normal CC: gang65
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 103859, 103903, 113868    
Attachments: EMF sample for PolyLineTo16
Screenshot of the sample opened in LO 7.2 and MS Paint side by side

Description Valek Filippov 2021-05-30 20:30:03 UTC
Description:
Despite [MS-EMF] description of the aPoints in PolyLineTo16 EMR as
"aPoints (variable): A Count length array of PointS objects ([MS-WMF] section 2.2.2.16, which specifies the array of points."
in case of EMF coordinates of the PointS come in the swapped order.

LO seems to read it the same way or WMF and EMF which creates an interesting effect on the ratio.

Steps to Reproduce:
Open attached EMF sample.

Actual Results:
LO draws a red frame in "portrait" orientation.

Expected Results:
The frame should have "landscape" orientation.


Reproducible: Always


User Profile Reset: No



Additional Info:
That probably impacts other "16-bit" EMRs too.

This problem is found during analysis of tdf#103903, fixing this will improve (or fix) 103903 too.
Comment 1 Valek Filippov 2021-05-30 20:30:38 UTC
Created attachment 172459 [details]
EMF sample for PolyLineTo16
Comment 2 Valek Filippov 2021-05-30 20:32:48 UTC
Created attachment 172460 [details]
Screenshot of the sample opened in LO 7.2 and MS Paint side by side
Comment 3 Valek Filippov 2021-05-31 13:05:29 UTC
Checked with Bartosz.
Coordinates are extracted properly.

The problem seems to be the "Frame" dimensions in the header with a different ration than BBox dimentions.
That impacts mapping of the PolyLineTo16 and does not impact 32-bit records (eg. Rectangle).

The interesting thing is that MS Office is also scales PolyLineTo16 and doesn't scale Rectangle -- EMF sample looks in LO the same as in MSO.