mirror of
https://github.com/aseprite/aseprite.git
synced 2024-11-20 14:21:45 +00:00
Fix error using an invalid crop_image() with Width < 1, Height < 1 when using New Brush with right-click outside the canvas bounds
This commit is contained in:
parent
8281e49798
commit
8405add137
@ -113,11 +113,14 @@ void NewBrushCommand::onQuickboxEnd(Editor* editor, const gfx::Rect& rect, ui::M
|
|||||||
try {
|
try {
|
||||||
ContextWriter writer(UIContext::instance(), 250);
|
ContextWriter writer(UIContext::instance(), 250);
|
||||||
if (writer.cel()) {
|
if (writer.cel()) {
|
||||||
|
gfx::Rect canvasRect = (rect & writer.cel()->bounds());
|
||||||
|
if (!canvasRect.isEmpty()) {
|
||||||
Tx tx(writer.context(), "Clear");
|
Tx tx(writer.context(), "Clear");
|
||||||
tx(new cmd::ClearRect(writer.cel(), rect));
|
tx(new cmd::ClearRect(writer.cel(), canvasRect));
|
||||||
tx.commit();
|
tx.commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (const std::exception& ex) {
|
catch (const std::exception& ex) {
|
||||||
Console::showException(ex);
|
Console::showException(ex);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user