[Scummvm-cvs-logs] SF.net SVN: scummvm:[35314] scummvm/trunk/engines/saga

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Dec 12 15:23:02 CET 2008


Revision: 35314
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35314&view=rev
Author:   thebluegr
Date:     2008-12-12 14:23:02 +0000 (Fri, 12 Dec 2008)

Log Message:
-----------
- Stop passing the scene clip rectangle around for no reason
- More changes for dirty rectangle handling
- Stop adding dirty rectangles that cover the whole screen for no reason
- Dirty rectangle handling is still very buggy, so it's still disabled

Modified Paths:
--------------
    scummvm/trunk/engines/saga/actor.cpp
    scummvm/trunk/engines/saga/animation.cpp
    scummvm/trunk/engines/saga/events.cpp
    scummvm/trunk/engines/saga/gfx.cpp
    scummvm/trunk/engines/saga/gfx.h
    scummvm/trunk/engines/saga/interface.cpp
    scummvm/trunk/engines/saga/isomap.cpp
    scummvm/trunk/engines/saga/puzzle.cpp
    scummvm/trunk/engines/saga/render.cpp
    scummvm/trunk/engines/saga/scene.cpp
    scummvm/trunk/engines/saga/sfuncs.cpp
    scummvm/trunk/engines/saga/sprite.cpp
    scummvm/trunk/engines/saga/sprite.h

Modified: scummvm/trunk/engines/saga/actor.cpp
===================================================================
--- scummvm/trunk/engines/saga/actor.cpp	2008-12-12 13:32:24 UTC (rev 35313)
+++ scummvm/trunk/engines/saga/actor.cpp	2008-12-12 14:23:02 UTC (rev 35314)
@@ -1059,7 +1059,7 @@
 		if (_vm->_scene->getFlags() & kSceneFlagISO) {
 			_vm->_isoMap->drawSprite(*spriteList, frameNumber, drawObject->_location, drawObject->_screenPosition, drawObject->_screenScale);
 		} else {
-			_vm->_sprite->drawOccluded(_vm->_scene->getSceneClip(),*spriteList, frameNumber, drawObject->_screenPosition, drawObject->_screenScale, drawObject->_screenDepth);
+			_vm->_sprite->drawOccluded(*spriteList, frameNumber, drawObject->_screenPosition, drawObject->_screenScale, drawObject->_screenDepth);
 		}
 	}
 

Modified: scummvm/trunk/engines/saga/animation.cpp
===================================================================
--- scummvm/trunk/engines/saga/animation.cpp	2008-12-12 13:32:24 UTC (rev 35313)
+++ scummvm/trunk/engines/saga/animation.cpp	2008-12-12 14:23:02 UTC (rev 35314)
@@ -350,6 +350,7 @@
 	memcpy(pal, palPointer, sizeof(pal));
 	const Rect rect(width, height);
 	_vm->_render->getBackGroundSurface()->blit(rect, buf);
+	_vm->_render->setFullRefresh(true);
 	_vm->_frameCount++;
 
 	if (_cutAwayFade) {
@@ -540,6 +541,7 @@
 
 		// FIXME: if start > 0, then this works incorrectly
 		decodeFrame(anim, anim->frameOffsets[frame], displayBuffer, _vm->getDisplayWidth() * _vm->getDisplayHeight());
+		_vm->_render->addDirtyRect(Common::Rect(0, 0, _vm->getDisplayWidth(), _vm->getDisplayHeight()));
 		_vm->_frameCount++;
 		anim->currentFrame++;
 		if (anim->completed != 65535) {

Modified: scummvm/trunk/engines/saga/events.cpp
===================================================================
--- scummvm/trunk/engines/saga/events.cpp	2008-12-12 13:32:24 UTC (rev 35313)
+++ scummvm/trunk/engines/saga/events.cpp	2008-12-12 14:23:02 UTC (rev 35314)
@@ -170,6 +170,7 @@
 			rect.right = bgInfo.bounds.width();
 			rect.bottom = bgInfo.bounds.height();
 			_vm->_render->getBackGroundSurface()->transitionDissolve(bgInfo.buffer, rect, 0, event_pc);
+			_vm->_render->setFullRefresh(true);
 			break;
 		case kEventDissolveBGMask:
 			// we dissolve it centered.
@@ -185,6 +186,7 @@
 			rect.setHeight(h);
 
 			_vm->_render->getBackGroundSurface()->transitionDissolve( maskBuffer, rect, 1, event_pc);
+			_vm->_render->setFullRefresh(true);
 			break;
 		default:
 			break;
@@ -351,8 +353,6 @@
 				}
 			}
 			_vm->_render->clearFlag(RF_DISABLE_ACTORS);
