mirror of https://github.com/aseprite/aseprite.git
[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);
|
doc::copy_image(dst, src, pos.x, pos.y);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gfx::Rect bounds(pos, src->size());
|
gfx::Rect bounds(0, 0, src->size().w, src->size().h);
|
||||||
gfx::Rect output;
|
|
||||||
if (doc::algorithm::shrink_bounds2(src, dst, bounds, output)) {
|
// TODO Use something similar to doc::algorithm::shrink_bounds2()
|
||||||
Tx tx;
|
// but we need something that does the render and compares
|
||||||
tx(new cmd::CopyRegion(
|
// the minimal modified area.
|
||||||
dst, src, gfx::Region(output),
|
Tx tx;
|
||||||
gfx::Point(0, 0)));
|
tx(new cmd::CopyRegion(
|
||||||
tx.commit();
|
dst, src, gfx::Region(bounds),
|
||||||
}
|
gfx::Point(pos.x + bounds.x, pos.y + bounds.y)));
|
||||||
|
tx.commit();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue