summaryrefslogtreecommitdiff
path: root/canvas
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-06-23 15:02:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-06-24 08:43:55 +0200
commita2fc883173d7053cefe543620982051ae40c4b03 (patch)
treedac1b760925c8151dfd8a9cbe3a8735b68ab9f79 /canvas
parent010713e65ccade7b682c219707c8db3d864145c1 (diff)
use more std::container::insert instead of std::copy
which is both more compact code, and more efficient, since the insert method can do smarter resizing Change-Id: I17f226660f87cdf002edccc29b4af8fd59a25f91 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96948 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'canvas')
-rw-r--r--canvas/source/opengl/ogl_spritedevicehelper.cxx8
-rw-r--r--canvas/source/tools/spriteredrawmanager.cxx5
2 files changed, 4 insertions, 9 deletions
diff --git a/canvas/source/opengl/ogl_spritedevicehelper.cxx b/canvas/source/opengl/ogl_spritedevicehelper.cxx
index 6a1d935c9ba9..57b0875c3f4e 100644
--- a/canvas/source/opengl/ogl_spritedevicehelper.cxx
+++ b/canvas/source/opengl/ogl_spritedevicehelper.cxx
@@ -281,11 +281,9 @@ namespace oglcanvas
mpSpriteCanvas->renderRecordedActions();
// render all sprites (in order of priority) on top of that
- std::vector< ::rtl::Reference<CanvasCustomSprite> > aSprites;
- std::copy(maActiveSprites.begin(),
- maActiveSprites.end(),
- std::back_insert_iterator<
- std::vector< ::rtl::Reference< CanvasCustomSprite > > >(aSprites));
+ std::vector< ::rtl::Reference<CanvasCustomSprite> > aSprites(
+ maActiveSprites.begin(),
+ maActiveSprites.end());
std::sort(aSprites.begin(),
aSprites.end(),
SpriteComparator());
diff --git a/canvas/source/tools/spriteredrawmanager.cxx b/canvas/source/tools/spriteredrawmanager.cxx
index c1595f459940..443673093ff1 100644
--- a/canvas/source/tools/spriteredrawmanager.cxx
+++ b/canvas/source/tools/spriteredrawmanager.cxx
@@ -234,10 +234,7 @@ namespace canvas
}
// sort sprites after prio
- VectorOfSprites aSortedSpriteVector;
- std::copy( maSprites.begin(),
- maSprites.end(),
- std::back_insert_iterator< VectorOfSprites >(aSortedSpriteVector) );
+ VectorOfSprites aSortedSpriteVector( maSprites.begin(), maSprites.end() );
std::sort( aSortedSpriteVector.begin(),
aSortedSpriteVector.end(),
aSpriteComparator );