diff --git a/es-core/src/utils/CImgUtil.cpp b/es-core/src/utils/CImgUtil.cpp index 4b23b9027..c9c228b27 100644 --- a/es-core/src/utils/CImgUtil.cpp +++ b/es-core/src/utils/CImgUtil.cpp @@ -12,7 +12,7 @@ namespace Utils { namespace CImg { - void convertRGBAToCImg(std::vector imageRGBA, + void convertRGBAToCImg(const std::vector& imageRGBA, cimg_library::CImg& image) { // CImg does not interleave the pixels as in RGBARGBARGBA so a conversion is required. @@ -28,15 +28,15 @@ namespace Utils } } - void convertCImgToRGBA(cimg_library::CImg image, + void convertCImgToRGBA(const cimg_library::CImg& image, std::vector& imageRGBA) { for (int r = image.height() - 1; r >= 0; r--) { for (int c = 0; c < image.width(); c++) { - imageRGBA.push_back((unsigned char)image(c, r, 0, 2)); - imageRGBA.push_back((unsigned char)image(c, r, 0, 1)); - imageRGBA.push_back((unsigned char)image(c, r, 0, 0)); - imageRGBA.push_back((unsigned char)image(c, r, 0, 3)); + imageRGBA.emplace_back((unsigned char)image(c, r, 0, 2)); + imageRGBA.emplace_back((unsigned char)image(c, r, 0, 1)); + imageRGBA.emplace_back((unsigned char)image(c, r, 0, 0)); + imageRGBA.emplace_back((unsigned char)image(c, r, 0, 3)); } } } diff --git a/es-core/src/utils/CImgUtil.h b/es-core/src/utils/CImgUtil.h index ee3dd39ef..a5afca199 100644 --- a/es-core/src/utils/CImgUtil.h +++ b/es-core/src/utils/CImgUtil.h @@ -20,9 +20,9 @@ namespace Utils { namespace CImg { - void convertRGBAToCImg(std::vector imageRGBA, + void convertRGBAToCImg(const std::vector& imageRGBA, cimg_library::CImg& image); - void convertCImgToRGBA(cimg_library::CImg image, + void convertCImgToRGBA(const cimg_library::CImg& image, std::vector& imageRGBA); void getTransparentPaddingCoords(cimg_library::CImg& image, int (&imageCoords)[4]);