-
-			_vm->_render->setFullRefresh(true);
 		}
 		break;
 	case kPsychicProfileBgEvent:
@@ -376,6 +376,7 @@
 		const Rect profileRect(width, height);
 
 		_vm->_render->getBackGroundSurface()->blit(profileRect, buf);
+		_vm->_render->addDirtyRect(profileRect);
 		_vm->_frameCount++;
 
 		_vm->_gfx->setPalette(palette);
@@ -390,14 +391,12 @@
 	case kAnimEvent:
 		switch (event->op) {
 		case kEventPlay:
-			_vm->_render->setFullRefresh(true);
 			_vm->_anim->play(event->param, event->time, true);
 			break;
 		case kEventStop:
 			_vm->_anim->stop(event->param);
 			break;
 		case kEventFrame:
-			_vm->_render->setFullRefresh(true);
 			_vm->_anim->play(event->param, event->time, false);
 			break;
 		case kEventSetFlag:
@@ -420,6 +419,7 @@
 				BGInfo bgInfo;
 				_vm->_scene->getBGInfo(bgInfo);
 				_vm->_render->getBackGroundSurface()->blit(bgInfo.bounds, bgInfo.buffer);
+				_vm->_render->addDirtyRect(bgInfo.bounds);
 				_vm->_scene->draw();
 			}
 			break;

Modified: scummvm/trunk/engines/saga/gfx.cpp
===================================================================
--- scummvm/trunk/engines/saga/gfx.cpp	2008-12-12 13:32:24 UTC (rev 35313)
+++ scummvm/trunk/engines/saga/gfx.cpp	2008-12-12 14:23:02 UTC (rev 35314)
@@ -586,4 +586,10 @@
 	_vm->_render->addDirtyRect(destRect);
 }
 
+// This method does not add a dirty rectangle automatically
+void Gfx::drawBgRegion(const Common::Rect &destRect, const byte *sourceBuffer) {
+	_backBuffer.blit(destRect, sourceBuffer);
+}
+
+
 } // End of namespace Saga

Modified: scummvm/trunk/engines/saga/gfx.h
===================================================================
--- scummvm/trunk/engines/saga/gfx.h	2008-12-12 13:32:24 UTC (rev 35313)
+++ scummvm/trunk/engines/saga/gfx.h	2008-12-12 14:23:02 UTC (rev 35314)
@@ -166,6 +166,9 @@
 	// This method adds a dirty rectangle automatically
 	void drawRegion(const Common::Rect &destRect, const byte *sourceBuffer);
 
+	// This method does not add a dirty rectangle automatically
+	void drawBgRegion(const Common::Rect &destRect, const byte *sourceBuffer);
+
 	// Used for testing
 	void drawPalette() {
 		_backBuffer.drawPalette();

Modified: scummvm/trunk/engines/saga/interface.cpp
===================================================================
--- scummvm/trunk/engines/saga/interface.cpp	2008-12-12 13:32:24 UTC (rev 35313)
+++ scummvm/trunk/engines/saga/interface.cpp	2008-12-12 14:23:02 UTC (rev 35314)
@@ -503,6 +503,7 @@
 	}
 
 	draw();
+	_vm->_render->setFullRefresh(true);
 }
 
 bool Interface::processAscii(Common::KeyState keystate) {
@@ -782,7 +783,7 @@
 	point.x = _mainPanel.x + panelButton->xOffset;
 	point.y = _mainPanel.y + panelButton->yOffset;
 
-	_vm->_sprite->draw(_vm->getDisplayClip(), _mainPanel.sprites, spriteNumber, point, 256);
+	_vm->_sprite->draw(_mainPanel.sprites, spriteNumber, point, 256);
 
 	drawVerbPanelText(panelButton, textColor, kKnownColorVerbTextShadow);
 }
