[aseprite] 93/196: Flip mask when the whole canvas is flipped (fix #561)
Tobias Hansen
thansen at moszumanska.debian.org
Wed Apr 20 18:50: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 7841ec82f3e636cc6dc2f91a24a8d013f0fa2792
Author: David Capello <davidcapello at gmail.com>
Date: Mon Mar 21 14:51:43 2016 -0300
Flip mask when the whole canvas is flipped (fix #561)
---
src/app/commands/cmd_flip.cpp | 33 ++++++++++++++++++++++++---------
1 file changed, 24 insertions(+), 9 deletions(-)
diff --git a/src/app/commands/cmd_flip.cpp b/src/app/commands/cmd_flip.cpp
index 63ddb62..b1347bd 100644
--- a/src/app/commands/cmd_flip.cpp
+++ b/src/app/commands/cmd_flip.cpp
@@ -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
@@ -14,6 +14,7 @@
#include "app/app.h"
#include "app/cmd/flip_mask.h"
#include "app/cmd/flip_masked_cel.h"
+#include "app/cmd/set_mask_position.h"
#include "app/commands/params.h"
#include "app/context_access.h"
#include "app/document_api.h"
@@ -75,8 +76,8 @@ void FlipCommand::onExecute(Context* context)
"Flip Canvas Vertical"));
DocumentApi api = document->getApi(transaction);
+ Mask* mask = document->mask();
if (m_flipMask) {
- Mask* mask = document->mask();
CelList cels;
Site site = *writer.site();
@@ -133,13 +134,6 @@ void FlipCommand::onExecute(Context* context)
api.flipImage(image, bounds, m_flipType);
}
}
-
- // Flip the mask.
- Image* maskBitmap = mask->bitmap();
- if (maskBitmap) {
- transaction.execute(new cmd::FlipMask(document, m_flipType));
- document->generateMaskBoundaries();
- }
}
else {
for (Cel* cel : sprite->uniqueCels()) {
@@ -158,6 +152,27 @@ void FlipCommand::onExecute(Context* context)
}
}
+ // Flip the mask.
+ Image* maskBitmap = mask->bitmap();
+ if (maskBitmap) {
+ transaction.execute(new cmd::FlipMask(document, m_flipType));
+
+ // Flip the mask position because the
+ if (!m_flipMask)
+ transaction.execute(
+ new cmd::SetMaskPosition(
+ document,
+ gfx::Point(
+ (m_flipType == doc::algorithm::FlipHorizontal ?
+ sprite->width() - mask->bounds().x2():
+ mask->bounds().x),
+ (m_flipType == doc::algorithm::FlipVertical ?
+ sprite->height() - mask->bounds().y2():
+ mask->bounds().y))));
+
+ document->generateMaskBoundaries();
+ }
+
transaction.commit();
}
--
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