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