Skip to content

Commit

Permalink
lib: Yet another SDL2 fix
Browse files Browse the repository at this point in the history
I applied the previous one too quickly, didn't test properly. Now it
should be working.
  • Loading branch information
vkoskiv committed Dec 20, 2023
1 parent ec49028 commit 84109d4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/driver/sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,10 @@ struct input_state win_update(struct sdl_window *w, const struct cr_tile *tiles,
for (int x = 0; x < tiles[i].w; ++x) {
const int ax = x + tiles[i].start_x;
const int ay = y + tiles[i].start_y;
dst[(ax + (ay * width)) * 3 + 0] = (unsigned char)min(linearToSRGB(src[(ax + (ay * width)) * 3 + 0]) * 255.0f, 255.0f);
dst[(ax + (ay * width)) * 3 + 1] = (unsigned char)min(linearToSRGB(src[(ax + (ay * width)) * 3 + 1]) * 255.0f, 255.0f);
dst[(ax + (ay * width)) * 3 + 2] = (unsigned char)min(linearToSRGB(src[(ax + (ay * width)) * 3 + 2]) * 255.0f, 255.0f);
dst[(ax + (ay * width)) * 4 + 0] = (unsigned char)min(linearToSRGB(src[(ax + (ay * width)) * 4 + 0]) * 255.0f, 255.0f);
dst[(ax + (ay * width)) * 4 + 1] = (unsigned char)min(linearToSRGB(src[(ax + (ay * width)) * 4 + 1]) * 255.0f, 255.0f);
dst[(ax + (ay * width)) * 4 + 2] = (unsigned char)min(linearToSRGB(src[(ax + (ay * width)) * 4 + 2]) * 255.0f, 255.0f);
dst[(ax + (ay * width)) * 4 + 3] = 255;
}
}
}
Expand Down

0 comments on commit 84109d4

Please sign in to comment.