summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorBayram Çiçek <mail@bayramcicek.com.tr>2021-06-07 07:24:05 +0300
committerMuhammet Kara <muhammet.kara@collabora.com>2021-06-08 22:09:19 +0200
commit59aed1d334de21270628c784920c61f2b8eb1da0 (patch)
treea5253ba9d3a3dccf5b5138793c74a20f3b125ee0 /sw/source/core
parent6d843855c3d71a214f869ca873362675071bbda5 (diff)
tdf#104995: Fix opposite cropping issue on flipped images in Writer
In Writer, cropping an flipped image crops the opposite side of the image instead of the selected side. Fix: update crop values after the flipping(mirroring). Change-Id: I55cfed086bbf63b0c516e1cb6b2624c02b04a6da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116770 Tested-by: Jenkins Reviewed-by: Muhammet Kara <muhammet.kara@collabora.com>
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/graphic/ndgrf.cxx29
1 files changed, 25 insertions, 4 deletions
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 83e8a33a3527..680f142ef1d6 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -775,10 +775,31 @@ GraphicAttr& SwGrfNode::GetGraphicAttr( GraphicAttr& rGA,
rGA.SetMirrorFlags( nMirror );
const SwCropGrf& rCrop = rSet.GetCropGrf();
- rGA.SetCrop( convertTwipToMm100( rCrop.GetLeft() ),
- convertTwipToMm100( rCrop.GetTop() ),
- convertTwipToMm100( rCrop.GetRight() ),
- convertTwipToMm100( rCrop.GetBottom() ));
+
+ tools::Long nCropLeft = rCrop.GetLeft();
+ tools::Long nCropTop = rCrop.GetTop();
+ tools::Long nCropRight = rCrop.GetRight();
+ tools::Long nCropBottom = rCrop.GetBottom();
+
+ // take mirroring of crop values into consideration
+ // while cropping a flipped image. otherwise,
+ // cropping will crop the opposite side of the image.
+ if (rGA.GetMirrorFlags() & BmpMirrorFlags::Vertical)
+ {
+ nCropTop = rCrop.GetBottom();
+ nCropBottom = rCrop.GetTop();
+ }
+
+ if (rGA.GetMirrorFlags() & BmpMirrorFlags::Horizontal)
+ {
+ nCropLeft = rCrop.GetRight();
+ nCropRight = rCrop.GetLeft();
+ }
+
+ rGA.SetCrop( convertTwipToMm100( nCropLeft ),
+ convertTwipToMm100( nCropTop ),
+ convertTwipToMm100( nCropRight ),
+ convertTwipToMm100( nCropBottom ));
const SwRotationGrf& rRotation = rSet.GetRotationGrf();
rGA.SetRotation( rRotation.GetValue() );