[aseprite] 29/64: Fix spray and jumble tools (fix #1130)
Tobias Hansen
thansen at moszumanska.debian.org
Tue Jun 21 14:43:02 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 94e56ad97a67e990dd824253ce90bc63fd005c6c
Author: David Capello <davidcapello at gmail.com>
Date: Wed May 11 13:14:52 2016 -0300
Fix spray and jumble tools (fix #1130)
---
src/app/tools/trace_policy.h | 4 ++--
src/app/util/expand_cel_canvas.cpp | 9 ++++++++-
src/app/util/expand_cel_canvas.h | 5 +++++
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/app/tools/trace_policy.h b/src/app/tools/trace_policy.h
index 17ebadd..881c1d0 100644
--- a/src/app/tools/trace_policy.h
+++ b/src/app/tools/trace_policy.h
@@ -1,5 +1,5 @@
// Aseprite
-// Copyright (C) 2001-2015 David Capello
+// Copyright (C) 2001-2016 David Capello
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@@ -38,7 +38,7 @@ namespace app {
// Like accumulate, but the destination is copied to the source
// on each ToolLoop step, so the tool overlaps its own effect.
- // Used by blur, jumble, or spray.
+ // Used by jumble and spray.
Overlap,
};
diff --git a/src/app/util/expand_cel_canvas.cpp b/src/app/util/expand_cel_canvas.cpp
index d99779e..2d325f7 100644
--- a/src/app/util/expand_cel_canvas.cpp
+++ b/src/app/util/expand_cel_canvas.cpp
@@ -73,6 +73,7 @@ ExpandCelCanvas::ExpandCelCanvas(
, m_closed(false)
, m_committed(false)
, m_transaction(transaction)
+ , m_canCompareSrcVsDst((m_flags & NeedsSource) == NeedsSource)
{
ASSERT(!singleton);
singleton = this;
@@ -184,7 +185,7 @@ void ExpandCelCanvas::commit()
gfx::Region* regionToPatch = &m_validDstRegion;
gfx::Region reduced;
- if ((m_flags & NeedsSource) == NeedsSource) {
+ if (m_canCompareSrcVsDst) {
ASSERT(gfx::Region().createSubtraction(m_validDstRegion, m_validSrcRegion).isEmpty());
for (gfx::Rect rc : m_validDstRegion) {
@@ -193,6 +194,7 @@ void ExpandCelCanvas::commit()
reduced |= gfx::Region(rc);
}
}
+
regionToPatch = &reduced;
}
@@ -352,6 +354,11 @@ void ExpandCelCanvas::copyValidDestToSourceCanvas(const gfx::Region& rgn)
for (const auto& rc : rgn2)
m_srcImage->copy(m_dstImage.get(),
gfx::Clip(rc.x, rc.y, rc.x, rc.y, rc.w, rc.h));
+
+ // We cannot compare src vs dst in this case (e.g. on tools like
+ // spray and jumble that updated the source image form the modified
+ // destination).
+ m_canCompareSrcVsDst = false;
}
gfx::Rect ExpandCelCanvas::getTrimDstImageBounds() const
diff --git a/src/app/util/expand_cel_canvas.h b/src/app/util/expand_cel_canvas.h
index d78d1fc..9771079 100644
--- a/src/app/util/expand_cel_canvas.h
+++ b/src/app/util/expand_cel_canvas.h
@@ -91,6 +91,11 @@ namespace app {
Transaction& m_transaction;
gfx::Region m_validSrcRegion;
gfx::Region m_validDstRegion;
+
+ // True if we can compare src image with dst image to patch the
+ // cel. This is false when dst is copied to the src, so we cannot
+ // reduce the patched region because both images will be the same.
+ bool m_canCompareSrcVsDst;
};
} // namespace app
--
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