From d4a731c0f3a529bb9376f7ee532877e642f7aa6b Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Wed, 21 Sep 2011 19:21:08 -0400 Subject: PEGASUS: Fix updating elements when the bounds change --- engines/pegasus/elements.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/engines/pegasus/elements.cpp b/engines/pegasus/elements.cpp index faf46f780f..ea1ed8436c 100644 --- a/engines/pegasus/elements.cpp +++ b/engines/pegasus/elements.cpp @@ -71,10 +71,7 @@ void DisplayElement::stopDisplaying() { } void DisplayElement::setBounds(const tCoordType left, const tCoordType top, const tCoordType right, const tCoordType bottom) { - _bounds.left = left; - _bounds.top = top; - _bounds.right = right; - _bounds.bottom = bottom; + setBounds(Common::Rect(left, top, right, bottom)); } void DisplayElement::getBounds(Common::Rect &r) const { @@ -82,16 +79,22 @@ void DisplayElement::getBounds(Common::Rect &r) const { } void DisplayElement::sizeElement(const tCoordType h, const tCoordType v) { - _bounds.right = _bounds.left + h; - _bounds.bottom = _bounds.top + v; + Common::Rect newBounds = _bounds; + newBounds.right = _bounds.left + h; + newBounds.bottom = _bounds.top + v; + setBounds(newBounds); } void DisplayElement::moveElementTo(const tCoordType h, const tCoordType v) { - _bounds.moveTo(h, v); + Common::Rect newBounds = _bounds; + newBounds.moveTo(h, v); + setBounds(newBounds); } void DisplayElement::moveElement(const tCoordType dh, const tCoordType dv) { - _bounds.translate(dh, dv); + Common::Rect newBounds = _bounds; + newBounds.translate(dh, dv); + setBounds(newBounds); } void DisplayElement::getLocation(tCoordType &h, tCoordType &v) const { @@ -100,7 +103,9 @@ void DisplayElement::getLocation(tCoordType &h, tCoordType &v) const { } void DisplayElement::centerElementAt(const tCoordType h, const tCoordType v) { - _bounds.moveTo(h - (_bounds.width() / 2), v - (_bounds.height() / 2)); + Common::Rect newBounds = _bounds; + newBounds.moveTo(h - (_bounds.width() / 2), v - (_bounds.height() / 2)); + setBounds(newBounds); } void DisplayElement::getCenter(tCoordType &h, tCoordType &v) const { -- cgit v1.2.3