drawinglayer/source/processor2d/vclprocessor2d.cxx | 30 +++++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-)
New commits: commit 2a9b53bb9f85c2869c779dde36a2d77353fef14b Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Jun 27 10:18:15 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Jun 27 13:10:01 2024 +0200 tdf#160345 Slow rendering of filled polygon Partial fix of this problem. The tiled image is a single pixel big, so we can do a solid color fill. Ideally vcl needs to pass the operation down to skia/cairo and let those layers do the tiling. Change-Id: Ifcb1d1a71f0b23b772bbacf1b1e2b15ea315f578 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169619 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 45825a2a477b..7c21e4ea1f1c 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -701,8 +701,31 @@ bool VclProcessor2D::RenderFillGraphicPrimitive2DImpl( // check if offset is used const sal_Int32 nOffsetX(basegfx::fround(rFillGraphicAttribute.getOffsetX() * nBWidth)); + const sal_Int32 nOffsetY(basegfx::fround(rFillGraphicAttribute.getOffsetY() * nBHeight)); - if (nOffsetX) + if (nOffsetX == 0 && nOffsetY == 0) + { + if (!bPreScaled) + aBitmapEx.Scale(aNeededBitmapSizePixel); + + // if the tile is a single pixel big, just flood fill with that pixel color + if (aNeededBitmapSizePixel.getWidth() == 1 && aNeededBitmapSizePixel.getHeight() == 1) + { + Color col = aBitmapEx.GetPixelColor(0, 0); + mpOutputDevice->SetLineColor(col); + mpOutputDevice->SetFillColor(col); + mpOutputDevice->DrawRect(aVisiblePixel); + } + else + { + // TODO vcl does not have an optimised path here, it should be passing some kind of fill/tile + // operation down to the cairo/skia layers + Wallpaper aWallpaper(aBitmapEx); + aWallpaper.SetColor(COL_TRANSPARENT); + mpOutputDevice->DrawWallpaper(aVisiblePixel, aWallpaper); + } + } + else if (nOffsetX) { // offset in X, so iterate over Y first and draw lines for (sal_Int32 nYPos(nBTop); nYPos < nOTop + nOHeight; nYPos += nBHeight, nPosY++) @@ -727,11 +750,8 @@ bool VclProcessor2D::RenderFillGraphicPrimitive2DImpl( } } } - else + else // nOffsetY is used { - // check if offset is used - const sal_Int32 nOffsetY(basegfx::fround(rFillGraphicAttribute.getOffsetY() * nBHeight)); - // possible offset in Y, so iterate over X first and draw columns for (sal_Int32 nXPos(nBLeft); nXPos < nOLeft + nOWidth; nXPos += nBWidth, nPosX++) {