[Scummvm-git-logs] scummvm master -> 09c12a820ac1c307004732fdb2ecf90c8dc7b3e7

sev- sev at scummvm.org
Fri Aug 7 08:08:31 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:
09c12a820a GRAPHICS: MACGUI: Make sure MacText is updated on cursor change


Commit: 09c12a820ac1c307004732fdb2ecf90c8dc7b3e7
    https://github.com/scummvm/scummvm/commit/09c12a820ac1c307004732fdb2ecf90c8dc7b3e7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-08-07T10:07:32+02:00

Commit Message:
GRAPHICS: MACGUI: Make sure MacText is updated on cursor change

Changed paths:
    engines/director/channel.cpp
    graphics/macgui/mactext.cpp
    graphics/macgui/mactext.h
    graphics/macgui/macwidget.h


diff --git a/engines/director/channel.cpp b/engines/director/channel.cpp
index f6775aa152..68bed4609f 100644
--- a/engines/director/channel.cpp
+++ b/engines/director/channel.cpp
@@ -339,13 +339,12 @@ void Channel::replaceWidget() {
 		if (_widget) {
 			_widget->_priority = _priority;
 			_widget->draw();
-			_widget->_contentIsDirty = false;
 		}
 	}
 }
 
 bool Channel::updateWidget() {
-	if (_widget && _widget->_contentIsDirty) {
+	if (_widget && _widget->needsRedraw()) {
 		if (_sprite->_cast) {
 			_sprite->_cast->updateFromWidget(_widget);
 		}
diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 2560339c66..12efda3df0 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -857,7 +857,7 @@ void MacText::draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int
 }
 
 bool MacText::draw(bool forceRedraw) {
-	if (!_contentIsDirty && !_cursorDirty && !forceRedraw)
+	if (!needsRedraw() && !forceRedraw)
 		return false;
 
 	if (!_surface) {
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index 15e09dedb9..2f4e6b0547 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -146,6 +146,8 @@ public:
 	virtual void resize(int w, int h);
 	virtual bool processEvent(Common::Event &event) override;
 
+	virtual bool needsRedraw() override { return _contentIsDirty || _cursorDirty; }
+
 	void render();
 	void undrawCursor();
 	void draw(ManagedSurface *g, int x, int y, int w, int h, int xoff, int yoff);
diff --git a/graphics/macgui/macwidget.h b/graphics/macgui/macwidget.h
index b853c1498e..a25a7260e3 100644
--- a/graphics/macgui/macwidget.h
+++ b/graphics/macgui/macwidget.h
@@ -62,6 +62,8 @@ public:
 	 */
 	void setDirty(bool dirty) { _contentIsDirty = dirty; }
 
+	virtual bool needsRedraw() { return _contentIsDirty; }
+
 	virtual bool draw(ManagedSurface *g, bool forceRedraw = false);
 	virtual bool draw(bool forceRedraw = false);
 	virtual void blit(ManagedSurface *g, Common::Rect &dest);
@@ -91,9 +93,10 @@ protected:
 
 	Graphics::ManagedSurface *_composeSurface;
 
+	bool _contentIsDirty;
+
 public:
 	bool _focusable;
-	bool _contentIsDirty;
 	bool _active;
 	bool _editable;
 	uint _priority;




More information about the Scummvm-git-logs mailing list