diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-12-10 00:02:59 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2015-12-10 00:07:49 +0100 |
commit | c5a98c282b86d97330352fe17a7b6998b38237e5 (patch) | |
tree | f0b1db03292bbbf2b84821dd41cb9ec1322c7663 /src/view/SpriteCache.cpp | |
parent | cc6a8f553e703ca305454f612256fb734861ad0f (diff) | |
download | rpgedit-c5a98c282b86d97330352fe17a7b6998b38237e5.tar rpgedit-c5a98c282b86d97330352fe17a7b6998b38237e5.zip |
SpriteCache: use correct pitch for sprite rotation
Diffstat (limited to 'src/view/SpriteCache.cpp')
-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); } } |