diff --git a/arm9/src/gdrv.cpp b/arm9/src/gdrv.cpp index 1d988ff..78ad9c3 100644 --- a/arm9/src/gdrv.cpp +++ b/arm9/src/gdrv.cpp @@ -88,13 +88,13 @@ void gdrv_bitmap8::ScaleIndexed(float scaleX, float scaleY) return; auto newIndBuf = new char[newHeight * newWidht]; - for (int y = 0; y < Height; y++) + for (int dst=0, y = 0; y < newHeight; y++) { - for (int x = 0; x < Width; x++) + for (int x = 0; x < newWidht; x++, dst++) { - int smallX = static_cast(static_cast(x) / Width * newWidht); - int smallY = static_cast(static_cast(y) / Height * newHeight); - newIndBuf[smallY * newWidht + smallX] = IndexedBmpPtr[(y * IndexedStride) + x]; + auto px = static_cast(x / scaleX); + auto py = static_cast(y / scaleY); + newIndBuf[dst] = IndexedBmpPtr[(py * IndexedStride) + px]; } }