From c984afdf47ef31511024c6b70bd4b4c4e64f56a6 Mon Sep 17 00:00:00 2001 From: LaG1924 Date: Sat, 8 Jul 2023 23:30:25 +0500 Subject: Fixed some errors detected by static analysis --- src/TextureAtlas.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/TextureAtlas.cpp') diff --git a/src/TextureAtlas.cpp b/src/TextureAtlas.cpp index 9ad018e..e2cd355 100644 --- a/src/TextureAtlas.cpp +++ b/src/TextureAtlas.cpp @@ -96,10 +96,11 @@ TextureAtlas::TextureAtlas(std::vector &textures) { //Uploading texture data for (int i = 0; i < textureCoords.size(); i++) { size_t bytesPerLine = textureCoords[i].pixelW * 4; + auto& textureData = textures[i].data; for (int y = 0; y < textureCoords[i].pixelH / 2; y++) { int invY = textureCoords[i].pixelH - y - 1; - unsigned char *src = textures[i].data.data() + y * bytesPerLine; - unsigned char *dst = textures[i].data.data() + invY * bytesPerLine; + unsigned char *src = textureData.data() + y * bytesPerLine; + unsigned char *dst = textureData.data() + invY * bytesPerLine; for (int j = 0; j < bytesPerLine; j++) { std::swap(*(src + j), *(dst + j)); } @@ -111,7 +112,7 @@ TextureAtlas::TextureAtlas(std::vector &textures) { textureCoords[i].pixelW, textureCoords[i].pixelH, 1, - { reinterpret_cast(textures[i].data.data()), reinterpret_cast(textures[i].data.data()) + textures[i].data.size() } + { reinterpret_cast(textureData.data()), reinterpret_cast(textureData.data()) + textureData.size() } ); } -- cgit v1.2.3