diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2023-07-08 21:41:27 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-08 21:41:27 +0200 |
commit | a68f48ad526d0843eb451af0be7f119db5ff794e (patch) | |
tree | 3c539c9e7de841c6616f532dadb7c8c1ef552d95 /src/TextureAtlas.cpp | |
parent | Merge pull request #80 from LaG1924/ftr/better-water (diff) | |
parent | Fixed some errors detected by static analysis (diff) | |
download | AltCraft-master.tar AltCraft-master.tar.gz AltCraft-master.tar.bz2 AltCraft-master.tar.lz AltCraft-master.tar.xz AltCraft-master.tar.zst AltCraft-master.zip |
Diffstat (limited to '')
-rw-r--r-- | src/TextureAtlas.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
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<TextureData> &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<TextureData> &textures) { textureCoords[i].pixelW, textureCoords[i].pixelH, 1, - { reinterpret_cast<std::byte*>(textures[i].data.data()), reinterpret_cast<std::byte*>(textures[i].data.data()) + textures[i].data.size() } + { reinterpret_cast<std::byte*>(textureData.data()), reinterpret_cast<std::byte*>(textureData.data()) + textureData.size() } ); } |