[aseprite] 215/250: Reduce dirty area when symmetry mode is enabled
Tobias Hansen
thansen at moszumanska.debian.org
Sun Dec 20 15:27:32 UTC 2015
This is an automated email from the git hooks/post-receive script.
thansen pushed a commit to branch master
in repository aseprite.
commit d75ac238e422297a30ab273158508471db1171a2
Author: David Capello <davidcapello at gmail.com>
Date: Thu Oct 29 16:24:20 2015 -0300
Reduce dirty area when symmetry mode is enabled
---
src/app/tools/stroke.h | 2 ++
src/app/tools/symmetry.h | 2 --
src/app/tools/tool_loop_manager.cpp | 17 +++++++++--------
src/app/tools/tool_loop_manager.h | 2 +-
4 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/src/app/tools/stroke.h b/src/app/tools/stroke.h
index 618ae0f..55eb63e 100644
--- a/src/app/tools/stroke.h
+++ b/src/app/tools/stroke.h
@@ -60,6 +60,8 @@ namespace app {
Points m_points;
};
+ typedef std::vector<Stroke> Strokes;
+
} // namespace tools
} // namespace app
diff --git a/src/app/tools/symmetry.h b/src/app/tools/symmetry.h
index 84faae6..d1368dd 100644
--- a/src/app/tools/symmetry.h
+++ b/src/app/tools/symmetry.h
@@ -16,8 +16,6 @@
namespace app {
namespace tools {
- typedef std::vector<Stroke> Strokes;
-
// This class controls user input.
class Symmetry {
public:
diff --git a/src/app/tools/tool_loop_manager.cpp b/src/app/tools/tool_loop_manager.cpp
index eccb1bc..a0f136a 100644
--- a/src/app/tools/tool_loop_manager.cpp
+++ b/src/app/tools/tool_loop_manager.cpp
@@ -170,6 +170,7 @@ void ToolLoopManager::doLoopStep(bool last_step)
m_toolLoop->getController()->getStrokeToInterwine(m_stroke, main_stroke);
else
main_stroke = m_stroke;
+
main_stroke.offset(m_toolLoop->getOffset());
// Apply symmetry
@@ -181,11 +182,7 @@ void ToolLoopManager::doLoopStep(bool last_step)
strokes.push_back(main_stroke);
// Calculate the area to be updated in all document observers.
- gfx::Rect strokeBounds;
- for (const Stroke& stroke : strokes)
- strokeBounds |= stroke.bounds();
-
- calculateDirtyArea(strokeBounds);
+ calculateDirtyArea(strokes);
// Validate source image area.
if (m_toolLoop->getInk()->needsSpecialSourceArea()) {
@@ -214,7 +211,7 @@ void ToolLoopManager::doLoopStep(bool last_step)
m_toolLoop->validateDstImage(m_dirtyArea);
// Get the modified area in the sprite with this intertwined set of points
- for (const Stroke& stroke : strokes) {
+ for (Stroke& stroke : strokes) {
if (!m_toolLoop->getFilled() || (!last_step && !m_toolLoop->getPreviewFilled()))
m_toolLoop->getIntertwine()->joinStroke(m_toolLoop, stroke);
else
@@ -241,7 +238,7 @@ void ToolLoopManager::snapToGrid(Point& point)
point = snap_to_grid(m_toolLoop->getGridBounds(), point);
}
-void ToolLoopManager::calculateDirtyArea(const gfx::Rect& strokeBounds)
+void ToolLoopManager::calculateDirtyArea(const Strokes& strokes)
{
// Save the current dirty area if it's needed
Region prevDirtyArea;
@@ -251,7 +248,11 @@ void ToolLoopManager::calculateDirtyArea(const gfx::Rect& strokeBounds)
// Start with a fresh dirty area
m_dirtyArea.clear();
- if (!strokeBounds.isEmpty()) {
+ for (auto& stroke : strokes) {
+ gfx::Rect strokeBounds = stroke.bounds();
+ if (strokeBounds.isEmpty())
+ continue;
+
// Expand the dirty-area with the pen width
Rect r1, r2;
diff --git a/src/app/tools/tool_loop_manager.h b/src/app/tools/tool_loop_manager.h
index a3462e2..500f777 100644
--- a/src/app/tools/tool_loop_manager.h
+++ b/src/app/tools/tool_loop_manager.h
@@ -90,7 +90,7 @@ namespace app {
void doLoopStep(bool last_step);
void snapToGrid(gfx::Point& point);
- void calculateDirtyArea(const gfx::Rect& strokeBounds);
+ void calculateDirtyArea(const Strokes& strokes);
ToolLoop* m_toolLoop;
Stroke m_stroke;
--
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