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 <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user