Related tdf#149890: SVG: pattern is displayed with black fill

Regression from 5707b5dce7
tdf#101083 speed up SVG rendering with pattern fill (2)
This is the same thing I did in

     commit 3cbe3a0259
     Author: Noel Grandin <noel.grandin@collabora.co.uk>
     Date:   Mon Jun 14 15:05:59 2021 +0200
     tdf#101083 speed up SVG rendering with pattern fill

but cut and paste from the VclPixelProcessor2D to the CairoPixelProcessor2D code.

Which makes this SVG render in reasonable time when using the cairo backend.

We can probably do even better by cutting out the usage of VCL here, but this
is good enough for now.

+ apply the same as af2175bb87
    crashtesting: divide by zero

    since:

    commit 7b807a6b79
    Date:   Fri Jun 21 12:28:30 2024 +0200

        tdf#161086 bitmap location wrong with SVG with an embedded PNG

    bodge it by using the requested width/height and not the possibly
    zero on fail actual sizes

Change-Id: Ie0e0462e564a568f99d1c5b9c62f71049f71f9b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208275
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
This commit is contained in:
Julien Nabet
2026-07-20 21:30:55 +02:00
parent 72da83e66f
commit 5f0cf799b3
@@ -3575,7 +3575,12 @@ void CairoPixelProcessor2D::processPatternFillPrimitive2D(
{
mpTargetOutputDevice->Push(vcl::PushFlags::CLIPREGION);
mpTargetOutputDevice->IntersectClipRegion(vcl::Region(aMask));
mpTargetOutputDevice->DrawWallpaper(aMaskRect, Wallpaper(aTileImage));
Wallpaper aWallpaper(aTileImage);
aWallpaper.SetColor(COL_TRANSPARENT);
Point aPaperPt(aMaskRect.getX() % nTileWidth, aMaskRect.getY() % nTileHeight);
tools::Rectangle aPaperRect(aPaperPt, aTileImage.GetSizePixel());
aWallpaper.SetRect(aPaperRect);
mpTargetOutputDevice->DrawWallpaper(aMaskRect, aWallpaper);
mpTargetOutputDevice->Pop();
return;
}