diff options
author | Marisa-Chan | 2014-08-27 14:57:35 +0700 |
---|---|---|
committer | Marisa-Chan | 2014-08-27 14:57:35 +0700 |
commit | 21d6fddab43ff4adbd8c8b3d10b110576c197108 (patch) | |
tree | c90ecc7de8ce1afb4480f65156675d4417d889e3 | |
parent | 2cfef440d7a9d3f50ebddd3e662175c0e0bd4e94 (diff) | |
download | scummvm-rg350-21d6fddab43ff4adbd8c8b3d10b110576c197108.tar.gz scummvm-rg350-21d6fddab43ff4adbd8c8b3d10b110576c197108.tar.bz2 scummvm-rg350-21d6fddab43ff4adbd8c8b3d10b110576c197108.zip |
ZVISION: Added scaled blitter to bkg
-rw-r--r-- | engines/zvision/graphics/render_manager.cpp | 26 | ||||
-rw-r--r-- | engines/zvision/graphics/render_manager.h | 2 |
2 files changed, 28 insertions, 0 deletions
diff --git a/engines/zvision/graphics/render_manager.cpp b/engines/zvision/graphics/render_manager.cpp index c89444df13..5aa0d752d0 100644 --- a/engines/zvision/graphics/render_manager.cpp +++ b/engines/zvision/graphics/render_manager.cpp @@ -565,6 +565,32 @@ void RenderManager::blitSurfaceToBkg(const Graphics::Surface &src, int x, int y, _bkgDirtyRect.extend(dirty); } +void RenderManager::blitSurfaceToBkgScaled(const Graphics::Surface &src, const Common::Rect &_dstRect) { + if (src.w == _dstRect.width() && src.h == _dstRect.height()) + blitSurfaceToBkg(src, _dstRect.left, _dstRect.top); + else { + Graphics::Surface *tmp = new Graphics::Surface; + tmp->create(_dstRect.width(), _dstRect.height(), src.format); + scaleBuffer(src.getPixels(), tmp->getPixels(), src.w, src.h, src.format.bytesPerPixel, _dstRect.width(), _dstRect.height()); + blitSurfaceToBkg(*tmp, _dstRect.left, _dstRect.top); + tmp->free(); + delete tmp; + } +} + +void RenderManager::blitSurfaceToBkgScaled(const Graphics::Surface &src, const Common::Rect &_dstRect, uint32 colorkey) { + if (src.w == _dstRect.width() && src.h == _dstRect.height()) + blitSurfaceToBkg(src, _dstRect.left, _dstRect.top, colorkey); + else { + Graphics::Surface *tmp = new Graphics::Surface; + tmp->create(_dstRect.width(), _dstRect.height(), src.format); + scaleBuffer(src.getPixels(), tmp->getPixels(), src.w, src.h, src.format.bytesPerPixel, _dstRect.width(), _dstRect.height()); + blitSurfaceToBkg(*tmp, _dstRect.left, _dstRect.top, colorkey); + tmp->free(); + delete tmp; + } +} + void RenderManager::blitSurfaceToMenu(const Graphics::Surface &src, int x, int y) { Common::Rect empt; blitSurfaceToSurface(src, empt, _menuWnd, x, y); diff --git a/engines/zvision/graphics/render_manager.h b/engines/zvision/graphics/render_manager.h index b4c6c76a6e..24234e28e1 100644 --- a/engines/zvision/graphics/render_manager.h +++ b/engines/zvision/graphics/render_manager.h @@ -229,6 +229,8 @@ public: void blitSurfaceToSurface(const Graphics::Surface &src, Graphics::Surface &dst, int x, int y, uint32 colorkey); void blitSurfaceToBkg(const Graphics::Surface &src, int x, int y); void blitSurfaceToBkg(const Graphics::Surface &src, int x, int y, uint32 colorkey); + void blitSurfaceToBkgScaled(const Graphics::Surface &src, const Common::Rect &_dstRect); + void blitSurfaceToBkgScaled(const Graphics::Surface &src, const Common::Rect &_dstRect, uint32 colorkey); void blitSurfaceToMenu(const Graphics::Surface &src, int x, int y); void blitSurfaceToMenu(const Graphics::Surface &src, int x, int y, uint32 colorkey); |