MCPcopy Create free account
hub / github.com/diasurgical/devilution / RenderPresent

Function RenderPresent

SourceX/dx.cpp:251–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249}
250
251void 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
294void PaletteGetEntries(DWORD dwNumEntries, SDL_Color *lpEntries)
295{

Callers 9

SVidPlayContinueFunction · 0.85
UiProgressDialogFunction · 0.85
LoadBackgroundArtFunction · 0.85
UiFadeInFunction · 0.85
RedPaletteFunction · 0.85
DrawAndBlitFunction · 0.85
PaletteFadeInFunction · 0.85
PaletteFadeOutFunction · 0.85

Calls 2

GetOutputSurfaceFunction · 0.85
LimitFrameRateFunction · 0.85

Tested by

no test coverage detected