mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-16 14:42:44 +00:00
Fix crash trying to move the selection from a empty cel
This commit is contained in:
parent
d1fc7f643a
commit
0b3ec08987
@ -118,6 +118,7 @@ void PixelsMovement::cutMask()
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
ContextWriter writer(m_reader);
|
ContextWriter writer(m_reader);
|
||||||
|
if (writer.cel())
|
||||||
m_document->getApi().clearMask(m_layer, writer.cel(),
|
m_document->getApi().clearMask(m_layer, writer.cel(),
|
||||||
app_get_color_to_clear_layer(m_layer));
|
app_get_color_to_clear_layer(m_layer));
|
||||||
}
|
}
|
||||||
|
@ -225,17 +225,15 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg)
|
|||||||
if (editor->isInsideSelection() &&
|
if (editor->isInsideSelection() &&
|
||||||
currentTool->getInk(0)->isSelection() &&
|
currentTool->getInk(0)->isSelection() &&
|
||||||
msg->left()) {
|
msg->left()) {
|
||||||
int x, y, opacity;
|
|
||||||
Image* image = location.image(&x, &y, &opacity);
|
|
||||||
if (image) {
|
|
||||||
if (!layer->isWritable()) {
|
if (!layer->isWritable()) {
|
||||||
Alert::show(PACKAGE "<<The layer is locked.||&Close");
|
Alert::show(PACKAGE "<<The layer is locked.||&Close");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int x, y, opacity;
|
||||||
|
Image* image = location.image(&x, &y, &opacity);
|
||||||
// Change to MovingPixelsState
|
// Change to MovingPixelsState
|
||||||
transformSelection(editor, msg, MoveHandle);
|
transformSelection(editor, msg, MoveHandle);
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,17 +52,17 @@ Image* NewImageFromMask(const DocumentLocation& location)
|
|||||||
ASSERT(srcSprite);
|
ASSERT(srcSprite);
|
||||||
ASSERT(srcMask);
|
ASSERT(srcMask);
|
||||||
ASSERT(srcMaskBitmap);
|
ASSERT(srcMaskBitmap);
|
||||||
ASSERT(src);
|
|
||||||
|
|
||||||
dst = Image::create(srcSprite->pixelFormat(), srcBounds.w, srcBounds.h);
|
dst = Image::create(srcSprite->pixelFormat(), srcBounds.w, srcBounds.h);
|
||||||
if (!dst)
|
if (!dst)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// Clear the new image
|
// Clear the new image
|
||||||
dst->setMaskColor(src->maskColor());
|
dst->setMaskColor(src ? src->maskColor(): srcSprite->transparentColor());
|
||||||
clear_image(dst, dst->maskColor());
|
clear_image(dst, dst->maskColor());
|
||||||
|
|
||||||
// Copy the masked zones
|
// Copy the masked zones
|
||||||
|
if (src) {
|
||||||
const LockImageBits<BitmapTraits> maskBits(srcMaskBitmap, gfx::Rect(0, 0, srcBounds.w, srcBounds.h));
|
const LockImageBits<BitmapTraits> maskBits(srcMaskBitmap, gfx::Rect(0, 0, srcBounds.w, srcBounds.h));
|
||||||
LockImageBits<BitmapTraits>::const_iterator mask_it = maskBits.begin();
|
LockImageBits<BitmapTraits>::const_iterator mask_it = maskBits.begin();
|
||||||
|
|
||||||
@ -80,6 +80,7 @@ Image* NewImageFromMask(const DocumentLocation& location)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user