[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - svx/source
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Sat Jun 8 16:57:29 UTC 2019
svx/source/unodraw/UnoGraphicExporter.cxx | 66 +++++++++++++++---------------
1 file changed, 35 insertions(+), 31 deletions(-)
New commits:
commit fd4324c64a6919ef46328608b447decc5c5f2d49
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Mon Jun 3 16:36:23 2019 +0200
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Sat Jun 8 18:56:47 2019 +0200
tdf#125062: distort hairline borders only if selection is used
Regression from 046df0a876b3d948bb1e14443c00c180bc8cccaa
Use the fix for tdf#105998 only when 'selection' option is checked
in the save dialog
Change-Id: I8c4127c780736408e905ead48e0d3ee6ae149197
Reviewed-on: https://gerrit.libreoffice.org/73391
Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>
Tested-by: Xisco Faulí <xiscofauli at libreoffice.org>
(cherry picked from commit 6c31c2b01dd32cc7ba1230f2c4a98b8f7def219b)
Reviewed-on: https://gerrit.libreoffice.org/73559
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index 80ff5b14c23b..1e111f7d2ab6 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -178,7 +178,7 @@ namespace {
/** creates a bitmap that is optionally transparent from a metafile
*/
- BitmapEx GetBitmapFromMetaFile( const GDIMetaFile& rMtf, const Size* pSize )
+ BitmapEx GetBitmapFromMetaFile( const GDIMetaFile& rMtf,bool bIsSelection, const Size* pSize )
{
// use new primitive conversion tooling
basegfx::B2DRange aRange(basegfx::B2DPoint(0.0, 0.0));
@@ -211,35 +211,39 @@ namespace {
if(!aRect.IsEmpty())
{
- // tdf#105998 Correct the Metafile using information from it's real sizes measured
- // using rMtf.GetBoundRect above and a copy
- const Size aOnePixelInMtf(
- Application::GetDefaultDevice()->PixelToLogic(
- Size(1, 1),
- rMtf.GetPrefMapMode()));
GDIMetaFile aMtf(rMtf);
- 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
- aMtf.Move(
- aHalfPixelInMtf.getWidth() - aRect.Left(),
- aHalfPixelInMtf.getHeight() - aRect.Top());
-
- // 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
- aMtf.SetPrefSize(
- Size(
- aRect.getWidth() + (bHairlineBR ? aOnePixelInMtf.getWidth() : 0) + aHalfPixelInMtf.getWidth(),
- aRect.getHeight() + (bHairlineBR ? aOnePixelInMtf.getHeight() : 0) + aHalfPixelInMtf.getHeight()));
+
+ if (bIsSelection)
+ {
+ // tdf#105998 Correct the Metafile using information from it's real sizes measured
+ // using rMtf.GetBoundRect above and a copy
+ const Size aOnePixelInMtf(
+ Application::GetDefaultDevice()->PixelToLogic(
+ Size(1, 1),
+ rMtf.GetPrefMapMode()));
+ 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
+ aMtf.Move(
+ aHalfPixelInMtf.getWidth() - aRect.Left(),
+ aHalfPixelInMtf.getHeight() - aRect.Top());
+
+ // 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
+ aMtf.SetPrefSize(
+ Size(
+ aRect.getWidth() + (bHairlineBR ? aOnePixelInMtf.getWidth() : 0) + aHalfPixelInMtf.getWidth(),
+ aRect.getHeight() + (bHairlineBR ? aOnePixelInMtf.getHeight() : 0) + aHalfPixelInMtf.getHeight()));
+ }
return convertMetafileToBitmapEx(aMtf, aRange, nMaximumQuadraticPixels);
}
@@ -778,7 +782,7 @@ bool GraphicExporter::GetGraphic( ExportSettings const & rSettings, Graphic& aGr
if( rSettings.mbTranslucent )
{
Size aOutSize;
- aGraphic = GetBitmapFromMetaFile( aGraphic.GetGDIMetaFile(), CalcSize( rSettings.mnWidth, rSettings.mnHeight, aNewSize, aOutSize ) );
+ aGraphic = GetBitmapFromMetaFile( aGraphic.GetGDIMetaFile(), false, CalcSize( rSettings.mnWidth, rSettings.mnHeight, aNewSize, aOutSize ) );
}
}
}
@@ -968,7 +972,7 @@ bool GraphicExporter::GetGraphic( ExportSettings const & rSettings, Graphic& aGr
if( !bVectorType )
{
Size aOutSize;
- aGraphic = GetBitmapFromMetaFile( aMtf, CalcSize( rSettings.mnWidth, rSettings.mnHeight, aBoundSize, aOutSize ) );
+ aGraphic = GetBitmapFromMetaFile( aMtf, true, CalcSize( rSettings.mnWidth, rSettings.mnHeight, aBoundSize, aOutSize ) );
}
else
{
More information about the Libreoffice-commits
mailing list