rendering update

This commit is contained in:
Jorijn van der Graaf 2026-03-22 21:08:02 +01:00
commit 7fdab4f62b
4 changed files with 33 additions and 49 deletions

View file

@ -115,5 +115,16 @@ export namespace Crafter {
redraw[i] = true;
}
}
void CopyNearestNeighbor(Vector<std::uint8_t, 4>* dst, std::uint16_t dstSizeX, std::uint16_t dstScaledSizeX, std::uint16_t dstScaledSizeY, std::uint16_t offsetX, std::uint16_t offsetY) {
for (std::uint16_t y = 0; y < dstScaledSizeY; y++) {
std::uint16_t srcY = y * scaled.size.y / dstScaledSizeY;
std::uint16_t dstY = y + offsetY;
for (std::uint16_t x = 0; x < dstScaledSizeX; x++) {
std::uint16_t srcX = x * scaled.size.x / dstScaledSizeX;
std::uint16_t dstX = x + offsetX;
dst[dstY * dstSizeX + dstX] = buffer[srcY * this->scaled.size.x + srcX];
}
}
}
};
}