[Scummvm-git-logs] scummvm master -> 6148a6df49c8490d18d9ff341a98e618b22f1359
sev-
sev at scummvm.org
Sat Mar 28 12:52:50 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
6148a6df49 DIRECTOR: Optimize rendering for Dissolve transition
Commit: 6148a6df49c8490d18d9ff341a98e618b22f1359
https://github.com/scummvm/scummvm/commit/6148a6df49c8490d18d9ff341a98e618b22f1359
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-03-28T13:52:32+01:00
Commit Message:
DIRECTOR: Optimize rendering for Dissolve transition
Changed paths:
engines/director/score.cpp
engines/director/score.h
engines/director/transitions.cpp
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 6eea6a2c2f..d4c8304ca2 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -71,6 +71,7 @@ Score::Score(DirectorEngine *vm) {
_surface = nullptr;
_trailSurface = nullptr;
_backSurface = nullptr;
+ _backSurface2 = nullptr;
_lingo = _vm->getLingo();
_soundManager = _vm->getSoundManager();
_currentMouseDownSpriteId = 0;
@@ -421,7 +422,11 @@ Score::~Score() {
if (_backSurface && _backSurface->w)
_backSurface->free();
+ if (_backSurface2 && _backSurface2->w)
+ _backSurface2->free();
+
delete _backSurface;
+ delete _backSurface2;
delete _surface;
delete _trailSurface;
@@ -1440,10 +1445,12 @@ void Score::startLoop() {
_surface = new Graphics::ManagedSurface;
_trailSurface = new Graphics::ManagedSurface;
_backSurface = new Graphics::ManagedSurface;
+ _backSurface2 = new Graphics::ManagedSurface;
_surface->create(_movieRect.width(), _movieRect.height());
_trailSurface->create(_movieRect.width(), _movieRect.height());
_backSurface->create(_movieRect.width(), _movieRect.height());
+ _backSurface2->create(_movieRect.width(), _movieRect.height());
g_director->_wm->setScreen(_surface);
@@ -1526,6 +1533,9 @@ void Score::update() {
debugC(1, kDebugImages, "****************************** Current frame: %d", _currentFrame);
+ if (_frames[_currentFrame]->_transType != 0) // Store screen, so we could draw a nice transition
+ _backSurface2->copyFrom(*_surface);
+
_surface->clear(_stageColor);
_surface->copyFrom(*_trailSurface);
diff --git a/engines/director/score.h b/engines/director/score.h
index 4ed654722f..68a9e9fbf3 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -135,6 +135,7 @@ public:
Graphics::ManagedSurface *_surface;
Graphics::ManagedSurface *_trailSurface;
Graphics::ManagedSurface *_backSurface;
+ Graphics::ManagedSurface *_backSurface2;
Graphics::Font *_font;
Archive *_movieArchive;
Common::Rect _movieRect;
diff --git a/engines/director/transitions.cpp b/engines/director/transitions.cpp
index bba72dfd7a..f20a94284e 100644
--- a/engines/director/transitions.cpp
+++ b/engines/director/transitions.cpp
@@ -304,6 +304,9 @@ static void dissolveTrans(TransParams &t, Score *score, Common::Rect &clipRect)
if (hBits <= 0 || vBits <= 0)
return;
+ // Get previous frame
+ score->_backSurface->copyFrom(*score->_backSurface2);
+
rnd = seed = randomSeed[hBits + vBits];
int hMask = (1L << hBits) - 1;
int vShift = hBits;
@@ -318,6 +321,8 @@ static void dissolveTrans(TransParams &t, Score *score, Common::Rect &clipRect)
}
t.steps++;
+ Common::Rect r(1, 1);
+
while (t.steps) {
uint32 pixPerStep = pixPerStepInit;
do {
@@ -325,9 +330,8 @@ static void dissolveTrans(TransParams &t, Score *score, Common::Rect &clipRect)
uint32 y = rnd >> vShift;
if (x < w && y < h) {
- uint32 color = *(uint32 *)score->_surface->getBasePtr(x, y);
- *(uint32 *)score->_backSurface->getBasePtr(0, 0) = color;
- g_system->copyRectToScreen(score->_backSurface->getPixels(), score->_backSurface->pitch, x, y, 1, 1);
+ r.moveTo(x, y);
+ score->_backSurface->copyRectToSurface(*score->_surface, x, y, r);
}
rnd = (rnd & 1) ? (rnd >> 1) ^ seed : rnd >> 1;
@@ -339,9 +343,10 @@ static void dissolveTrans(TransParams &t, Score *score, Common::Rect &clipRect)
}
} while (rnd != seed);
- uint32 color = *(uint32 *)score->_surface->getBasePtr(0, 0);
- *(uint32 *)score->_backSurface->getBasePtr(0, 0) = color;
- g_system->copyRectToScreen(score->_backSurface->getPixels(), score->_backSurface->pitch, 0, 0, 1, 1);
+ r.moveTo(0, 0);
+ score->_backSurface->copyRectToSurface(*score->_surface, 0, 0, r);
+
+ g_system->copyRectToScreen(score->_backSurface->getPixels(), score->_backSurface->pitch, 0, 0, score->_backSurface->w, score->_backSurface->h);
g_system->delayMillis(t.stepDuration);
if (processQuitEvent(true))
More information about the Scummvm-git-logs
mailing list