diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2021-12-12 14:18:23 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-12-15 13:34:51 +0100 |
commit | 90b925307da4066cd18fcbf31b903e948fa55e82 (patch) | |
tree | da55b28c5bc17f7e70f989da67bd912404e54c54 /filter | |
parent | fd06b1b2689d4189fd94beade3983af4acc5ffc3 (diff) |
tdf#145904,tdf#145956 improve extrusion of custom shapes
The patch addressed these errors:
The property Origin is relative to the bounding rectangle of the shape
not to the snap rectangle. That error is visible e.g. for a block arc.
Rotation center x- and y- values are relative to the snap rectangle and
not absolute.
Rotation center z-value is in Hmm and needs conversion to Twips in
Writer.
Rotation is around rotation center, which might be different from shape
center. That has been ignored.
I have moved calculation of the 2D logic rectangle of the scene to
main method to be able to reuse the transformation and other values.
I consider using a special local class as unneeded overhead.
I have reordered some parts to bring geometry relevant parts together.
Change-Id: I35ad0721091b365ae99cd3d7b2afb0ad7efe47fd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126847
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit 453c5b6214654b440fe1d3e926cddfb695e17f10)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126868
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/msfilter/escherex.cxx | 5 | ||||
-rw-r--r-- | filter/source/msfilter/msdffimp.cxx | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index bfdbdd72853a..c85c51e41c95 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -2849,8 +2849,9 @@ void EscherPropertyContainer::CreateCustomShapeProperties( const MSO_SPT eShapeT drawing::Direction3D aExtrusionRotationCenter; if ( rrProp.Value >>= aExtrusionRotationCenter ) { - AddOpt( DFF_Prop_c3DRotationCenterX, static_cast<sal_Int32>( aExtrusionRotationCenter.DirectionX * 360.0 ) ); - AddOpt( DFF_Prop_c3DRotationCenterY, static_cast<sal_Int32>( aExtrusionRotationCenter.DirectionY * 360.0 ) ); + // tdf#145904 X- and Y-component is fraction, Z-component in EMU + AddOpt( DFF_Prop_c3DRotationCenterX, static_cast<sal_Int32>( aExtrusionRotationCenter.DirectionX * 65536.0 ) ); + AddOpt( DFF_Prop_c3DRotationCenterY, static_cast<sal_Int32>( aExtrusionRotationCenter.DirectionY * 65536.0 ) ); AddOpt( DFF_Prop_c3DRotationCenterZ, static_cast<sal_Int32>( aExtrusionRotationCenter.DirectionZ * 360.0 ) ); nFillHarshFlags &=~8; // don't use AutoRotationCenter; } diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 8de295d6b897..44c9f10402e3 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -1808,9 +1808,10 @@ void DffPropertyReader::ApplyCustomShapeGeometryAttributes( SvStream& rIn, SfxIt // "RotationCenter" if ( IsProperty( DFF_Prop_c3DRotationCenterX ) || IsProperty( DFF_Prop_c3DRotationCenterY ) || IsProperty( DFF_Prop_c3DRotationCenterZ ) ) { + // tdf#145904 X- and Y-component is fraction, Z-component in EMU css::drawing::Direction3D aRotationCenter( - static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DRotationCenterX, 0 ))) / 360.0, - static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DRotationCenterY, 0 ))) / 360.0, + static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DRotationCenterX, 0 ))) / 65536.0, + static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DRotationCenterY, 0 ))) / 65536.0, static_cast<double>(static_cast<sal_Int32>(GetPropertyValue( DFF_Prop_c3DRotationCenterZ, 0 ))) / 360.0 ); aProp.Name = "RotationCenter"; |