Error checking for GetOutputSurface
This commit is contained in:
parent
d4d89077cd
commit
b87058a717
2 changed files with 8 additions and 7 deletions
|
|
@ -109,9 +109,6 @@ void CreatePrimarySurface()
|
|||
RendererTextureSurface = SDLWrap::CreateRGBSurfaceWithFormat(0, width, height, SDL_BITSPERPIXEL(format), format);
|
||||
}
|
||||
#endif
|
||||
if (GetOutputSurface() == nullptr) {
|
||||
ErrSdl();
|
||||
}
|
||||
}
|
||||
|
||||
void LockBufPriv()
|
||||
|
|
@ -203,8 +200,6 @@ void dx_cleanup()
|
|||
sgdwLockCount = 0;
|
||||
MemCrit.unlock();
|
||||
|
||||
if (PalSurface == nullptr)
|
||||
return;
|
||||
PalSurface = nullptr;
|
||||
PinnedPalSurface = nullptr;
|
||||
Palette = nullptr;
|
||||
|
|
|
|||
|
|
@ -257,11 +257,17 @@ bool SpawnWindow(const char *lpWindowName)
|
|||
SDL_Surface *GetOutputSurface()
|
||||
{
|
||||
#ifdef USE_SDL1
|
||||
return SDL_GetVideoSurface();
|
||||
SDL_Surface *ret = SDL_GetVideoSurface();
|
||||
if (ret == nullptr)
|
||||
ErrSdl();
|
||||
return ret;
|
||||
#else
|
||||
if (renderer != nullptr)
|
||||
return RendererTextureSurface.get();
|
||||
return SDL_GetWindowSurface(ghMainWnd);
|
||||
SDL_Surface *ret = SDL_GetWindowSurface(ghMainWnd);
|
||||
if (ret == nullptr)
|
||||
ErrSdl();
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue