SpriteCache: use correct pitch for sprite rotation
This commit is contained in:
parent
cc6a8f553e
commit
c5a98c282b
1 changed files with 3 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue