Kaydet (Commit) 6c31c2b0 authored tarafından Xisco Fauli's avatar Xisco Fauli Kaydeden (comit) Xisco Faulí

tdf#125062: distort hairline borders only if selection is used

Regression from 046df0a8

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/73391Reviewed-by: 's avatarXisco Faulí <xiscofauli@libreoffice.org>
Tested-by: 's avatarXisco Faulí <xiscofauli@libreoffice.org>
üst 65610498
......@@ -180,7 +180,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));
......@@ -212,6 +212,10 @@ namespace {
const tools::Rectangle aRect(rMtf.GetBoundRect(*Application::GetDefaultDevice(), &aHairlineRect));
if(!aRect.IsEmpty())
{
GDIMetaFile aMtf(rMtf);
if (bIsSelection)
{
// tdf#105998 Correct the Metafile using information from it's real sizes measured
// using rMtf.GetBoundRect above and a copy
......@@ -219,7 +223,6 @@ namespace {
Application::GetDefaultDevice()->PixelToLogic(
Size(1, 1),
rMtf.GetPrefMapMode()));
GDIMetaFile aMtf(rMtf);
const Size aHalfPixelInMtf(
(aOnePixelInMtf.getWidth() + 1) / 2,
(aOnePixelInMtf.getHeight() + 1) / 2);
......@@ -242,6 +245,7 @@ namespace {
Size(
aRect.getWidth() + (bHairlineBR ? aOnePixelInMtf.getWidth() : 0) + aHalfPixelInMtf.getWidth(),
aRect.getHeight() + (bHairlineBR ? aOnePixelInMtf.getHeight() : 0) + aHalfPixelInMtf.getHeight()));
}
return convertMetafileToBitmapEx(aMtf, aRange, nMaximumQuadraticPixels);
}
......@@ -780,7 +784,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 ) );
}
}
}
......@@ -966,7 +970,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
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment