aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2016-09-04 16:15:47 +0200
committerEugene Sandulenko2016-09-04 16:15:47 +0200
commit00a13baf84d25697f0086658726bbb63cfc27d5e (patch)
tree1f80be0df2ee9dd3cc9c07100991269dfc5aaabb
parent149267613a0f9e4b04f63ee71865e5948871cf4f (diff)
downloadscummvm-rg350-00a13baf84d25697f0086658726bbb63cfc27d5e.tar.gz
scummvm-rg350-00a13baf84d25697f0086658726bbb63cfc27d5e.tar.bz2
scummvm-rg350-00a13baf84d25697f0086658726bbb63cfc27d5e.zip
FULLPIPE: Optimize sceneFade()
-rw-r--r--engines/fullpipe/gfx.cpp20
1 files changed, 5 insertions, 15 deletions
diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp
index 32d23048cd..6d0edf7852 100644
--- a/engines/fullpipe/gfx.cpp
+++ b/engines/fullpipe/gfx.cpp
@@ -1270,7 +1270,10 @@ void FullpipeEngine::drawAlphaRectangle(int x1, int y1, int x2, int y2, int alph
for (int x = x1; x < x2; x++) {
uint32 color = *ptr;
- color = (color & 0xffffff00) | (alpha & 0xff);
+ color = (((color >> 24) & 0xff) * alpha / 0xff) << 24 |
+ (((color >> 16) & 0xff) * alpha / 0xff) << 16 |
+ (((color >> 8) & 0xff) * alpha / 0xff) << 8 |
+ (color & 0xff);
*ptr = color;
ptr++;
}
@@ -1282,20 +1285,7 @@ void FullpipeEngine::sceneFade(Scene *sc, bool direction) {
int ticks = g_fp->_system->getMillis();
sc->draw();
- for (int y = 0; y < g_fp->_backgroundSurface.h; y++) {
- uint32 *ptr = (uint32 *)g_fp->_backgroundSurface.getBasePtr(0, y);
-
- for (int x = 0; x < g_fp->_backgroundSurface.w; x++) {
- uint32 color = *ptr;
- color = (((color >> 24) & 0xff) * dim / 0xff) << 24 |
- (((color >> 16) & 0xff) * dim / 0xff) << 16 |
- (((color >> 8) & 0xff) * dim / 0xff) << 8 |
- (color & 0xff);
- *ptr = color;
- ptr++;
- }
- }
-
+ 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();