summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-05-26 17:27:15 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-05-31 13:43:30 +0200
commitc547cf9b8c14062b2e6bb3ba9ee6541bd9e16fba (patch)
treefd3e57127e539745735f58f61973d4f3058dadd2
parent657a01ef00064f8f7cf7e81582f44064417321a8 (diff)
tdf#108056 sw SubtractFlys: add missing expansion of the clip path
With this finally the bugdoc has no more unexpected white lines around the fly frame. In the non-SubtractFlys case DrawFillAttributes() already did an expansion of the clip path, but this was overwritten in case the layout flag was set. Fix the problem by taking care of this in lcl_SubtractFlys() itself. Change-Id: Iac91279f8bc19588e763425aff5cb800e793da83 Reviewed-on: https://gerrit.libreoffice.org/38079 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit 0714d2f3009bbb24501561c1a8e96a6feb9a42ca) Reviewed-on: https://gerrit.libreoffice.org/38262
-rw-r--r--sw/source/core/layout/paintfrm.cxx21
1 files changed, 18 insertions, 3 deletions
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index bb6ca5a7e2eb..008e26f9efef 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1532,6 +1532,21 @@ static void lcl_ExtendLeftAndRight( SwRect& _rRect,
}
}
+/// Returns a range suitable for subtraction when lcl_SubtractFlys() is used.
+/// Otherwise DrawFillAttributes() expands the clip path itself.
+static basegfx::B2DRange lcl_ShrinkFly(const SwRect& rRect)
+{
+ static MapMode aMapMode(MapUnit::MapTwip);
+ static const Size aSingleUnit = Application::GetDefaultDevice()->PixelToLogic(Size(1, 1), aMapMode);
+
+ double x1 = rRect.Left() + aSingleUnit.getWidth();
+ double y1 = rRect.Top() + aSingleUnit.getHeight();
+ double x2 = rRect.Right() - aSingleUnit.getWidth();
+ double y2 = rRect.Bottom() - aSingleUnit.getHeight();
+
+ return basegfx::B2DRange(x1, y1, x2, y2);
+}
+
static void lcl_SubtractFlys( const SwFrame *pFrame, const SwPageFrame *pPage,
const SwRect &rRect, SwRegionRects &rRegion, basegfx::tools::B2DClipState& rClipState, SwPaintProperties & rProperties)
{
@@ -1666,7 +1681,7 @@ static void lcl_SubtractFlys( const SwFrame *pFrame, const SwPageFrame *pPage,
const SwBorderAttrs &rAttrs = *aAccess.Get();
::lcl_CalcBorderRect( aRect, pFly, rAttrs, true, rProperties );
rRegion -= aRect;
- rClipState.subtractRange(basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()));
+ rClipState.subtractRange(lcl_ShrinkFly(aRect));
continue;
}
else
@@ -1684,14 +1699,14 @@ static void lcl_SubtractFlys( const SwFrame *pFrame, const SwPageFrame *pPage,
const SwBorderAttrs &rAttrs = *aAccess.Get();
::lcl_CalcBorderRect( aRect, pFly, rAttrs, true, rProperties );
rRegion -= aRect;
- rClipState.subtractRange(basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()));
+ rClipState.subtractRange(lcl_ShrinkFly(aRect));
}
else
{
SwRect aRect( pFly->Prt() );
aRect += pFly->Frame().Pos();
rRegion -= aRect;
- rClipState.subtractRange(basegfx::B2DRange(aRect.Left(), aRect.Top(), aRect.Right(), aRect.Bottom()));
+ rClipState.subtractRange(lcl_ShrinkFly(aRect));
}
}
if (gProp.pSRetoucheFly == gProp.pSRetoucheFly2)