Fix bug where the palette weren't updated on the screen after converting the sprite color space

This commit is contained in:
David Capello 2018-10-25 17:29:32 -03:00
parent 4487c3d35f
commit 6542008aef
3 changed files with 20 additions and 3 deletions

View File

@ -578,8 +578,7 @@ InputChain& App::inputChain()
}
#endif
// Updates palette and redraw the screen.
void app_refresh_screen()
void app_update_current_palette()
{
#ifdef ENABLE_UI
Context* context = UIContext::instance();
@ -590,7 +589,15 @@ void app_refresh_screen()
if (Palette* pal = site.palette())
set_current_palette(pal, false);
else
set_current_palette(NULL, false);
set_current_palette(nullptr, false);
#endif // ENABLE_UI
}
// Updates palette and redraw the screen.
void app_refresh_screen()
{
#ifdef ENABLE_UI
app_update_current_palette();
// Invalidate the whole screen.
ui::Manager::getDefault()->invalidate();

View File

@ -147,6 +147,7 @@ namespace app {
#endif
};
void app_update_current_palette();
void app_refresh_screen();
void app_rebuild_documents_tabs();
PixelFormat app_get_current_pixel_format();

View File

@ -34,6 +34,7 @@
#include "doc/sprite.h"
#include "os/display.h"
#include "os/system.h"
#include "ui/system.h"
#include <limits>
#include <map>
@ -508,6 +509,14 @@ void Doc::updateOSColorSpace(bool appWideSignal)
context()->activeDocument() == this) {
App::instance()->ColorSpaceChange();
}
if (ui::is_ui_thread()) {
// As the color space has changed, we might need to upate the
// current palette (because the color space conversion might be
// came from a cmd::ConvertColorProfile, so the palette might be
// changed). This might generate a PaletteChange() signal.
app_update_current_palette();
}
}
// static