Fix graphical glitches while painting (fix #1262)

This commit is contained in:
David Capello 2016-09-22 20:16:14 -03:00
parent 1ffbd4c343
commit d4c4cb5f72
3 changed files with 8 additions and 8 deletions

View File

@ -52,10 +52,6 @@ DrawingState::~DrawingState()
void DrawingState::initToolLoop(Editor* editor, MouseMessage* msg)
{
// It's needed to clear and redraw the brush boundaries after the
// first mouse pressed/point shape if drawn.
HideBrushPreview hide(editor->brushPreview());
// Prepare preview image (the destination image will be our preview
// in the tool-loop time, so we can see what we are drawing)
editor->renderEngine().setPreviewImage(

View File

@ -305,6 +305,12 @@ bool StandbyState::onMouseDown(Editor* editor, MouseMessage* msg)
if (layerEdges)
layerEdgesOption(false);
// We need to clear and redraw the brush boundaries after the
// first mouse pressed/point shape if drawn. This is to avoid
// graphical glitches (invalid areas in the ToolLoop's src/dst
// images).
HideBrushPreview hide(editor->brushPreview());
tools::ToolLoop* toolLoop = create_tool_loop(editor, context);
if (toolLoop) {
EditorStatePtr newState(new DrawingState(toolLoop));

View File

@ -242,10 +242,8 @@ public:
}
void updateDirtyArea() override {
// TODO find a way to avoid calling hide/show brush preview here
HideBrushPreview hide(m_editor->brushPreview());
m_document->notifySpritePixelsModified(m_sprite, m_dirtyArea,
m_frame);
m_document->notifySpritePixelsModified(
m_sprite, m_dirtyArea, m_frame);
}
void updateStatusBar(const char* text) override {