diff options
author | Einar Johan Trøan Sømåen | 2012-12-13 23:14:58 +0100 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2012-12-13 23:24:37 +0100 |
commit | d6ec8c194778bf2e06c2d84013435a4144fde6e8 (patch) | |
tree | 3f1bec5eb7960cba536bda0a44963520bfaa9a63 /engines/wintermute/base/gfx/osystem/base_render_osystem.cpp | |
parent | 61f387190c10274ccb649321c8244e1ca3d74b42 (diff) | |
download | scummvm-rg350-d6ec8c194778bf2e06c2d84013435a4144fde6e8.tar.gz scummvm-rg350-d6ec8c194778bf2e06c2d84013435a4144fde6e8.tar.bz2 scummvm-rg350-d6ec8c194778bf2e06c2d84013435a4144fde6e8.zip |
WINTERMUTE: Split renderTicket into a separate file.
Diffstat (limited to 'engines/wintermute/base/gfx/osystem/base_render_osystem.cpp')
-rw-r--r-- | engines/wintermute/base/gfx/osystem/base_render_osystem.cpp | 68 |
1 files changed, 2 insertions, 66 deletions
diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index 3a69e53d16..5097d2078f 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -28,6 +28,7 @@ #include "engines/wintermute/base/gfx/osystem/base_render_osystem.h" #include "engines/wintermute/base/gfx/osystem/base_surface_osystem.h" +#include "engines/wintermute/base/gfx/osystem/render_ticket.h" #include "engines/wintermute/base/base_surface_storage.h" #include "engines/wintermute/base/gfx/base_image.h" #include "engines/wintermute/math/math_util.h" @@ -40,58 +41,6 @@ namespace Wintermute { -RenderTicket::RenderTicket(BaseSurfaceOSystem *owner, const Graphics::Surface *surf, Common::Rect *srcRect, Common::Rect *dstRect, bool mirrorX, bool mirrorY, bool disableAlpha) : _owner(owner), - _srcRect(*srcRect), _dstRect(*dstRect), _drawNum(0), _isValid(true), _wantsDraw(true), _hasAlpha(!disableAlpha) { - _colorMod = 0; - _batchNum = 0; - _mirror = TransparentSurface::FLIP_NONE; - if (mirrorX) { - _mirror |= TransparentSurface::FLIP_V; - } - if (mirrorY) { - _mirror |= TransparentSurface::FLIP_H; - } - if (surf) { - _surface = new Graphics::Surface(); - _surface->create((uint16)srcRect->width(), (uint16)srcRect->height(), surf->format); - assert(_surface->format.bytesPerPixel == 4); - // Get a clipped copy of the surface - for (int i = 0; i < _surface->h; i++) { - memcpy(_surface->getBasePtr(0, i), surf->getBasePtr(srcRect->left, srcRect->top + i), srcRect->width() * _surface->format.bytesPerPixel); - } - // Then scale it if necessary - if (dstRect->width() != srcRect->width() || dstRect->height() != srcRect->height()) { - TransparentSurface src(*_surface, false); - Graphics::Surface *temp = src.scale(dstRect->width(), dstRect->height()); - _surface->free(); - delete _surface; - _surface = temp; - } - } else { - _surface = NULL; - } -} - -RenderTicket::~RenderTicket() { - if (_surface) { - _surface->free(); - delete _surface; - } -} - -bool RenderTicket::operator==(RenderTicket &t) { - if ((t._owner != _owner) || - (t._batchNum != t._batchNum) || - (t._hasAlpha != _hasAlpha) || - (t._mirror != _mirror) || - (t._colorMod != _colorMod) || - (t._dstRect != _dstRect) || - (t._srcRect != _srcRect)) { - return false; - } - return true; -} - BaseRenderer *makeOSystemRenderer(BaseGame *inGame) { return new BaseRenderOSystem(inGame); } @@ -524,20 +473,7 @@ void BaseRenderOSystem::drawFromSurface(RenderTicket *ticket, Common::Rect *clip } } void BaseRenderOSystem::drawFromSurface(RenderTicket *ticket, Common::Rect *srcRect, Common::Rect *dstRect, 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, dstRect->left, dstRect->top, ticket->_mirror, clipRect, _colorMod, clipRect->width(), clipRect->height()); - if (doDelete) { - delete clipRect; - } + ticket->drawToSurface(_renderSurface, srcRect, dstRect, clipRect); } ////////////////////////////////////////////////////////////////////////// |