Bug 132050

Summary: Repeated load/save/close cycles result in some flipped / mirrored drawing objects changing position over time.
Product: LibreOffice Reporter: brianjheisler <brianjheisler>
Component: DrawAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: normal CC: birnbach, brianjheisler, himajin100000, rb.henschel, stephane.guillou, telesto
Priority: high    
Version: Inherited From OOo   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=152883
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 108741    
Attachments: Demo File for Reproducing Drifting Drawing Object Bug
More Detailed Shape Drift Demo Incl un-Mirrored Shape

Description brianjheisler@gmail.com 2020-04-11 17:25:43 UTC
Description:
"Drift of Some Drawing Objects in Grouped Items"

In some grouped items (it is not clear why it only affects some), constituent drawing objects (shapes or lines) will drift in one direction (generally left) with respect to the remaining drawing objects in the group. I have only observed this over the course of several load/save/close cycles.



Steps to Reproduce:
1. Download the attached demo file.
2. Open the demo file.
3. Note the gray shaded box's position.
4. Save the demo file. Close it. Open it.
5. Repeat step 4 nine times.
6. Observe the change in the gray shaded box's position.

Actual Results:
The gray shaded box drifted to the left.

Expected Results:
The gray shaded box should have stayed in the same location.


Reproducible: Always


User Profile Reset: Yes



Additional Info:
This bug has been reoccurring since sometime in 2018 and maybe before. I have just now managed to isolate it in a demo file.
Comment 1 brianjheisler@gmail.com 2020-04-11 17:28:57 UTC
Created attachment 159492 [details]
Demo File for Reproducing Drifting Drawing Object Bug
Comment 2 Telesto 2020-04-12 16:14:08 UTC
Repro with
Version: 7.0.0.0.alpha0+ (x64)
Build ID: 95ec2e9b024ff12a3005777c902d7e0975460b1d
CPU threads: 4; OS: Windows 6.3 Build 9600; UI render: Skia/Raster; VCL: win; 
Locale: nl-NL (nl_NL); UI-Language: en-US
Calc: CL

and with
Versie: 4.4.7.2 
Build ID: f3153a8b245191196a4b6b9abd1d0da16eead600
Locale: nl_NL

and in
Versie 4.0.0.3 (Bouw-id: 7545bee9c2a0782548772a21bc84a9dcc583b89
Comment 3 Regina Henschel 2020-04-12 18:26:17 UTC
It moves with 2/100 mm. It happens because the rectangle is mirrored and mirroring is done at the middle of the rectangle. And because of integer arithmetic "middle" might be off by one.
As long as we have position and size in integer, I see no solution.

You should investigate, whether in other "drifting" cases, mirrored objects are involved too. For the given example, you can try, whether it becomes better, if you remove the mirroring from the rectangles. Mirroring of rectangles is useless.
Comment 4 brianjheisler@gmail.com 2020-04-12 22:08:09 UTC
Thanks Regina!

I "un-Mirrored" the large rectangle and the drift stopped happening. Unfortunately, when I mirrored the grouped object (something I have to do a lot when I use LO Draw) the drifting returned.

I fear this will render the mirroring feature somewhat problematic.

I can't say that I fully understand why the mirroring operation cannot notice when the "middle" of an object won't be the "true middle" of an object and drop to the right a half-step so it will be aligned as it was before the mirroring.

The fact that the error here continually accumulates each time the position data is transferred from disk to ram then back to disk has me confused. The error should happen once (@ 1/2 resolution) then stop.

Anyway...  

I've been experimenting with various combinations of mirroring (both individual objects and grouped objects) as well as rotating grouped objects.

It appears that any mirroring - either at the object level or the grouped level - causes drifting with objects but these objects have to be of certain sizes. (Repositioning causes problems with the large rectangle but never the small rectangle... in this example.)

I will attach a second demo file to show my results.
Comment 5 brianjheisler@gmail.com 2020-04-12 22:10:53 UTC
Created attachment 159525 [details]
More Detailed Shape Drift Demo Incl un-Mirrored Shape

I did some experimental orientation changes to the object to see when the problem occurs and when it does not. Additional notes for each test case are in the document.
Comment 6 QA Administrators 2022-04-13 03:48:35 UTC Comment hidden (obsolete)
Comment 7 brianjheisler@gmail.com 2022-12-05 20:12:23 UTC
This is re:2022-04-13 re-test request

I've tested this and this bug is still present.

Version: 7.4.3.2 (x64) / LibreOffice Community
Build ID: 1048a8393ae2eeec98dff31b5c133c5f1d08b890
CPU threads: 8; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL
Comment 8 Buovjaga 2023-03-14 13:11:46 UTC
*** Bug 152505 has been marked as a duplicate of this bug. ***
Comment 9 Stéphane Guillou (stragu) 2023-11-10 09:15:33 UTC
Reproduced in recent trunk build:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: ff3fb42b48c70ba5788507a6177bf0a9f3b50fdb
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

Also in OOo 3.3, so issue is inherited.