aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gfx/gfx_pixmap_scale.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2009-03-08 20:17:01 +0000
committerWillem Jan Palenstijn2009-03-08 20:17:01 +0000
commitced40b2266976d0129294a1c5925b7d88024b2de (patch)
tree61b4339e05c997d91a3491aaeac2a978e86e9997 /engines/sci/gfx/gfx_pixmap_scale.cpp
parent85f6f204195c0859ecf4119e63d5f53b91fb5684 (diff)
downloadscummvm-rg350-ced40b2266976d0129294a1c5925b7d88024b2de.tar.gz
scummvm-rg350-ced40b2266976d0129294a1c5925b7d88024b2de.tar.bz2
scummvm-rg350-ced40b2266976d0129294a1c5925b7d88024b2de.zip
Use new Palette class to manager pixmap palettes.
There are some remaining regressions with text colour in SCI1 games, but overall it should fix more than it breaks. svn-id: r39242
Diffstat (limited to 'engines/sci/gfx/gfx_pixmap_scale.cpp')
-rw-r--r--engines/sci/gfx/gfx_pixmap_scale.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/engines/sci/gfx/gfx_pixmap_scale.cpp b/engines/sci/gfx/gfx_pixmap_scale.cpp
index eacc78e47c..999a42315d 100644
--- a/engines/sci/gfx/gfx_pixmap_scale.cpp
+++ b/engines/sci/gfx/gfx_pixmap_scale.cpp
@@ -66,15 +66,16 @@ void FUNCNAME(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) {
alpha_dest = pxm->alpha_map = (byte *)sci_malloc(pxm->index_xl * xfact * pxm->index_yl * yfact);
// Calculate all colors
- for (i = 0; i < pxm->colors_nr; i++) {
+ for (i = 0; i < pxm->colors_nr(); i++) {
int col;
+ const PaletteEntry& color = pxm->palette->getColor(i);
if (PALETTE_MODE)
- col = pxm->colors[i].global_index;
+ col = color.parent_index;
else {
- col = mode->red_mask & ((EXTEND_COLOR(pxm->colors[i].r)) >> mode->red_shift);
- col |= mode->green_mask & ((EXTEND_COLOR(pxm->colors[i].g)) >> mode->green_shift);
- col |= mode->blue_mask & ((EXTEND_COLOR(pxm->colors[i].b)) >> mode->blue_shift);
+ col = mode->red_mask & ((EXTEND_COLOR(color.r)) >> mode->red_shift);
+ col |= mode->green_mask & ((EXTEND_COLOR(color.g)) >> mode->green_shift);
+ col |= mode->blue_mask & ((EXTEND_COLOR(color.b)) >> mode->blue_shift);
col |= alpha_ormask;
}
result_colors[i] = col;
@@ -247,9 +248,10 @@ void FUNCNAME_LINEAR(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) {
rec[2] = other[2] - ctexel[2]; \
rec[3] = 0xffff - ctexel[3]; \
} else { \
- rec[0] = (EXTEND_COLOR(pxm->colors[nr].r) >> 16) - ctexel[0]; \
- rec[1] = (EXTEND_COLOR(pxm->colors[nr].g) >> 16) - ctexel[1]; \
- rec[2] = (EXTEND_COLOR(pxm->colors[nr].b) >> 16) - ctexel[2]; \
+ const PaletteEntry& e = (*pxm->palette)[nr]; \
+ rec[0] = (EXTEND_COLOR(e.r) >> 16) - ctexel[0]; \
+ rec[1] = (EXTEND_COLOR(e.g) >> 16) - ctexel[1]; \
+ rec[2] = (EXTEND_COLOR(e.b) >> 16) - ctexel[2]; \
rec[3] = 0 - ctexel[3]; \
}
@@ -326,9 +328,10 @@ static inline void gfx_apply_delta(unsigned int *color, int *delta, int factor)
rec[2] = 0; \
rec[3] = 0xffffff; \
} else { \
- rec[0] = (EXTEND_COLOR(pxm->colors[nr].r) >> 8); \
- rec[1] = (EXTEND_COLOR(pxm->colors[nr].g) >> 8); \
- rec[2] = (EXTEND_COLOR(pxm->colors[nr].b) >> 8); \
+ const PaletteEntry& e = (*pxm->palette)[nr]; \
+ rec[0] = (EXTEND_COLOR(e.r) >> 8); \
+ rec[1] = (EXTEND_COLOR(e.g) >> 8); \
+ rec[2] = (EXTEND_COLOR(e.b) >> 8); \
rec[3] = 0; \
}