mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-06 03:39:51 +00:00
Use a Tx instead of a Transaction on FilterManagerImpl (fix #2108)
This commit is contained in:
parent
6c7f1ff05b
commit
655ce92836
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -214,7 +215,7 @@ void FilterManagerImpl::apply()
|
|||||||
if (algorithm::shrink_bounds2(m_src.get(), m_dst.get(),
|
if (algorithm::shrink_bounds2(m_src.get(), m_dst.get(),
|
||||||
m_bounds, output)) {
|
m_bounds, output)) {
|
||||||
if (m_cel->layer()->isBackground()) {
|
if (m_cel->layer()->isBackground()) {
|
||||||
m_transaction->execute(
|
(*m_tx)(
|
||||||
new cmd::CopyRegion(
|
new cmd::CopyRegion(
|
||||||
m_cel->image(),
|
m_cel->image(),
|
||||||
m_dst.get(),
|
m_dst.get(),
|
||||||
@ -223,7 +224,7 @@ void FilterManagerImpl::apply()
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Patch "m_cel"
|
// Patch "m_cel"
|
||||||
m_transaction->execute(
|
(*m_tx)(
|
||||||
new cmd::PatchCel(
|
new cmd::PatchCel(
|
||||||
m_cel, m_dst.get(),
|
m_cel, m_dst.get(),
|
||||||
gfx::Region(output),
|
gfx::Region(output),
|
||||||
@ -278,7 +279,7 @@ void FilterManagerImpl::applyToTarget()
|
|||||||
// Initialize writting operation
|
// Initialize writting operation
|
||||||
ContextReader reader(m_context);
|
ContextReader reader(m_context);
|
||||||
ContextWriter writer(reader);
|
ContextWriter writer(reader);
|
||||||
m_transaction.reset(new Transaction(writer.context(), m_filter->getName(), ModifyDocument));
|
m_tx.reset(new Tx(writer.context(), m_filter->getName(), ModifyDocument));
|
||||||
|
|
||||||
m_progressBase = 0.0f;
|
m_progressBase = 0.0f;
|
||||||
m_progressWidth = (cels.size() > 0 ? 1.0f / cels.size(): 1.0f);
|
m_progressWidth = (cels.size() > 0 ? 1.0f / cels.size(): 1.0f);
|
||||||
@ -289,7 +290,7 @@ void FilterManagerImpl::applyToTarget()
|
|||||||
if (paletteChange) {
|
if (paletteChange) {
|
||||||
Palette newPalette = *getNewPalette();
|
Palette newPalette = *getNewPalette();
|
||||||
restoreSpritePalette();
|
restoreSpritePalette();
|
||||||
m_transaction->execute(
|
(*m_tx)(
|
||||||
new cmd::SetPalette(m_site.sprite(),
|
new cmd::SetPalette(m_site.sprite(),
|
||||||
m_site.frame(), &newPalette));
|
m_site.frame(), &newPalette));
|
||||||
}
|
}
|
||||||
@ -320,15 +321,15 @@ void FilterManagerImpl::applyToTarget()
|
|||||||
|
|
||||||
bool FilterManagerImpl::isTransaction() const
|
bool FilterManagerImpl::isTransaction() const
|
||||||
{
|
{
|
||||||
return m_transaction != nullptr;
|
return m_tx != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This must be executed in the main UI thread.
|
// This must be executed in the main UI thread.
|
||||||
// Check Transaction::commit() comments.
|
// Check Transaction::commit() comments.
|
||||||
void FilterManagerImpl::commitTransaction()
|
void FilterManagerImpl::commitTransaction()
|
||||||
{
|
{
|
||||||
ASSERT(m_transaction);
|
ASSERT(m_tx);
|
||||||
m_transaction->commit();
|
m_tx->commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FilterManagerImpl::flush()
|
void FilterManagerImpl::flush()
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
|
// Copyright (C) 2019 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -10,6 +11,7 @@
|
|||||||
|
|
||||||
#include "app/commands/filters/cels_target.h"
|
#include "app/commands/filters/cels_target.h"
|
||||||
#include "app/site.h"
|
#include "app/site.h"
|
||||||
|
#include "app/tx.h"
|
||||||
#include "base/exception.h"
|
#include "base/exception.h"
|
||||||
#include "doc/image_impl.h"
|
#include "doc/image_impl.h"
|
||||||
#include "doc/image_ref.h"
|
#include "doc/image_ref.h"
|
||||||
@ -38,7 +40,6 @@ namespace app {
|
|||||||
class Context;
|
class Context;
|
||||||
class Doc;
|
class Doc;
|
||||||
class Editor;
|
class Editor;
|
||||||
class Transaction;
|
|
||||||
|
|
||||||
using namespace filters;
|
using namespace filters;
|
||||||
|
|
||||||
@ -149,7 +150,7 @@ namespace app {
|
|||||||
Target m_target; // Filtered targets
|
Target m_target; // Filtered targets
|
||||||
CelsTarget m_celsTarget;
|
CelsTarget m_celsTarget;
|
||||||
std::unique_ptr<doc::Palette> m_oldPalette;
|
std::unique_ptr<doc::Palette> m_oldPalette;
|
||||||
std::unique_ptr<Transaction> m_transaction;
|
std::unique_ptr<Tx> m_tx;
|
||||||
|
|
||||||
// Hooks
|
// Hooks
|
||||||
float m_progressBase;
|
float m_progressBase;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user