[Scummvm-cvs-logs] SF.net SVN: scummvm: [27980] scummvm/trunk/engines/scumm
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Mon Jul 9 00:13:50 CEST 2007
Revision: 27980
http://scummvm.svn.sourceforge.net/scummvm/?rev=27980&view=rev
Author: fingolfin
Date: 2007-07-08 15:13:50 -0700 (Sun, 08 Jul 2007)
Log Message:
-----------
cleanup in ScummEngine::drawStripToScreen; in particular, the code is now more efficient for The Dig, FT and COMI
Modified Paths:
--------------
scummvm/trunk/engines/scumm/gfx.cpp
scummvm/trunk/engines/scumm/scumm.cpp
Modified: scummvm/trunk/engines/scumm/gfx.cpp
===================================================================
--- scummvm/trunk/engines/scumm/gfx.cpp 2007-07-08 21:42:39 UTC (rev 27979)
+++ scummvm/trunk/engines/scumm/gfx.cpp 2007-07-08 22:13:50 UTC (rev 27980)
@@ -544,7 +544,6 @@
assert(top >= 0 && bottom <= vs->h);
assert(x >= 0 && width <= vs->pitch);
assert(_textSurface.pixels);
- assert(_compositeBuf);
// Perform some clipping
if (width > vs->w - x)
@@ -561,17 +560,26 @@
if (width <= 0)
return;
- // Compute screen etc. buffer pointers
const byte *src = vs->getPixels(x, top);
- byte *dst = _compositeBuf + x + y * _screenWidth;
- if (_game.version < 7) {
- // Handle the text mask in older games; newer (V7/V8) games do not use it anymore.
+ if (_game.version >= 7) {
+ // For The Dig, FT and COMI, we just blit everything to the screen at once.
+ _system->copyRectToScreen(src, vs->pitch, x, y, width, height);
+
+ } else {
+ // For older games, things are more complicated. First off, we need to
+ // deal with the _textSurface, which needs to be composited over the
+ // screen contents. Secondly, a rendering mode might be active, which
+ // means a filter has to be applied.
+
+ // Compute pointers to the composite buffer and the text surface
+ assert(_compositeBuf);
+ byte *dst = _compositeBuf + x + y * _screenWidth;
const byte *text = (byte *)_textSurface.getBasePtr(x, y);
-
+
#ifdef __DS__
DS::asmDrawStripToScreen(height, width, text, src, dst, vs->pitch, _screenWidth, _textSurface.pitch);
-#else
+#else
// Compose the text over the game graphics
for (int h = 0; h < height; ++h) {
for (int w = 0; w < width; ++w) {
@@ -585,36 +593,38 @@
text += _textSurface.pitch;
}
#endif
- } else {
- // Just do a simple blit in V7/V8 games.
- blit(dst, _screenWidth, src, vs->pitch, width, height);
- }
- if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) {
- ditherHerc(_compositeBuf + x + y * _screenWidth, _herculesBuf, _screenWidth, &x, &y, &width, &height);
- // center image on the screen
- _system->copyRectToScreen(_herculesBuf + x + y * Common::kHercW, Common::kHercW,
- x + (Common::kHercW - _screenWidth * 2) / 2, y, width, height);
- } else {
- if (_renderMode == Common::kRenderCGA)
- ditherCGA(_compositeBuf + x + y * _screenWidth, _screenWidth, x, y, width, height);
-
- // Finally blit the whole thing to the screen
- int x1 = x;
+ src = dst = _compositeBuf + x + y * _screenWidth;
+ int pitch = _screenWidth;
- // HACK: This is dirty hack which renders narrow NES rooms centered
- // NES can address negative number strips and that poses problem for
- // our code. So instead of adding zillions of fixes and potentially
- // breaking other games, we shift it right at the rendering stage.
- if ((_game.platform == Common::kPlatformNES) && (((_NESStartStrip > 0) && (vs->number == kMainVirtScreen)) || (vs->number == kTextVirtScreen))) {
- x += 16;
- while (x + width >= _screenWidth)
- width -= 16;
- if (width < 0)
- return;
+ if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) {
+ ditherHerc(dst, _herculesBuf, _screenWidth, &x, &y, &width, &height);
+
+ src = _herculesBuf + x + y * Common::kHercW;
+ pitch = Common::kHercW;
+
+ // center image on the screen
+ x += (Common::kHercW - _screenWidth * 2) / 2; // (720 - 320*2)/2 = 40
+ } else {
+ if (_renderMode == Common::kRenderCGA)
+ ditherCGA(dst, _screenWidth, x, y, width, height);
+
+ // HACK: This is dirty hack which renders narrow NES rooms centered
+ // NES can address negative number strips and that poses problem for
+ // our code. So instead of adding zillions of fixes and potentially
+ // breaking other games, we shift it right at the rendering stage.
+ if ((_game.platform == Common::kPlatformNES) && (((_NESStartStrip > 0) && (vs->number == kMainVirtScreen)) || (vs->number == kTextVirtScreen))) {
+ x += 16;
+ while (x + width >= _screenWidth)
+ width -= 16;
+ if (width < 0)
+ return;
+ }
+
}
- _system->copyRectToScreen(_compositeBuf + x1 + y * _screenWidth, _screenWidth, x, y, width, height);
+ // Finally blit the whole thing to the screen
+ _system->copyRectToScreen(src, pitch, x, y, width, height);
}
}
Modified: scummvm/trunk/engines/scumm/scumm.cpp
===================================================================
--- scummvm/trunk/engines/scumm/scumm.cpp 2007-07-08 21:42:39 UTC (rev 27979)
+++ scummvm/trunk/engines/scumm/scumm.cpp 2007-07-08 22:13:50 UTC (rev 27980)
@@ -521,7 +521,11 @@
_screenHeight = 200;
}
- _compositeBuf = (byte *)malloc(_screenWidth * _screenHeight);
+ // Allocate gfx compositing buffer (not needed for V7/V8 games).
+ if (_game.version < 7)
+ _compositeBuf = (byte *)malloc(_screenWidth * _screenHeight);
+ else
+ _compositeBuf = 0;
_herculesBuf = 0;
if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list