[Scummvm-git-logs] scummvm master -> c1e16a7e4debc307f06d6dbb02ab27d60ec53b0b

whiterandrek whiterandrek at gmail.com
Fri May 22 12:47:14 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:
c1e16a7e4d PETKA: optimized drawing when moving mouse in map and startup interfaces


Commit: c1e16a7e4debc307f06d6dbb02ab27d60ec53b0b
    https://github.com/scummvm/scummvm/commit/c1e16a7e4debc307f06d6dbb02ab27d60ec53b0b
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2020-05-22T15:46:41+03:00

Commit Message:
PETKA: optimized drawing when moving mouse in map and startup interfaces

Changed paths:
    engines/petka/interfaces/map.cpp
    engines/petka/interfaces/startup.cpp


diff --git a/engines/petka/interfaces/map.cpp b/engines/petka/interfaces/map.cpp
index eac614793d..d0876cfae1 100644
--- a/engines/petka/interfaces/map.cpp
+++ b/engines/petka/interfaces/map.cpp
@@ -123,17 +123,16 @@ void InterfaceMap::onMouseMove(const Common::Point p) {
 		if (obj->_resourceId != 4901 && obj->_resourceId != _roomResID) {
 			FlicDecoder *flc = g_vm->resMgr()->loadFlic(obj->_resourceId);
 			if (flc) {
-				int frame = 1;
+				bool show = false;
 				if (!found && obj->isInPoint(p.x, p.y)) {
 					found = true;
-					frame = 2;
+					show = true;
 					_objUnderCursor = obj;
 				}
-				if (obj->_frame != frame) {
-					obj->_isShown = frame == 2;
+				if (obj->_isShown != show) {
+					obj->_isShown = show;
 					flc->setFrame(1);
 					g_vm->videoSystem()->addDirtyRect(Common::Point(obj->_x, obj->_y), *flc);
-					obj->_frame = frame;
 				}
 			}
 		}
diff --git a/engines/petka/interfaces/startup.cpp b/engines/petka/interfaces/startup.cpp
index 7648dfd5b7..42d359844e 100644
--- a/engines/petka/interfaces/startup.cpp
+++ b/engines/petka/interfaces/startup.cpp
@@ -108,18 +108,18 @@ void InterfaceStartup::onMouseMove(const Common::Point p) {
 		if (obj->_resourceId != kStartupCursorId && obj->_resourceId != kBackgroundId) {
 			FlicDecoder *flc = g_vm->resMgr()->loadFlic(obj->_resourceId);
 			if (flc) {
-				bool clicked = false;
+				bool show = false;
 				if (!found && obj->isInPoint(p.x, p.y)) {
 					found = true;
-					clicked = true;
-					obj->_isShown = true;
+					show = true;
 					_objUnderCursor = obj;
 				}
-				obj->_isShown = clicked;
-				flc->setFrame(1);
-				Common::Rect dirty(flc->getBounds());
-				dirty.translate(obj->_x, obj->_y);
-				g_vm->videoSystem()->addDirtyRect(dirty);
+				if (obj->_isShown != show) {
+					obj->_isShown = show;
+					flc->setFrame(1);
+					Common::Rect dirty(flc->getBounds());
+					g_vm->videoSystem()->addDirtyRect(dirty);
+				}
 			}
 		}
 	}




More information about the Scummvm-git-logs mailing list