[Libreoffice-commits] core.git: sc/source
Samuel Mehrbrodt
Samuel.Mehrbrodt at cib.de
Tue Mar 13 13:16:47 UTC 2018
sc/source/core/data/drwlayer.cxx | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
New commits:
commit 6ae7b9d40ca24c9c9fbad6346a4dd9112894dc49
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Tue Mar 13 12:26:44 2018 +0100
tdf#114552 Also reduce the anchor offset when shrinking images
Else the image will get larger than its current cell.
Follow-up for 4f29ce6a67b81e7f28e1c86d60ff15ec1d180661
Change-Id: If2fb1087961a1b20f5a408ca3061956e96330e91
Reviewed-on: https://gerrit.libreoffice.org/51209
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 3cadfdb55979..2e08f6b6e338 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -689,13 +689,13 @@ void ScDrawLayer::ResizeLastRectFromAnchor(const SdrObject* pObj, ScDrawObjData&
{
// To actually grow the image, we need to take the max
fWidthFactor = fHeightFactor = std::max(fWidthFactor, fHeightFactor);
- // But we don't want the image to become larger than the current cell
- fWidthFactor = fHeightFactor = std::min(fWidthFactor, fMaxFactor);
}
else // cell is growing smaller, take the min
{
fWidthFactor = fHeightFactor = std::min(fWidthFactor, fHeightFactor);
}
+ // We don't want the image to become larger than the current cell
+ fWidthFactor = fHeightFactor = std::min(fWidthFactor, fMaxFactor);
}
// When shrinking the cell, and the image still fits in the smaller cell, don't resize it at all
@@ -706,6 +706,13 @@ void ScDrawLayer::ResizeLastRectFromAnchor(const SdrObject* pObj, ScDrawObjData&
rtl::math::round(static_cast<double>(aRect.GetWidth()) * fWidthFactor));
aRect.setHeight(
rtl::math::round(static_cast<double>(aRect.GetHeight()) * fHeightFactor));
+
+ // Reduce offset also when shrinking
+ if (!bIsGrowingLarger)
+ {
+ aRect.setX(rtl::math::round(static_cast<double>(aRect.getX()) * fWidthFactor));
+ aRect.setY(rtl::math::round(static_cast<double>(aRect.getY()) * fHeightFactor));
+ }
}
}
}
More information about the Libreoffice-commits
mailing list