diff options
author | Willem Jan Palenstijn | 2009-05-24 12:56:06 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2009-05-24 12:56:06 +0000 |
commit | 725ff24170dd23394b4aa6de075d9ca74a7c9199 (patch) | |
tree | f63dc7e1f6ab7aa73dc6ea44d2dc28a17dda178c /engines | |
parent | b993eba6a59f4f1edaac5bf75f8338e3ec7cc799 (diff) | |
download | scummvm-rg350-725ff24170dd23394b4aa6de075d9ca74a7c9199.tar.gz scummvm-rg350-725ff24170dd23394b4aa6de075d9ca74a7c9199.tar.bz2 scummvm-rg350-725ff24170dd23394b4aa6de075d9ca74a7c9199.zip |
SCI: re-xlate pixmap when palette revision changed
svn-id: r40859
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/gfx/gfx_pixmap_scale.cpp | 2 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_system.h | 1 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_tools.cpp | 2 | ||||
-rw-r--r-- | engines/sci/gfx/operations.cpp | 5 |
4 files changed, 10 insertions, 0 deletions
diff --git a/engines/sci/gfx/gfx_pixmap_scale.cpp b/engines/sci/gfx/gfx_pixmap_scale.cpp index d13c0d143e..52c7b12396 100644 --- a/engines/sci/gfx/gfx_pixmap_scale.cpp +++ b/engines/sci/gfx/gfx_pixmap_scale.cpp @@ -646,6 +646,8 @@ void gfx_xlate_pixmap(gfx_pixmap_t *pxm, gfx_mode_t *mode, gfx_xlate_filter_t fi free(pxm->data); } } + if (pxm->palette) + pxm->palette_revision = pxm->palette->getRevision(); } diff --git a/engines/sci/gfx/gfx_system.h b/engines/sci/gfx/gfx_system.h index beb23b5db1..d21c28629b 100644 --- a/engines/sci/gfx/gfx_system.h +++ b/engines/sci/gfx/gfx_system.h @@ -201,6 +201,7 @@ struct gfx_pixmap_t { /* gfx_pixmap_t: Pixel map */ */ int color_key; + int palette_revision; // Revision of palette at the time data was generated }; diff --git a/engines/sci/gfx/gfx_tools.cpp b/engines/sci/gfx/gfx_tools.cpp index 501c972c2e..e1378e14d0 100644 --- a/engines/sci/gfx/gfx_tools.cpp +++ b/engines/sci/gfx/gfx_tools.cpp @@ -112,6 +112,7 @@ gfx_pixmap_t *gfx_clone_pixmap(gfx_pixmap_t *pxm, gfx_mode_t *mode) { clone->index_data = NULL; clone->palette = NULL; clone->data = NULL; + clone->palette_revision = -1; gfx_pixmap_alloc_data(clone, mode); memcpy(clone->data, pxm->data, clone->data_size); @@ -129,6 +130,7 @@ gfx_pixmap_t *gfx_new_pixmap(int xl, int yl, int resid, int loop, int cel) { pxm->alpha_map = NULL; pxm->data = NULL; pxm->palette = NULL; + pxm->palette_revision = -1; pxm->index_width = xl; pxm->index_height = yl; diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index 2e778e180f..15ee3d3ec5 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -196,8 +196,12 @@ static int _gfxop_install_pixmap(gfx_driver_t *driver, gfx_pixmap_t *pxm) { if (!driver->mode->palette) return GFX_OK; if (!pxm->palette) return GFX_OK; + pxm->palette->mergeInto(driver->mode->palette); assert(pxm->palette->getParent() == driver->mode->palette); + if (pxm->palette_revision != pxm->palette->getRevision()) + gfx_xlate_pixmap(pxm, driver->mode, GFX_XLATE_FILTER_NONE); + if (!driver->mode->palette->isDirty()) return GFX_OK; // TODO: We probably want to only update the colours used by this pixmap @@ -214,6 +218,7 @@ static int _gfxop_install_pixmap(gfx_driver_t *driver, gfx_pixmap_t *pxm) { g_system->setPalette(paletteData, 0, paletteSize); driver->mode->palette->markClean(); + return GFX_OK; } |