drawinglayer/source/processor2d/cairopixelprocessor2d.cxx | 19 ++++---- drawinglayer/source/processor2d/vclpixelprocessor2d.cxx | 33 ++++++-------- 2 files changed, 26 insertions(+), 26 deletions(-)
New commits: commit baee03e387386cfaff5f00200f294655c3aeea0e Author: Noel Grandin <[email protected]> AuthorDate: Wed Oct 15 12:54:08 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Wed Oct 15 18:47:51 2025 +0200 optimise processPatternFillPrimitive2D a little we can skip the intermediate impBufferDevice if we are doing a flood fill Change-Id: Ia37251d362ad6421ae0beb7ae1cf1f25d293b851 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192431 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx index 70f485b3247d..b9691f4db9f3 100644 --- a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx @@ -3480,22 +3480,23 @@ void CairoPixelProcessor2D::processPatternFillPrimitive2D( return; } - impBufferDevice aBufferDevice(*mpTargetOutputDevice, aMaskRange); - if (!aBufferDevice.isVisible()) - return; - // remember last OutDev and set to content - OutputDevice* pLastOutputDevice = mpTargetOutputDevice; - mpTargetOutputDevice = &aBufferDevice.getContent(); // if the tile is a single pixel big, just flood fill with that pixel color if (nTileWidth == 1 && nTileHeight == 1) { Color col = aTileImage.GetPixelColor(0, 0); mpTargetOutputDevice->SetLineColor(col); mpTargetOutputDevice->SetFillColor(col); - mpTargetOutputDevice->DrawRect(aMaskRect); + mpTargetOutputDevice->DrawPolyPolygon(aMask); + return; } - else - mpTargetOutputDevice->DrawWallpaper(aMaskRect, Wallpaper(aTileImage)); + + impBufferDevice aBufferDevice(*mpTargetOutputDevice, aMaskRange); + if (!aBufferDevice.isVisible()) + return; + // remember last OutDev and set to content + OutputDevice* pLastOutputDevice = mpTargetOutputDevice; + mpTargetOutputDevice = &aBufferDevice.getContent(); + mpTargetOutputDevice->DrawWallpaper(aMaskRect, Wallpaper(aTileImage)); // back to old OutDev mpTargetOutputDevice = pLastOutputDevice; // draw mask diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx index 200a08fb8b61..d271b5ee2ca3 100644 --- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx @@ -1085,6 +1085,16 @@ void VclPixelProcessor2D::processPatternFillPrimitive2D( return; } + // if the tile is a single pixel big, just flood fill with that pixel color + if (nTileWidth == 1 && nTileHeight == 1) + { + Color col = aTileImage.GetPixelColor(0, 0); + mpOutputDevice->SetLineColor(col); + mpOutputDevice->SetFillColor(col); + mpOutputDevice->DrawPolyPolygon(aMask); + return; + } + impBufferDevice aBufferDevice(*mpOutputDevice, aMaskRange); if (!aBufferDevice.isVisible()) @@ -1094,23 +1104,12 @@ void VclPixelProcessor2D::processPatternFillPrimitive2D( OutputDevice* pLastOutputDevice = mpOutputDevice; mpOutputDevice = &aBufferDevice.getContent(); - // if the tile is a single pixel big, just flood fill with that pixel color - if (nTileWidth == 1 && nTileHeight == 1) - { - Color col = aTileImage.GetPixelColor(0, 0); - mpOutputDevice->SetLineColor(col); - mpOutputDevice->SetFillColor(col); - mpOutputDevice->DrawRect(aMaskRect); - } - else - { - Wallpaper aWallpaper(aTileImage); - aWallpaper.SetColor(COL_TRANSPARENT); - Point aPaperPt(aMaskRect.getX() % nTileWidth, aMaskRect.getY() % nTileHeight); - tools::Rectangle aPaperRect(aPaperPt, aTileImage.GetSizePixel()); - aWallpaper.SetRect(aPaperRect); - mpOutputDevice->DrawWallpaper(aMaskRect, aWallpaper); - } + Wallpaper aWallpaper(aTileImage); + aWallpaper.SetColor(COL_TRANSPARENT); + Point aPaperPt(aMaskRect.getX() % nTileWidth, aMaskRect.getY() % nTileHeight); + tools::Rectangle aPaperRect(aPaperPt, aTileImage.GetSizePixel()); + aWallpaper.SetRect(aPaperRect); + mpOutputDevice->DrawWallpaper(aMaskRect, aWallpaper); // back to old OutDev mpOutputDevice = pLastOutputDevice;
