diff options
author | Max Horn | 2009-05-08 16:02:22 +0000 |
---|---|---|
committer | Max Horn | 2009-05-08 16:02:22 +0000 |
commit | de114d3d52d485a69ce972cfc3e4f051975aaef1 (patch) | |
tree | ee7313d12dd777e03a51a011f97121368f705153 /engines/sci | |
parent | 527463dea2ee7ad30a030df0598ecf7a44853b57 (diff) | |
download | scummvm-rg350-de114d3d52d485a69ce972cfc3e4f051975aaef1.tar.gz scummvm-rg350-de114d3d52d485a69ce972cfc3e4f051975aaef1.tar.bz2 scummvm-rg350-de114d3d52d485a69ce972cfc3e4f051975aaef1.zip |
SCI: Got rid of code for endian adjusting pixmaps
svn-id: r40387
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/gfx/gfx_resmgr.cpp | 23 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_resource.cpp | 135 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_resource.h | 10 | ||||
-rw-r--r-- | engines/sci/gfx/gfx_system.h | 3 | ||||
-rw-r--r-- | engines/sci/gfx/operations.cpp | 1 |
5 files changed, 5 insertions, 167 deletions
diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index aa7832c493..6866f32be6 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -300,15 +300,12 @@ void GfxResManager::setStaticPalette(Palette *newPalette) } static gfxr_pic_t *gfxr_pic_xlate_common(gfx_resource_t *res, int maps, int scaled, int force, gfx_mode_t *mode, - gfx_xlate_filter_t filter, int endianize, gfx_options_t *options) { + gfx_xlate_filter_t filter, gfx_options_t *options) { XLATE_AS_APPROPRIATE(GFX_MASK_VISUAL, visual_map); XLATE_AS_APPROPRIATE(GFX_MASK_PRIORITY, priority_map); XLATE_AS_APPROPRIATE(GFX_MASK_CONTROL, control_map); - if (endianize && (maps & GFX_MASK_VISUAL) && res->scaled_data.pic->visual_map) - gfxr_endianness_adjust(res->scaled_data.pic->visual_map, mode); - return scaled ? res->scaled_data.pic : res->unscaled_data.pic; } #undef XLATE_AS_APPROPRIATE @@ -319,7 +316,6 @@ gfxr_pic_t *GfxResManager::getPic(int num, int maps, int flags, int default_pale IntResMap &resMap = _resourceMaps[GFX_RESOURCE_TYPE_PIC]; gfx_resource_t *res = NULL; int hash = getOptionsHash(GFX_RESOURCE_TYPE_PIC); - int must_post_process_pic = 0; int need_unscaled = (_driver->mode->xfact != 1 || _driver->mode->yfact != 1); hash |= (flags << 20) | ((default_palette & 0x7) << 28); @@ -388,22 +384,15 @@ gfxr_pic_t *GfxResManager::getPic(int num, int maps, int flags, int default_pale #endif } - must_post_process_pic = res->scaled_data.pic->visual_map->data == NULL; - // If the pic was only just drawn, we'll have to endianness-adjust it now - #ifdef CUSTOM_GRAPHICS_OPTIONS npic = gfxr_pic_xlate_common(res, maps, scaled || _options->pic0_unscaled, 0, _driver->mode, - _options->pic_xlate_filter, 0, _options); + _options->pic_xlate_filter, _options); #else npic = gfxr_pic_xlate_common(res, maps, 1, 0, _driver->mode, - GFX_XLATE_FILTER_NONE, 0, _options); + GFX_XLATE_FILTER_NONE, _options); #endif - if (must_post_process_pic) { - gfxr_endianness_adjust(npic->visual_map, _driver->mode); - } - return npic; } @@ -503,9 +492,9 @@ gfxr_pic_t *GfxResManager::addToPic(int old_nr, int new_nr, int flags, int old_d int old_ID = get_pic_id(res); set_pic_id(res, GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, new_nr)); // To ensure that our graphical translation options work properly #ifdef CUSTOM_GRAPHICS_OPTIONS - pic = gfxr_pic_xlate_common(res, GFX_MASK_VISUAL, 1, 1, _driver->mode, _options->pic_xlate_filter, 1, _options); + pic = gfxr_pic_xlate_common(res, GFX_MASK_VISUAL, 1, 1, _driver->mode, _options->pic_xlate_filter, _options); #else - pic = gfxr_pic_xlate_common(res, GFX_MASK_VISUAL, 1, 1, _driver->mode, GFX_XLATE_FILTER_NONE, 1, _options); + pic = gfxr_pic_xlate_common(res, GFX_MASK_VISUAL, 1, 1, _driver->mode, GFX_XLATE_FILTER_NONE, _options); #endif set_pic_id(res, old_ID); } @@ -610,7 +599,6 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) { #else gfx_xlate_pixmap(cel_data, _driver->mode, GFX_XLATE_FILTER_NONE); #endif - gfxr_endianness_adjust(cel_data, _driver->mode); } return view; @@ -692,7 +680,6 @@ gfx_pixmap_t *GfxResManager::getCursor(int num) { #else gfx_xlate_pixmap(cursor, _driver->mode, GFX_XLATE_FILTER_NONE); #endif - gfxr_endianness_adjust(cursor, _driver->mode); res->unscaled_data.pointer = cursor; diff --git a/engines/sci/gfx/gfx_resource.cpp b/engines/sci/gfx/gfx_resource.cpp index 0335a3ea21..59170ec4fa 100644 --- a/engines/sci/gfx/gfx_resource.cpp +++ b/engines/sci/gfx/gfx_resource.cpp @@ -67,141 +67,6 @@ void gfxr_free_view(gfxr_view_t *view) { free(view); } -static void pixmap_endianness_reverse_2_simple(byte *data, int area) { - int c; - - for (c = 0; c < area; c++) { - byte val = *data; - *data = data[1]; - data[1] = val; - - data += 2; - } -} - -static void pixmap_endianness_reverse_2(byte *data, int area) { - int c; - int sl = sizeof(unsigned long); - - for (c = 0; c < (area & ~(sl - 1)); c += (sl >> 1)) { - unsigned long temp; - - memcpy(&temp, data, sl); - - // The next line will give warnings on 32 bit archs, but that's OK. -#if SIZEOF_LONG < 8 - temp = 0; -#else - temp = ((temp & 0xff00ff00ff00ff00l) >> 8) - | ((temp & 0x00ff00ff00ff00ffl) << 8); -#endif - - memcpy(data, &temp, sl); - - data += sl; - } - - pixmap_endianness_reverse_2_simple(data, area & (sl - 1)); -} - -static void pixmap_endianness_reverse_3_simple(byte *data, int area) { - int c; - - for (c = 0; c < area; c++) { - byte val0 = data[0]; - - data[0] = data[2]; - data[2] = val0; - - data += 3; - } -} - -static void pixmap_endianness_reverse_4_simple(byte *data, int area) { - int c; - - for (c = 0; c < area; c++) { - byte val0 = data[0]; - byte val1 = data[1]; - - data[0] = data[3]; - data[3] = val0; - - data[1] = data[2]; - data[2] = val1; - - data += 4; - } -} - -static void pixmap_endianness_reverse_4(byte *data, int area) { - int c; - int sl = sizeof(unsigned long); - - for (c = 0; c < (area & ~(sl - 1)); c += (sl >> 2)) { - unsigned long temp; - - memcpy(&temp, data, sl); - - // The next lines will give warnings on 32 bit archs, but that's OK. -#if SIZEOF_LONG < 8 - temp = 0l; -#else - temp = ((temp & 0xffff0000ffff0000l) >> 16) - | ((temp & 0x0000ffff0000ffffl) << 16); - temp = ((temp & 0xff00ff00ff00ff00l) >> 8) - | ((temp & 0x00ff00ff00ff00ffl) << 8); -#endif - - memcpy(data, &temp, sl); - - data += sl; - } - - pixmap_endianness_reverse_4_simple(data, area & (sl - 1)); -} - -gfx_pixmap_t *gfxr_endianness_adjust(gfx_pixmap_t *pixmap, gfx_mode_t *mode) { - int bytespp; - byte *data; - - if (!pixmap || !pixmap->data || !mode) { - GFXERROR("gfxr_endianness_adjust(): Invoked with invalid values\n"); - BREAKPOINT(); - return NULL; - } - - if (!(mode->flags & GFX_MODE_FLAG_REVERSE_ENDIAN)) - return pixmap; - - bytespp = mode->bytespp; - - data = pixmap->data; - - switch (bytespp) { - case 1: - break; - - case 2: - pixmap_endianness_reverse_2(data, pixmap->width * pixmap->height); - break; - - case 3: - pixmap_endianness_reverse_3_simple(data, pixmap->width * pixmap->height); - break; - - case 4: - pixmap_endianness_reverse_4(data, pixmap->width * pixmap->height); - break; - - default: - fprintf(stderr, "gfxr_endianness_adjust(): Cannot adjust endianness for %d bytespp!\n", bytespp); - return NULL; - } - - return pixmap; -} - void gfxr_free_pic(gfxr_pic_t *pic) { gfx_free_pixmap(pic->visual_map); gfx_free_pixmap(pic->priority_map); diff --git a/engines/sci/gfx/gfx_resource.h b/engines/sci/gfx/gfx_resource.h index 44ae01828e..51e1e2b75a 100644 --- a/engines/sci/gfx/gfx_resource.h +++ b/engines/sci/gfx/gfx_resource.h @@ -292,16 +292,6 @@ gfxr_view_t *gfxr_draw_view1(int id, byte *resource, int size, Palette *static_p gfx_pixmap_t *gfxr_draw_cel1(int id, int loop, int cel, int mirrored, byte *resource, byte *cel_base, int size, gfxr_view_t *view, bool isAmiga, bool isSci11); -gfx_pixmap_t *gfxr_endianness_adjust(gfx_pixmap_t *pixmap, gfx_mode_t *mode); -/* Endianness-adjusts a pixmap, if neccessary -** Parameters: (gfx_pixmap_t *) pixmap: The pixmap to adjust -** (gfx_mode_t *) mode: The mode to adjust it for -** Returns : (gfx_pixmap_t *) pixmap, or NULL on error -** The pixmap is adjusted iff the mode signals that this is -** required (by means of setting the appropriate flag), and -** the mode has a byte depth of more than 1. -*/ - } // End of namespace Sci #endif // SCI_GFX_GFX_RESOURCE_H diff --git a/engines/sci/gfx/gfx_system.h b/engines/sci/gfx/gfx_system.h index bfbc7299ff..a698c77f22 100644 --- a/engines/sci/gfx/gfx_system.h +++ b/engines/sci/gfx/gfx_system.h @@ -53,9 +53,6 @@ namespace Sci { #define GFX_MODE_IS_UNSCALED(mode) (((mode)->xfact == 1) && ((mode)->yfact == 1)) -/* Reverse-endian: Target display has non-native endianness -** (BE if local is LE or the other way 'round */ -#define GFX_MODE_FLAG_REVERSE_ENDIAN (1<<0) /* Reverse Alpha: Alpha values 0 mean "transparent" if this is ** enabled */ #define GFX_MODE_FLAG_REVERSE_ALPHA (1<<1) diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp index 1cf1f19590..e9e3b6ee24 100644 --- a/engines/sci/gfx/operations.cpp +++ b/engines/sci/gfx/operations.cpp @@ -2063,7 +2063,6 @@ int gfxop_draw_text(GfxState *state, TextHandle *handle, rect_t zone) { #else gfx_xlate_pixmap(pxm, state->driver->mode, GFX_XLATE_FILTER_NONE); #endif - gfxr_endianness_adjust(pxm, state->driver->mode); // FIXME: resmgr layer! } if (!pxm) { GFXERROR("Could not find text pixmap %d/%d\n", i, handle->lines.size()); |