diff options
author | Thomas Fach-Pedersen | 2017-08-04 21:40:09 +0200 |
---|---|---|
committer | Thomas Fach-Pedersen | 2017-08-04 21:43:47 +0200 |
commit | bf45db6c589a75c8b2e19bd734d4e2dd306158c9 (patch) | |
tree | cc8bf1040a86f8f57f6a226bc588745b822633a1 /engines | |
parent | 3874f454e0bdc9e76e47c7d7339a43fe61b0bdf3 (diff) | |
download | scummvm-rg350-bf45db6c589a75c8b2e19bd734d4e2dd306158c9.tar.gz scummvm-rg350-bf45db6c589a75c8b2e19bd734d4e2dd306158c9.tar.bz2 scummvm-rg350-bf45db6c589a75c8b2e19bd734d4e2dd306158c9.zip |
BLADERUNNER: Add blit and blitToScreen helpers
Diffstat (limited to 'engines')
-rw-r--r-- | engines/bladerunner/bladerunner.cpp | 19 | ||||
-rw-r--r-- | engines/bladerunner/bladerunner.h | 4 | ||||
-rw-r--r-- | engines/bladerunner/outtake.cpp | 3 | ||||
-rw-r--r-- | engines/bladerunner/scene.cpp | 2 | ||||
-rw-r--r-- | engines/bladerunner/spinner.cpp | 5 |
5 files changed, 21 insertions, 12 deletions
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp index 348d5f7c1f..76c0c3f7ea 100644 --- a/engines/bladerunner/bladerunner.cpp +++ b/engines/bladerunner/bladerunner.cpp @@ -526,8 +526,7 @@ bool BladeRunnerEngine::loadSplash() { img.copyToSurface(&_surfaceGame); - _system->copyRectToScreen(_surfaceGame.getPixels(), _surfaceGame.pitch, 0, 0, _surfaceGame.w, _surfaceGame.h); - _system->updateScreen(); + blitToScreen(_surfaceGame); return true; } @@ -616,9 +615,9 @@ void BladeRunnerEngine::gameTick() { backgroundChanged = true; } (void)backgroundChanged; - _surfaceGame.copyRectToSurface(_surfaceInterface.getPixels(), _surfaceInterface.pitch, 0, 0, 640, 480); + blit(_surfaceInterface, _surfaceGame); // TODO: remove zbuffer draw - //_surface2.copyRectToSurface(_zbuffer->getData(), 1280, 0, 0, 640, 480); + // _surfaceGame.copyRectToSurface(_zbuffer->getData(), 1280, 0, 0, 640, 480); // TODO: Render overlays @@ -774,8 +773,7 @@ void BladeRunnerEngine::gameTick() { } #endif - _system->copyRectToScreen(_surfaceGame.getPixels(), _surfaceGame.pitch, 0, 0, 640, 480); - _system->updateScreen(); + blitToScreen(_surfaceGame); _system->delayMillis(10); } } @@ -1019,4 +1017,13 @@ void BladeRunnerEngine::ISez(const char *str) { debug("\t%s", str); } +void BladeRunnerEngine::blitToScreen(const Graphics::Surface &src) { + _system->copyRectToScreen(src.getPixels(), src.pitch, 0, 0, src.w, src.h); + _system->updateScreen(); +} + +void blit(const Graphics::Surface &src, Graphics::Surface &dst) { + dst.copyRectToSurface(src.getPixels(), src.pitch, 0, 0, src.w, src.h); +} + } // End of namespace BladeRunner diff --git a/engines/bladerunner/bladerunner.h b/engines/bladerunner/bladerunner.h index 8fd43df211..fd654ac5fb 100644 --- a/engines/bladerunner/bladerunner.h +++ b/engines/bladerunner/bladerunner.h @@ -194,12 +194,16 @@ public: void playerGainsControl(); void ISez(const char *str); + + void blitToScreen(const Graphics::Surface &src); }; static inline const Graphics::PixelFormat createRGB555() { return Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); } +void blit(const Graphics::Surface &src, Graphics::Surface &dst); + } // End of namespace BladeRunner #endif diff --git a/engines/bladerunner/outtake.cpp b/engines/bladerunner/outtake.cpp index 80e4d78a1a..d60079032a 100644 --- a/engines/bladerunner/outtake.cpp +++ b/engines/bladerunner/outtake.cpp @@ -59,8 +59,7 @@ void OuttakePlayer::play(const Common::String &name, bool noLocalization, int co break; if (frame >= 0) { - _vm->_system->copyRectToScreen(_vm->_surfaceGame.getPixels(), _vm->_surfaceGame.pitch, 0, 0, 640, 480); - _vm->_system->updateScreen(); + _vm->blitToScreen(_vm->_surfaceGame); } _vm->_system->delayMillis(10); diff --git a/engines/bladerunner/scene.cpp b/engines/bladerunner/scene.cpp index 1e5297a4bf..f73d0d9882 100644 --- a/engines/bladerunner/scene.cpp +++ b/engines/bladerunner/scene.cpp @@ -172,7 +172,7 @@ bool Scene::close(bool isLoadingGame) { int Scene::advanceFrame() { int frame = _vqaPlayer->update(); if (frame >= 0) { - _vm->_surfaceGame.copyRectToSurface(_vm->_surfaceInterface.getPixels(), _vm->_surfaceInterface.pitch, 0, 0, 640, 480); + blit(_vm->_surfaceInterface, _vm->_surfaceGame); _vqaPlayer->updateZBuffer(_vm->_zbuffer); _vqaPlayer->updateView(_vm->_view); _vqaPlayer->updateLights(_vm->_lights); diff --git a/engines/bladerunner/spinner.cpp b/engines/bladerunner/spinner.cpp index 6c30a62bac..bc447e17e2 100644 --- a/engines/bladerunner/spinner.cpp +++ b/engines/bladerunner/spinner.cpp @@ -247,7 +247,7 @@ void Spinner::tick() { assert(frame >= -1); // vqaPlayer renders to _surfaceInterface - _vm->_surfaceGame.copyRectToSurface(_vm->_surfaceInterface, 0, 0, Common::Rect(640, 480)); + blit(_vm->_surfaceInterface, _vm->_surfaceGame); _imagePicker->draw(_vm->_surfaceInterface); @@ -260,8 +260,7 @@ void Spinner::tick() { } _vm->_mouse->draw(_vm->_surfaceGame, p.x, p.y); - _vm->_system->copyRectToScreen(_vm->_surfaceGame.getPixels(), _vm->_surfaceGame.pitch, 0, 0, 640, 480); - _vm->_system->updateScreen(); + _vm->blitToScreen(_vm->_surfaceGame); _vm->_system->delayMillis(10); } |