mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-07 09:56:59 +00:00
[lua] Fix clipping when drawing an image on a cel image (fix #3054)
This commit is contained in:
parent
12e61d33be
commit
8deb9c46e7
@ -230,15 +230,16 @@ int Image_drawImage(lua_State* L)
|
||||
doc::copy_image(dst, src, pos.x, pos.y);
|
||||
}
|
||||
else {
|
||||
gfx::Rect bounds(pos, src->size());
|
||||
gfx::Rect output;
|
||||
if (doc::algorithm::shrink_bounds2(src, dst, bounds, output)) {
|
||||
Tx tx;
|
||||
tx(new cmd::CopyRegion(
|
||||
dst, src, gfx::Region(output),
|
||||
gfx::Point(0, 0)));
|
||||
tx.commit();
|
||||
}
|
||||
gfx::Rect bounds(0, 0, src->size().w, src->size().h);
|
||||
|
||||
// TODO Use something similar to doc::algorithm::shrink_bounds2()
|
||||
// but we need something that does the render and compares
|
||||
// the minimal modified area.
|
||||
Tx tx;
|
||||
tx(new cmd::CopyRegion(
|
||||
dst, src, gfx::Region(bounds),
|
||||
gfx::Point(pos.x + bounds.x, pos.y + bounds.y)));
|
||||
tx.commit();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user