diff options
author | Tibor Nagy <nagy.tibor2@nisz.hu> | 2023-06-16 09:34:29 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2023-06-30 00:52:48 +0200 |
commit | 285da02c047f58b2d9ae8aba5d450f75e006e9fb (patch) | |
tree | 717164f9868a96158b5150f16e38435b99006911 /svx | |
parent | 8b9913cab48bc33bdf76ae7f617cd9932a49c5bf (diff) |
tdf#155863 sd: fix resizing of cropped images to original size
Resizing with the function "Original Size" (e.g. in the context menu) resulted distortion in case of cropped images, if the original image
and its cropping have different aspect ratios. Now zoom the cropped
image to the original resolution instead of stretching it to the
same size.
Change-Id: I5e59f8b48dc03844a739c3eb803e3195a12d9c6d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153170
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
(cherry picked from commit a4e12cbfc69cfe668fa30756a3c5843e911e22b1)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153342
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/svdraw/svdograf.cxx | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index 1c1be8a7a69a..946cbee0ba0d 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -480,23 +480,21 @@ Size SdrGrafObj::getOriginalSize() const { Size aSize = GetGrafPrefSize(); - if (aGrafInfo.IsCropped()) - { - const tools::Long aCroppedTop(OutputDevice::LogicToLogic(aGrafInfo.GetTopCrop(), getSdrModelFromSdrObject().GetScaleUnit(), GetGrafPrefMapMode().GetMapUnit())); - const tools::Long aCroppedBottom(OutputDevice::LogicToLogic(aGrafInfo.GetBottomCrop(), getSdrModelFromSdrObject().GetScaleUnit(), GetGrafPrefMapMode().GetMapUnit())); - const tools::Long aCroppedLeft(OutputDevice::LogicToLogic(aGrafInfo.GetLeftCrop(), getSdrModelFromSdrObject().GetScaleUnit(), GetGrafPrefMapMode().GetMapUnit())); - const tools::Long aCroppedRight(OutputDevice::LogicToLogic(aGrafInfo.GetRightCrop(), getSdrModelFromSdrObject().GetScaleUnit(), GetGrafPrefMapMode().GetMapUnit())); - const tools::Long aCroppedWidth(aSize.getWidth() - aCroppedLeft + aCroppedRight); - const tools::Long aCroppedHeight(aSize.getHeight() - aCroppedTop + aCroppedBottom); - - aSize = Size ( aCroppedWidth, aCroppedHeight); - } - - if ( GetGrafPrefMapMode().GetMapUnit() == MapUnit::MapPixel ) + if (GetGrafPrefMapMode().GetMapUnit() == MapUnit::MapPixel) aSize = Application::GetDefaultDevice()->PixelToLogic(aSize, MapMode(getSdrModelFromSdrObject().GetScaleUnit())); else aSize = OutputDevice::LogicToLogic(aSize, GetGrafPrefMapMode(), MapMode(getSdrModelFromSdrObject().GetScaleUnit())); + if (aGrafInfo.IsCropped()) + { + const tools::Long aCroppedWidth(aSize.getWidth() - aGrafInfo.GetLeftCrop() + - aGrafInfo.GetRightCrop()); + const tools::Long aCroppedHeight(aSize.getHeight() - aGrafInfo.GetTopCrop() + - aGrafInfo.GetBottomCrop()); + + aSize = Size(aCroppedWidth, aCroppedHeight); + } + return aSize; } |