mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-05 13:14:37 +00:00
Don't redraw brush preview area in other editors if they aren't in the current frame
This commit is contained in:
parent
1b930d4d42
commit
b75b9a6f1b
@ -114,11 +114,12 @@ void Document::notifyGeneralUpdate()
|
||||
notifyObservers<doc::DocumentEvent&>(&doc::DocumentObserver::onGeneralUpdate, ev);
|
||||
}
|
||||
|
||||
void Document::notifySpritePixelsModified(Sprite* sprite, const gfx::Region& region)
|
||||
void Document::notifySpritePixelsModified(Sprite* sprite, const gfx::Region& region, frame_t frame)
|
||||
{
|
||||
doc::DocumentEvent ev(this);
|
||||
ev.sprite(sprite);
|
||||
ev.region(region);
|
||||
ev.frame(frame);
|
||||
notifyObservers<doc::DocumentEvent&>(&doc::DocumentObserver::onSpritePixelsModified, ev);
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ namespace app {
|
||||
// Notifications
|
||||
|
||||
void notifyGeneralUpdate();
|
||||
void notifySpritePixelsModified(Sprite* sprite, const gfx::Region& region);
|
||||
void notifySpritePixelsModified(Sprite* sprite, const gfx::Region& region, frame_t frame);
|
||||
void notifyExposeSpritePixels(Sprite* sprite, const gfx::Region& region);
|
||||
void notifyLayerMergedDown(Layer* srcLayer, Layer* targetLayer);
|
||||
void notifyCelMoved(Layer* fromLayer, frame_t fromFrame, Layer* toLayer, frame_t toFrame);
|
||||
|
@ -373,7 +373,8 @@ void DocumentView::onGeneralUpdate(doc::DocumentEvent& ev)
|
||||
|
||||
void DocumentView::onSpritePixelsModified(doc::DocumentEvent& ev)
|
||||
{
|
||||
if (m_editor->isVisible())
|
||||
if (m_editor->isVisible() &&
|
||||
m_editor->frame() == ev.frame())
|
||||
m_editor->drawSpriteClipped(ev.region());
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ void BrushPreview::show(const gfx::Point& screenPos)
|
||||
if (cel) opacity = MUL_UN8(opacity, cel->opacity(), t);
|
||||
if (layer) opacity = MUL_UN8(opacity, static_cast<LayerImage*>(layer)->opacity(), t);
|
||||
|
||||
document->prepareExtraCel(brushBounds, m_editor->frame(), opacity);
|
||||
document->prepareExtraCel(brushBounds, site.frame(), opacity);
|
||||
document->setExtraCelType(render::ExtraType::NONE);
|
||||
document->setExtraCelBlendMode(
|
||||
(layer ? static_cast<LayerImage*>(layer)->blendMode():
|
||||
@ -168,7 +168,7 @@ void BrushPreview::show(const gfx::Point& screenPos)
|
||||
|
||||
if (layer) {
|
||||
render::Render().renderLayer(
|
||||
extraImage, layer, m_editor->frame(),
|
||||
extraImage, layer, site.frame(),
|
||||
gfx::Clip(0, 0, brushBounds),
|
||||
BlendMode::SRC);
|
||||
|
||||
@ -192,7 +192,7 @@ void BrushPreview::show(const gfx::Point& screenPos)
|
||||
}
|
||||
|
||||
document->notifySpritePixelsModified(
|
||||
sprite, gfx::Region(m_lastBounds = brushBounds));
|
||||
sprite, gfx::Region(m_lastBounds = brushBounds), site.frame());
|
||||
|
||||
m_withRealPreview = true;
|
||||
}
|
||||
@ -246,9 +246,11 @@ void BrushPreview::hide()
|
||||
|
||||
// Clean pixel/brush preview
|
||||
if (m_withRealPreview) {
|
||||
frame_t frame = document->getExtraCel()->frame();
|
||||
|
||||
document->destroyExtraCel();
|
||||
document->notifySpritePixelsModified(
|
||||
sprite, gfx::Region(m_lastBounds));
|
||||
sprite, gfx::Region(m_lastBounds), frame);
|
||||
|
||||
m_withRealPreview = false;
|
||||
}
|
||||
|
@ -409,7 +409,8 @@ void PixelsMovement::moveImage(const gfx::Point& pos, MoveModifier moveModifier)
|
||||
// If "fullBounds" is empty is because the cel was not moved
|
||||
if (!fullBounds.isEmpty()) {
|
||||
// Notify the modified region.
|
||||
m_document->notifySpritePixelsModified(m_sprite, gfx::Region(fullBounds));
|
||||
m_document->notifySpritePixelsModified(m_sprite, gfx::Region(fullBounds),
|
||||
m_site.frame());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,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_document->notifySpritePixelsModified(m_sprite, m_dirtyArea,
|
||||
m_frame);
|
||||
}
|
||||
|
||||
void updateStatusBar(const char* text) override {
|
||||
|
Loading…
x
Reference in New Issue
Block a user