@@ -818,7 +819,7 @@
 		(_panelMode == kPanelNull && _vm->getGameId() == GID_IHNM_DEMO)) {
 		leftPortraitPoint.x = _mainPanel.x + _vm->getDisplayInfo().leftPortraitXOffset;
 		leftPortraitPoint.y = _mainPanel.y + _vm->getDisplayInfo().leftPortraitYOffset;
-		_vm->_sprite->draw(_vm->getDisplayClip(), _defPortraits, _leftPortrait, leftPortraitPoint, 256);
+		_vm->_sprite->draw(_defPortraits, _leftPortrait, leftPortraitPoint, 256);
 	}
 
 	if (!_inMainMode && _vm->getDisplayInfo().rightPortraitXOffset >= 0) { //FIXME: should we change !_inMainMode to _panelMode == kPanelConverse ?
@@ -833,7 +834,7 @@
 		if (_rightPortrait >= _scenePortraits.spriteCount)
 			_rightPortrait = 0;
 
-		_vm->_sprite->draw(_vm->getDisplayClip(), _scenePortraits, _rightPortrait, rightPortraitPoint, 256);
+		_vm->_sprite->draw(_scenePortraits, _rightPortrait, rightPortraitPoint, 256);
 	}
 
 	drawInventory();
@@ -973,7 +974,7 @@
 		panelButton = &_optionPanel.buttons[0];
 		sliderPoint.x = _optionPanel.x + panelButton->xOffset;
 		sliderPoint.y = _optionSaveRectSlider.top;
-		_vm->_sprite->draw(_vm->getDisplayClip(), _optionPanel.sprites, 0 + _optionSaveFileSlider->state, sliderPoint, 256);
+		_vm->_sprite->draw(_optionPanel.sprites, 0 + _optionSaveFileSlider->state, sliderPoint, 256);
 
 	}
 
@@ -1903,7 +1904,7 @@
 
 		rect.right = rect.left + _vm->getDisplayInfo().saveReminderWidth;
 		rect.bottom = rect.top + _vm->getDisplayInfo().saveReminderHeight;
