[Scummvm-cvs-logs] scummvm master -> f9595b11fc2bef08d84a00b81f9b2884f77897b0

bluegr bluegr at gmail.com
Fri Dec 26 22:20:05 CET 2014


This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
db37cfb1b0 ZVISION: Remove duplicate blitting code for images and animations
a9701d04c1 ZVISION: Remove duplicate image loading code
85142cd0d7 ZVISION: Remove duplicate subtitle code
19ce38d40e ZVISION: Turn off subtitles, if requested
f9595b11fc ZVISION: Add an FPS timer (accessible with F10, or the "FRAME" cheat)


Commit: db37cfb1b04fb6d1fb21ef3bd3c0b90128bf4d89
    https://github.com/scummvm/scummvm/commit/db37cfb1b04fb6d1fb21ef3bd3c0b90128bf4d89
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-12-26T22:30:32+02:00

Commit Message:
ZVISION: Remove duplicate blitting code for images and animations

Changed paths:
    engines/zvision/graphics/render_manager.cpp
    engines/zvision/graphics/render_manager.h
    engines/zvision/scripting/actions.cpp
    engines/zvision/scripting/sidefx/animation_node.cpp
    engines/zvision/text/text.cpp



diff --git a/engines/zvision/graphics/render_manager.cpp b/engines/zvision/graphics/render_manager.cpp
index 0a48ae6..7bbde81 100644
--- a/engines/zvision/graphics/render_manager.cpp
+++ b/engines/zvision/graphics/render_manager.cpp
@@ -104,7 +104,8 @@ void RenderManager::renderSceneToScreen() {
 					post = (*it)->draw(_currentBackgroundImage.getSubArea(rect));
 				else
 					post = (*it)->draw(_effectSurface.getSubArea(rect));
-				blitSurfaceToSurface(*post, _effectSurface, screenSpaceLocation.left, screenSpaceLocation.top);
+				Common::Rect empty;
+				blitSurfaceToSurface(*post, empty, _effectSurface, screenSpaceLocation.left, screenSpaceLocation.top);
 				screenSpaceLocation.clip(windowRect);
 				if (_backgroundSurfaceDirtyRect .isEmpty()) {
 					_backgroundSurfaceDirtyRect = screenSpaceLocation;
@@ -511,30 +512,12 @@ void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, const Com
 	delete srcAdapted;
 }
 
-void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, Graphics::Surface &dst, int x, int y) {
+void RenderManager::blitSurfaceToBkg(const Graphics::Surface &src, int x, int y, int32 colorkey) {
 	Common::Rect empt;
-	blitSurfaceToSurface(src, empt, dst, x, y);
-}
-
-void RenderManager::blitSurfaceToSurface(const Graphics::Surface &src, Graphics::Surface &dst, int x, int y, uint32 colorkey) {
-	Common::Rect empt;
-	blitSurfaceToSurface(src, empt, dst, x, y, colorkey);
-}
-
-void RenderManager::blitSurfaceToBkg(const Graphics::Surface &src, int x, int y) {
-	Common::Rect empt;
-	blitSurfaceToSurface(src, empt, _currentBackgroundImage, x, y);
-	Common::Rect dirty(src.w, src.h);
-	dirty.translate(x, y);
-	if (_backgroundDirtyRect.isEmpty())
-		_backgroundDirtyRect = dirty;
+	if (colorkey >= 0)
+		blitSurfaceToSurface(src, empt, _currentBackgroundImage, x, y, colorkey);
 	else
-		_backgroundDirtyRect.extend(dirty);
-}
-
-void RenderManager::blitSurfaceToBkg(const Graphics::Surface &src, int x, int y, uint32 colorkey) {
-	Common::Rect empt;
-	blitSurfaceToSurface(src, empt, _currentBackgroundImage, x, y, colorkey);
+		blitSurfaceToSurface(src, empt, _currentBackgroundImage, x, y);
 	Common::Rect dirty(src.w, src.h);
 	dirty.translate(x, y);
 	if (_backgroundDirtyRect.isEmpty())
@@ -543,23 +526,10 @@ void RenderManager::blitSurfaceToBkg(const Graphics::Surface &src, int x, int y,
 		_backgroundDirtyRect.extend(dirty);
 }
 
-void RenderManager::blitSurfaceToBkgScaled(const Graphics::Surface &src, const Common::Rect &_dstRect) {
-	if (src.w == _dstRect.width() && src.h == _dstRect.height())
-		blitSurfaceToBkg(src, _dstRect.left, _dstRect.top);
-	else {
-		Graphics::Surface *tmp = new Graphics::Surface;
-		tmp->create(_dstRect.width(), _dstRect.height(), src.format);
-		scaleBuffer(src.getPixels(), tmp->getPixels(), src.w, src.h, src.format.bytesPerPixel, _dstRect.width(), _dstRect.height());
-		blitSurfaceToBkg(*tmp, _dstRect.left, _dstRect.top);
-		tmp->free();
-		delete tmp;
-	}
-}
-
-void RenderManager::blitSurfaceToBkgScaled(const Graphics::Surface &src, const Common::Rect &_dstRect, uint32 colorkey) {
-	if (src.w == _dstRect.width() && src.h == _dstRect.height())
+void RenderManager::blitSurfaceToBkgScaled(const Graphics::Surface &src, const Common::Rect &_dstRect, int32 colorkey) {
+	if (src.w == _dstRect.width() && src.h == _dstRect.height()) {
 		blitSurfaceToBkg(src, _dstRect.left, _dstRect.top, colorkey);
-	else {
+	} else {
 		Graphics::Surface *tmp = new Graphics::Surface;
 		tmp->create(_dstRect.width(), _dstRect.height(), src.format);
 		scaleBuffer(src.getPixels(), tmp->getPixels(), src.w, src.h, src.format.bytesPerPixel, _dstRect.width(), _dstRect.height());
@@ -569,20 +539,12 @@ void RenderManager::blitSurfaceToBkgScaled(const Graphics::Surface &src, const C
 	}
 }
 
-void RenderManager::blitSurfaceToMenu(const Graphics::Surface &src, int x, int y) {
+void RenderManager::blitSurfaceToMenu(const Graphics::Surface &src, int x, int y, int32 colorkey) {
 	Common::Rect empt;
-	blitSurfaceToSurface(src, empt, _menuSurface, x, y);
-	Common::Rect dirty(src.w, src.h);
-	dirty.translate(x, y);
-	if (_menuSurfaceDirtyRect.isEmpty())
-		_menuSurfaceDirtyRect = dirty;
+	if (colorkey >= 0)
+		blitSurfaceToSurface(src, empt, _menuSurface, x, y, colorkey);
 	else
-		_menuSurfaceDirtyRect.extend(dirty);
-}
-
-void RenderManager::blitSurfaceToMenu(const Graphics::Surface &src, int x, int y, uint32 colorkey) {
-	Common::Rect empt;
-	blitSurfaceToSurface(src, empt, _menuSurface, x, y, colorkey);
+		blitSurfaceToSurface(src, empt, _menuSurface, x, y);
 	Common::Rect dirty(src.w, src.h);
 	dirty.translate(x, y);
 	if (_menuSurfaceDirtyRect.isEmpty())
@@ -803,7 +765,8 @@ void RenderManager::processSubs(uint16 deltatime) {
 				Graphics::Surface *rndr = new Graphics::Surface();
 				rndr->create(sub->r.width(), sub->r.height(), _engine->_resourcePixelFormat);
 				_engine->getTextRenderer()->drawTxtInOneLine(sub->txt, *rndr);
-				blitSurfaceToSurface(*rndr, _subtitleSurface, sub->r.left - _subtitleArea.left + _workingWindow.left, sub->r.top - _subtitleArea.top + _workingWindow.top);
+				Common::Rect empty;
+				blitSurfaceToSurface(*rndr, empty, _subtitleSurface, sub->r.left - _subtitleArea.left + _workingWindow.left, sub->r.top - _subtitleArea.top + _workingWindow.top);
 				rndr->free();
 				delete rndr;
 			}
diff --git a/engines/zvision/graphics/render_manager.h b/engines/zvision/graphics/render_manager.h
index 30e5145..a7e49b7 100644
--- a/engines/zvision/graphics/render_manager.h
+++ b/engines/zvision/graphics/render_manager.h
@@ -230,20 +230,15 @@ public:
 	// Blitting surface-to-surface methods
 	void blitSurfaceToSurface(const Graphics::Surface &src, const Common::Rect &_srcRect , Graphics::Surface &dst, int x, int y);
 	void blitSurfaceToSurface(const Graphics::Surface &src, const Common::Rect &_srcRect , Graphics::Surface &dst, int _x, int _y, uint32 colorkey);
-	void blitSurfaceToSurface(const Graphics::Surface &src, Graphics::Surface &dst, int x, int y);
-	void blitSurfaceToSurface(const Graphics::Surface &src, Graphics::Surface &dst, int x, int y, uint32 colorkey);
 
 	// Blitting surface-to-background methods
-	void blitSurfaceToBkg(const Graphics::Surface &src, int x, int y);
-	void blitSurfaceToBkg(const Graphics::Surface &src, int x, int y, uint32 colorkey);
+	void blitSurfaceToBkg(const Graphics::Surface &src, int x, int y, int32 colorkey = -1);
 
 	// Blitting surface-to-background methods with scale
-	void blitSurfaceToBkgScaled(const Graphics::Surface &src, const Common::Rect &_dstRect);
-	void blitSurfaceToBkgScaled(const Graphics::Surface &src, const Common::Rect &_dstRect, uint32 colorkey);
+	void blitSurfaceToBkgScaled(const Graphics::Surface &src, const Common::Rect &_dstRect, int32 colorkey = -1);
 
 	// Blitting surface-to-menu methods
-	void blitSurfaceToMenu(const Graphics::Surface &src, int x, int y);
-	void blitSurfaceToMenu(const Graphics::Surface &src, int x, int y, uint32 colorkey);
+	void blitSurfaceToMenu(const Graphics::Surface &src, int x, int y, int32 colorkey = -1);
 
 	// Subtitles methods
 
diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp
index 7c3463b..a914767 100644
--- a/engines/zvision/scripting/actions.cpp
+++ b/engines/zvision/scripting/actions.cpp
@@ -566,6 +566,12 @@ ActionPreloadAnimation::ActionPreloadAnimation(ZVision *engine, int32 slotkey, c
 	// The two %*u are usually 0 and dont seem to have a use
 	sscanf(line.c_str(), "%24s %*u %*u %d %d", fileName, &_mask, &_framerate);
 
+	// Mask 0 means "no transparency" in this case. Since we use a common blitting
+	// code for images and animations, we set it to -1 to avoid confusion with
+	// color 0, which is used as a mask in some images
+	if (_mask == 0)
+		_mask = -1;
+
 	_fileName = Common::String(fileName);
 }
 
@@ -628,6 +634,12 @@ ActionPlayAnimation::ActionPlayAnimation(ZVision *engine, int32 slotkey, const C
 	       "%24s %u %u %u %u %u %u %d %*u %*u %d %d",
 	       fileName, &_x, &_y, &_x2, &_y2, &_start, &_end, &_loopCount, &_mask, &_framerate);
 
+	// Mask 0 means "no transparency" in this case. Since we use a common blitting
+	// code for images and animations, we set it to -1 to avoid confusion with
+	// color 0, which is used as a mask in some images
+	if (_mask == 0)
+		_mask = -1;
+
 	_fileName = Common::String(fileName);
 }
 
diff --git a/engines/zvision/scripting/sidefx/animation_node.cpp b/engines/zvision/scripting/sidefx/animation_node.cpp
index b966aa9..7759758 100644
--- a/engines/zvision/scripting/sidefx/animation_node.cpp
+++ b/engines/zvision/scripting/sidefx/animation_node.cpp
@@ -154,17 +154,11 @@ bool AnimationNode::process(uint32 deltaTimeInMillis) {
 
 				if (_engine->getRenderManager()->getRenderTable()->getRenderState() == RenderTable::PANORAMA) {
 					Graphics::Surface *transposed = RenderManager::tranposeSurface(frame);
-					if (_mask > 0)
-						_engine->getRenderManager()->blitSurfaceToBkg(*transposed, nod->pos.left, nod->pos.top, _mask);
-					else
-						_engine->getRenderManager()->blitSurfaceToBkg(*transposed, nod->pos.left, nod->pos.top);
+					_engine->getRenderManager()->blitSurfaceToBkg(*transposed, nod->pos.left, nod->pos.top, _mask);
 					transposed->free();
 					delete transposed;
 				} else {
-					if (_mask > 0)
-						_engine->getRenderManager()->blitSurfaceToBkg(*frame, nod->pos.left, nod->pos.top, _mask);
-					else
-						_engine->getRenderManager()->blitSurfaceToBkg(*frame, nod->pos.left, nod->pos.top);
+					_engine->getRenderManager()->blitSurfaceToBkg(*frame, nod->pos.left, nod->pos.top, _mask);
 				}
 			}
 		}
diff --git a/engines/zvision/text/text.cpp b/engines/zvision/text/text.cpp
index f28ba6a..a5ed044 100644
--- a/engines/zvision/text/text.cpp
+++ b/engines/zvision/text/text.cpp
@@ -462,15 +462,16 @@ void TextRenderer::drawTxtInOneLine(const Common::String &text, Graphics::Surfac
 			j++;
 		}
 		dx = 0;
+		Common::Rect empty;
 		for (int32 jj = 0; jj < j; jj++) {
 			if (TxtJustify[i] == TXT_JUSTIFY_LEFT)
-				_engine->getRenderManager()->blitSurfaceToSurface(*TxtSurfaces[i][jj], dst, dx, dy + TxtPoint[i] - TxtSurfaces[i][jj]->h, 0);
+				_engine->getRenderManager()->blitSurfaceToSurface(*TxtSurfaces[i][jj], empty, dst, dx, dy + TxtPoint[i] - TxtSurfaces[i][jj]->h, 0);
 
 			else if (TxtJustify[i] == TXT_JUSTIFY_CENTER)
-				_engine->getRenderManager()->blitSurfaceToSurface(*TxtSurfaces[i][jj], dst, ((dst.w - width) / 2) + dx,  dy + TxtPoint[i] - TxtSurfaces[i][jj]->h, 0);
+				_engine->getRenderManager()->blitSurfaceToSurface(*TxtSurfaces[i][jj], empty, dst, ((dst.w - width) / 2) + dx,  dy + TxtPoint[i] - TxtSurfaces[i][jj]->h, 0);
 
 			else if (TxtJustify[i] == TXT_JUSTIFY_RIGHT)
-				_engine->getRenderManager()->blitSurfaceToSurface(*TxtSurfaces[i][jj], dst, dst.w - width + dx, dy + TxtPoint[i] - TxtSurfaces[i][jj]->h, 0);
+				_engine->getRenderManager()->blitSurfaceToSurface(*TxtSurfaces[i][jj], empty, dst, dst.w - width + dx, dy + TxtPoint[i] - TxtSurfaces[i][jj]->h, 0);
 
 			dx += TxtSurfaces[i][jj]->w;
 		}


Commit: a9701d04c17b6f565e5602f12546bfe7aa2848af
    https://github.com/scummvm/scummvm/commit/a9701d04c17b6f565e5602f12546bfe7aa2848af
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-12-26T22:35:02+02:00

Commit Message:
ZVISION: Remove duplicate image loading code

Changed paths:
    engines/zvision/graphics/render_manager.cpp
    engines/zvision/graphics/render_manager.h



diff --git a/engines/zvision/graphics/render_manager.cpp b/engines/zvision/graphics/render_manager.cpp
index 7bbde81..73483f2 100644
--- a/engines/zvision/graphics/render_manager.cpp
+++ b/engines/zvision/graphics/render_manager.cpp
@@ -568,28 +568,18 @@ Graphics::Surface *RenderManager::getBkgRect(Common::Rect &rect) {
 	return srf;
 }
 
-Graphics::Surface *RenderManager::loadImage(Common::String &file) {
+Graphics::Surface *RenderManager::loadImage(Common::String file) {
 	Graphics::Surface *tmp = new Graphics::Surface;
 	readImageToSurface(file, *tmp);
 	return tmp;
 }
 
-Graphics::Surface *RenderManager::loadImage(const char *file) {
-	Common::String str = Common::String(file);
-	return loadImage(str);
-}
-
-Graphics::Surface *RenderManager::loadImage(Common::String &file, bool transposed) {
+Graphics::Surface *RenderManager::loadImage(Common::String file, bool transposed) {
 	Graphics::Surface *tmp = new Graphics::Surface;
 	readImageToSurface(file, *tmp, transposed);
 	return tmp;
 }
 
-Graphics::Surface *RenderManager::loadImage(const char *file, bool transposed) {
-	Common::String str = Common::String(file);
-	return loadImage(str, transposed);
-}
-
 void RenderManager::prepareBackground() {
 	_backgroundDirtyRect.clip(_backgroundWidth, _backgroundHeight);
 	RenderTable::RenderState state = _renderTable.getRenderState();
diff --git a/engines/zvision/graphics/render_manager.h b/engines/zvision/graphics/render_manager.h
index a7e49b7..d9a6c88 100644
--- a/engines/zvision/graphics/render_manager.h
+++ b/engines/zvision/graphics/render_manager.h
@@ -263,10 +263,8 @@ public:
 	Graphics::Surface *getBkgRect(Common::Rect &rect);
 
 	// Load image into new surface
-	Graphics::Surface *loadImage(const char *file);
-	Graphics::Surface *loadImage(Common::String &file);
-	Graphics::Surface *loadImage(const char *file, bool transposed);
-	Graphics::Surface *loadImage(Common::String &file, bool transposed);
+	Graphics::Surface *loadImage(Common::String file);
+	Graphics::Surface *loadImage(Common::String file, bool transposed);
 
 	// Clear whole/area of menu surface
 	void clearMenuSurface();


Commit: 85142cd0d7fb6e24fc45b2c61611f848b8c4a102
    https://github.com/scummvm/scummvm/commit/85142cd0d7fb6e24fc45b2c61611f848b8c4a102
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-12-26T22:48:58+02:00

Commit Message:
ZVISION: Remove duplicate subtitle code

Changed paths:
    engines/zvision/graphics/render_manager.cpp



diff --git a/engines/zvision/graphics/render_manager.cpp b/engines/zvision/graphics/render_manager.cpp
index 73483f2..4f7b16c 100644
--- a/engines/zvision/graphics/render_manager.cpp
+++ b/engines/zvision/graphics/render_manager.cpp
@@ -698,18 +698,9 @@ uint16 RenderManager::createSubArea(const Common::Rect &area) {
 }
 
 uint16 RenderManager::createSubArea() {
-	_subid++;
-
-	OneSubtitle sub;
-	sub.redraw = false;
-	sub.timer = -1;
-	sub.todelete = false;
-	sub.r = Common::Rect(_subtitleArea.left, _subtitleArea.top, _subtitleArea.right, _subtitleArea.bottom);
-	sub.r.translate(-_workingWindow.left, -_workingWindow.top);
-
-	_subsList[_subid] = sub;
-
-	return _subid;
+	Common::Rect r(_subtitleArea.left, _subtitleArea.top, _subtitleArea.right, _subtitleArea.bottom);
+	r.translate(-_workingWindow.left, -_workingWindow.top);
+	return createSubArea(r);
 }
 
 void RenderManager::deleteSubArea(uint16 id) {


Commit: 19ce38d40e9f273335b06a62bcb0d3643602080c
    https://github.com/scummvm/scummvm/commit/19ce38d40e9f273335b06a62bcb0d3643602080c
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-12-26T22:51:33+02:00

Commit Message:
ZVISION: Turn off subtitles, if requested

Changed paths:
    engines/zvision/graphics/render_manager.cpp



diff --git a/engines/zvision/graphics/render_manager.cpp b/engines/zvision/graphics/render_manager.cpp
index 4f7b16c..4f26123 100644
--- a/engines/zvision/graphics/render_manager.cpp
+++ b/engines/zvision/graphics/render_manager.cpp
@@ -737,7 +737,7 @@ void RenderManager::processSubs(uint16 deltatime) {
 		}
 	}
 
-	if (redraw) {
+	if (redraw && _engine->getScriptManager()->getStateValue(StateKey_Subtitles) == 1) {
 		_subtitleSurface.fillRect(Common::Rect(_subtitleSurface.w, _subtitleSurface.h), 0);
 
 		for (SubtitleMap::iterator it = _subsList.begin(); it != _subsList.end(); it++) {


Commit: f9595b11fc2bef08d84a00b81f9b2884f77897b0
    https://github.com/scummvm/scummvm/commit/f9595b11fc2bef08d84a00b81f9b2884f77897b0
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2014-12-26T23:18:54+02:00

Commit Message:
ZVISION: Add an FPS timer (accessible with F10, or the "FRAME" cheat)

Changed paths:
    engines/zvision/core/events.cpp
    engines/zvision/zvision.cpp
    engines/zvision/zvision.h



diff --git a/engines/zvision/core/events.cpp b/engines/zvision/core/events.cpp
index 4438474..7804130 100644
--- a/engines/zvision/core/events.cpp
+++ b/engines/zvision/core/events.cpp
@@ -158,15 +158,18 @@ void ZVision::cheatCodes(uint8 key) {
 		}
 	}
 
-	if (checkCode("FRAME"))
-		_renderManager->showDebugMsg(Common::String::format("FPS: ???, not implemented"));
+	if (checkCode("FRAME")) {
+		Common::String fpsStr = Common::String::format("FPS: %d", getFPS());
+		_renderManager->showDebugMsg(fpsStr);
+	}
+
+	if (checkCode("COMPUTERARCH"))
+		_renderManager->showDebugMsg("COMPUTERARCH: var-viewer not implemented");
 
+	// This cheat essentially toggles the GOxxxx cheat below
 	if (checkCode("XYZZY"))
 		_scriptManager->setStateValue(StateKey_DebugCheats, 1 - _scriptManager->getStateValue(StateKey_DebugCheats));
 
-	if (checkCode("COMPUTERARCH"))
-		_renderManager->showDebugMsg(Common::String::format("COMPUTERARCH: var-viewer not implemented"));
-
 	if (_scriptManager->getStateValue(StateKey_DebugCheats) == 1)
 		if (checkCode("GO????"))
 			_scriptManager->changeLocation(getBufferedKey(3),
@@ -240,6 +243,11 @@ void ZVision::processEvents() {
 					                     _scriptManager->getStateValue(StateKey_KbdRotateSpeed)) * 2;
 				break;
 
+			case Common::KEYCODE_F10: {
+				Common::String fpsStr = Common::String::format("FPS: %d", getFPS());
+				_renderManager->showDebugMsg(fpsStr);
+				}
+				break;
 			default:
 				break;
 			}
diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp
index b3fc02e..615574b 100644
--- a/engines/zvision/zvision.cpp
+++ b/engines/zvision/zvision.cpp
@@ -101,7 +101,9 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc)
 	  _frameRenderDelay(2),
 	  _keyboardVelocity(0),
 	  _mouseVelocity(0),
-	  _videoIsPlaying(false) {
+	  _videoIsPlaying(false),
+	  _renderedFrameCount(0),
+	  _fps(0) {
 
 	debug(1, "ZVision::ZVision");
 
@@ -130,6 +132,8 @@ ZVision::~ZVision() {
 	delete _rnd;
 	delete _midiManager;
 
+	getTimerManager()->removeTimerProc(&fpsTimerCallback);
+
 	// Remove all of our debug levels
 	DebugMan.clearAllDebugChannels();
 }
@@ -214,6 +218,9 @@ void ZVision::initialize() {
 	// Create debugger console. It requires GFX to be initialized
 	_console = new Console(this);
 	_doubleFPS = ConfMan.getBool("doublefps");
+
+	// Initialize FPS timer callback
+	getTimerManager()->installTimerProc(&fpsTimerCallback, 1000000, this, "zvisionFPS");
 }
 
 Common::Error ZVision::run() {
@@ -246,6 +253,7 @@ Common::Error ZVision::run() {
 		// Update the screen
 		if (canRender()) {
 			_system->updateScreen();
+			_renderedFrameCount++;
 		} else {
 			_frameRenderDelay--;
 		}
@@ -291,4 +299,13 @@ bool ZVision::canRender() {
 	return _frameRenderDelay <= 0;
 }
 
+void ZVision::fpsTimerCallback(void *refCon) {
+	((ZVision *)refCon)->fpsTimer();
+}
+
+void ZVision::fpsTimer() {
+	_fps = _renderedFrameCount;
+	_renderedFrameCount = 0;
+}
+
 } // End of namespace ZVision
diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h
index 6664d0c..5482060 100644
--- a/engines/zvision/zvision.h
+++ b/engines/zvision/zvision.h
@@ -119,6 +119,8 @@ private:
 	Common::Event _event;
 
 	int _frameRenderDelay;
+	int _renderedFrameCount;
+	int _fps;
 	int16 _mouseVelocity;
 	int16 _keyboardVelocity;
 	bool _doubleFPS;
@@ -197,6 +199,11 @@ public:
 
 	void setRenderDelay(uint);
 	bool canRender();
+	static void fpsTimerCallback(void *refCon);
+	void fpsTimer();
+	int getFPS() const {
+		return _fps;
+	}
 
 	void loadSettings();
 	void saveSettings();






More information about the Scummvm-git-logs mailing list