mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
gl1: take care of const
This commit is contained in:
parent
897488862e
commit
27d2877106
@ -568,28 +568,27 @@ static void draw_tex(gl1_t *gl1, int pot_width, int pot_height, int width, int h
|
||||
so we send the frame as dummy data */
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, pot_width, pot_height, 0, format, type, frame_to_copy);
|
||||
|
||||
uint8_t *frame = (uint8_t*)frame_to_copy;
|
||||
uint8_t *frame_rgba = NULL;
|
||||
if (!gl1->supports_bgra) {
|
||||
uint8_t* frame_rgba = malloc(pot_width * pot_height * 4);
|
||||
uint8_t* frame_bgra = frame_to_copy;
|
||||
int x, y;
|
||||
for (y = 0; y < pot_height; y++) {
|
||||
for (x = 0; x < pot_width; x++) {
|
||||
int index = (y * pot_width + x) * 4;
|
||||
frame_rgba[index + 2] = frame_bgra[index + 0];
|
||||
frame_rgba[index + 1] = frame_bgra[index + 1];
|
||||
frame_rgba[index + 0] = frame_bgra[index + 2];
|
||||
frame_rgba[index + 3] = 255;
|
||||
frame_rgba = (uint8_t*)malloc(pot_width * pot_height * 4);
|
||||
if (frame_rgba) {
|
||||
int x, y;
|
||||
for (y = 0; y < pot_height; y++) {
|
||||
for (x = 0; x < pot_width; x++) {
|
||||
int index = (y * pot_width + x) * 4;
|
||||
frame_rgba[index + 2] = frame[index + 0];
|
||||
frame_rgba[index + 1] = frame[index + 1];
|
||||
frame_rgba[index + 0] = frame[index + 2];
|
||||
frame_rgba[index + 3] = frame[index + 3];
|
||||
}
|
||||
}
|
||||
frame = frame_rgba;
|
||||
}
|
||||
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, type, frame_rgba);
|
||||
free(frame_rgba);
|
||||
}
|
||||
else {
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, format, type, frame_to_copy);
|
||||
}
|
||||
|
||||
|
||||
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, format, type, frame);
|
||||
free(frame_rgba);
|
||||
|
||||
if (tex == gl1->tex)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user