From d4313bf6b50fe57f949ccb6dfd9f2accd885ed94 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 26 Dec 2016 19:13:07 +0100 Subject: FULLPIPE: Decrease header dependency --- engines/fullpipe/detection.cpp | 2 ++ engines/fullpipe/fullpipe.cpp | 8 ++++++-- engines/fullpipe/fullpipe.h | 4 +--- engines/fullpipe/gfx.cpp | 15 ++++++++------- engines/fullpipe/gfx.h | 5 +++++ engines/fullpipe/modal.cpp | 1 + engines/fullpipe/scene.cpp | 3 ++- 7 files changed, 25 insertions(+), 13 deletions(-) (limited to 'engines') diff --git a/engines/fullpipe/detection.cpp b/engines/fullpipe/detection.cpp index 8f4de11e79..e22bcd3d50 100644 --- a/engines/fullpipe/detection.cpp +++ b/engines/fullpipe/detection.cpp @@ -25,6 +25,8 @@ #include "engines/advancedDetector.h" #include "common/file.h" +#include "graphics/surface.h" + #include "fullpipe/fullpipe.h" #include "fullpipe/gameloader.h" diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 10c1744dd9..9c474d111b 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -28,6 +28,7 @@ #include "audio/mixer.h" #include "engines/util.h" +#include "graphics/surface.h" #include "fullpipe/fullpipe.h" #include "fullpipe/gameloader.h" @@ -285,7 +286,8 @@ Common::Error FullpipeEngine::run() { // Initialize backend initGraphics(800, 600, true, &format); - _backgroundSurface.create(800, 600, format); + _backgroundSurface = new Graphics::Surface; + _backgroundSurface->create(800, 600, format); _origFormat = new Graphics::PixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0); @@ -502,7 +504,9 @@ void FullpipeEngine::cleanup() { stopAllSoundStreams(); delete _origFormat; - _backgroundSurface.free(); + _backgroundSurface->free(); + + delete _backgroundSurface; } void FullpipeEngine::updateScreen() { diff --git a/engines/fullpipe/fullpipe.h b/engines/fullpipe/fullpipe.h index b00da629fe..3733bed65d 100644 --- a/engines/fullpipe/fullpipe.h +++ b/engines/fullpipe/fullpipe.h @@ -30,8 +30,6 @@ #include "common/savefile.h" #include "common/system.h" -#include "graphics/transparent_surface.h" - #include "engines/engine.h" #include "gui/debugger.h" @@ -123,7 +121,7 @@ public: void updateEvents(); - Graphics::Surface _backgroundSurface; + Graphics::Surface *_backgroundSurface; Graphics::PixelFormat *_origFormat; GameLoader *_gameLoader; diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index 4dec4b640c..ea07621cd4 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -30,6 +30,7 @@ #include "fullpipe/gameloader.h" #include "common/memstream.h" +#include "graphics/transparent_surface.h" namespace Fullpipe { @@ -677,8 +678,8 @@ void Picture::displayPicture() { if (!_dataSize) return; - g_fp->_backgroundSurface.fillRect(Common::Rect(0, 0, 800, 600), 0); - g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface.getBasePtr(0, 0), g_fp->_backgroundSurface.pitch, 0, 0, 800, 600); + g_fp->_backgroundSurface->fillRect(Common::Rect(0, 0, 800, 600), 0); + g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface->getBasePtr(0, 0), g_fp->_backgroundSurface->pitch, 0, 0, 800, 600); draw(0, 0, 0, 0); @@ -858,8 +859,8 @@ void Bitmap::putDib(int x, int y, int32 *palette, byte alpha) { int alphac = TS_ARGB(0xff, alpha, 0xff, 0xff); - _surface->blit(g_fp->_backgroundSurface, x1, y1, _flipping, &sub, alphac); - g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface.getBasePtr(x1, y1), g_fp->_backgroundSurface.pitch, x1, y1, sub.width(), sub.height()); + _surface->blit(*g_fp->_backgroundSurface, x1, y1, _flipping, &sub, alphac); + g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface->getBasePtr(x1, y1), g_fp->_backgroundSurface->pitch, x1, y1, sub.width(), sub.height()); } bool Bitmap::putDibRB(int32 *palette) { @@ -1255,7 +1256,7 @@ DynamicPhase *Shadows::findSize(int width, int height) { void FullpipeEngine::drawAlphaRectangle(int x1, int y1, int x2, int y2, int alpha) { for (int y = y1; y < y2; y++) { - uint32 *ptr = (uint32 *)g_fp->_backgroundSurface.getBasePtr(x1, y); + uint32 *ptr = (uint32 *)g_fp->_backgroundSurface->getBasePtr(x1, y); for (int x = x1; x < x2; x++) { uint32 color = *ptr; @@ -1274,8 +1275,8 @@ void FullpipeEngine::sceneFade(Scene *sc, bool direction) { int ticks = g_fp->_system->getMillis(); sc->draw(); - drawAlphaRectangle(0, 0, g_fp->_backgroundSurface.w, g_fp->_backgroundSurface.h, direction ? dim : 255 - dim); - g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface.getBasePtr(0, 0), g_fp->_backgroundSurface.pitch, 0, 0, 800, 600); + drawAlphaRectangle(0, 0, g_fp->_backgroundSurface->w, g_fp->_backgroundSurface->h, direction ? dim : 255 - dim); + g_fp->_system->copyRectToScreen(g_fp->_backgroundSurface->getBasePtr(0, 0), g_fp->_backgroundSurface->pitch, 0, 0, 800, 600); g_fp->_system->updateScreen(); ticks = g_fp->_system->getMillis() - ticks; diff --git a/engines/fullpipe/gfx.h b/engines/fullpipe/gfx.h index 566586fb48..1b4b4d3cef 100644 --- a/engines/fullpipe/gfx.h +++ b/engines/fullpipe/gfx.h @@ -23,6 +23,11 @@ #ifndef FULLPIPE_GFX_H #define FULLPIPE_GFX_H +namespace Graphics { + struct Surface; + struct TransparentSurface; +} + namespace Fullpipe { class DynamicPhase; diff --git a/engines/fullpipe/modal.cpp b/engines/fullpipe/modal.cpp index 147012b864..3faa035c60 100644 --- a/engines/fullpipe/modal.cpp +++ b/engines/fullpipe/modal.cpp @@ -33,6 +33,7 @@ #include "fullpipe/objectnames.h" #include "graphics/palette.h" +#include "graphics/surface.h" #include "video/avi_decoder.h" #include "engines/savestate.h" diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index b5258183b0..efd07b9455 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -31,6 +31,7 @@ #include "fullpipe/constants.h" #include "common/algorithm.h" +#include "graphics/surface.h" namespace Fullpipe { @@ -534,7 +535,7 @@ void Scene::draw() { updateScrolling(); // Clean previous stuff - g_fp->_backgroundSurface.fillRect(Common::Rect(0, 0, 800, 600), 0); + g_fp->_backgroundSurface->fillRect(Common::Rect(0, 0, 800, 600), 0); drawContent(60000, 0, true); -- cgit v1.2.3