mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-01 06:58:34 +00:00
WINTERMUTE: Remove unnecessary re-iteration
This commit is contained in:
parent
dbbf95ca50
commit
b27ac796d8
@ -295,7 +295,7 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S
|
||||
if (_disableDirtyRects) {
|
||||
drawFromSurface(compareTicket);
|
||||
} else {
|
||||
drawFromTicket(compareTicket);
|
||||
drawFromQueuedTicket(it);
|
||||
_previousTicket = compareTicket;
|
||||
}
|
||||
return;
|
||||
@ -374,7 +374,8 @@ void BaseRenderOSystem::invalidateTicketsFromSurface(BaseSurfaceOSystem *surf) {
|
||||
void BaseRenderOSystem::drawFromTicket(RenderTicket *renderTicket) {
|
||||
renderTicket->_wantsDraw = true;
|
||||
// A new item always has _drawNum == 0
|
||||
if (renderTicket->_drawNum == 0) {
|
||||
assert(renderTicket->_drawNum == 0);
|
||||
{
|
||||
++_lastFrameIter;
|
||||
// In-order
|
||||
if (_renderQueue.empty() || _drawNum > (_renderQueue.back())->_drawNum) {
|
||||
@ -410,7 +411,14 @@ void BaseRenderOSystem::drawFromTicket(RenderTicket *renderTicket) {
|
||||
addDirtyRect(renderTicket->_dstRect);
|
||||
_lastAddedTicket = pos;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
void BaseRenderOSystem::drawFromQueuedTicket(const RenderQueueIterator &ticket) {
|
||||
RenderTicket *renderTicket = *ticket;
|
||||
renderTicket->_wantsDraw = true;
|
||||
assert(renderTicket->_drawNum != 0);
|
||||
{
|
||||
++_lastFrameIter;
|
||||
// Was drawn last round, still in the same order
|
||||
if (_drawNum == renderTicket->_drawNum) {
|
||||
@ -423,15 +431,7 @@ void BaseRenderOSystem::drawFromTicket(RenderTicket *renderTicket) {
|
||||
--_lastFrameIter;
|
||||
assert(_drawNum < renderTicket->_drawNum);
|
||||
// Remove the ticket from the list
|
||||
RenderQueueIterator it = _renderQueue.begin();
|
||||
while (it != _renderQueue.end()) {
|
||||
if ((*it) == renderTicket) {
|
||||
it = _renderQueue.erase(it);
|
||||
break;
|
||||
} else {
|
||||
++it;
|
||||
}
|
||||
}
|
||||
RenderQueueIterator it = _renderQueue.erase(ticket);
|
||||
if (it != _renderQueue.end()) {
|
||||
// Decreement the following tickets.
|
||||
for (; it != _renderQueue.end(); ++it) {
|
||||
|
@ -62,6 +62,8 @@ public:
|
||||
BaseRenderOSystem(BaseGame *inGame);
|
||||
~BaseRenderOSystem();
|
||||
|
||||
typedef Common::List<RenderTicket *>::iterator RenderQueueIterator;
|
||||
|
||||
Common::String getName() const;
|
||||
|
||||
bool initRenderer(int width, int height, bool windowed) override;
|
||||
@ -79,11 +81,16 @@ public:
|
||||
void invalidateTicket(RenderTicket *renderTicket);
|
||||
void invalidateTicketsFromSurface(BaseSurfaceOSystem *surf);
|
||||
/**
|
||||
* Insert a ticket into the queue, adding a dirty rect if it's
|
||||
* new, or out-of-order from last draw from the ticket.
|
||||
* Insert a new ticket into the queue, adding a dirty rect
|
||||
* param renderTicket the ticket to be added.
|
||||
*/
|
||||
void drawFromTicket(RenderTicket *renderTicket);
|
||||
/**
|
||||
* Re-insert an existing ticket into the queue, adding a dirty rect
|
||||
* out-of-order from last draw from the ticket.
|
||||
* param ticket iterator pointing to the ticket to be added.
|
||||
*/
|
||||
void drawFromQueuedTicket(const RenderQueueIterator &ticket);
|
||||
|
||||
bool setViewport(int left, int top, int right, int bottom) override;
|
||||
bool setViewport(Rect32 *rect) override { return BaseRenderer::setViewport(rect); }
|
||||
@ -120,7 +127,6 @@ private:
|
||||
void drawFromSurface(RenderTicket *ticket);
|
||||
// Dirty-rects:
|
||||
void drawFromSurface(RenderTicket *ticket, Common::Rect *dstRect, Common::Rect *clipRect);
|
||||
typedef Common::List<RenderTicket *>::iterator RenderQueueIterator;
|
||||
Common::Rect *_dirtyRect;
|
||||
Common::List<RenderTicket *> _renderQueue;
|
||||
RenderQueueIterator _lastAddedTicket;
|
||||
|
Loading…
Reference in New Issue
Block a user