aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNipun Garg2019-06-17 22:33:52 +0530
committerEugene Sandulenko2019-09-03 17:16:46 +0200
commit8bc38a67ee1aa60a8e7c4bc386fb20f31a7b869d (patch)
treece20cc9d1cab83362ee9a492271225d29b25f4b8 /engines
parent5f0413645259cae7dd4b445918f5c61b1ae83f35 (diff)
downloadscummvm-rg350-8bc38a67ee1aa60a8e7c4bc386fb20f31a7b869d.tar.gz
scummvm-rg350-8bc38a67ee1aa60a8e7c4bc386fb20f31a7b869d.tar.bz2
scummvm-rg350-8bc38a67ee1aa60a8e7c4bc386fb20f31a7b869d.zip
HDB: Make _globalSurface Back Buffer
Modify drawMan to use _globalSurface as a copy of the whole screen
Diffstat (limited to 'engines')
-rw-r--r--engines/hdb/draw-manager.cpp15
-rw-r--r--engines/hdb/draw-manager.h7
-rw-r--r--engines/hdb/hdb.cpp2
3 files changed, 14 insertions, 10 deletions
diff --git a/engines/hdb/draw-manager.cpp b/engines/hdb/draw-manager.cpp
index 69d946cd7d..1a49b3050b 100644
--- a/engines/hdb/draw-manager.cpp
+++ b/engines/hdb/draw-manager.cpp
@@ -97,7 +97,7 @@ bool DrawMan::init() {
void DrawMan::fillScreen(uint32 color) {
_globalSurface.fillRect(Common::Rect(kScreenWidth, kScreenHeight), color);
- g_system->copyRectToScreen(_globalSurface.getBasePtr(0, 0), _globalSurface.pitch, 0, 0, _globalSurface.w, _globalSurface.h);
+// g_system->copyRectToScreen(_globalSurface.getBasePtr(0, 0), _globalSurface.pitch, 0, 0, _globalSurface.w, _globalSurface.h);
}
Tile *DrawMan::getTile(int index) {
@@ -270,14 +270,14 @@ Graphics::Surface Picture::load(Common::SeekableReadStream *stream) {
}
void Picture::draw(int x, int y) {
- g_system->copyRectToScreen(_surface.getBasePtr(0, 0), _surface.pitch, x, y, _surface.w, _surface.h);
+ g_hdb->_drawMan->_globalSurface.copyRectToSurface(_surface.getBasePtr(0, 0), _surface.pitch, x, y, _surface.w, _surface.h);
+// g_system->copyRectToScreen(_surface.getBasePtr(0, 0), _surface.pitch, x, y, _surface.w, _surface.h);
}
void Picture::drawMasked(int x, int y) {
- Graphics::ManagedSurface tempSurf;
- tempSurf.create(_surface.w, _surface.h);
- tempSurf.transBlitFrom(_surface, 0xf81f);
- g_system->copyRectToScreen(tempSurf.getBasePtr(0, 0), tempSurf.pitch, x, y, tempSurf.w, tempSurf.h);
+ _surface.transBlitFrom(_surface, 0xf81f);
+ g_hdb->_drawMan->_globalSurface.copyRectToSurface(_surface.getBasePtr(0, 0), _surface.pitch, x, y, _surface.w, _surface.h);
+// g_system->copyRectToScreen(tempSurf.getBasePtr(0, 0), tempSurf.pitch, x, y, tempSurf.w, tempSurf.h);
}
Tile::~Tile() {
@@ -305,7 +305,8 @@ Graphics::Surface Tile::load(Common::SeekableReadStream *stream) {
}
void Tile::draw(int x, int y) {
- g_system->copyRectToScreen(_surface.getBasePtr(0, 0), _surface.pitch, x, y, _surface.w, _surface.h);
+ g_hdb->_drawMan->_globalSurface.copyRectToSurface(_surface.getBasePtr(0, 0), _surface.pitch, x, y, _surface.w, _surface.h);
+// g_system->copyRectToScreen(_surface.getBasePtr(0, 0), _surface.pitch, x, y, _surface.w, _surface.h);
}
}
diff --git a/engines/hdb/draw-manager.h b/engines/hdb/draw-manager.h
index f6909918ed..cb4f8182ba 100644
--- a/engines/hdb/draw-manager.h
+++ b/engines/hdb/draw-manager.h
@@ -55,6 +55,8 @@ public:
DrawMan();
~DrawMan();
+ Graphics::ManagedSurface _globalSurface;
+
bool init();
void fillScreen(uint32 color);
Tile *getTile(int index);
@@ -69,7 +71,6 @@ public:
void drawSky();
private:
- Graphics::ManagedSurface _globalSurface;
int _numTiles;
TileLookup *_tLookupArray;
uint16 _skyTiles[kMaxSkies];
@@ -109,7 +110,7 @@ private:
uint _width, _height;
char _name[64];
- Graphics::Surface _surface;
+ Graphics::ManagedSurface _surface;
};
@@ -126,7 +127,7 @@ public:
private:
char _name[64];
- Graphics::Surface _surface;
+ Graphics::ManagedSurface _surface;
};
} // End of Namespace HDB
diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp
index 1b86838417..c0fd7bee57 100644
--- a/engines/hdb/hdb.cpp
+++ b/engines/hdb/hdb.cpp
@@ -188,6 +188,8 @@ Common::Error HDBGame::run() {
}
}
+ Graphics::ManagedSurface backBuffer = _drawMan->_globalSurface;
+ g_system->copyRectToScreen(backBuffer.getBasePtr(0, 0), backBuffer.pitch, 0, 0, backBuffer.w, backBuffer.h);
g_system->updateScreen();
g_system->delayMillis(10);
}