aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/base/gfx
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-12-13 23:43:18 +0100
committerEinar Johan Trøan Sømåen2012-12-16 23:13:58 +0100
commit6d79a66766ede297ace36e060a0ab2b06aa42025 (patch)
treeafbcbe61111296c3efb67edee138eee997e8cb78 /engines/wintermute/base/gfx
parentc14f45ee0544254ffeca5cde4d92cd99efdff4b6 (diff)
downloadscummvm-rg350-6d79a66766ede297ace36e060a0ab2b06aa42025.tar.gz
scummvm-rg350-6d79a66766ede297ace36e060a0ab2b06aa42025.tar.bz2
scummvm-rg350-6d79a66766ede297ace36e060a0ab2b06aa42025.zip
WINTERMUTE: Move draw-code to render_ticket.cpp
Diffstat (limited to 'engines/wintermute/base/gfx')
-rw-r--r--engines/wintermute/base/gfx/osystem/base_render_osystem.cpp28
-rw-r--r--engines/wintermute/base/gfx/osystem/base_render_osystem.h4
-rw-r--r--engines/wintermute/base/gfx/osystem/render_ticket.cpp16
-rw-r--r--engines/wintermute/base/gfx/osystem/render_ticket.h15
4 files changed, 34 insertions, 29 deletions
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
index 5097d2078f..32bb608d1c 100644
--- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
+++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp
@@ -277,7 +277,7 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S
if (*(compareTicket) == compare && compareTicket->_isValid) {
compareTicket->_colorMod = _colorMod;
if (_disableDirtyRects) {
- drawFromSurface(compareTicket, NULL);
+ drawFromSurface(compareTicket);
} else {
drawFromTicket(compareTicket);
}
@@ -292,7 +292,7 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S
} else {
ticket->_wantsDraw = true;
_renderQueue.push_back(ticket);
- drawFromSurface(ticket, NULL);
+ drawFromSurface(ticket);
}
}
@@ -426,7 +426,7 @@ void BaseRenderOSystem::drawTickets() {
dstClip.translate(-offsetX, -offsetY);
_colorMod = ticket->_colorMod;
- drawFromSurface(ticket, &ticket->_srcRect, &pos, &dstClip);
+ drawFromSurface(ticket, &pos, &dstClip);
_needsFlip = true;
}
// Some tickets want redraw but don't actually clip the dirty area (typically the ones that shouldnt become clear-color)
@@ -456,24 +456,12 @@ void BaseRenderOSystem::drawTickets() {
}
// Replacement for SDL2's SDL_RenderCopy
-void BaseRenderOSystem::drawFromSurface(RenderTicket *ticket, Common::Rect *clipRect) {
- TransparentSurface src(*ticket->getSurface(), false);
- bool doDelete = false;
- if (!clipRect) {
- doDelete = true;
- clipRect = new Common::Rect();
- clipRect->setWidth(ticket->getSurface()->w);
- clipRect->setHeight(ticket->getSurface()->h);
- }
-
- src._enableAlphaBlit = ticket->_hasAlpha;
- src.blit(*_renderSurface, ticket->_dstRect.left, ticket->_dstRect.top, ticket->_mirror, clipRect, _colorMod, clipRect->width(), clipRect->height());
- if (doDelete) {
- delete clipRect;
- }
+void BaseRenderOSystem::drawFromSurface(RenderTicket *ticket) {
+ ticket->drawToSurface(_renderSurface);
}
-void BaseRenderOSystem::drawFromSurface(RenderTicket *ticket, Common::Rect *srcRect, Common::Rect *dstRect, Common::Rect *clipRect) {
- ticket->drawToSurface(_renderSurface, srcRect, dstRect, clipRect);
+
+void BaseRenderOSystem::drawFromSurface(RenderTicket *ticket, Common::Rect *dstRect, Common::Rect *clipRect) {
+ ticket->drawToSurface(_renderSurface, dstRect, clipRect);
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.h b/engines/wintermute/base/gfx/osystem/base_render_osystem.h
index e7f14470f4..039679a663 100644
--- a/engines/wintermute/base/gfx/osystem/base_render_osystem.h
+++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.h
@@ -86,9 +86,9 @@ private:
void addDirtyRect(const Common::Rect &rect);
void drawTickets();
// Non-dirty-rects:
- void drawFromSurface(RenderTicket *ticket, Common::Rect *clipRect);
+ void drawFromSurface(RenderTicket *ticket);
// Dirty-rects:
- void drawFromSurface(RenderTicket *ticket, Common::Rect *srcRect, Common::Rect *dstRect, Common::Rect *clipRect);
+ void drawFromSurface(RenderTicket *ticket, Common::Rect *dstRect, Common::Rect *clipRect);
typedef Common::List<RenderTicket *>::iterator RenderQueueIterator;
Common::Rect *_dirtyRect;
Common::List<RenderTicket *> _renderQueue;
diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.cpp b/engines/wintermute/base/gfx/osystem/render_ticket.cpp
index 8b513f8543..174f54e315 100644
--- a/engines/wintermute/base/gfx/osystem/render_ticket.cpp
+++ b/engines/wintermute/base/gfx/osystem/render_ticket.cpp
@@ -83,7 +83,19 @@ bool RenderTicket::operator==(RenderTicket &t) {
return true;
}
-void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface, Common::Rect *srcRect, Common::Rect *dstRect, Common::Rect *clipRect) {
+// Replacement for SDL2's SDL_RenderCopy
+void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface) {
+ TransparentSurface src(*getSurface(), false);
+
+ Common::Rect clipRect;
+ clipRect.setWidth(getSurface()->w);
+ clipRect.setHeight(getSurface()->h);
+
+ src._enableAlphaBlit = _hasAlpha;
+ src.blit(*_targetSurface, _dstRect.left, _dstRect.top, _mirror, &clipRect, _colorMod, clipRect.width(), clipRect.height());
+}
+
+void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface, Common::Rect *dstRect, Common::Rect *clipRect) {
TransparentSurface src(*getSurface(), false);
bool doDelete = false;
if (!clipRect) {
@@ -92,7 +104,7 @@ void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface, Common::Rect
clipRect->setWidth(getSurface()->w);
clipRect->setHeight(getSurface()->h);
}
-
+
src._enableAlphaBlit = _hasAlpha;
src.blit(*_targetSurface, dstRect->left, dstRect->top, _mirror, clipRect, _colorMod, clipRect->width(), clipRect->height());
if (doDelete) {
diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.h b/engines/wintermute/base/gfx/osystem/render_ticket.h
index 242822c868..19637a23d0 100644
--- a/engines/wintermute/base/gfx/osystem/render_ticket.h
+++ b/engines/wintermute/base/gfx/osystem/render_ticket.h
@@ -36,18 +36,18 @@ namespace Wintermute {
class BaseSurfaceOSystem;
class RenderTicket {
- Graphics::Surface *_surface;
public:
RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRest, bool mirrorX = false, bool mirrorY = false, bool disableAlpha = false);
RenderTicket() : _isValid(true), _wantsDraw(false), _drawNum(0) {}
~RenderTicket();
const Graphics::Surface *getSurface() { return _surface; }
- void drawToSurface(Graphics::Surface *_targetSurface, Common::Rect *srcRect, Common::Rect *dstRect, Common::Rect *clipRect);
- Common::Rect _srcRect;
+ // Non-dirty-rects:
+ void drawToSurface(Graphics::Surface *_targetSurface);
+ // Dirty-rects:
+ void drawToSurface(Graphics::Surface *_targetSurface, Common::Rect *dstRect, Common::Rect *clipRect);
+
Common::Rect _dstRect;
- uint32 _mirror;
uint32 _batchNum;
- bool _hasAlpha;
bool _isValid;
bool _wantsDraw;
@@ -56,6 +56,11 @@ public:
BaseSurfaceOSystem *_owner;
bool operator==(RenderTicket &a);
+private:
+ Graphics::Surface *_surface;
+ Common::Rect _srcRect;
+ bool _hasAlpha;
+ uint32 _mirror;
};
} // end of namespace Wintermute