comparison render_sdl.c @ 1952:42c12d141f6e

Remove usage of GCC pointer arithmetic on void * extension
author Michael Pavone <pavone@retrodev.com>
date Thu, 30 Apr 2020 23:30:22 -0700
parents 5a76a7373823
children bd70f1e15684
comparison
equal deleted inserted replaced
1951:8494fe8d6b65 1952:42c12d141f6e
1359 } 1359 }
1360 if (which >= num_textures) { 1360 if (which >= num_textures) {
1361 warning("Request for invalid framebuffer number %d\n", which); 1361 warning("Request for invalid framebuffer number %d\n", which);
1362 return NULL; 1362 return NULL;
1363 } 1363 }
1364 void *pixels; 1364 uint8_t *pixels;
1365 if (SDL_LockTexture(sdl_textures[which], NULL, &pixels, pitch) < 0) { 1365 if (SDL_LockTexture(sdl_textures[which], NULL, (void **)&pixels, pitch) < 0) {
1366 warning("Failed to lock texture: %s\n", SDL_GetError()); 1366 warning("Failed to lock texture: %s\n", SDL_GetError());
1367 return NULL; 1367 return NULL;
1368 } 1368 }
1369 static uint8_t last; 1369 static uint8_t last;
1370 if (which <= FRAMEBUFFER_EVEN) { 1370 if (which <= FRAMEBUFFER_EVEN) {
1371 locked_pixels = pixels; 1371 locked_pixels = (uint32_t *)pixels;
1372 if (which == FRAMEBUFFER_EVEN) { 1372 if (which == FRAMEBUFFER_EVEN) {
1373 pixels += *pitch; 1373 pixels += *pitch;
1374 } 1374 }
1375 locked_pitch = *pitch; 1375 locked_pitch = *pitch;
1376 if (which != last) { 1376 if (which != last) {
1377 *pitch *= 2; 1377 *pitch *= 2;
1378 } 1378 }
1379 last = which; 1379 last = which;
1380 } 1380 }
1381 return pixels; 1381 return (uint32_t *)pixels;
1382 #ifndef DISABLE_OPENGL 1382 #ifndef DISABLE_OPENGL
1383 } 1383 }
1384 #endif 1384 #endif
1385 } 1385 }
1386 1386