From 0beb259278dfd18757bf9484a6123edf4b44864e Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Sat, 22 Jul 2017 15:54:05 -0500 Subject: SCI32: Improve performance when flushing events during video playback Calling through EventManager::getSciEvent to flush events is pretty inefficient and created stalls that lead to dropped frames during the chapter 7 chase in Phantasmagoria 1. If necessary, performance could be improved further by extending Common::EventManager to expose SDL_FlushEvents, but this seems to finish in 0-1ms so should be OK for now. Refs Trac#9974, Trac#9975. --- engines/sci/event.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'engines/sci/event.cpp') diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp index 873b6bb48a..b1be46aded 100644 --- a/engines/sci/event.cpp +++ b/engines/sci/event.cpp @@ -408,6 +408,13 @@ SciEvent EventManager::getSciEvent(uint32 mask) { return event; } +void EventManager::flushEvents() { + Common::EventManager *em = g_system->getEventManager(); + Common::Event event; + while (em->pollEvent(event)); + _events.clear(); +} + #ifdef ENABLE_SCI32 void EventManager::setHotRectanglesActive(const bool active) { _hotRectanglesActive = active; -- cgit v1.2.3