[Scummvm-cvs-logs] SF.net SVN: scummvm:[35281] scummvm/trunk/engines/saga
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Sun Dec 7 19:49:35 CET 2008
Revision: 35281
http://scummvm.svn.sourceforge.net/scummvm/?rev=35281&view=rev
Author: thebluegr
Date: 2008-12-07 18:49:35 +0000 (Sun, 07 Dec 2008)
Log Message:
-----------
More dirty rectangle related changes (dirty rectangle handling is still broken)
Modified Paths:
--------------
scummvm/trunk/engines/saga/font.cpp
scummvm/trunk/engines/saga/gfx.cpp
scummvm/trunk/engines/saga/interface.cpp
scummvm/trunk/engines/saga/isomap.cpp
scummvm/trunk/engines/saga/render.cpp
scummvm/trunk/engines/saga/render.h
scummvm/trunk/engines/saga/scene.cpp
scummvm/trunk/engines/saga/sprite.cpp
Modified: scummvm/trunk/engines/saga/font.cpp
===================================================================
--- scummvm/trunk/engines/saga/font.cpp 2008-12-07 17:32:25 UTC (rev 35280)
+++ scummvm/trunk/engines/saga/font.cpp 2008-12-07 18:49:35 UTC (rev 35281)
@@ -30,6 +30,7 @@
#include "saga/rscfile.h"
#include "saga/font.h"
+#include "saga/render.h"
namespace Saga {
@@ -304,15 +305,15 @@
const byte *textPointer;
byte *c_dataPointer;
int c_code;
- int charRow;
+ int charRow = 0;
Point textPoint(point);
byte *outputPointer;
byte *outputPointer_min;
byte *outputPointer_max;
- int row;
- int rowLimit;
+ int row = 0;
+ int rowLimit = 0;
int c_byte_len;
int c_byte;
@@ -406,6 +407,10 @@
// Advance tracking position
textPoint.x += drawFont.fontCharEntry[c_code].tracking;
} // end per-character processing
+
+ rowLimit = (_vm->_gfx->getBackBufferHeight() < (textPoint.y + drawFont.header.charHeight)) ? _vm->_gfx->getBackBufferHeight() : textPoint.y + drawFont.header.charHeight;
+ // TODO: for now we add a dirty rect that ends at the right of the screen
+ _vm->_render->addDirtyRect(Common::Rect(textPoint.x, textPoint.y, _vm->_gfx->getBackBufferWidth(), rowLimit));
}
Modified: scummvm/trunk/engines/saga/gfx.cpp
===================================================================
--- scummvm/trunk/engines/saga/gfx.cpp 2008-12-07 17:32:25 UTC (rev 35280)
+++ scummvm/trunk/engines/saga/gfx.cpp 2008-12-07 18:49:35 UTC (rev 35281)
@@ -565,7 +565,7 @@
// This method adds a dirty rectangle automatically
void Gfx::drawFrame(const Common::Point &p1, const Common::Point &p2, int color) {
_backBuffer.drawFrame(p1, p2, color);
- _vm->_render->addDirtyRect(Common::Rect(p1.x, p1.y, p2.x, p2.y));
+ _vm->_render->addDirtyRect(Common::Rect(p1.x, p1.y, p2.x + 1, p2.y + 1));
}
// This method adds a dirty rectangle automatically
Modified: scummvm/trunk/engines/saga/interface.cpp
===================================================================
--- scummvm/trunk/engines/saga/interface.cpp 2008-12-07 17:32:25 UTC (rev 35280)
+++ scummvm/trunk/engines/saga/interface.cpp 2008-12-07 18:49:35 UTC (rev 35281)
@@ -2186,11 +2186,14 @@
int xe = rect.right - 1;
int ye = rect.bottom - 1;
- _vm->_gfx->drawRect(Common::Rect(x, y, x + w, y + h), frameColor);
_vm->_gfx->setPixelColor(x, y, cornerColor);
_vm->_gfx->setPixelColor(x, ye, cornerColor);
_vm->_gfx->setPixelColor(xe, y, cornerColor);
_vm->_gfx->setPixelColor(xe, ye, cornerColor);
+ _vm->_gfx->hLine(x + 1, y, x + w - 2, frameColor);
+ _vm->_gfx->hLine(x + 1, ye, x + w - 2, frameColor);
+ _vm->_gfx->vLine(x, y + 1, y + h - 2, frameColor);
+ _vm->_gfx->vLine(xe, y + 1, y + h - 2, frameColor);
x++;
y++;
@@ -2198,7 +2201,6 @@
ye--;
w -= 2;
h -= 2;
- // drawRect() above added a dirty rectangle automatically for these
_vm->_gfx->vLine(x, y, y + h - 1, odl);
_vm->_gfx->hLine(x, ye, x + w - 1, odl);
_vm->_gfx->vLine(xe, y, y + h - 2, our);
@@ -2210,7 +2212,6 @@
ye--;
w -= 2;
h -= 2;
- // drawRect() above added a dirty rectangle automatically for these
_vm->_gfx->setPixelColor(x, y, fillColor);
_vm->_gfx->setPixelColor(xe, ye, fillColor);
_vm->_gfx->vLine(x, y + 1, y + 1 + h - 2, idl);
@@ -2223,6 +2224,7 @@
Common::Rect fill(x, y, x + w, y + h);
_vm->_gfx->fillRect(fill, solidColor);
+ _vm->_render->addDirtyRect(rect);
}
static const int readingSpeeds[] = { kTextClick, kTextSlow, kTextMid, kTextFast };
Modified: scummvm/trunk/engines/saga/isomap.cpp
===================================================================
--- scummvm/trunk/engines/saga/isomap.cpp 2008-12-07 17:32:25 UTC (rev 35280)
+++ scummvm/trunk/engines/saga/isomap.cpp 2008-12-07 18:49:35 UTC (rev 35281)
@@ -29,6 +29,7 @@
#include "saga/gfx.h"
#include "saga/scene.h"
#include "saga/isomap.h"
+#include "saga/render.h"
namespace Saga {
@@ -877,6 +878,12 @@
}
}
+ // Compute dirty rect
+ int rectX = MAX<int>(drawPoint.x, 0);
+ int rectY = MAX<int>(drawPoint.y, 0);
+ int rectX2 = MIN<int>(drawPoint.x + SAGA_ISOTILE_WIDTH, _tileClip.right);
+ int rectY2 = MIN<int>(drawPoint.y + height, _tileClip.bottom);
+ _vm->_render->addDirtyRect(Common::Rect(rectX, rectY, rectX2, rectY2));
}
bool IsoMap::checkDragonPoint(int16 u, int16 v, uint16 direction) {
Modified: scummvm/trunk/engines/saga/render.cpp
===================================================================
--- scummvm/trunk/engines/saga/render.cpp 2008-12-07 17:32:25 UTC (rev 35280)
+++ scummvm/trunk/engines/saga/render.cpp 2008-12-07 18:49:35 UTC (rev 35281)
@@ -92,6 +92,8 @@
// Get mouse coordinates
mousePoint = _vm->mousePos();
+ restoreChangedRects();
+
if (!(_flags & (RF_DEMO_SUBST | RF_MAP) || curMode == kPanelPlacard)) {
// Do not redraw the whole scene and the actors if the scene is fading out or
// if an overlay is drawn above it (e.g. the options menu)
@@ -100,8 +102,10 @@
curMode != kPanelLoad && curMode != kPanelSave &&
curMode != kPanelProtect)) {
// Display scene background
- if (!(_flags & RF_DISABLE_ACTORS) || _vm->getGameType() == GType_ITE)
- _vm->_scene->draw();
+ if (_fullRefresh) {
+ if (!(_flags & RF_DISABLE_ACTORS) || _vm->getGameType() == GType_ITE)
+ _vm->_scene->draw();
+ }
if (_vm->_puzzle->isActive()) {
_vm->_puzzle->movePiece(mousePoint);
@@ -202,6 +206,8 @@
drawDirtyRects();
_system->updateScreen();
+
+ _fullRefresh = false;
}
void Render::addDirtyRect(Common::Rect rect) {
@@ -215,6 +221,16 @@
_dirtyRects.push_back(rect);
}
+void Render::restoreChangedRects() {
+ if (!_fullRefresh) {
+ Common::List<Common::Rect>::const_iterator it;
+ for (it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) {
+ g_system->copyRectToScreen((byte *)_backGroundSurface.pixels, _backGroundSurface.w, it->left, it->top, it->width(), it->height());
+ }
+ }
+ _dirtyRects.clear();
+}
+
void Render::drawDirtyRects() {
if (_fullRefresh) {
_system->copyRectToScreen(_vm->_gfx->getBackBufferPixels(), _vm->_gfx->getBackBufferWidth(), 0, 0,
@@ -222,11 +238,9 @@
} else {
Common::List<Common::Rect>::const_iterator it;
for (it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) {
- g_system->copyRectToScreen(_vm->_gfx->getBackBufferPixels(), it->width(), it->left, it->top, it->width(), it->height());
+ g_system->copyRectToScreen(_vm->_gfx->getBackBufferPixels(), _backGroundSurface.w, it->left, it->top, it->width(), it->height());
}
}
-
- _dirtyRects.clear();
}
#ifdef SAGA_DEBUG
Modified: scummvm/trunk/engines/saga/render.h
===================================================================
--- scummvm/trunk/engines/saga/render.h 2008-12-07 17:32:25 UTC (rev 35280)
+++ scummvm/trunk/engines/saga/render.h 2008-12-07 18:49:35 UTC (rev 35281)
@@ -94,6 +94,7 @@
}
void drawDirtyRects();
+ void restoreChangedRects();
private:
#ifdef SAGA_DEBUG
Modified: scummvm/trunk/engines/saga/scene.cpp
===================================================================
--- scummvm/trunk/engines/saga/scene.cpp 2008-12-07 17:32:25 UTC (rev 35280)
+++ scummvm/trunk/engines/saga/scene.cpp 2008-12-07 18:49:35 UTC (rev 35281)
@@ -589,6 +589,9 @@
Event *q_event;
static PalEntry current_pal[PAL_ENTRIES];
+ // Since we are loading a new scene, do a full refresh
+ _vm->_render->setFullRefresh(true);
+
if (loadSceneParams->transitionType == kTransitionFade)
_vm->_interface->setFadeMode(kFadeOut);
@@ -1185,6 +1188,7 @@
} else {
_vm->_gfx->getBackBufferRect(rect);
_vm->_render->getBackGroundSurface()->blit(rect, (const byte *)_vm->_gfx->getBackBufferPixels());
+ _vm->_render->addDirtyRect(rect);
}
// Free scene background
Modified: scummvm/trunk/engines/saga/sprite.cpp
===================================================================
--- scummvm/trunk/engines/saga/sprite.cpp 2008-12-07 17:32:25 UTC (rev 35280)
+++ scummvm/trunk/engines/saga/sprite.cpp 2008-12-07 18:49:35 UTC (rev 35281)
@@ -33,6 +33,7 @@
#include "saga/font.h"
#include "saga/sprite.h"
+#include "saga/render.h"
namespace Saga {
@@ -251,6 +252,8 @@
bufRowPointer += _vm->_gfx->getBackBufferPitch();
srcRowPointer += width;
}
+
+ _vm->_render->addDirtyRect(Common::Rect(spritePointer.x, spritePointer.y, spritePointer.x + clipWidth, spritePointer.y + clipHeight));
}
void Sprite::draw(const Rect &clipRect, SpriteList &spriteList, int32 spriteNumber, const Point &screenCoord, int scale) {
@@ -391,6 +394,9 @@
maskRowPointer += maskWidth;
sourceRowPointer += width;
}
+
+ _vm->_render->addDirtyRect(Common::Rect(clipData.destPoint.x, clipData.destPoint.y,
+ clipData.destPoint.x + clipData.drawWidth, clipData.destPoint.y + clipData.drawHeight));
}
void Sprite::decodeRLEBuffer(const byte *inputBuffer, size_t inLength, size_t outLength) {
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