diff options
author | Armin Le Grand (Allotropia) <Armin.Le.Grand@me.com> | 2022-01-31 19:44:19 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2022-02-02 09:43:10 +0100 |
commit | 4d535c4f867d86d40786788e5e5c9fd061a65673 (patch) | |
tree | 9611377bf20a0d9ac46ffc1101f769ae0e1f7ac3 /vcl | |
parent | 60a1f07049a817d4d3d7beb6c9b9da2571e2463b (diff) |
tdf#126319 Corrected bitmap creation from metafile
The conversion from Metafile to Bitmap in GraphicExporter
is based on metafiles which does just not deliver enough
precision when getting the bounds to do the correct size
calculation for the target Bitmap.
So I changed that to use Primitive functionality what
produces better data. That old fix/correction itself was
based on hairlines only which is anyways no longer
sufficient since LO uses less hairlines nowadays, what
is good in general (They are a relic of non-AA times
when it was not possible to paint/work with lines taller
than one pixel).
Thus, cases need to be solved more generic based on
better data. It would also be good to change this
to primitives completely, but that is too much for now.
Change-Id: I71bd136b106ef8ff3ba51458c46df08269773c01
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129235
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/gdimtf.cxx | 100 | ||||
-rw-r--r-- | vcl/source/gdi/impgraph.cxx | 27 |
2 files changed, 45 insertions, 82 deletions
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index 105798f51446..5aba0452296e 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -1277,8 +1277,7 @@ void GDIMetaFile::Rotate( Degree10 nAngle10 ) static void ImplActionBounds( tools::Rectangle& o_rOutBounds, const tools::Rectangle& i_rInBounds, - const std::vector<tools::Rectangle>& i_rClipStack, - tools::Rectangle* o_pHairline ) + const std::vector<tools::Rectangle>& i_rClipStack ) { tools::Rectangle aBounds( i_rInBounds ); if( ! i_rInBounds.IsEmpty() && ! i_rClipStack.empty() && ! i_rClipStack.back().IsEmpty() ) @@ -1290,17 +1289,9 @@ static void ImplActionBounds( tools::Rectangle& o_rOutBounds, o_rOutBounds.Union( aBounds ); else o_rOutBounds = aBounds; - - if(o_pHairline) - { - if( ! o_pHairline->IsEmpty() ) - o_pHairline->Union( aBounds ); - else - *o_pHairline = aBounds; - } } -tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::Rectangle* pHairline ) const +tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference ) const { ScopedVclPtrInstance< VirtualDevice > aMapVDev( i_rReference ); @@ -1311,17 +1302,12 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R std::vector<vcl::PushFlags> aPushFlagStack; tools::Rectangle aBound; - - if(pHairline) - *pHairline = tools::Rectangle(); - const sal_uLong nCount(GetActionSize()); for(sal_uLong a(0); a < nCount; a++) { MetaAction* pAction = GetAction(a); const MetaActionType nActionType = pAction->GetType(); - tools::Rectangle* pUseHairline = (pHairline && aMapVDev->IsLineColor()) ? pHairline : nullptr; switch( nActionType ) { @@ -1331,7 +1317,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R ImplActionBounds( aBound, tools::Rectangle( OutputDevice::LogicToLogic( pAct->GetPoint(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aMapVDev->PixelToLogic( Size( 1, 1 ), GetPrefMapMode() ) ), - aClipStack, pUseHairline ); + aClipStack ); } break; @@ -1341,7 +1327,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R ImplActionBounds( aBound, tools::Rectangle( OutputDevice::LogicToLogic( pAct->GetPoint(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aMapVDev->PixelToLogic( Size( 1, 1 ), GetPrefMapMode() ) ), - aClipStack, pUseHairline ); + aClipStack ); } break; @@ -1352,36 +1338,28 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R tools::Rectangle aRect( aP1, aP2 ); aRect.Justify(); - if(pUseHairline) - { - const LineInfo& rLineInfo = pAct->GetLineInfo(); - - if(0 != rLineInfo.GetWidth()) - pUseHairline = nullptr; - } - - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; case MetaActionType::RECT: { MetaRectAction* pAct = static_cast<MetaRectAction*>(pAction); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; case MetaActionType::ROUNDRECT: { MetaRoundRectAction* pAct = static_cast<MetaRoundRectAction*>(pAction); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; case MetaActionType::ELLIPSE: { MetaEllipseAction* pAct = static_cast<MetaEllipseAction*>(pAction); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1390,7 +1368,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R MetaArcAction* pAct = static_cast<MetaArcAction*>(pAction); // FIXME: this is imprecise // e.g. for small arcs the whole rectangle is WAY too large - ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1399,7 +1377,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R MetaPieAction* pAct = static_cast<MetaPieAction*>(pAction); // FIXME: this is imprecise // e.g. for small arcs the whole rectangle is WAY too large - ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1408,7 +1386,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R MetaChordAction* pAct = static_cast<MetaChordAction*>(pAction); // FIXME: this is imprecise // e.g. for small arcs the whole rectangle is WAY too large - ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( pAct->GetRect(), aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1417,15 +1395,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R MetaPolyLineAction* pAct = static_cast<MetaPolyLineAction*>(pAction); tools::Rectangle aRect( pAct->GetPolygon().GetBoundRect() ); - if(pUseHairline) - { - const LineInfo& rLineInfo = pAct->GetLineInfo(); - - if(0 != rLineInfo.GetWidth()) - pUseHairline = nullptr; - } - - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1433,7 +1403,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R { MetaPolygonAction* pAct = static_cast<MetaPolygonAction*>(pAction); tools::Rectangle aRect( pAct->GetPolygon().GetBoundRect() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1441,7 +1411,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R { MetaPolyPolygonAction* pAct = static_cast<MetaPolyPolygonAction*>(pAction); tools::Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, pUseHairline ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1453,7 +1423,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R aMapVDev->GetTextBoundRect( aRect, pAct->GetText(), pAct->GetIndex(), pAct->GetIndex(), pAct->GetLen() ); Point aPt( pAct->GetPoint() ); aRect.Move( aPt.X(), aPt.Y() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1466,7 +1436,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R 0, pAct->GetDXArray() ); Point aPt( pAct->GetPoint() ); aRect.Move( aPt.X(), aPt.Y() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1479,7 +1449,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R pAct->GetWidth() ); Point aPt( pAct->GetPoint() ); aRect.Move( aPt.X(), aPt.Y() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1495,7 +1465,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R Point aPt( pAct->GetStartPoint() ); aRect.Move( aPt.X(), aPt.Y() ); aRect.SetRight( aRect.Left() + pAct->GetWidth() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1503,7 +1473,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R { MetaBmpScaleAction* pAct = static_cast<MetaBmpScaleAction*>(pAction); tools::Rectangle aRect( pAct->GetPoint(), pAct->GetSize() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1511,7 +1481,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R { MetaBmpScalePartAction* pAct = static_cast<MetaBmpScalePartAction*>(pAction); tools::Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1519,7 +1489,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R { MetaBmpExScaleAction* pAct = static_cast<MetaBmpExScaleAction*>(pAction); tools::Rectangle aRect( pAct->GetPoint(), pAct->GetSize() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1527,7 +1497,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R { MetaBmpExScalePartAction* pAct = static_cast<MetaBmpExScalePartAction*>(pAction); tools::Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1535,7 +1505,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R { MetaGradientAction* pAct = static_cast<MetaGradientAction*>(pAction); tools::Rectangle aRect( pAct->GetRect() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1543,7 +1513,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R { MetaGradientExAction* pAct = static_cast<MetaGradientExAction*>(pAction); tools::Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1557,7 +1527,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R { MetaHatchAction* pAct = static_cast<MetaHatchAction*>(pAction); tools::Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1565,7 +1535,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R { MetaTransparentAction* pAct = static_cast<MetaTransparentAction*>(pAction); tools::Rectangle aRect( pAct->GetPolyPolygon().GetBoundRect() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1575,7 +1545,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R // MetaFloatTransparentAction is defined limiting its content Metafile // to its geometry definition(Point, Size), so use these directly const tools::Rectangle aRect( pAct->GetPoint(), pAct->GetSize() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1583,7 +1553,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R { MetaEPSAction* pAct = static_cast<MetaEPSAction*>(pAction); tools::Rectangle aRect( pAct->GetPoint(), pAct->GetSize() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1623,7 +1593,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R { MetaBmpAction* pAct = static_cast<MetaBmpAction*>(pAction); tools::Rectangle aRect( pAct->GetPoint(), aMapVDev->PixelToLogic( pAct->GetBitmap().GetSizePixel() ) ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1631,7 +1601,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R { MetaBmpExAction* pAct = static_cast<MetaBmpExAction*>(pAction); tools::Rectangle aRect( pAct->GetPoint(), aMapVDev->PixelToLogic( pAct->GetBitmapEx().GetSizePixel() ) ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1639,7 +1609,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R { MetaMaskAction* pAct = static_cast<MetaMaskAction*>(pAction); tools::Rectangle aRect( pAct->GetPoint(), aMapVDev->PixelToLogic( pAct->GetBitmap().GetSizePixel() ) ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1647,7 +1617,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R { MetaMaskScalePartAction* pAct = static_cast<MetaMaskScalePartAction*>(pAction); tools::Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1655,7 +1625,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R { MetaMaskScalePartAction* pAct = static_cast<MetaMaskScalePartAction*>(pAction); tools::Rectangle aRect( pAct->GetDestPoint(), pAct->GetDestSize() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1663,7 +1633,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R { MetaWallpaperAction* pAct = static_cast<MetaWallpaperAction*>(pAction); tools::Rectangle aRect( pAct->GetRect() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; @@ -1671,7 +1641,7 @@ tools::Rectangle GDIMetaFile::GetBoundRect( OutputDevice& i_rReference, tools::R { MetaTextRectAction* pAct = static_cast<MetaTextRectAction*>(pAction); tools::Rectangle aRect( pAct->GetRect() ); - ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack, nullptr ); + ImplActionBounds( aBound, OutputDevice::LogicToLogic( aRect, aMapVDev->GetMapMode(), GetPrefMapMode() ), aClipStack ); } break; diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 7fd24f419a95..37e13abc57a3 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -591,23 +591,16 @@ Bitmap ImpGraphic::getBitmap(const GraphicConversionParameters& rParameters) con if(GraphicType::GdiMetafile == getType()) { - // get hairline and full bound rect - tools::Rectangle aHairlineRect; - const tools::Rectangle aRect(maMetaFile.GetBoundRect(*aVDev, &aHairlineRect)); - - if(!aRect.IsEmpty() && !aHairlineRect.IsEmpty()) - { - // expand if needed to allow bottom and right hairlines to be added - if(aRect.Right() == aHairlineRect.Right()) - { - aPixelSize.setWidth(aPixelSize.getWidth() + 1); - } - - if(aRect.Bottom() == aHairlineRect.Bottom()) - { - aPixelSize.setHeight(aPixelSize.getHeight() + 1); - } - } + // tdf#126319 Removed correction based on hairline-at-the-extremes of + // the metafile. The task shows that this is no longer sufficient since + // less hairlines get used in general - what is good, but breaks that + // old fix. Anyways, hairlines are a left-over from non-AA times + // when it was not possible to paint lines taller than one pixel. + // This might need to be corrected further using primitives and + // the possibility to get better-quality ranges for correction. For + // now, always add that one pixel. + aPixelSize.setWidth(aPixelSize.getWidth() + 1); + aPixelSize.setHeight(aPixelSize.getHeight() + 1); } if(aVDev->SetOutputSizePixel(aPixelSize)) |