-		_vm->_sprite->draw(_vm->getDisplayClip(), _vm->_sprite->_saveReminderSprites,
+		_vm->_sprite->draw(_vm->_sprite->_saveReminderSprites,
 			_vm->getDisplayInfo().saveReminderFirstSpriteNumber + _saveReminderState - 1,
 			rect, 256);
 
@@ -2117,7 +2118,7 @@
 
 		if (ci < _inventoryCount) {
 			obj = _vm->_actor->getObj(_inventory[ci]);
-			_vm->_sprite->draw(_vm->getDisplayClip(), _vm->_sprite->_inventorySprites, obj->_spriteListResourceId, rect, 256);
+			_vm->_sprite->draw(_vm->_sprite->_inventorySprites, obj->_spriteListResourceId, rect, 256);
 		}
 
 		ci++;
@@ -2316,23 +2317,23 @@
 		if (panel == &_optionPanel) {
 			texturePoint.x = _optionPanel.x + panelButton->xOffset - 1;
 			texturePoint.y = _optionPanel.y + panelButton->yOffset - 1;
-			_vm->_sprite->draw(_vm->getDisplayClip(), _optionPanel.sprites, spritenum + 2 + litButton, texturePoint, 256);
+			_vm->_sprite->draw(_optionPanel.sprites, spritenum + 2 + litButton, texturePoint, 256);
 		} else if (panel == &_quitPanel) {
 			texturePoint.x = _quitPanel.x + panelButton->xOffset - 3;
 			texturePoint.y = _quitPanel.y + panelButton->yOffset - 3;
-			_vm->_sprite->draw(_vm->getDisplayClip(), _quitPanel.sprites, litButton, texturePoint, 256);
+			_vm->_sprite->draw(_quitPanel.sprites, litButton, texturePoint, 256);
 		} else if (panel == &_savePanel) {
 			texturePoint.x = _savePanel.x + panelButton->xOffset - 3;
 			texturePoint.y = _savePanel.y + panelButton->yOffset - 3;
-			_vm->_sprite->draw(_vm->getDisplayClip(), _savePanel.sprites, litButton, texturePoint, 256);
+			_vm->_sprite->draw(_savePanel.sprites, litButton, texturePoint, 256);
 			// Input text box sprite
 			texturePoint.x = _savePanel.x + _saveEdit->xOffset - 2;
 			texturePoint.y = _savePanel.y + _saveEdit->yOffset - 2;
-			_vm->_sprite->draw(_vm->getDisplayClip(), _savePanel.sprites, 2, texturePoint, 256);
+			_vm->_sprite->draw(_savePanel.sprites, 2, texturePoint, 256);
 		} else if (panel == &_loadPanel) {
 			texturePoint.x = _loadPanel.x + panelButton->xOffset - 3;
 			texturePoint.y = _loadPanel.y + panelButton->yOffset - 3;
-			_vm->_sprite->draw(_vm->getDisplayClip(), _loadPanel.sprites, litButton, texturePoint, 256);
+			_vm->_sprite->draw(_loadPanel.sprites, litButton, texturePoint, 256);
 		} else {
 			// revert to default behavior
 			drawButtonBox(rect, kButton, panelButton->state > 0);
@@ -2361,9 +2362,9 @@
 	point.y = panel->y + panelButton->yOffset;
 
 	if (_vm->getGameType() == GType_ITE)
-		_vm->_sprite->draw(_vm->getDisplayClip(), _vm->_sprite->_mainSprites, spriteNumber, point, 256);
+		_vm->_sprite->draw(_vm->_sprite->_mainSprites, spriteNumber, point, 256);
 	else
-		_vm->_sprite->draw(_vm->getDisplayClip(), _vm->_sprite->_arrowSprites, spriteNumber, point, 256);
+		_vm->_sprite->draw(_vm->_sprite->_arrowSprites, spriteNumber, point, 256);
 }
 
 void Interface::drawVerbPanelText(PanelButton *panelButton, KnownColor textKnownColor, KnownColor textShadowKnownColor) {
@@ -2789,7 +2790,7 @@
 	Rect screen(_vm->getDisplayWidth(), _vm->_scene->getHeight());
 
 	if (screen.contains(mapPosition)) {
-		_vm->_sprite->draw(_vm->getDisplayClip(), _vm->_sprite->_mainSprites,
+		_vm->_sprite->draw(_vm->_sprite->_mainSprites,
 						   _mapPanelCrossHairState? RID_ITE_SPR_CROSSHAIR : RID_ITE_SPR_CROSSHAIR + 1,
 						   mapPosition, 256);
 	}

Modified: scummvm/trunk/engines/saga/isomap.cpp
===================================================================
--- scummvm/trunk/engines/saga/isomap.cpp	2008-12-12 13:32:24 UTC (rev 35313)
+++ scummvm/trunk/engines/saga/isomap.cpp	2008-12-12 14:23:02 UTC (rev 35314)
@@ -395,7 +395,6 @@
 	int yAlign;
 	const byte *spriteBuffer;
 	Point spritePointer;
-	Rect clip(_vm->_scene->getSceneClip());
 
 	_vm->_sprite->getScaledSpriteBuffer(spriteList, spriteNumber, scale, width, height, xAlign, yAlign, spriteBuffer);
 
@@ -407,7 +406,7 @@
 	_tileClip.top = CLIP<int>(spritePointer.y, 0, _vm->_scene->getHeight());
 	_tileClip.bottom = CLIP<int>(spritePointer.y + height, 0, _vm->_scene->getHeight());
 
-	_vm->_sprite->drawClip(clip, spritePointer, width, height, spriteBuffer);
+	_vm->_sprite->drawClip(spritePointer, width, height, spriteBuffer);
 	drawTiles(&location);
 }
 

Modified: scummvm/trunk/engines/saga/puzzle.cpp
===================================================================
--- scummvm/trunk/engines/saga/puzzle.cpp	2008-12-12 13:32:24 UTC (rev 35313)
+++ scummvm/trunk/engines/saga/puzzle.cpp	2008-12-12 14:23:02 UTC (rev 35314)
@@ -195,7 +195,7 @@
 		int num = _piecePriority[j];
 
 		if (_puzzlePiece != num) {
-			_vm->_sprite->draw(_vm->getDisplayClip(), *spriteList, num, Point(_pieceInfo[num].curX, _pieceInfo[num].curY), 256);
+			_vm->_sprite->draw(*spriteList, num, Point(_pieceInfo[num].curX, _pieceInfo[num].curY), 256);
 		}
 	}
 }
