mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-30 06:32:42 +00:00
Fix problem leaving dirty areas in the screen when we move a window
This commit is contained in:
parent
a0c2237839
commit
04f07af173
@ -37,12 +37,8 @@ Graphics::~Graphics()
|
||||
{
|
||||
// If we were drawing in the screen surface, we mark these regions
|
||||
// as dirty for the final flip.
|
||||
if (m_surface == she::instance()->defaultDisplay()->getSurface()) {
|
||||
gfx::Region& dirty = Manager::getDirtyRegion();
|
||||
Manager::getDirtyRegion().createUnion(
|
||||
Manager::getDirtyRegion(),
|
||||
gfx::Region(m_dirtyBounds));
|
||||
}
|
||||
if (m_surface == she::instance()->defaultDisplay()->getSurface())
|
||||
Manager::getDefault()->dirtyRect(m_dirtyBounds);
|
||||
}
|
||||
|
||||
int Graphics::width() const
|
||||
|
@ -875,6 +875,11 @@ bool Manager::isFocusMovementKey(Message* msg)
|
||||
return false;
|
||||
}
|
||||
|
||||
void Manager::dirtyRect(const gfx::Rect& bounds)
|
||||
{
|
||||
m_dirtyRegion.createUnion(m_dirtyRegion, gfx::Region(bounds));
|
||||
}
|
||||
|
||||
/* configures the window for begin the loop */
|
||||
void Manager::_openWindow(Window* window)
|
||||
{
|
||||
|
@ -31,10 +31,6 @@ namespace ui {
|
||||
return m_defaultManager;
|
||||
}
|
||||
|
||||
static gfx::Region& getDirtyRegion() {
|
||||
return m_dirtyRegion;
|
||||
}
|
||||
|
||||
Manager();
|
||||
~Manager();
|
||||
|
||||
@ -89,6 +85,8 @@ namespace ui {
|
||||
|
||||
bool isFocusMovementKey(Message* msg);
|
||||
|
||||
void dirtyRect(const gfx::Rect& bounds);
|
||||
|
||||
void _openWindow(Window* window);
|
||||
void _closeWindow(Window* window, bool redraw_background);
|
||||
|
||||
|
@ -35,8 +35,12 @@ void move_region(Manager* manager, const Region& region, int dx, int dy)
|
||||
|
||||
// Blit directly screen to screen.
|
||||
if (nrects == 1) {
|
||||
Rect rc = region[0];
|
||||
gfx::Rect rc = region[0];
|
||||
lock->scrollTo(rc, dx, dy);
|
||||
|
||||
rc.offset(dx, dy);
|
||||
Manager::getDefault()->dirtyRect(rc);
|
||||
|
||||
}
|
||||
// Blit saving areas and copy them.
|
||||
else if (nrects > 1) {
|
||||
@ -56,11 +60,12 @@ void move_region(Manager* manager, const Region& region, int dx, int dy)
|
||||
}
|
||||
|
||||
for (c=0, it=begin; it != end; ++it, ++c) {
|
||||
const Rect& rc = *it;
|
||||
gfx::Rect rc((*it).x+dx, (*it).y+dy, (*it).w, (*it).h);
|
||||
sur = images[c];
|
||||
{
|
||||
she::ScopedSurfaceLock surlock(sur);
|
||||
surlock->blitTo(lock, 0, 0, rc.x+dx, rc.y+dy, rc.w, rc.h);
|
||||
surlock->blitTo(lock, 0, 0, rc.x, rc.y, rc.w, rc.h);
|
||||
manager->dirtyRect(rc);
|
||||
}
|
||||
sur->dispose();
|
||||
}
|
||||
|
@ -63,11 +63,10 @@ void Overlay::drawOverlay(she::LockedSurface* screen)
|
||||
she::ScopedSurfaceLock lockedSurface(m_surface);
|
||||
screen->drawRgbaSurface(lockedSurface, m_pos.x, m_pos.y);
|
||||
|
||||
Manager::getDirtyRegion().createUnion(
|
||||
Manager::getDirtyRegion(),
|
||||
gfx::Region(gfx::Rect(m_pos.x, m_pos.y,
|
||||
m_surface->width(),
|
||||
m_surface->height())));
|
||||
Manager::getDefault()->dirtyRect(
|
||||
gfx::Rect(m_pos.x, m_pos.y,
|
||||
m_surface->width(),
|
||||
m_surface->height()));
|
||||
}
|
||||
|
||||
void Overlay::moveOverlay(const gfx::Point& newPos)
|
||||
@ -100,11 +99,10 @@ void Overlay::restoreOverlappedArea(she::LockedSurface* screen)
|
||||
lock->blitTo(screen, 0, 0, m_pos.x, m_pos.y,
|
||||
m_overlap->width(), m_overlap->height());
|
||||
|
||||
Manager::getDirtyRegion().createUnion(
|
||||
Manager::getDirtyRegion(),
|
||||
gfx::Region(gfx::Rect(m_pos.x, m_pos.y,
|
||||
m_overlap->width(),
|
||||
m_overlap->height())));
|
||||
Manager::getDefault()->dirtyRect(
|
||||
gfx::Rect(m_pos.x, m_pos.y,
|
||||
m_overlap->width(),
|
||||
m_overlap->height()));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user