Redraw transformation handles correctly after auto-scroll

When we're moving the selection and touch a corner, the scroll is changed.
We cannot blit/move/reuse the screen content because the handles are on
the screen, so moving the already painted handle-pixels makes it hard to
redraw those areas too.
This commit is contained in:
David Capello 2014-08-27 10:06:38 -03:00
parent 5ea5d0d92f
commit 1297a42933
4 changed files with 9 additions and 9 deletions

View File

@ -137,7 +137,7 @@ bool DrawingState::onMouseMove(Editor* editor, MouseMessage* msg)
editor->hideDrawingCursor();
// Infinite scroll
gfx::Point mousePos = editor->autoScroll(msg);
gfx::Point mousePos = editor->autoScroll(msg, true);
// Hide the cursor again
editor->hideDrawingCursor();

View File

@ -291,7 +291,7 @@ void Editor::setDefaultScroll()
}
// Sets the scroll position of the editor
void Editor::setEditorScroll(int x, int y, int use_refresh_region)
void Editor::setEditorScroll(int x, int y, bool blit_valid_rgn)
{
View* view = View::getView(this);
Point oldScroll;
@ -301,7 +301,7 @@ void Editor::setEditorScroll(int x, int y, int use_refresh_region)
if (thick)
clearBrushPreview();
if (use_refresh_region) {
if (blit_valid_rgn) {
getDrawableRegion(region, kCutTopWindows);
oldScroll = view->getViewScroll();
}
@ -309,7 +309,7 @@ void Editor::setEditorScroll(int x, int y, int use_refresh_region)
view->setViewScroll(Point(x, y));
Point newScroll = view->getViewScroll();
if (use_refresh_region) {
if (blit_valid_rgn) {
// Move screen with blits
scrollRegion(region,
oldScroll.x - newScroll.x,
@ -701,7 +701,7 @@ void Editor::flashCurrentLayer()
#endif
}
gfx::Point Editor::autoScroll(MouseMessage* msg)
gfx::Point Editor::autoScroll(MouseMessage* msg, bool blit_valid_rgn)
{
View* view = View::getView(this);
gfx::Rect vp = view->getViewportBounds();
@ -720,7 +720,7 @@ gfx::Point Editor::autoScroll(MouseMessage* msg)
gfx::Point scroll = view->getViewScroll();
scroll += delta;
setEditorScroll(scroll.x, scroll.y, true);
setEditorScroll(scroll.x, scroll.y, blit_valid_rgn);
m_oldPos = mousePos;
mousePos = gfx::Point(

View File

@ -127,7 +127,7 @@ namespace app {
void setOffsetY(int y) { m_offset_y = y; }
void setDefaultScroll();
void setEditorScroll(int x, int y, int use_refresh_region);
void setEditorScroll(int x, int y, bool blit_valid_rgn);
void setEditorZoom(int zoom);
// Updates the Editor's view.
@ -166,7 +166,7 @@ namespace app {
void updateStatusBar();
// Control scroll when cursor goes out of the editor viewport.
gfx::Point autoScroll(ui::MouseMessage* msg);
gfx::Point autoScroll(ui::MouseMessage* msg, bool blit_valid_rgn);
tools::Tool* getCurrentEditorTool();
tools::Ink* getCurrentEditorInk();

View File

@ -252,7 +252,7 @@ bool MovingPixelsState::onMouseMove(Editor* editor, MouseMessage* msg)
// If there is a button pressed
if (m_pixelsMovement->isDragging()) {
// Auto-scroll
gfx::Point mousePos = editor->autoScroll(msg);
gfx::Point mousePos = editor->autoScroll(msg, false);
// Get the position of the mouse in the sprite
int x, y;