From c690747bd2032cbee0f2ee1c94470847cbd95e2b Mon Sep 17 00:00:00 2001 From: David Capello Date: Wed, 3 Apr 2019 21:19:44 -0300 Subject: [PATCH] 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). --- src/app/commands/cmd_change_pixel_format.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/app/commands/cmd_change_pixel_format.cpp b/src/app/commands/cmd_change_pixel_format.cpp index 8fe26fd37..309971218 100644 --- a/src/app/commands/cmd_change_pixel_format.cpp +++ b/src/app/commands/cmd_change_pixel_format.cpp @@ -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 m_bgThread; ConversionItem* m_selectedItem; DitheringSelector* m_ditheringSelector; + bool m_imageJustCreated; }; } // anonymous namespace