summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorArmin Le Grand (Allotropia) <Armin.Le.Grand@me.com>2022-01-26 18:02:27 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-02-11 20:35:28 +0100
commitb3712c66978012ea49479bf3ac04bf8355d2a885 (patch)
treec05cc063391a2b1df9b27b7f05c57d346fc60409 /svx
parent60811f97c753360393f52aa747837db15a722162 (diff)
tdf#126319 Correct area(s) on selection export
For shapes like TextFrames the export of the selected object(s) to Bitmap needed to be adapted. It should not reduce to minimal geometric necessary size. While reduction seems good initially as an idea this may change aspect ratio and expected size of the result by cutting off visually empty areas, e.g. the text distance areas to the shape's logical bounds. This also needed to be adapted to multi-selections accordingly. Change-Id: I85bffe60fcfc2e8da87f69936af30f64c26deead Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129002 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129809
Diffstat (limited to 'svx')
-rw-r--r--svx/source/unodraw/UnoGraphicExporter.cxx24
1 files changed, 14 insertions, 10 deletions
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index 73d77cb54ea8..d6029dde6d29 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -224,25 +224,29 @@ namespace {
const Size aHalfPixelInMtf(
(aOnePixelInMtf.getWidth() + 1) / 2,
(aOnePixelInMtf.getHeight() + 1) / 2);
- const bool bHairlineBR(
- !aHairlineRect.IsEmpty() && (aRect.Right() == aHairlineRect.Right() || aRect.Bottom() == aHairlineRect.Bottom()));
- // Move the content to (0,0), usually TopLeft ist slightly
- // negative. For better visualization, add a half pixel, too
+ // tdf#126319 take bounds into account individually
+ const bool bHairlineRight(!aHairlineRect.IsEmpty() && aRect.Right() == aHairlineRect.Right());
+ const bool bHairlineBottom(!aHairlineRect.IsEmpty() && aRect.Bottom() == aHairlineRect.Bottom());
+ const bool bHairlineLeft(!aHairlineRect.IsEmpty() && aRect.Left() == aHairlineRect.Left());
+ const bool bHairlineTop(!aHairlineRect.IsEmpty() && aRect.Top() == aHairlineRect.Top());
+
+ // tdf#126319 Move the content dependent on Top/Left hairline
aMtf.Move(
- aHalfPixelInMtf.getWidth() - aRect.Left(),
- aHalfPixelInMtf.getHeight() - aRect.Top());
+ (bHairlineLeft ? -aHalfPixelInMtf.getWidth() : aHalfPixelInMtf.getWidth()),
+ (bHairlineTop ? -aHalfPixelInMtf.getHeight() : aHalfPixelInMtf.getHeight()));
// Do not Scale, but set the PrefSize. Some levels deeper the
// MetafilePrimitive will add a mapping to the decomposition
// (and possibly a clipping) to map the graphic content to
// a unit coordinate system.
- // Size is the measured size plus one pixel if needed (bHairlineBR)
- // and the moved half pixwel from above
+ // tdf#126319 Size is the previous already correct size plus one
+ // pixel if needed (dependent on Righ/Bottom hairline) and the
+ // already moved half pixel from above
aMtf.SetPrefSize(
Size(
- aRect.getWidth() + (bHairlineBR ? aOnePixelInMtf.getWidth() : 0) + aHalfPixelInMtf.getWidth(),
- aRect.getHeight() + (bHairlineBR ? aOnePixelInMtf.getHeight() : 0) + aHalfPixelInMtf.getHeight()));
+ aMtf.GetPrefSize().Width() + (bHairlineRight ? aHalfPixelInMtf.getWidth() : 0),
+ aMtf.GetPrefSize().Height() + (bHairlineBottom ? aHalfPixelInMtf.getHeight() : 0)));
}
return convertMetafileToBitmapEx(aMtf, aRange, nMaximumQuadraticPixels);