@@ -206,7 +206,7 @@
 	SpriteList *spriteList;
 	_vm->_actor->getSpriteParams(puzzle, frameNumber, spriteList);
 
-	_vm->_sprite->draw(_vm->_scene->getSceneClip(), *spriteList, _puzzlePiece,
+	_vm->_sprite->draw(*spriteList, _puzzlePiece,
 			   Point(_pieceInfo[_puzzlePiece].curX, _pieceInfo[_puzzlePiece].curY), 256);
 }
 

Modified: scummvm/trunk/engines/saga/render.cpp
===================================================================
--- scummvm/trunk/engines/saga/render.cpp	2008-12-12 13:32:24 UTC (rev 35313)
+++ scummvm/trunk/engines/saga/render.cpp	2008-12-12 14:23:02 UTC (rev 35314)
@@ -83,9 +83,7 @@
 	assert(_initialized);
 
 	// TODO: Remove this to use dirty rectangles
-	// 2 known glitches exist:
-	// - When a placard is up, the text is not shown correctly
-	// - Sprite::drawClip() can draw sprites incorrectly in isometric scenes in ITE
+	// Still quite buggy
 	_fullRefresh = true;
 
 #ifdef SAGA_DEBUG
@@ -95,7 +93,10 @@
 	// Get mouse coordinates
 	mousePoint = _vm->mousePos();
 
-	restoreChangedRects();
+	if (!_fullRefresh)
+		restoreChangedRects();
+	else
+		_dirtyRects.clear();
 
 	if (!(_flags & (RF_DEMO_SUBST | RF_MAP) || curMode == kPanelPlacard)) {
 		if (_vm->_interface->getFadeMode() != kFadeOut) {
@@ -126,8 +127,9 @@
 				_vm->_actor->drawPathTest();
 			}
 #endif
-
 		}
+	} else {
+		_fullRefresh = true;
 	}
 
 	if (_flags & RF_MAP)
@@ -207,6 +209,9 @@
 }
 
 void Render::addDirtyRect(Common::Rect rect) {
+	if (_fullRefresh)
+		return;
+
 	// Clip rectangle
 	int x1 = MAX<int>(rect.left, 0);
 	int y1 = MAX<int>(rect.top, 0);
@@ -234,8 +239,8 @@
  	 	Common::List<Common::Rect>::const_iterator it;
  	 	for (it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) {
 			//_backGroundSurface.frameRect(*it, 1);		// DEBUG
-			if (it->bottom <= _vm->_scene->getHeight())
-				g_system->copyRectToScreen((byte *)_backGroundSurface.pixels, _backGroundSurface.w, it->left, it->top, it->width(), it->height());
+			if (_vm->_interface->getFadeMode() != kFadeOut)
+				g_system->copyRectToScreen(_vm->_gfx->getBackBufferPixels(), _backGroundSurface.w, it->left, it->top, it->width(), it->height());
 		}
 	}
 	_dirtyRects.clear();
