[aseprite] 161/308: Don't scroll invalid areas in Widget::scrollRegion()

Tobias Hansen thansen at moszumanska.debian.org
Tue Mar 8 02:45:06 UTC 2016


This is an automated email from the git hooks/post-receive script.

thansen pushed a commit to branch master
in repository aseprite.

commit 199a3db278d25f99583a86df465ebb655bab817a
Author: David Capello <davidcapello at gmail.com>
Date:   Mon Dec 28 13:37:01 2015 -0300

    Don't scroll invalid areas in Widget::scrollRegion()
---
 src/ui/widget.cpp | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/ui/widget.cpp b/src/ui/widget.cpp
index 5266fa0..f5276ac 100644
--- a/src/ui/widget.cpp
+++ b/src/ui/widget.cpp
@@ -1041,17 +1041,25 @@ void Widget::scrollRegion(const Region& region, const Point& delta)
   if (delta.x == 0 && delta.y == 0)
     return;
 
-  Region reg2 = region;
-  reg2.offset(delta);
-  reg2.createIntersection(reg2, region);
-
+  // The movable region includes the given region in the "region"
+  // parameter without the invalid widget region (i.e. m_updateRegion,
+  // as we cannot move invalid/non-updated screen areas), and
+  // intersecting with the moved "region" area (so we don't overlap
+  // regions outside the "region" parameters)
+  Region movable = region;
+  movable.createSubtraction(movable, m_updateRegion);
+  movable.offset(delta);
+  movable.createIntersection(movable, region);
+
+  // Now we invalidate the given "region" without the moved region
+  // ("movable" variable).
   m_updateRegion.createUnion(m_updateRegion, region);
-  m_updateRegion.createSubtraction(m_updateRegion, reg2);
+  m_updateRegion.createSubtraction(m_updateRegion, movable);
   mark_dirty_flag(this);
 
   // Move screen pixels
-  reg2.offset(-delta);
-  ui::move_region(manager(), reg2, delta.x, delta.y);
+  movable.offset(-delta);
+  ui::move_region(manager(), movable, delta.x, delta.y);
 
   // Generate the kPaintMessage messages for the widget's m_updateRegion
   flushRedraw();

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git



More information about the Pkg-games-commits mailing list