diff options
-rw-r--r-- | src/view/SpriteCache.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/view/SpriteCache.cpp b/src/view/SpriteCache.cpp index 206aa1c..a7018f7 100644 --- a/src/view/SpriteCache.cpp +++ b/src/view/SpriteCache.cpp @@ -70,6 +70,8 @@ SpriteCache::sprite_value SpriteCache::load(const std::string &id, unsigned rota uint8_t *src = reinterpret_cast<uint8_t *>(base->pixels); uint8_t *dst = reinterpret_cast<uint8_t *>(surface->pixels); + int pitch = base->pitch; + int pitch2 = surface->pitch; for (int x = 0; x < w; x++) { for (int y = 0; y < h; y++) { @@ -89,7 +91,7 @@ SpriteCache::sprite_value SpriteCache::load(const std::string &id, unsigned rota y2 = x; } - std::memcpy(dst + d * (y2*w2 + x2), src + d * (y*w + x), d); + std::memcpy(dst + y2*pitch2 + d*x2, src + y*pitch + d*x, d); } } |