Bug 147576 - SLIDESHOW: Shapes get stretched in slideshow
Summary: SLIDESHOW: Shapes get stretched in slideshow
Status: RESOLVED DUPLICATE of bug 150402
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
7.4.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Slide-Show
  Show dependency treegraph
 
Reported: 2022-02-21 14:05 UTC by Sarper Akdemir (allotropia)
Modified: 2023-02-04 19:22 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
reproducer slideshow from mso powerpoint (1.29 MB, application/vnd.openxmlformats-officedocument.presentationml.presentation)
2022-02-21 14:05 UTC, Sarper Akdemir (allotropia)
Details
Before regression LO slideshow (57.37 KB, image/png)
2022-02-21 14:08 UTC, Sarper Akdemir (allotropia)
Details
After regression LO slideshow (59.55 KB, image/png)
2022-02-21 14:09 UTC, Sarper Akdemir (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sarper Akdemir (allotropia) 2022-02-21 14:05:53 UTC
Created attachment 178433 [details]
reproducer slideshow from mso powerpoint

Steps to reproduce:
1. Open attached pptx document in Impress
2. Observe the shapes
3. Start slideshow

-> Shapes appear stretched in the slideshow, unlike how they appeared in the edit mode.

Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: 8b327cd86d71d71d2f5f883321e5d53e3b42ed4e
CPU threads: 4; OS: Linux 5.16; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 1 Sarper Akdemir (allotropia) 2022-02-21 14:08:51 UTC
Created attachment 178435 [details]
Before regression LO slideshow
Comment 2 Sarper Akdemir (allotropia) 2022-02-21 14:09:14 UTC
Created attachment 178436 [details]
After regression LO slideshow
Comment 3 Sarper Akdemir (allotropia) 2022-02-21 14:17:24 UTC
Regression introduced by:

https://cgit.freedesktop.org/libreoffice/core/commit/?id=4d535c4f867d86d40786788e5e5c9fd061a65673


author	Armin Le Grand (Allotropia) <Armin.Le.Grand@me.com>	2022-01-31 19:44:19 +0100
committer	Armin Le Grand <Armin.Le.Grand@me.com>	2022-02-02 09:43:10 +0100
commit 4d535c4f867d86d40786788e5e5c9fd061a65673 (patch)
tree 9611377bf20a0d9ac46ffc1101f769ae0e1f7ac3
parent 60a1f07049a817d4d3d7beb6c9b9da2571e2463b (diff)
tdf#126319 Corrected bitmap creation from metafile

Bisected with: bibisect-linux64-7.4

Adding cc: to Armin Le Grand
Comment 4 raal 2022-02-21 16:32:21 UTC
Confirm with Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: 0723b41bed9bb4ad50d2993744a60177966d1a21
CPU threads: 4; OS: Linux 5.13; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded Jumbo
Comment 5 Armin Le Grand (allotropia) 2022-02-28 10:21:38 UTC
Seems as if something is wrong with the size of the Metafile that gets created in-between. Selecting one of the objects and using convert/to_metafile in the context menu creates a correct metafile, bit it's frame is too big - same too big as the shape is later, stretched vertically.
Comment 6 Armin Le Grand (allotropia) 2022-02-28 10:51:53 UTC
Tried to check what ConvertToMetafile does for that objects, but 2nd time converting them does not create that too big metafile again - after undo. Very strange & makes things difficult...
Comment 7 Armin Le Grand (allotropia) 2022-02-28 11:01:24 UTC
Looks like SdrExchangeView::GetMarkedObjMetaFile gets that wrong stretched BoundRect from 1st call to GetMarkedObjBoundRect() - very strange.
Together with that no longer happening after doing once & UNDO it smells more like BoundRect being wrong after import.
Indeed, after having all converted once & then slideshow display is correct.

Weren't there some 'optimizations' recently to not broadcast too much after import - to avoid too much recalculations & broadcastings...?
Comment 8 Armin Le Grand (allotropia) 2022-02-28 11:28:55 UTC
Indeed, adding
        ::std::vector< SdrObject* > aSdrObjects(GetMarkedObjects());
        for(auto* pCand : aSdrObjects) pCand->SetBoundRectDirty();
to SdrExchangeView::GetMarkedObjMetaFile and thus forcing update of he BoundRects corrects that error when 1st converting to Metafile. This is proof that the BoundRects are *wrong* after import.

Thus my change is not a regression, but uncovers another error.
Comment 9 Armin Le Grand (allotropia) 2022-02-28 11:45:55 UTC
There definitely *was* a mechanism to do some cleanups/refreshes after import/load, I checked SdrModel::setLock that does ReformatAllEdgeObjects. Releasing the lock at the SdrModel is used to act at end of import. I am not sure how that was formally done for invalidating the BoundRects of SdrObjects, but it seems definitely no longer to be done. Trying to find how that was done formally (probably some broadcast...)
Comment 10 Armin Le Grand (allotropia) 2022-02-28 15:54:54 UTC
There are re-calculations of RecalcBoundRect() after lock is freed. Nonetheless, the correction form comment 8 works for context menu convert/to metafile as correction, so these seem to be initially wrong calculated (?)
A slideshow start we can check at DrawShape::DrawShape in slideshow/source/engine/shapes/drawshape.cxx. In member initilaization there is
            maBounds( getAPIShapeBounds( xShape ) ),
which uses GetCurrentBoundRect() over UNO API and there is
            mpCurrMtf = getMetaFile(uno::Reference<lang::XComponent>(xShape, uno::UNO_QUERY),
                                    xContainingPage, mnCurrMtfLoadFlags,
                                    mxComponentContext );
below that. The mpCurrMtf PrefSize (created using the corected GraphicExporter::GetGraphic mentioned as regression commit) is correct, while maBounds (from GetCurrentBoundRect()) is not.

Trying to make a useful conclusion from this...
Comment 11 Armin Le Grand (allotropia) 2022-02-28 17:10:49 UTC Comment hidden (obsolete)
Comment 12 Gabor Kelemen (allotropia) 2022-06-09 15:08:54 UTC
(In reply to Armin Le Grand from comment #11)
> Created a version without the change in discussion. The context menu
> convert/to metafile creates the same error, so the BoundRect is already
> wrong in that version. But he Presentation works - have to check why, AFAIK
> GraphicExporter::GetGraphic (where the change is) is not used by
> Presentation preparations...?

I just checked the error with the convert/to metafile case, can confirm that is changing the shapes from square to rectangle shape at least since 3.5.0 - this is not a new issue by any means.
Comment 13 Timur 2022-06-09 16:39:13 UTC
(In reply to Gabor Kelemen (allotropia) from comment #12)
> this is not a new issue by any means.

I read this aa "not a regression" but it's marked so, please clarify.
Comment 14 Gerald Pfeifer 2022-09-06 02:39:02 UTC
(In reply to Armin Le Grand from comment #8)
> Thus my change is not a regression, but uncovers another error.

Bug #150402 was bisected to the same commit and appears quite different
from the outside? Maybe that's worth pursuing, Armin?
Comment 15 Gabor Kelemen (allotropia) 2022-09-26 09:38:57 UTC
This is looking good after

https://git.libreoffice.org/core/+/1b0ff1c166211b34370f53995ae9fb3f8eed182e%5E%21

author	Armin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de>	Mon Sep 19 11:48:20 2022 +0200
committer	Armin Le Grand <Armin.Le.Grand@me.com>	Mon Sep 19 16:24:46 2022 +0200

tdf#150402 Correct wrong Bound of Shape in Slideshow

*** This bug has been marked as a duplicate of bug 150402 ***