Bug 142571 - [EMF] PolyLineTo16 and probably other "*16" EMRs have swapped coordinates
Summary: [EMF] PolyLineTo16 and probably other "*16" EMRs have swapped coordinates
Status: RESOLVED WONTFIX
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: EMF-WMF 103903 113868
  Show dependency treegraph
 
Reported: 2021-05-30 20:30 UTC by Valek Filippov
Modified: 2021-05-31 13:30 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
EMF sample for PolyLineTo16 (396 bytes, image/x-emf)
2021-05-30 20:30 UTC, Valek Filippov
Details
Screenshot of the sample opened in LO 7.2 and MS Paint side by side (8.89 KB, image/png)
2021-05-30 20:32 UTC, Valek Filippov
Details

Note You need to log in before you can comment on or make changes to this bug.
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.