mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 19:20:09 +00:00
Don't trim background layer cels automatically (fix #1166)
This commit is contained in:
parent
67ce9473f8
commit
9897256d26
@ -117,7 +117,8 @@ void FlipCommand::onExecute(Context* context)
|
||||
else
|
||||
api.flipImage(image, flipBounds, m_flipType);
|
||||
|
||||
transaction.execute(new cmd::TrimCel(cel));
|
||||
if (cel->layer()->isTransparent())
|
||||
transaction.execute(new cmd::TrimCel(cel));
|
||||
}
|
||||
// When the mask is bigger than the cel bounds, we have to
|
||||
// expand the cel, make the flip, and shrink it again.
|
||||
|
@ -523,7 +523,8 @@ bool DocumentView::onClear(Context* ctx)
|
||||
transaction.execute(new cmd::ClearMask(writer.cel()));
|
||||
|
||||
// If the cel wasn't deleted by cmd::ClearMask, we trim it.
|
||||
if (writer.cel())
|
||||
if (writer.cel() &&
|
||||
writer.cel()->layer()->isTransparent())
|
||||
transaction.execute(new cmd::TrimCel(writer.cel()));
|
||||
|
||||
if (visibleMask &&
|
||||
|
@ -182,7 +182,8 @@ void PixelsMovement::cutMask()
|
||||
m_transaction.execute(new cmd::ClearMask(writer.cel()));
|
||||
|
||||
ASSERT(writer.cel());
|
||||
if (writer.cel())
|
||||
if (writer.cel() &&
|
||||
writer.cel()->layer()->isTransparent())
|
||||
m_transaction.execute(new cmd::TrimCel(writer.cel()));
|
||||
}
|
||||
}
|
||||
|
@ -225,7 +225,8 @@ void cut(ContextWriter& writer)
|
||||
transaction.execute(new cmd::ClearMask(writer.cel()));
|
||||
|
||||
ASSERT(writer.cel());
|
||||
if (writer.cel())
|
||||
if (writer.cel() &&
|
||||
writer.cel()->layer()->isTransparent())
|
||||
transaction.execute(new cmd::TrimCel(writer.cel()));
|
||||
|
||||
transaction.execute(new cmd::DeselectMask(writer.document()));
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "app/app.h"
|
||||
#include "app/cmd/add_cel.h"
|
||||
#include "app/cmd/clear_cel.h"
|
||||
#include "app/cmd/copy_region.h"
|
||||
#include "app/cmd/patch_cel.h"
|
||||
#include "app/context.h"
|
||||
#include "app/document.h"
|
||||
@ -198,12 +199,22 @@ void ExpandCelCanvas::commit()
|
||||
regionToPatch = &reduced;
|
||||
}
|
||||
|
||||
m_transaction.execute(
|
||||
new cmd::PatchCel(
|
||||
m_cel,
|
||||
m_dstImage.get(),
|
||||
*regionToPatch,
|
||||
m_bounds.origin()));
|
||||
if (m_layer->isBackground()) {
|
||||
m_transaction.execute(
|
||||
new cmd::CopyRegion(
|
||||
m_cel->image(),
|
||||
m_dstImage.get(),
|
||||
*regionToPatch,
|
||||
m_bounds.origin()));
|
||||
}
|
||||
else {
|
||||
m_transaction.execute(
|
||||
new cmd::PatchCel(
|
||||
m_cel,
|
||||
m_dstImage.get(),
|
||||
*regionToPatch,
|
||||
m_bounds.origin()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
ASSERT(false);
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite Document Library
|
||||
// Copyright (c) 2001-2015 David Capello
|
||||
// Copyright (c) 2001-2016 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -62,11 +62,12 @@ namespace doc {
|
||||
bool isImage() const { return type() == ObjectType::LayerImage; }
|
||||
bool isFolder() const { return type() == ObjectType::LayerFolder; }
|
||||
|
||||
bool isBackground() const { return hasFlags(LayerFlags::Background); }
|
||||
bool isVisible() const { return hasFlags(LayerFlags::Visible); }
|
||||
bool isEditable() const { return hasFlags(LayerFlags::Editable); }
|
||||
bool isMovable() const { return !hasFlags(LayerFlags::LockMove); }
|
||||
bool isContinuous() const { return hasFlags(LayerFlags::Continuous); }
|
||||
bool isBackground() const { return hasFlags(LayerFlags::Background); }
|
||||
bool isTransparent() const { return !hasFlags(LayerFlags::Background); }
|
||||
bool isVisible() const { return hasFlags(LayerFlags::Visible); }
|
||||
bool isEditable() const { return hasFlags(LayerFlags::Editable); }
|
||||
bool isMovable() const { return !hasFlags(LayerFlags::LockMove); }
|
||||
bool isContinuous() const { return hasFlags(LayerFlags::Continuous); }
|
||||
|
||||
void setBackground(bool state) { switchFlags(LayerFlags::Background, state); }
|
||||
void setVisible (bool state) { switchFlags(LayerFlags::Visible, state); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user