@@ -246,12 +251,15 @@
  	 	Common::List<Common::Rect>::const_iterator it;
  	 	for (it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) {
 			//_backGroundSurface.frameRect(*it, 2);		// DEBUG
-			g_system->copyRectToScreen(_vm->_gfx->getBackBufferPixels(), _backGroundSurface.w, it->left, it->top, it->width(), it->height());
+			if (_vm->_interface->getFadeMode() != kFadeOut)
+				g_system->copyRectToScreen(_vm->_gfx->getBackBufferPixels(), _backGroundSurface.w, it->left, it->top, it->width(), it->height());
 		}
 	} else {
 		_system->copyRectToScreen(_vm->_gfx->getBackBufferPixels(), _vm->_gfx->getBackBufferWidth(), 0, 0,
 								  _vm->_gfx->getBackBufferWidth(), _vm->_gfx->getBackBufferHeight());
 	}
+
+	_dirtyRects.clear();
 }
 
 #ifdef SAGA_DEBUG

Modified: scummvm/trunk/engines/saga/scene.cpp
===================================================================
--- scummvm/trunk/engines/saga/scene.cpp	2008-12-12 13:32:24 UTC (rev 35313)
+++ scummvm/trunk/engines/saga/scene.cpp	2008-12-12 14:23:02 UTC (rev 35314)
@@ -1153,7 +1153,10 @@
 		Rect rect;
 		_vm->_render->getBackGroundSurface()->getRect(rect);
 		rect.bottom = (_sceneClip.bottom < rect.bottom) ? getHeight() : rect.bottom;
-		_vm->_gfx->drawRegion(rect, (const byte *)_vm->_render->getBackGroundSurface()->pixels);
+		if (_vm->_render->isFullRefresh())
+			_vm->_gfx->drawRegion(rect, (const byte *)_vm->_render->getBackGroundSurface()->pixels);
+		else
+			_vm->_gfx->drawBgRegion(rect, (const byte *)_vm->_render->getBackGroundSurface()->pixels);
 	}
 }
 

Modified: scummvm/trunk/engines/saga/sfuncs.cpp
===================================================================
--- scummvm/trunk/engines/saga/sfuncs.cpp	2008-12-12 13:32:24 UTC (rev 35313)
+++ scummvm/trunk/engines/saga/sfuncs.cpp	2008-12-12 14:23:02 UTC (rev 35314)
@@ -1453,6 +1453,7 @@
 	BGInfo backGroundInfo;
 	_vm->_scene->getBGInfo(backGroundInfo);
 	_vm->_render->getBackGroundSurface()->blit(backGroundInfo.bounds, backGroundInfo.buffer);
+	_vm->_render->addDirtyRect(backGroundInfo.bounds);
 }
 
 // Script function #63 (0x3F)

Modified: scummvm/trunk/engines/saga/sprite.cpp
===================================================================
--- scummvm/trunk/engines/saga/sprite.cpp	2008-12-12 13:32:24 UTC (rev 35313)
+++ scummvm/trunk/engines/saga/sprite.cpp	2008-12-12 14:23:02 UTC (rev 35314)
@@ -212,9 +212,10 @@
 	}
 }
 
-void Sprite::drawClip(const Rect &clipRect, const Point &spritePointer, int width, int height, const byte *spriteBuffer) {
+void Sprite::drawClip(const Point &spritePointer, int width, int height, const byte *spriteBuffer) {
 	int clipWidth;
 	int clipHeight;
+	Common::Rect clipRect(_vm->getDisplayClip());
 
 	int i, j, jo, io;
 	byte *bufRowPointer;
@@ -253,10 +254,16 @@
 		srcRowPointer += width;
 	}
 
-	_vm->_render->addDirtyRect(clipRect);
+	int x1 = MAX<int>(spritePointer.x, 0);
+	int y1 = MAX<int>(spritePointer.y, 0);
+	int x2 = MIN<int>(MAX<int>(spritePointer.x + clipWidth, 0), clipRect.right);
+	int y2 = MIN<int>(MAX<int>(spritePointer.y + clipHeight, 0), clipRect.bottom);
+
+	if (x2 > x1 && y2 > y1)
+		_vm->_render->addDirtyRect(Common::Rect(x1, y1, x2, y2));
 }
 
