[aseprite] 217/250: Apply symmetry at the doPointshapePoint() level

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 f4373ffbc5e6a44059d595c8ad2c955e6ee172e6
Author: David Capello <davidcapello at gmail.com>
Date:   Thu Oct 29 17:01:43 2015 -0300

    Apply symmetry at the doPointshapePoint() level
    
    This fixes the pixel-perfect mode (when symmetry is enabled) as it
    expects only one joinPoints() call.
---
 src/app/tools/intertwine.cpp        | 17 ++++++++++++++++-
 src/app/tools/tool_loop_manager.cpp | 15 ++++++---------
 2 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/src/app/tools/intertwine.cpp b/src/app/tools/intertwine.cpp
index 9aaf965..3cb2c97 100644
--- a/src/app/tools/intertwine.cpp
+++ b/src/app/tools/intertwine.cpp
@@ -12,6 +12,8 @@
 #include "app/tools/intertwine.h"
 
 #include "app/tools/point_shape.h"
+#include "app/tools/stroke.h"
+#include "app/tools/symmetry.h"
 #include "app/tools/tool_loop.h"
 #include "doc/algo.h"
 
@@ -23,7 +25,20 @@ using namespace doc;
 
 void Intertwine::doPointshapePoint(int x, int y, ToolLoop* loop)
 {
-  loop->getPointShape()->transformPoint(loop, x, y);
+  Symmetry* symmetry = loop->getSymmetry();
+  if (symmetry) {
+    Stroke main_stroke;
+    main_stroke.addPoint(gfx::Point(x, y));
+
+    Strokes strokes;
+    symmetry->generateStrokes(main_stroke, strokes);
+    for (const auto& stroke : strokes)
+      loop->getPointShape()->transformPoint(
+        loop, stroke[0].x, stroke[0].y);
+  }
+  else {
+    loop->getPointShape()->transformPoint(loop, x, y);
+  }
 }
 
 void Intertwine::doPointshapeHline(int x1, int y, int x2, ToolLoop* loop)
diff --git a/src/app/tools/tool_loop_manager.cpp b/src/app/tools/tool_loop_manager.cpp
index a0f136a..ce858b4 100644
--- a/src/app/tools/tool_loop_manager.cpp
+++ b/src/app/tools/tool_loop_manager.cpp
@@ -173,7 +173,7 @@ void ToolLoopManager::doLoopStep(bool last_step)
 
   main_stroke.offset(m_toolLoop->getOffset());
 
-  // Apply symmetry
+  // Calculate the area to be updated in all document observers.
   Symmetry* symmetry = m_toolLoop->getSymmetry();
   Strokes strokes;
   if (symmetry)
@@ -181,7 +181,6 @@ void ToolLoopManager::doLoopStep(bool last_step)
   else
     strokes.push_back(main_stroke);
 
-  // Calculate the area to be updated in all document observers.
   calculateDirtyArea(strokes);
 
   // Validate source image area.
@@ -210,13 +209,11 @@ 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 (Stroke& stroke : strokes) {
-    if (!m_toolLoop->getFilled() || (!last_step && !m_toolLoop->getPreviewFilled()))
-      m_toolLoop->getIntertwine()->joinStroke(m_toolLoop, stroke);
-    else
-      m_toolLoop->getIntertwine()->fillStroke(m_toolLoop, stroke);
-  }
+  // Join or fill user points
+  if (!m_toolLoop->getFilled() || (!last_step && !m_toolLoop->getPreviewFilled()))
+    m_toolLoop->getIntertwine()->joinStroke(m_toolLoop, main_stroke);
+  else
+    m_toolLoop->getIntertwine()->fillStroke(m_toolLoop, main_stroke);
 
   if (m_toolLoop->getTracePolicy() == TracePolicy::Overlap) {
     // Copy destination to source (yes, destination to source). In

-- 
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