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

dreammaster dreammaster at scummvm.org
Thu Jul 9 01:11:50 CEST 2015


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:
b7c2c345e3 SHERLOCK: RT: Fix display of tooltips in scrolled scenes


Commit: b7c2c345e318e1d359b0ce64c8b2d898e37b5e73
    https://github.com/scummvm/scummvm/commit/b7c2c345e318e1d359b0ce64c8b2d898e37b5e73
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-07-08T19:10:42-04:00

Commit Message:
SHERLOCK: RT: Fix display of tooltips in scrolled scenes

Changed paths:
    engines/sherlock/tattoo/widget_base.cpp
    engines/sherlock/tattoo/widget_tooltip.cpp



diff --git a/engines/sherlock/tattoo/widget_base.cpp b/engines/sherlock/tattoo/widget_base.cpp
index cdebe69..905dd31 100644
--- a/engines/sherlock/tattoo/widget_base.cpp
+++ b/engines/sherlock/tattoo/widget_base.cpp
@@ -143,12 +143,12 @@ Common::String WidgetBase::splitLines(const Common::String &str, Common::StringA
 void WidgetBase::restrictToScreen() {
 	Screen &screen = *_vm->_screen;
 
-	if (_bounds.left < 0)
-		_bounds.moveTo(0, _bounds.top);
+	if (_bounds.left < screen._currentScroll.x)
+		_bounds.moveTo(screen._currentScroll.x, _bounds.top);
 	if (_bounds.top < 0)
 		_bounds.moveTo(_bounds.left, 0);
-	if (_bounds.right > screen._backBuffer1.w())
-		_bounds.moveTo(screen._backBuffer1.w() - _bounds.width(), _bounds.top);
+	if (_bounds.right > SHERLOCK_SCENE_WIDTH)
+		_bounds.moveTo(SHERLOCK_SCENE_WIDTH - _bounds.width(), _bounds.top);
 	if (_bounds.bottom > SHERLOCK_SCREEN_HEIGHT)
 		_bounds.moveTo(_bounds.left, SHERLOCK_SCREEN_HEIGHT - _bounds.height());
 }
diff --git a/engines/sherlock/tattoo/widget_tooltip.cpp b/engines/sherlock/tattoo/widget_tooltip.cpp
index 7e211bb..b1c13c7 100644
--- a/engines/sherlock/tattoo/widget_tooltip.cpp
+++ b/engines/sherlock/tattoo/widget_tooltip.cpp
@@ -39,6 +39,8 @@ void WidgetTooltipBase::draw() {
 		erase();
 
 	if (_bounds.width() > 0 && !_surface.empty()) {
+		restrictToScreen();
+
 		// Blit the affected area to the screen
 		screen.slamRect(_bounds);
 		
@@ -140,8 +142,8 @@ void WidgetTooltip::setText(const Common::String &str) {
 		}
 
 		// Set the initial display position for the tooltip text
-		int tagX = CLIP(mousePos.x - width / 2, 0, SHERLOCK_SCREEN_WIDTH - width);
-		int tagY = MAX(mousePos.y - height, 0);
+		int tagX = mousePos.x - width / 2;
+		int tagY = mousePos.y - height;
 
 		_bounds = Common::Rect(tagX, tagY, tagX + width, tagY + height);
 	} else {
@@ -158,8 +160,8 @@ void WidgetTooltip::handleEvents() {
 	Common::Point mousePos = events.mousePos();
 
 	// Set the new position for the tooltip
-	int xp = CLIP(mousePos.x - _bounds.width() / 2, 0, SHERLOCK_SCREEN_WIDTH - _bounds.width());
-	int yp = MAX(mousePos.y - _bounds.height(), 0);
+	int xp = mousePos.x - _bounds.width() / 2;
+	int yp = mousePos.y - _bounds.height();
 
 	_bounds.moveTo(xp, yp);
 }






More information about the Scummvm-git-logs mailing list