-void Sprite::draw(const Rect &clipRect, SpriteList &spriteList, int32 spriteNumber, const Point &screenCoord, int scale) {
+void Sprite::draw(SpriteList &spriteList, int32 spriteNumber, const Point &screenCoord, int scale) {
 	const byte *spriteBuffer = NULL;
 	int width  = 0;
 	int height = 0;
@@ -269,10 +276,10 @@
 	spritePointer.x = screenCoord.x + xAlign;
 	spritePointer.y = screenCoord.y + yAlign;
 
-	drawClip(clipRect, spritePointer, width, height, spriteBuffer);
+	drawClip(spritePointer, width, height, spriteBuffer);
 }
 
-void Sprite::draw(const Rect &clipRect, SpriteList &spriteList, int32 spriteNumber, const Rect &screenRect, int scale) {
+void Sprite::draw(SpriteList &spriteList, int32 spriteNumber, const Rect &screenRect, int scale) {
 	const byte *spriteBuffer = NULL;
 	int width  = 0;
 	int height = 0;
@@ -293,7 +300,7 @@
 	}
 	spritePointer.x = screenRect.left + xAlign + spw;
 	spritePointer.y = screenRect.top + yAlign + sph;
-	drawClip(clipRect, spritePointer, width, height, spriteBuffer);
+	drawClip(spritePointer, width, height, spriteBuffer);
 }
 
 bool Sprite::hitTest(SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, const Point &testPoint) {
@@ -323,7 +330,7 @@
 	return *srcRowPointer != 0;
 }
 
-void Sprite::drawOccluded(const Rect &clipRect, SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, int depth) {
+void Sprite::drawOccluded(SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, int depth) {
 	const byte *spriteBuffer = NULL;
 	int x, y;
 	byte *destRowPointer;
@@ -347,7 +354,7 @@
 	int maskZ;
 
 	if (!_vm->_scene->isBGMaskPresent()) {
-		draw(clipRect, spriteList, spriteNumber, screenCoord, scale);
+		draw(spriteList, spriteNumber, screenCoord, scale);
 		return;
 	}
 
@@ -363,7 +370,7 @@
 	clipData.sourceRect.right = width;
 	clipData.sourceRect.bottom = height;
 
-	clipData.destRect = clipRect;
+	clipData.destRect = _vm->getDisplayClip();
 
 	if (!clipData.calcClip()) {
 		return;
@@ -395,7 +402,8 @@
 		sourceRowPointer += width;
 	}
 
-	_vm->_render->addDirtyRect(clipRect);
+	_vm->_render->addDirtyRect(Common::Rect(clipData.drawSource.x, clipData.drawSource.y, 
+								clipData.drawSource.x + width, clipData.drawSource.y + height));
 }
 
 void Sprite::decodeRLEBuffer(const byte *inputBuffer, size_t inLength, size_t outLength) {

Modified: scummvm/trunk/engines/saga/sprite.h
===================================================================
--- scummvm/trunk/engines/saga/sprite.h	2008-12-12 13:32:24 UTC (rev 35313)
+++ scummvm/trunk/engines/saga/sprite.h	2008-12-12 14:23:02 UTC (rev 35314)
@@ -74,15 +74,15 @@
 	~Sprite(void);
 
 	// draw scaled sprite using background scene mask
-	void drawOccluded(const Rect &clipRect, SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, int depth);
+	void drawOccluded(SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, int depth);
 
 	// draw scaled sprite using background scene mask
-	void draw(const Rect &clipRect, SpriteList &spriteList, int32 spriteNumber, const Point &screenCoord, int scale);
+	void draw(SpriteList &spriteList, int32 spriteNumber, const Point &screenCoord, int scale);
 
 	// main function
-	void drawClip(const Rect &clipRect, const Point &spritePointer, int width, int height, const byte *spriteBuffer);
+	void drawClip(const Point &spritePointer, int width, int height, const byte *spriteBuffer);
 
-	void draw(const Rect &clipRect, SpriteList &spriteList, int32 spriteNumber, const Rect &screenRect, int scale);
+	void draw(SpriteList &spriteList, int32 spriteNumber, const Rect &screenRect, int scale);
 
 	void loadList(int resourceId, SpriteList &spriteList); // load or append spriteList
 	bool hitTest(SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, const Point &testPoint);


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