From 21d6fddab43ff4adbd8c8b3d10b110576c197108 Mon Sep 17 00:00:00 2001 From: Marisa-Chan Date: Wed, 27 Aug 2014 14:57:35 +0700 Subject: ZVISION: Added scaled blitter to bkg --- engines/zvision/graphics/render_manager.cpp | 26 ++++++++++++++++++++++++++ engines/zvision/graphics/render_manager.h | 2 ++ 2 files changed, 28 insertions(+) (limited to 'engines') 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); -- cgit v1.2.3