Improve color conversion preview without clearing the old image

It is better for continuous preview feedback to keep the old image so
the new preview result is painted above the old one (and there is no
flicker effects).
This commit is contained in:
David Capello 2019-04-03 21:19:44 -03:00
parent 109e6fa205
commit c690747bd2

View File

@ -174,6 +174,7 @@ public:
, m_imageBuffer(new doc::ImageBuffer)
, m_selectedItem(nullptr)
, m_ditheringSelector(nullptr)
, m_imageJustCreated(true)
{
doc::PixelFormat from = m_editor->sprite()->pixelFormat();
@ -311,6 +312,10 @@ private:
visibleBounds.w,
visibleBounds.h,
m_imageBuffer));
if (m_imageJustCreated) {
m_imageJustCreated = false;
m_image->clear(0);
}
m_editor->renderEngine().setPreviewImage(
nullptr,
@ -319,7 +324,6 @@ private:
visibleBounds.origin(),
doc::BlendMode::SRC);
m_image->clear(0);
m_editor->invalidate();
progress()->setValue(0);
progress()->setVisible(true);
@ -370,6 +374,7 @@ private:
std::unique_ptr<ConvertThread> m_bgThread;
ConversionItem* m_selectedItem;
DitheringSelector* m_ditheringSelector;
bool m_imageJustCreated;
};
} // anonymous namespace