summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2017-11-29 21:22:51 +0000
committerMichael Meeks <michael.meeks@collabora.com>2017-12-02 12:43:23 +0100
commit4ec42ad9976698d09afb8f9f3f5ec232b48dfca0 (patch)
treeeaa90925dd14ac082cd7e9160aff74cda2adb3f9 /sw/source
parenteed2c5d7fc7e96a06bf5862f023f08f5e2446343 (diff)
Writer page shadow - avoid scaling stored bitmaps at all.
Follow-on improvement from previous leak fix. Change-Id: Iad18da20c3ee03cbafd191ddd722f58bd45911be Reviewed-on: https://gerrit.libreoffice.org/45538 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com> (cherry picked from commit 268d019c4b05f37e99e1da85472dc9255f186a27) Reviewed-on: https://gerrit.libreoffice.org/45661
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/layout/paintfrm.cxx41
1 files changed, 9 insertions, 32 deletions
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 4024f341defc..e2187a1da863 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -5876,7 +5876,6 @@ bool SwPageFrame::IsLeftShadowNeeded() const
}
enum PaintArea {LEFT, RIGHT, TOP, BOTTOM};
-#define BORDER_TILE_SIZE 512
/// Wrapper around pOut->DrawBitmapEx.
static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoint, const Size& aSize, const BitmapEx& rBitmapEx, PaintArea eArea)
@@ -5898,24 +5897,14 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
pOut->SetLineColor();
pOut->DrawRect(pOut->PixelToLogic(aRect));
- // Tiled render if necessary
- tools::Rectangle aComplete(aPoint, aSize);
- Size aTileSize(BORDER_TILE_SIZE, BORDER_TILE_SIZE);
-
- long iterX = eArea != RIGHT && eArea != LEFT ? BORDER_TILE_SIZE : 0;
- long iterY = eArea == RIGHT || eArea == LEFT ? BORDER_TILE_SIZE : 0;
-
- for (tools::Rectangle aTile = tools::Rectangle(aPoint, aTileSize); true; aTile.Move(iterX, iterY))
- {
- tools::Rectangle aRender = aComplete.GetIntersection(aTile);
- if (aRender.IsEmpty())
- break;
- pOut->DrawBitmapEx(pOut->PixelToLogic(aRender.TopLeft()),
- pOut->PixelToLogic(aRender.GetSize()),
- Point(0, 0), aRender.GetSize(),
- rBitmapEx);
- }
+ Size aOutSize = pOut->PixelToLogic(aSize);
+ Point aOutPoint = pOut->PixelToLogic(aPoint);
+ pOut->DrawTransformedBitmapEx(
+ basegfx::utils::createScaleTranslateB2DHomMatrix(
+ aOutSize.Width(), aOutSize.Height(),
+ aOutPoint.X(), aOutPoint.Y()),
+ rBitmapEx);
}
/**
@@ -6027,9 +6016,6 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
{
const long nWidth = aPageRightShadow.GetSizePixel().Width();
const long nHeight = aPagePxRect.Height() - 2 * (mnShadowPxWidth - 1);
- if (aPageRightShadow.GetSizePixel().Height() < BORDER_TILE_SIZE)
- aPageRightShadow.Scale(Size(nWidth, BORDER_TILE_SIZE), BmpScaleFlag::Fast);
-
lcl_paintBitmapExToRect(pOut,
Point(aPaintRect.Right() + mnShadowPxWidth, aPagePxRect.Top() + mnShadowPxWidth - 1),
Size(nWidth, nHeight),
@@ -6048,9 +6034,6 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
{
const long nWidth = aPageLeftShadow.GetSizePixel().Width();
const long nHeight = aPagePxRect.Height() - 2 * (mnShadowPxWidth - 1);
- if (aPageLeftShadow.GetSizePixel().Height() < BORDER_TILE_SIZE)
- aPageLeftShadow.Scale(Size(nWidth, BORDER_TILE_SIZE), BmpScaleFlag::Fast);
-
lcl_paintBitmapExToRect(pOut,
Point(lLeft, aPagePxRect.Top() + mnShadowPxWidth - 1),
Size(nWidth, nHeight),
@@ -6060,22 +6043,16 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin
// Bottom shadow
const long nBottomHeight = aPageBottomShadow.GetSizePixel().Height();
- if (aPageBottomShadow.GetSizePixel().Width() < BORDER_TILE_SIZE)
- aPageBottomShadow.Scale(Size(BORDER_TILE_SIZE, nBottomHeight), BmpScaleFlag::Fast);
-
lcl_paintBitmapExToRect(pOut,
Point(aPaintRect.Left(), aPagePxRect.Bottom() + 2),
- Size(aPaintRect.Width(), nBottomHeight),
+ Size(aPaintRect.Width() - 1, nBottomHeight),
aPageBottomShadow, BOTTOM);
// Top shadow
const long nTopHeight = aPageTopShadow.GetSizePixel().Height();
- if (aPageTopShadow.GetSizePixel().Width() < BORDER_TILE_SIZE)
- aPageTopShadow.Scale(Size(BORDER_TILE_SIZE, nTopHeight), BmpScaleFlag::Fast);
-
lcl_paintBitmapExToRect(pOut,
Point(aPaintRect.Left(), aPagePxRect.Top() - mnShadowPxWidth),
- Size(aPaintRect.Width(), nTopHeight),
+ Size(aPaintRect.Width() - 1, nTopHeight),
aPageTopShadow, TOP);
}