|
@@ -127,40 +127,24 @@ void VideoDriver_SDL_Default::Paint()
|
|
|
}
|
|
|
|
|
|
SDL_Rect r = { this->dirty_rect.left, this->dirty_rect.top, this->dirty_rect.right - this->dirty_rect.left, this->dirty_rect.bottom - this->dirty_rect.top };
|
|
|
|
|
|
if (_sdl_surface != _sdl_real_surface) {
|
|
|
SDL_BlitSurface(_sdl_surface, &r, _sdl_real_surface, &r);
|
|
|
}
|
|
|
SDL_UpdateWindowSurfaceRects(this->sdl_window, &r, 1);
|
|
|
|
|
|
this->dirty_rect = {};
|
|
|
}
|
|
|
|
|
|
void VideoDriver_SDL_Default::PaintThread()
|
|
|
{
|
|
|
/* First tell the main thread we're started */
|
|
|
std::unique_lock<std::recursive_mutex> lock(*this->draw_mutex);
|
|
|
this->draw_signal->notify_one();
|
|
|
|
|
|
/* Now wait for the first thing to draw! */
|
|
|
this->draw_signal->wait(*this->draw_mutex);
|
|
|
|
|
|
while (this->draw_continue) {
|
|
|
/* Then just draw and wait till we stop */
|
|
|
this->Paint();
|
|
|
this->draw_signal->wait(lock);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
bool VideoDriver_SDL_Default::AllocateBackingStore(int w, int h, bool force)
|
|
|
{
|
|
|
int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth();
|
|
|
|
|
|
_sdl_real_surface = SDL_GetWindowSurface(this->sdl_window);
|
|
|
if (_sdl_real_surface == nullptr) usererror("SDL2: Couldn't get window surface: %s", SDL_GetError());
|
|
|
|
|
|
if (!force && w == _sdl_real_surface->w && h == _sdl_real_surface->h) return false;
|
|
|
|
|
|
/* Free any previously allocated rgb surface. */
|
|
|
if (_sdl_rgb_surface != nullptr) {
|
|
|
SDL_FreeSurface(_sdl_rgb_surface);
|