summaryrefslogtreecommitdiffstats
path: root/src/TextureAtlas.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2023-07-08 21:41:27 +0200
committerGitHub <noreply@github.com>2023-07-08 21:41:27 +0200
commita68f48ad526d0843eb451af0be7f119db5ff794e (patch)
tree3c539c9e7de841c6616f532dadb7c8c1ef552d95 /src/TextureAtlas.cpp
parentMerge pull request #80 from LaG1924/ftr/better-water (diff)
parentFixed some errors detected by static analysis (diff)
downloadAltCraft-a68f48ad526d0843eb451af0be7f119db5ff794e.tar
AltCraft-a68f48ad526d0843eb451af0be7f119db5ff794e.tar.gz
AltCraft-a68f48ad526d0843eb451af0be7f119db5ff794e.tar.bz2
AltCraft-a68f48ad526d0843eb451af0be7f119db5ff794e.tar.lz
AltCraft-a68f48ad526d0843eb451af0be7f119db5ff794e.tar.xz
AltCraft-a68f48ad526d0843eb451af0be7f119db5ff794e.tar.zst
AltCraft-a68f48ad526d0843eb451af0be7f119db5ff794e.zip
Diffstat (limited to 'src/TextureAtlas.cpp')
-rw-r--r--src/TextureAtlas.cpp7
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() }
);
}