| 249 | } |
| 250 | |
| 251 | void RenderPresent() |
| 252 | { |
| 253 | SDL_Surface *surface = GetOutputSurface(); |
| 254 | assert(!SDL_MUSTLOCK(surface)); |
| 255 | |
| 256 | if (!gbActive) { |
| 257 | LimitFrameRate(); |
| 258 | return; |
| 259 | } |
| 260 | |
| 261 | #ifndef USE_SDL1 |
| 262 | if (renderer) { |
| 263 | if (SDL_UpdateTexture(texture, NULL, surface->pixels, surface->pitch) <= -1) { //pitch is 2560 |
| 264 | ErrSdl(); |
| 265 | } |
| 266 | |
| 267 | // Clear buffer to avoid artifacts in case the window was resized |
| 268 | if (SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255) <= -1) { // TODO only do this if window was resized |
| 269 | ErrSdl(); |
| 270 | } |
| 271 | |
| 272 | if (SDL_RenderClear(renderer) <= -1) { |
| 273 | ErrSdl(); |
| 274 | } |
| 275 | |
| 276 | if (SDL_RenderCopy(renderer, texture, NULL, NULL) <= -1) { |
| 277 | ErrSdl(); |
| 278 | } |
| 279 | SDL_RenderPresent(renderer); |
| 280 | } else { |
| 281 | if (SDL_UpdateWindowSurface(window) <= -1) { |
| 282 | ErrSdl(); |
| 283 | } |
| 284 | LimitFrameRate(); |
| 285 | } |
| 286 | #else |
| 287 | if (SDL_Flip(surface) <= -1) { |
| 288 | ErrSdl(); |
| 289 | } |
| 290 | LimitFrameRate(); |
| 291 | #endif |
| 292 | } |
| 293 | |
| 294 | void PaletteGetEntries(DWORD dwNumEntries, SDL_Color *lpEntries) |
| 295 | { |
no test coverage detected