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