summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-06-11 21:25:28 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-06-12 09:57:15 +0200
commitf11818696a6b810a16c8b13707d76d5c358036e5 (patch)
treedeef2e74a0ed2c216813803c12cc32be45c5d417 /svtools
parent9cdeee3a7740b4f1f28611f4db3bd5d8326c71ce (diff)
skip copying tile when we don't need to
Change-Id: I137c69b7217801a6c86634f7e44e363ef73fd9de Reviewed-on: https://gerrit.libreoffice.org/38667 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/graphic/grfmgr2.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index 35288085a287..d8687abf75b9 100644
--- a/svtools/source/graphic/grfmgr2.cxx
+++ b/svtools/source/graphic/grfmgr2.cxx
@@ -1709,7 +1709,8 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
GraphicManagerDrawFlags nFlags, ImplTileInfo& rTileInfo )
{
// gets loaded with our tile bitmap
- GraphicObject aTmpGraphic;
+ std::unique_ptr<GraphicObject> xTmpGraphic;
+ GraphicObject* pTileGraphic;
// stores a flag that renders the zero'th tile position
// (i.e. (0,0)+rCurrPos) only if we're at the bottom of the
@@ -1729,7 +1730,7 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
// check for recursion's end condition: LSB place reached?
if( nMSBFactor == 1 )
{
- aTmpGraphic = *this;
+ pTileGraphic = this;
// set initial tile size -> orig size
aTileInfo.aTileSizePixel = rTileSizePixel;
@@ -1744,7 +1745,8 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
// extract generated tile -> see comment on the first loop below
BitmapEx aTileBitmap( rVDev.GetBitmap( aTileInfo.aTileTopLeft, aTileInfo.aTileSizePixel ) );
- aTmpGraphic = GraphicObject( aTileBitmap );
+ xTmpGraphic.reset(new GraphicObject(aTileBitmap));
+ pTileGraphic = xTmpGraphic.get();
// fill stripes left over from upstream levels:
@@ -1771,7 +1773,7 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
Point aCurrPos(aTileInfo.aNextTileTopLeft.X(), aTileInfo.aTileTopLeft.Y());
for (int nX=0; nX < aTileInfo.nTilesEmptyX; nX += nMSBFactor)
{
- if( !aTmpGraphic.Draw( &rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags ) )
+ if (!pTileGraphic->Draw(&rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags))
return false;
aCurrPos.X() += aTileInfo.aTileSizePixel.Width();
@@ -1792,7 +1794,7 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
aCurrPos.Y() = aTileInfo.aNextTileTopLeft.Y();
for (int nY=0; nY < aTileInfo.nTilesEmptyY; nY += nMSBFactor)
{
- if( !aTmpGraphic.Draw( &rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags ) )
+ if (!pTileGraphic->Draw(&rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags))
return false;
aCurrPos.Y() += aTileInfo.aTileSizePixel.Height();
@@ -1852,7 +1854,7 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
{
if( bNoFirstTileDraw )
bNoFirstTileDraw = false; // don't draw first tile position
- else if( !aTmpGraphic.Draw( &rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags ) )
+ else if (!pTileGraphic->Draw(&rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr, nFlags))
return false;
aCurrPos.X() += aTileInfo.aTileSizePixel.Width();