[Scummvm-git-logs] scummvm master -> 106c43e2d431abb1a083b2848c097a52cd9c405f

npjg nathanael.gentrydb8 at gmail.com
Tue Jun 16 16:47:59 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:
106c43e2d4 DIRECTOR: Clean up one-off rendering methods


Commit: 106c43e2d431abb1a083b2848c097a52cd9c405f
    https://github.com/scummvm/scummvm/commit/106c43e2d431abb1a083b2848c097a52cd9c405f
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2020-06-16T12:47:15-04:00

Commit Message:
DIRECTOR: Clean up one-off rendering methods

Changed paths:
    engines/director/score.cpp
    engines/director/score.h


diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index b8af63e241..d69a88c346 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -504,15 +504,43 @@ void Score::renderFrame(uint16 frameId, bool forceUpdate, bool updateStageOnly)
 		// (maybe we have to compare all the sprite attributes, not just these two?)
 		bool needsUpdate = currentSprite->isDirty() || currentSprite->_castId != nextSprite->_castId || currentSprite->_currentBbox != nextSprite->_currentBbox;
 
-		if (needsUpdate || forceUpdate)
-			unrenderSprite(i);
+		if (needsUpdate || forceUpdate) {
+			if (!currentSprite->_trails) {
+				_maskSurface->fillRect(currentSprite->_currentBbox, 1);
+				_surface->fillRect(currentSprite->_currentBbox, _stageColor);
+			}
+
+			currentSprite->_currentBbox = currentSprite->getBbox();
+		}
 
 		_maskSurface->fillRect(nextSprite->_currentBbox, 1);
 		_sprites[i] = nextSprite;
 	}
 
-	for (uint i = 0; i < _sprites.size(); i++)
-		renderSprite(i);
+	for (uint id = 0; id < _sprites.size(); id++) {
+		Sprite *sprite = _sprites[id];
+
+		if (!sprite || !sprite->_enabled || !sprite->_castType)
+			continue;
+
+		sprite->updateCast();
+
+		debugC(1, kDebugImages, "Score::renderSprite(): channel: %d,  castType: %d,  castId: %d", id, sprite->_castType, sprite->_castId);
+		if (sprite->_castType == kCastShape) {
+			renderShape(id);
+		} else {
+			Cast *cast = _sprites[id]->_cast;
+			if (cast && cast->_widget) {
+				cast->_widget->_priority = id;
+				cast->_widget->draw();
+				inkBasedBlit(cast->_widget->getMask(), cast->_widget->getSurface()->rawSurface(), _sprites[id]->_ink, _sprites[id]->_currentBbox, id);
+			} else {
+				warning("Score::renderSprite: No widget for channel ID %d", id);
+			}
+		}
+
+		sprite->setClean();
+	}
 
 	if (!updateStageOnly) {
 		_vm->_wm->renderZoomBox();
@@ -533,43 +561,6 @@ void Score::renderFrame(uint16 frameId, bool forceUpdate, bool updateStageOnly)
 	g_system->copyRectToScreen(_surface->getPixels(), _surface->pitch, 0, 0, _surface->getBounds().width(), _surface->getBounds().height());
 }
 
-void Score::unrenderSprite(uint16 spriteId) {
-	Sprite *currentSprite = _sprites[spriteId];
-
-	if (!currentSprite->_trails) {
-		_maskSurface->fillRect(currentSprite->_currentBbox, 1);
-		_surface->fillRect(currentSprite->_currentBbox, _stageColor);
-	}
-
-	currentSprite->_currentBbox = currentSprite->getBbox();
-}
-
-void Score::renderSprite(uint16 id) {
-	Sprite *sprite = _sprites[id];
-	SpriteChannel *channel = _spriteChannels[id];
-
-	if (!sprite || !sprite->_enabled || !channel->_visible || !sprite->_castType)
-		return;
-
-	sprite->updateCast();
-
-	debugC(1, kDebugImages, "Score::renderSprite(): channel: %d,  castType: %d,  castId: %d", id, sprite->_castType, sprite->_castId);
-	if (sprite->_castType == kCastShape) {
-		renderShape(id);
-	} else {
-		Cast *cast = _sprites[id]->_cast;
-		if (cast && cast->_widget) {
-			cast->_widget->_priority = id;
-			cast->_widget->draw();
-			inkBasedBlit(cast->_widget->getMask(), cast->_widget->getSurface()->rawSurface(), _sprites[id]->_ink, _sprites[id]->_currentBbox, id);
-		} else {
-			warning("Score::renderSprite: No widget for channel ID %d", id);
-		}
-	}
-
-	sprite->setClean();
-}
-
 void Score::renderShape(uint16 spriteId) {
 	Sprite *sp = _sprites[spriteId];
 
diff --git a/engines/director/score.h b/engines/director/score.h
index d9969fdabe..1eb98aafaf 100644
--- a/engines/director/score.h
+++ b/engines/director/score.h
@@ -133,8 +133,6 @@ public:
 	Cast *getCastMember(int castId);
 	const Stxt *getStxt(int castId);
 	void renderFrame(uint16 frameId, bool forceUpdate = false, bool updateStageOnly = false);
-	void renderSprite(uint16 id);
-	void unrenderSprite(uint16 spriteId);
 
 private:
 	void update();




More information about the Scummvm-git-logs mailing list