Fix bug in tools with TracePolicyLast: the old_dirty_area was accumulated between different ToolLoopManager loops

This commit is contained in:
David Capello 2013-02-18 21:21:30 -03:00
parent 9b8e87da10
commit f4d2b60948
2 changed files with 5 additions and 4 deletions

View File

@ -143,8 +143,6 @@ void ToolLoopManager::movement(const Pointer& pointer)
void ToolLoopManager::doLoopStep(bool last_step)
{
static Region old_dirty_area; // TODO Not thread safe
Points points_to_interwine;
if (!last_step)
m_toolLoop->getController()->getPointsToInterwine(m_points, points_to_interwine);
@ -186,8 +184,9 @@ void ToolLoopManager::doLoopStep(bool last_step)
calculateDirtyArea(m_toolLoop, points_to_interwine, dirty_area);
if (m_toolLoop->getTracePolicy() == TracePolicyLast) {
dirty_area.createUnion(dirty_area, old_dirty_area);
old_dirty_area = dirty_area;
Region prev_dirty_area = dirty_area;
dirty_area.createUnion(dirty_area, m_oldDirtyArea);
m_oldDirtyArea = prev_dirty_area;
}
if (!dirty_area.isEmpty())

View File

@ -22,6 +22,7 @@
#include <vector>
#include "gfx/point.h"
#include "gfx/region.h"
namespace gfx { class Region; }
@ -109,6 +110,7 @@ private:
ToolLoop* m_toolLoop;
Points m_points;
gfx::Point m_oldPoint;
gfx::Region m_oldDirtyArea;
};
} // namespace tools