mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-29 10:20:48 +00:00
Update to new gfx::Region API
This commit is contained in:
parent
97345f4866
commit
4004f7be65
2
laf
2
laf
@ -1 +1 @@
|
|||||||
Subproject commit ad6dff6dffb3e1ff73140d00714725dee7ecb0fc
|
Subproject commit 9d5e9ac44c4b010360b233f903afcaf32a54ca39
|
@ -36,11 +36,10 @@ void move_region(Manager* manager, const Region& region, int dx, int dy)
|
|||||||
|
|
||||||
os::Surface* surface = display->getSurface();
|
os::Surface* surface = display->getSurface();
|
||||||
os::SurfaceLock lock(surface);
|
os::SurfaceLock lock(surface);
|
||||||
std::size_t nrects = region.size();
|
|
||||||
|
|
||||||
// Fast path, move one rectangle.
|
// Fast path, move one rectangle.
|
||||||
if (nrects == 1) {
|
if (region.isRect()) {
|
||||||
gfx::Rect rc = region[0];
|
gfx::Rect rc = region.bounds();
|
||||||
surface->scrollTo(rc, dx, dy);
|
surface->scrollTo(rc, dx, dy);
|
||||||
|
|
||||||
rc.offset(dx, dy);
|
rc.offset(dx, dy);
|
||||||
@ -50,7 +49,8 @@ void move_region(Manager* manager, const Region& region, int dx, int dy)
|
|||||||
// through the y-axis, we can sort the rectangles by y-axis and then
|
// through the y-axis, we can sort the rectangles by y-axis and then
|
||||||
// by x-axis to move rectangle by rectangle depending on the dx/dy
|
// by x-axis to move rectangle by rectangle depending on the dx/dy
|
||||||
// direction so we don't overlap each rectangle.
|
// direction so we don't overlap each rectangle.
|
||||||
else if (nrects > 1) {
|
else if (region.isComplex()) {
|
||||||
|
std::size_t nrects = region.size();
|
||||||
std::vector<gfx::Rect> rcs(nrects);
|
std::vector<gfx::Rect> rcs(nrects);
|
||||||
std::copy(region.begin(), region.end(), rcs.begin());
|
std::copy(region.begin(), region.end(), rcs.begin());
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user