aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2009-05-08 16:00:39 +0000
committerMax Horn2009-05-08 16:00:39 +0000
commite34c6316c67a06d9586e217cdca52d3bc6cc0438 (patch)
treeb50edba644faa997de6e9e53b2ede8f561ddf3da
parent418d80c8a84175bdefb5e8310816d489abf0e1c6 (diff)
downloadscummvm-rg350-e34c6316c67a06d9586e217cdca52d3bc6cc0438.tar.gz
scummvm-rg350-e34c6316c67a06d9586e217cdca52d3bc6cc0438.tar.bz2
scummvm-rg350-e34c6316c67a06d9586e217cdca52d3bc6cc0438.zip
SCI: Replaced gfx_driver_t::set_palette and install_palette by directly invoking their OSystem counterparts
svn-id: r40385
-rw-r--r--engines/sci/gfx/gfx_driver.cpp32
-rw-r--r--engines/sci/gfx/gfx_driver.h21
-rw-r--r--engines/sci/gfx/operations.cpp11
3 files changed, 8 insertions, 56 deletions
diff --git a/engines/sci/gfx/gfx_driver.cpp b/engines/sci/gfx/gfx_driver.cpp
index ffe161d846..e4f6a40120 100644
--- a/engines/sci/gfx/gfx_driver.cpp
+++ b/engines/sci/gfx/gfx_driver.cpp
@@ -38,7 +38,6 @@ struct _scummvm_driver_state {
byte *visual[2];
uint8 *pointer_data;
int xsize, ysize;
- uint8 *palette_data;
};
#define S ((struct _scummvm_driver_state *)(drv->state))
@@ -79,10 +78,6 @@ static int scummvm_init(gfx_driver_t *drv, int xfact, int yfact, int bytespp) {
drv->mode = gfx_new_mode(xfact, yfact, format, new Palette(256), 0);
drv->mode->palette->name = "global";
- S->palette_data = new uint8[4*256];
- for (i = 0; i < 4*256; ++i)
- S->palette_data[i] = 0;
-
return GFX_OK;
}
@@ -102,9 +97,6 @@ static void scummvm_exit(gfx_driver_t *drv) {
delete[] S->pointer_data;
S->pointer_data = NULL;
- delete[] S->palette_data;
- S->palette_data = NULL;
-
delete S;
}
}
@@ -306,28 +298,6 @@ static int scummvm_set_pointer(gfx_driver_t *drv, gfx_pixmap_t *pointer, Common:
return GFX_OK;
}
-// Palette operations
-
-static int scummvm_set_palette(gfx_driver_t *drv, int index, byte red, byte green, byte blue) {
- if (index < 0 || index > 255) {
- GFXERROR("Attempt to set invalid palette entry %d\n", index);
- return GFX_ERROR;
- }
-
- S->palette_data[4*index+0] = red;
- S->palette_data[4*index+1] = green;
- S->palette_data[4*index+2] = blue;
- S->palette_data[4*index+3] = 255;
-
- return GFX_OK;
-}
-
-static int scummvm_install_palette(gfx_driver_t *drv, Palette* palette) {
- g_system->setPalette(S->palette_data, 0, palette->size());
- return GFX_OK;
-}
-
-
gfx_driver_t gfx_driver_scummvm = {
NULL,
0, 0,
@@ -343,8 +313,6 @@ gfx_driver_t gfx_driver_scummvm = {
scummvm_update,
scummvm_set_static_buffer,
scummvm_set_pointer,
- scummvm_set_palette,
- scummvm_install_palette,
NULL
};
diff --git a/engines/sci/gfx/gfx_driver.h b/engines/sci/gfx/gfx_driver.h
index a24347c1f1..634fe072e0 100644
--- a/engines/sci/gfx/gfx_driver.h
+++ b/engines/sci/gfx/gfx_driver.h
@@ -267,27 +267,6 @@ struct gfx_driver_t { /* Graphics driver */
*/
- /*** Palette operations ***/
-
- int (*set_palette)(gfx_driver_t *drv, int index, byte red, byte green,
- byte blue);
- /* Manipulates a palette index in the hardware palette.
- ** The actual update is not performed until install_palette() is called.
- ** This way updates can be batched.
- ** Parameters: (gfx_driver_t *) drv: The driver affected
- ** (int) index: The index of the palette entry to modify
- ** (int x int x int) red, green, blue: The RGB intensities to
- ** set for the specified index. The minimum
- ** intensity is 0, maximum is 0xff.
- ** Returns : (int) GFX_OK, GFX_ERROR or GFX_FATAL
- ** This function does not need to update mode->palette, as this is done
- ** by the calling code.
- ** set_palette() is only required for targets supporting color index mode.
- */
-
- int (*install_palette)(gfx_driver_t *drv, Palette* pal);
- /* As set_palette, but for the full palette. */
-
void *state; /* Reserved for internal use */
};
diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp
index 0559a677b3..1cf1f19590 100644
--- a/engines/sci/gfx/operations.cpp
+++ b/engines/sci/gfx/operations.cpp
@@ -202,12 +202,17 @@ static int _gfxop_install_pixmap(gfx_driver_t *driver, gfx_pixmap_t *pxm) {
// TODO: We probably want to only update the colours used by this pixmap
// here. This will require updating the 'dirty' system.
- for (unsigned int i = 0; i < driver->mode->palette->size(); ++i) {
+ uint8 paletteData[4*256];
+ const uint paletteSize = driver->mode->palette->size();
+ for (uint i = 0; i < paletteSize; ++i) {
const PaletteEntry& c = (*driver->mode->palette)[i];
- driver->set_palette(driver, i, c.r, c.g, c.b);
+ paletteData[4*i+0] = c.r;
+ paletteData[4*i+1] = c.g;
+ paletteData[4*i+2] = c.b;
+ paletteData[4*i+3] = 255;
}
- driver->install_palette(driver, driver->mode->palette);
+ g_system->setPalette(paletteData, 0, paletteSize);
driver->mode->palette->markClean();
return GFX_OK;
}