Optimize rendering

This commit is contained in:
Miloslav Ciz 2025-04-24 16:55:35 +02:00
parent c22f17ef8c
commit 5265552c57
8 changed files with 117 additions and 89 deletions

View file

@ -448,7 +448,7 @@ static const char *LCR_internalDataFile =
":^D1bJ:f11i:^J1bL:f11i"
":^D0bJ-:f11i:^J0bL-:f11i"
":^E1s:f511"
":>E0k:f513"
":>E0k:f514"
// slope:
":^C2vI-:f611"
":^p3v:fj11"
@ -7066,9 +7066,9 @@ void LCR_imageChangeBrightness(int up)
Samples currently loaded image at given pixels coordinates (with wrapping).
This is slower than reading the image pixel by pixel.
*/
uint16_t LCR_sampleImage(int x, int y)
uint16_t LCR_sampleImage(int_fast32_t x, int_fast32_t y)
{
// TODO: bottleneck, later on optimize here
// bottleneck here, optimization will increase rendering performance
x = (y % LCR_IMAGE_SIZE) * LCR_IMAGE_SIZE + (x % LCR_IMAGE_SIZE);
x += (x < 0) * (LCR_IMAGE_SIZE * LCR_IMAGE_SIZE);
return LCR_currentImage.palette[LCR_currentImage.image[x]];