Bug 115529 - Image rotation is wrong for angles in range 181° to 359°
Summary: Image rotation is wrong for angles in range 181° to 359°
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.1.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Armin Le Grand (allotropia)
URL:
Whiteboard: target:6.0.2
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-07 21:49 UTC by Regina Henschel
Modified: 2018-02-20 14:10 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments
Dummytext with rotated image (13.87 KB, application/vnd.oasis.opendocument.text)
2018-02-07 21:49 UTC, Regina Henschel
Details
Spreadsheet for manually calculating the rotation (25.05 KB, application/vnd.oasis.opendocument.spreadsheet)
2018-02-07 21:54 UTC, Regina Henschel
Details
Example to test angles (22.85 KB, application/vnd.oasis.opendocument.text)
2018-02-08 14:55 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2018-02-07 21:49:39 UTC
Created attachment 139677 [details]
Dummytext with rotated image

The attached document was generated by Word from Office365. Opening in LO6.1 the rotation and the position is totally wrong.

The image has size 9cm width and 4cm height. It is anchored to paragraph with "parallel"-wrap. Its position is 4cm from left and 3cm from top relative to paragraph. So the center of the image is at 8,5cm from left and 5cm from top. The image is rotated by 30deg. The rotated image should have the same center.
 
If you unpack the file and look, what Word has written, you find, that the values are correct. So it is an import failure of LibreOffice.

I have tried it with Version: 6.1.0.0.alpha0+ (x64)
Build ID: 715114595e0feec49c4d54cc5eb26f13dccb7968
CPU threads: 8; OS: Windows 10.0; UI render: default; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2018-02-06_02:09:50
Locale: de-DE (de_DE); Calc: CL
Comment 1 Regina Henschel 2018-02-07 21:54:28 UTC
Created attachment 139678 [details]
Spreadsheet for manually calculating the rotation

The spreadsheet protection is without password. You can use the spreadsheet to calculate the transformation, which is given in the file, manually step-by-step . The default value for missing svg:x and svg:y values is zero.
Comment 2 Regina Henschel 2018-02-08 14:55:59 UTC
Created attachment 139695 [details]
Example to test angles

Similar problem can be seen in LibreOffice itself. Open attached document and set the rotation angle of the image to some values. Especially try 179°, 181°, 359°. Save the document and load it. Notice that the angles in the range 181° to 359° are broken in reload. Look at sidebar and in the image properties too.
Comment 3 Regina Henschel 2018-02-09 17:11:35 UTC
Position is a different problem. I have written bug 115590 for it. So the first attachment belongs to bug 115590.

In the meantime I have calculated Words values manually and found, that Word writes the sign of the rotation angle wrong. So use the "Dummytext with rotated image"-file for confirming this issue as described in comment 2.
Comment 4 Armin Le Grand (allotropia) 2018-02-14 14:08:20 UTC
Will ahve to take a look ASAP...
Comment 5 Armin Le Grand (allotropia) 2018-02-15 10:46:01 UTC
Debugging case, seems to have to do with numerical stuff only. Diverse places where warnings/corrections may/should be applied...
Comment 6 Armin Le Grand (allotropia) 2018-02-15 12:39:10 UTC
Probably found, trying modification.
Comment 7 Armin Le Grand (allotropia) 2018-02-15 14:52:47 UTC
Patch on gerrit (https://gerrit.libreoffice.org/#/c/49826/)
Comment 8 Armin Le Grand (allotropia) 2018-02-16 09:47:52 UTC
Checked locally, patch is on master.
Checking how to evtl. get to LO-6-0
Comment 9 Regina Henschel 2018-02-16 11:36:42 UTC
The commit message has a wrong bug number. It is tdf#115519 but should be tdf#115529.
The comments in grfatr.cxx and grfatr.hxx in the patch have wrong bug number. It is tdf#15529 but should be tdf#115529.
Comment 10 Commit Notification 2018-02-18 01:14:27 UTC
Armin Le Grand committed a patch related to this issue.
It has been pushed to "libreoffice-6-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3369410324fdcc221339685154f3168544c5817d&h=libreoffice-6-0

tdf#115529: Handle rotation for WriterFlyFrames correctly

It will be available in 6.0.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Adolfo Jayme Barrientos 2018-02-18 08:19:55 UTC
I corrected the bug numbers in commit dad787ca46457c77c1ac67d62a9a370ea3fbd8ee (master)