From 14e1b800fa917696d2d44040d9c87e4c080108d2 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 7 Nov 2021 18:18:41 +0100 Subject: [PATCH] Made two optimizations in TextureData. --- es-core/src/resources/TextureData.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/es-core/src/resources/TextureData.cpp b/es-core/src/resources/TextureData.cpp index e51908489..8182106f5 100644 --- a/es-core/src/resources/TextureData.cpp +++ b/es-core/src/resources/TextureData.cpp @@ -105,8 +105,9 @@ bool TextureData::initSVGFromMemory(const std::string& fileData) nsvgDeleteRasterizer(rast); - mDataRGBA.insert(mDataRGBA.begin(), tempVector.data(), - tempVector.data() + (mWidth * mHeight * 4)); + mDataRGBA.insert(mDataRGBA.begin(), std::make_move_iterator(tempVector.data()), + std::make_move_iterator(tempVector.data() + (mWidth * mHeight * 4))); + tempVector.erase(tempVector.begin(), tempVector.end()); ImageIO::flipPixelsVert(mDataRGBA.data(), mWidth, mHeight); mPendingRasterization = false; @@ -160,7 +161,8 @@ bool TextureData::initFromRGBA(const unsigned char* dataRGBA, size_t width, size return true; mDataRGBA.reserve(width * height * 4); - mDataRGBA.insert(mDataRGBA.begin(), dataRGBA, dataRGBA + (width * height * 4)); + mDataRGBA.insert(mDataRGBA.begin(), std::make_move_iterator(dataRGBA), + std::make_move_iterator(dataRGBA + (width * height * 4))); mWidth = static_cast(width); mHeight = static_cast(height);