[Scummvm-cvs-logs] SF.net SVN: scummvm:[43938] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Sep 4 11:44:10 CEST 2009


Revision: 43938
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43938&view=rev
Author:   thebluegr
Date:     2009-09-04 09:44:06 +0000 (Fri, 04 Sep 2009)

Log Message:
-----------
Removed the bilinear and trilinear FreeSCI scalers, and only left the unfiltered scaler in (to be replaced by ScummVM's scaler code). We really don't need bilinear and trilinear filtered scaling in the engine, as ScummVM's filters already perform bilinear and trilinear filtered scaling, if requested

Modified Paths:
--------------
    scummvm/trunk/engines/sci/console.cpp
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/gfx/gfx_options.h
    scummvm/trunk/engines/sci/gfx/gfx_pixmap_scale.cpp
    scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp
    scummvm/trunk/engines/sci/gfx/gfx_support.cpp
    scummvm/trunk/engines/sci/gfx/gfx_system.h
    scummvm/trunk/engines/sci/gfx/gfx_tools.cpp
    scummvm/trunk/engines/sci/gfx/gfx_tools.h
    scummvm/trunk/engines/sci/gfx/operations.cpp
    scummvm/trunk/engines/sci/gfx/res_pic.cpp
    scummvm/trunk/engines/sci/sci.cpp

Modified: scummvm/trunk/engines/sci/console.cpp
===================================================================
--- scummvm/trunk/engines/sci/console.cpp	2009-09-04 08:37:53 UTC (rev 43937)
+++ scummvm/trunk/engines/sci/console.cpp	2009-09-04 09:44:06 UTC (rev 43938)
@@ -1564,12 +1564,12 @@
 		break;
 
 	case 1:
-		gfx_xlate_pixmap(_vm->_gamestate->gfx_state->pic->priority_map, _vm->_gamestate->gfx_state->driver->getMode(), GFX_XLATE_FILTER_NONE);
+		gfx_xlate_pixmap(_vm->_gamestate->gfx_state->pic->priority_map, _vm->_gamestate->gfx_state->driver->getMode());
 		gfxop_draw_pixmap(_vm->_gamestate->gfx_state, _vm->_gamestate->gfx_state->pic->priority_map, gfx_rect(0, 0, 320, 200), Common::Point(0, 0));
 		break;
 
 	case 2:
-		gfx_xlate_pixmap(_vm->_gamestate->gfx_state->control_map, _vm->_gamestate->gfx_state->driver->getMode(), GFX_XLATE_FILTER_NONE);
+		gfx_xlate_pixmap(_vm->_gamestate->gfx_state->control_map, _vm->_gamestate->gfx_state->driver->getMode());
 		gfxop_draw_pixmap(_vm->_gamestate->gfx_state, _vm->_gamestate->gfx_state->control_map, gfx_rect(0, 0, 320, 200), Common::Point(0, 0));
 		break;
 

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-09-04 08:37:53 UTC (rev 43937)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-09-04 09:44:06 UTC (rev 43938)
@@ -3387,7 +3387,7 @@
 				pixmap->palette = palette;
 				
 				// Copy the frame to the screen
-				gfx_xlate_pixmap(pixmap, s->gfx_state->driver->getMode(), GFX_XLATE_FILTER_NONE);
+				gfx_xlate_pixmap(pixmap, s->gfx_state->driver->getMode());
 				gfxop_draw_pixmap(s->gfx_state, pixmap, gfx_rect(0, 0, 320, 200), Common::Point(pixmap->xoffset, pixmap->yoffset));
 				gfxop_update_box(s->gfx_state, gfx_rect(0, 0, 320, 200));
 				gfx_free_pixmap(pixmap);
@@ -3436,7 +3436,7 @@
 		if (frameNr++ == 0)
 			pixmap->palette->forceInto(s->gfx_state->driver->getMode()->palette);
 
-		gfx_xlate_pixmap(pixmap, s->gfx_state->driver->getMode(), GFX_XLATE_FILTER_NONE);
+		gfx_xlate_pixmap(pixmap, s->gfx_state->driver->getMode());
 		gfxop_draw_pixmap(s->gfx_state, pixmap, gfx_rect(0, 0, 320, 200), Common::Point(pixmap->xoffset, pixmap->yoffset));
 		gfxop_update_box(s->gfx_state, gfx_rect(0, 0, 320, 200));
 		gfx_free_pixmap(pixmap);

Modified: scummvm/trunk/engines/sci/gfx/gfx_options.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_options.h	2009-09-04 08:37:53 UTC (rev 43937)
+++ scummvm/trunk/engines/sci/gfx/gfx_options.h	2009-09-04 09:44:06 UTC (rev 43938)
@@ -54,10 +54,6 @@
 	gfx_brush_mode_t pic0_brush_mode;
 	gfx_line_mode_t pic0_line_mode;
 
-	gfx_xlate_filter_t cursor_xlate_filter;
-	gfx_xlate_filter_t view_xlate_filter;
-	gfx_xlate_filter_t pic_xlate_filter; /* Only relevant if (pic0_unscaled) */
-	gfx_xlate_filter_t text_xlate_filter;
 	gfx_res_fullconf_t res_conf; /* Resource customisation: Per-resource palettes etc. */
 
 	int workarounds;	// Workaround flags - see below

Modified: scummvm/trunk/engines/sci/gfx/gfx_pixmap_scale.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_pixmap_scale.cpp	2009-09-04 08:37:53 UTC (rev 43937)
+++ scummvm/trunk/engines/sci/gfx/gfx_pixmap_scale.cpp	2009-09-04 09:44:06 UTC (rev 43938)
@@ -35,12 +35,16 @@
 
 namespace Sci {
 
+
+// TODO: Replace this code with our common scalers (/graphics/scaler.h)
+
+
 #define EXTEND_COLOR(x) (unsigned) ((((unsigned) x) << 24) | (((unsigned) x) << 16) | (((unsigned) x) << 8) | ((unsigned) x))
 
 template<int COPY_BYTES, typename SIZETYPE, int EXTRA_BYTE_OFFSET>
 void _gfx_xlate_pixmap_unfiltered(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) {
 	SIZETYPE result_colors[GFX_PIC_COLORS];
-	SIZETYPE alpha_color = 0xffffffff & mode->alpha_mask;
+	SIZETYPE alpha_color = 0xffffffff & 0;
 	SIZETYPE alpha_ormask = 0;
 	int xfact = (scale) ? mode->xfact : 1;
 	int yfact = (scale) ? mode->yfact : 1;
@@ -55,7 +59,7 @@
 	byte *dest = pxm->data;
 	byte *alpha_dest = pxm->alpha_map;
 	int using_alpha = pxm->color_key != GFX_PIXMAP_COLOR_KEY_NONE;
-	int separate_alpha_map = (!mode->alpha_mask) && using_alpha;
+	int separate_alpha_map = using_alpha;
 
 	if (mode->flags & GFX_MODE_FLAG_REVERSE_ALPHA) {
 		alpha_ormask = alpha_color;
@@ -120,376 +124,6 @@
 	}
 }
 
-
-// linear filter: Macros (in reverse order)
-
-#define X_CALC_INTENSITY_NORMAL (ctexel[i] << 16) + ((linecolor[i]) * (256-column_valuator)) + ((othercolumn[i] * column_valuator)) * (256-line_valuator)
-#define X_CALC_INTENSITY_CENTER (ctexel[i] << 16) + ((linecolor[i]) * (256-column_valuator))
-
-#define WRITE_XPART(X_CALC_INTENSITY, DO_X_STEP) \
-				for (subx = 0; subx < ((DO_X_STEP) ? (xfact >> 1) : 1); subx++) { \
-					unsigned int intensity; \
-					wrcolor = 0; \
-					for (i = 0; i < 3; i++) { \
-						intensity = X_CALC_INTENSITY; \
-						wrcolor |= (intensity >> shifts[i]) & masks[i]; \
-					} \
-					i = 3; \
-					intensity = X_CALC_INTENSITY; \
-					if (inverse_alpha) \
-						intensity = ~intensity; \
-					wrcolor |= (intensity >> shifts[i]) & masks[i]; \
-					if (separate_alpha_map) \
-						*alpha_wrpos++ = intensity >> 24; \
-					wrcolor <<= (EXTRA_BYTE_OFFSET * 8); \
-					memcpy(wrpos, &wrcolor, COPY_BYTES); \
-					wrpos += COPY_BYTES; \
-					if (DO_X_STEP) \
-						column_valuator -= column_step; \
-				} \
-				if (DO_X_STEP) \
-				        column_step = -column_step
-// End of macro definition
-
-
-#define Y_CALC_INTENSITY_CENTER 0
-#define Y_CALC_INTENSITY_NORMAL otherline[i] * line_valuator
-
-#define WRITE_YPART(DO_Y_STEP, LINE_COLOR) \
-			for (suby = 0; suby < ((DO_Y_STEP)? yfact >> 1 : 1); suby++) { \
-				int column_valuator = column_step? 128 - (column_step >> 1) : 256; \
-				int linecolor[4]; \
-				int othercolumn[4]; \
-				int i; \
-				SIZETYPE wrcolor; \
-				wrpos = sublinepos; \
-				alpha_wrpos = alpha_sublinepos; \
-				for (i = 0; i < 4; i++) \
-					linecolor[i] = LINE_COLOR; \
-				/*-- left half --*/ \
-				MAKE_PIXEL((x == 0), othercolumn, ctexel, src[-1]); \
-				WRITE_XPART(X_CALC_INTENSITY_NORMAL, 1); \
-				column_valuator -= column_step; \
-				/*-- center --*/ \
-				if (xfact & 1) { \
-					WRITE_XPART(X_CALC_INTENSITY_CENTER, 0); \
-				} \
-				/*-- right half --*/ \
-				MAKE_PIXEL((x + 1 == pxm->index_width), othercolumn, ctexel, src[+1]); \
-				WRITE_XPART(X_CALC_INTENSITY_NORMAL, 1); \
-				if (DO_Y_STEP) \
-					line_valuator -= line_step; \
-				sublinepos += pxm->width * bytespp; \
-				alpha_sublinepos += pxm->width; \
-			} \
-			if (DO_Y_STEP) \
-			        line_step = -line_step
-// End of macro definition
-
-
-template<int COPY_BYTES, typename SIZETYPE, int EXTRA_BYTE_OFFSET>
-void _gfx_xlate_pixmap_linear(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) {
-	int xfact = mode->xfact;
-	int yfact = mode->yfact;
-	int line_step = (yfact < 2) ? 0 : 256 / (yfact & ~1);
-	int column_step = (xfact < 2) ? 0 : 256 / (xfact & ~1);
-	int bytespp = mode->bytespp;
-	byte *src = pxm->index_data;
-	byte *dest = pxm->data;
-	byte *alpha_dest = pxm->alpha_map;
-	int using_alpha = pxm->color_key != GFX_PIXMAP_COLOR_KEY_NONE;
-	int separate_alpha_map = (!mode->alpha_mask) && using_alpha;
-	unsigned int masks[4], shifts[4], zero[3];
-	int x, y;
-	byte inverse_alpha = mode->flags & GFX_MODE_FLAG_REVERSE_ALPHA;
-
-	zero[0] = 255;
-	zero[1] = zero[2] = 0;
-
-	if (separate_alpha_map) {
-		masks[3] = 0;
-		shifts[3] = 24;
-	}
-
-	assert(bytespp == COPY_BYTES);
-	assert(!mode->palette);
-
-	masks[0] = mode->red_mask;
-	masks[1] = mode->green_mask;
-	masks[2] = mode->blue_mask;
-	masks[3] = mode->alpha_mask;
-	shifts[0] = mode->red_shift;
-	shifts[1] = mode->green_shift;
-	shifts[2] = mode->blue_shift;
-	shifts[3] = mode->alpha_shift;
-
-	if (separate_alpha_map && !alpha_dest)
-		alpha_dest = pxm->alpha_map = (byte *)malloc(pxm->index_width * xfact * pxm->index_height * yfact);
-
-	for (y = 0; y < pxm->index_height; y++) {
-		byte *linepos = dest;
-		byte *alpha_linepos = alpha_dest;
-
-		for (x = 0; x < pxm->index_width; x++) {
-			int otherline[4]; // the above line or the line below
-			int ctexel[4]; // Current texel
-			int subx, suby;
-			int line_valuator = line_step ? 128 - (line_step >> 1) : 256;
-			byte *wrpos, *alpha_wrpos;
-			byte *sublinepos = linepos;
-			byte *alpha_sublinepos = alpha_linepos;
-
-			ctexel[0] = ctexel[1] = ctexel[2] = ctexel[3] = 0;
-
-#define MAKE_PIXEL(cond, rec, other, nr) \
-			if ((cond) || (using_alpha && nr == pxm->color_key)) { \
-				rec[0] = other[0] - ctexel[0]; \
-				rec[1] = other[1] - ctexel[1]; \
-				rec[2] = other[2] - ctexel[2]; \
-				rec[3] = 0xffff - ctexel[3]; \
-			} else { \
-				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]; \
-			}
-
-			MAKE_PIXEL(0, ctexel, zero, *src);
-
-			//-- Upper half --
-			MAKE_PIXEL((y == 0), otherline, ctexel, src[-pxm->index_width]);
-			WRITE_YPART(1, Y_CALC_INTENSITY_NORMAL);
-
-			if (yfact & 1) {
-				WRITE_YPART(0, Y_CALC_INTENSITY_CENTER);
-			}
-
-			//-- Lower half --
-			line_valuator -= line_step;
-			MAKE_PIXEL((y + 1 == pxm->index_height), otherline, ctexel, src[pxm->index_width]);
-			WRITE_YPART(1, Y_CALC_INTENSITY_NORMAL);
-
-			src++;
-			linepos += xfact * bytespp;
-			alpha_linepos += xfact;
-		}
-
-		dest += pxm->width * yfact * bytespp;
-		alpha_dest += pxm->width * yfact;
-	}
-}
-
-
-//----------------------
-//** Trilinear filter **
-//----------------------
-
-
-#ifndef GFX_GET_PIXEL_DELTA
-#define GFX_GET_PIXEL_DELTA
-static void gfx_get_pixel_delta(unsigned int *color, int *delta, unsigned int *pixel0, unsigned int *pixel1) {
-	int j;
-	int transp0 = pixel0[3] == 0xffffff;
-	int transp1 = pixel1[3] == 0xffffff;
-
-	if (transp0 && !transp1) { // Transparent -> Opaque
-		memset(delta, 0, sizeof(int) * 3);
-		delta[3] = ((pixel1[3] >> 8) - (pixel0[3] >> 8));
-		memcpy(color, pixel1, sizeof(int) * 3);
-		color[3] = 0xffffff;
-	} else if (!transp0 && transp1) { // Opaque -> Transparent
-		memset(delta, 0, sizeof(int) * 3);
-		delta[3] = ((pixel1[3] >> 8) - (pixel0[3] >> 8));
-		memcpy(color, pixel0, sizeof(int) * 4);
-	} else if (transp0 && transp1) { // Transparent
-		delta[3] = 0;
-		color[3] = 0xffffff;
-	} else { // Opaque
-		memcpy(color, pixel0, sizeof(int) * 4);
-		for (j = 0; j < 4; j++)
-			delta[j] = ((pixel1[j] >> 8) - (pixel0[j] >> 8));
-	}
-}
-
-
-static void gfx_apply_delta(unsigned int *color, int *delta, int factor) {
-	int i;
-
-	for (i = 0; i < 4; i++)
-		color[i] += delta[i] * factor;
-}
-#endif
-
-#define MAKE_PIXEL_TRILINEAR(cond, rec, nr) \
-			if (!(cond) || (using_alpha && nr == pxm->color_key)) { \
-				rec[0] = 0; \
-				rec[1] = 0; \
-				rec[2] = 0; \
-				rec[3] = 0xffffff; \
-			} else { \
-				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; \
-			}
-
-#define REVERSE_ALPHA(foo) ((inverse_alpha) ? ~(foo) : (foo))
-
-template<int COPY_BYTES, typename SIZETYPE, int EXTRA_BYTE_OFFSET>
-void _gfx_xlate_pixmap_trilinear(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) {
-	int xfact = mode->xfact;
-	int yfact = mode->yfact;
-	int line_step = (yfact < 2) ? 0 : 256 / yfact;
-	int column_step = (xfact < 2) ? 0 : 256 / xfact;
-	int bytespp = mode->bytespp;
-	byte *src = pxm->index_data;
-	byte *dest = pxm->data;
-	byte *alpha_dest = pxm->alpha_map;
-	int using_alpha = pxm->color_key != GFX_PIXMAP_COLOR_KEY_NONE;
-	int separate_alpha_map = (!mode->alpha_mask) && using_alpha;
-	unsigned int masks[4], shifts[4];
-	unsigned int pixels[4][4];
-	// 0 1
-	// 2 3
-	int x, y;
-	byte inverse_alpha = mode->flags & GFX_MODE_FLAG_REVERSE_ALPHA;
-
-	if (separate_alpha_map) {
-		masks[3] = 0;
-		shifts[3] = 24;
-	}
-
-	assert(bytespp == COPY_BYTES);
-	assert(!mode->palette);
-
-	masks[0] = mode->red_mask;
-	masks[1] = mode->green_mask;
-	masks[2] = mode->blue_mask;
-	masks[3] = mode->alpha_mask;
-	shifts[0] = mode->red_shift;
-	shifts[1] = mode->green_shift;
-	shifts[2] = mode->blue_shift;
-	shifts[3] = mode->alpha_shift;
-
-	if (!(pxm->index_width && pxm->index_height))
-		return;
-
-	if (separate_alpha_map && !alpha_dest)
-		alpha_dest = pxm->alpha_map = (byte *)malloc(pxm->index_width * xfact * pxm->index_height * yfact);
-
-	src -= pxm->index_width + 1;
-
-	for (y = 0; y <= pxm->index_height; y++) {
-		byte *y_dest_backup = dest;
-		byte *y_alpha_dest_backup = alpha_dest;
-		int y_valuator = (y > 0) ? 0 : 128;
-		int yc_count;
-
-
-		if (y == 0)
-			yc_count = yfact >> 1;
-		else if (y == pxm->index_height)
-			yc_count = (yfact + 1) >> 1;
-		else
-			yc_count = yfact;
-
-		if (yfact & 1)
-			y_valuator += line_step >> 1;
-
-		for (x = 0; x <= pxm->index_width; x++) {
-			byte *x_dest_backup = dest;
-			byte *x_alpha_dest_backup = alpha_dest;
-			int x_valuator = (x > 0) ? 0 : 128;
-			int xc_count;
-			unsigned int leftcolor[4], rightcolor[4];
-			int leftdelta[4], rightdelta[4];
-			int xc, yc;
-
-			if (x == 0)
-				xc_count = xfact >> 1;
-			else if (x == pxm->index_width)
-				xc_count = (xfact + 1) >> 1;
-			else
-				xc_count = xfact;
-
-			if (xfact & 1)
-				x_valuator += column_step >> 1;
-
-			MAKE_PIXEL_TRILINEAR((y && x), pixels[0], *src);
-			MAKE_PIXEL_TRILINEAR((y && (x < pxm->index_width)), pixels[1], src[1]);
-			MAKE_PIXEL_TRILINEAR(((y < pxm->index_width) && x), pixels[2], src[pxm->index_width]);
-			MAKE_PIXEL_TRILINEAR(((y < pxm->index_width) && (x < pxm->index_width)), pixels[3], src[pxm->index_width + 1]);
-
-			// Optimize Me
-
-			gfx_get_pixel_delta(leftcolor, leftdelta, pixels[0], pixels[2]);
-			gfx_get_pixel_delta(rightcolor, rightdelta, pixels[1], pixels[3]);
-			gfx_apply_delta(leftcolor, leftdelta, y_valuator);
-			gfx_apply_delta(rightcolor, rightdelta, y_valuator);
-
-			for (yc = 0; yc < yc_count; yc++) {
-				unsigned int color[4];
-				int delta[4];
-				byte *yc_dest_backup = dest;
-				byte *yc_alpha_dest_backup = alpha_dest;
-
-				gfx_get_pixel_delta(color, delta, leftcolor, rightcolor);
-
-				gfx_apply_delta(color, delta, x_valuator);
-
-				for (xc = 0; xc < xc_count; xc++) {
-					SIZETYPE wrcolor;
-					int i;
-					wrcolor = 0;
-
-					for (i = 0; i < 3; i++)
-						wrcolor |= ((color[i] << 8) >> shifts[i]) & masks[i];
-
-					if (separate_alpha_map) {
-						*alpha_dest++ = REVERSE_ALPHA(color[3] >> 16);
-					} else
-						wrcolor |= REVERSE_ALPHA((color[3] << 8) >> shifts[3]) & masks[3];
-
-					wrcolor <<= (EXTRA_BYTE_OFFSET * 8);
-
-					memcpy(dest, &wrcolor, COPY_BYTES);
-					dest += COPY_BYTES;
-					gfx_apply_delta(color, delta, column_step);
-				}
-				gfx_apply_delta(leftcolor, leftdelta, line_step);
-				gfx_apply_delta(rightcolor, rightdelta, line_step);
-
-				dest = yc_dest_backup + pxm->index_width * xfact * COPY_BYTES;
-				alpha_dest = yc_alpha_dest_backup + pxm->index_width * xfact;
-			}
-
-			dest = x_dest_backup + xc_count * COPY_BYTES;
-			alpha_dest = x_alpha_dest_backup + xc_count;
-
-			if (x < pxm->index_width)
-				src++;
-		}
-		dest = y_dest_backup + pxm->index_width * xfact * yc_count * COPY_BYTES;
-		alpha_dest = y_alpha_dest_backup + pxm->index_width * xfact * yc_count;
-	}
-}
-
-#undef REVERSE_ALPHA
-#undef WRITE_YPART
-#undef Y_CALC_INTENSITY_CENTER
-#undef Y_CALC_INTENSITY_NORMAL
-#undef WRITE_XPART
-#undef X_CALC_INTENSITY_CENTER
-#undef X_CALC_INTENSITY_NORMAL
-#undef MAKE_PIXEL_TRILINEAR
-#undef MAKE_PIXEL
-#undef SIZETYPE
-#undef EXTEND_COLOR
-
-
-
 static void _gfx_xlate_pixmap_unfiltered(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) {
 	switch (mode->bytespp) {
 
@@ -526,80 +160,8 @@
 	}
 }
 
-static void _gfx_xlate_pixmap_linear(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) {
-	if (mode->palette || !scale) { // fall back to unfiltered
-		_gfx_xlate_pixmap_unfiltered(mode, pxm, scale);
-		return;
-	}
 
-	pxm->width = pxm->index_width * mode->xfact;
-	pxm->height = pxm->index_height * mode->yfact;
-
-	switch (mode->bytespp) {
-
-	case 1:
-		_gfx_xlate_pixmap_linear<1, uint8, 0>(mode, pxm, scale);
-		break;
-
-	case 2:
-		_gfx_xlate_pixmap_linear<2, uint16, 0>(mode, pxm, scale);
-		break;
-
-	case 3:
-#ifdef SCUMM_BIG_ENDIAN
-		_gfx_xlate_pixmap_linear<3, uint32, 1>(mode, pxm, scale);
-#else
-		_gfx_xlate_pixmap_linear<3, uint32, 0>(mode, pxm, scale);
-#endif
-		break;
-
-	case 4:
-		_gfx_xlate_pixmap_linear<4, uint32, 0>(mode, pxm, scale);
-		break;
-
-	default:
-		error("Invalid mode->bytespp=%d", mode->bytespp);
-	}
-
-}
-
-static void _gfx_xlate_pixmap_trilinear(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) {
-	if (mode->palette || !scale) { // fall back to unfiltered
-		_gfx_xlate_pixmap_unfiltered(mode, pxm, scale);
-		return;
-	}
-
-	pxm->width = pxm->index_width * mode->xfact;
-	pxm->height = pxm->index_height * mode->yfact;
-
-	switch (mode->bytespp) {
-	case 1:
-		_gfx_xlate_pixmap_trilinear<1, uint8, 0>(mode, pxm, scale);
-		break;
-
-	case 2:
-		_gfx_xlate_pixmap_trilinear<2, uint16, 0>(mode, pxm, scale);
-		break;
-
-	case 3:
-#ifdef SCUMM_BIG_ENDIAN
-		_gfx_xlate_pixmap_trilinear<3, uint32, 1>(mode, pxm, scale);
-#else
-		_gfx_xlate_pixmap_trilinear<3, uint32, 0>(mode, pxm, scale);
-#endif
-		break;
-
-	case 4:
-		_gfx_xlate_pixmap_trilinear<4, uint32, 0>(mode, pxm, scale);
-		break;
-
-	default:
-		error("Invalid mode->bytespp=%d", mode->bytespp);
-
-	}
-}
-
-void gfx_xlate_pixmap(gfx_pixmap_t *pxm, gfx_mode_t *mode, gfx_xlate_filter_t filter) {
+void gfx_xlate_pixmap(gfx_pixmap_t *pxm, gfx_mode_t *mode) {
 	int was_allocated = 0;
 
 	if (mode->palette) {
@@ -614,33 +176,13 @@
 		// Assume that memory, if allocated already, will be sufficient
 
 		// Allocate alpha map
-		if (!mode->alpha_mask && pxm->colors_nr() < GFX_PIC_COLORS)
+		if (pxm->colors_nr() < GFX_PIC_COLORS)
 			pxm->alpha_map = (byte*)malloc(mode->xfact * mode->yfact * pxm->index_width * pxm->index_height + 1);
 	} else
 		was_allocated = 1;
 
-	switch (filter) {
-	case GFX_XLATE_FILTER_NONE:
-		_gfx_xlate_pixmap_unfiltered(mode, pxm, !(pxm->flags & GFX_PIXMAP_FLAG_SCALED_INDEX));
-		break;
+	_gfx_xlate_pixmap_unfiltered(mode, pxm, !(pxm->flags & GFX_PIXMAP_FLAG_SCALED_INDEX));
 
-	case GFX_XLATE_FILTER_LINEAR:
-		_gfx_xlate_pixmap_linear(mode, pxm, !(pxm->flags & GFX_PIXMAP_FLAG_SCALED_INDEX));
-		break;
-
-	case GFX_XLATE_FILTER_TRILINEAR:
-		_gfx_xlate_pixmap_trilinear(mode, pxm, !(pxm->flags & GFX_PIXMAP_FLAG_SCALED_INDEX));
-		break;
-
-	default:
-		error("Attempt to filter pixmap %04x in invalid mode #%d", pxm->ID, filter);
-
-		if (!was_allocated) {
-			if (!mode->alpha_mask && pxm->colors_nr() < GFX_PIC_COLORS)
-				free(pxm->alpha_map);
-			free(pxm->data);
-		}
-	}
 	if (pxm->palette)
 		pxm->palette_revision = pxm->palette->getRevision();
 }

Modified: scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp	2009-09-04 08:37:53 UTC (rev 43937)
+++ scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp	2009-09-04 09:44:06 UTC (rev 43938)
@@ -292,14 +292,14 @@
 #define XLATE_AS_APPROPRIATE(key, entry) \
 	if (maps & key) { \
 		if (res->unscaled_data.pic&& (force || !res->unscaled_data.pic->entry->data)) { \
-			        gfx_xlate_pixmap(res->unscaled_data.pic->entry, mode, filter); \
+			        gfx_xlate_pixmap(res->unscaled_data.pic->entry, mode); \
 		} if (scaled && res->scaled_data.pic && (force || !res->scaled_data.pic->entry->data)) { \
-				gfx_xlate_pixmap(res->scaled_data.pic->entry, mode, filter); \
+				gfx_xlate_pixmap(res->scaled_data.pic->entry, mode); \
 		} \
 	}
 
 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, gfx_options_t *options) {
+										 gfx_options_t *options) {
 
 	XLATE_AS_APPROPRIATE(GFX_MASK_VISUAL, visual_map);
 	XLATE_AS_APPROPRIATE(GFX_MASK_PRIORITY, priority_map);
@@ -320,8 +320,6 @@
 	/* flags */ 0,
 	/* palette */ NULL,
 
-	/* color masks */ 0, 0, 0, 0,
-	/* color shifts */ 0, 0, 0, 0,
 	Graphics::PixelFormat()
 };
 
@@ -392,10 +390,10 @@
 
 #ifdef CUSTOM_GRAPHICS_OPTIONS
 	npic = gfxr_pic_xlate_common(res, maps, scaled || _options->pic0_unscaled, 0, _driver->getMode(),
-	                             _options->pic_xlate_filter, _options);
+	                             _options);
 #else
 	npic = gfxr_pic_xlate_common(res, maps, 1, 0, _driver->getMode(),
-	                             GFX_XLATE_FILTER_NONE, _options);
+	                             _options);
 #endif
 
 
@@ -494,9 +492,9 @@
 		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->getMode(), _options->pic_xlate_filter, _options);
+		pic = gfxr_pic_xlate_common(res, GFX_MASK_VISUAL, 1, 1, _driver->getMode(), _options);
 #else
-		pic = gfxr_pic_xlate_common(res, GFX_MASK_VISUAL, 1, 1, _driver->getMode(), GFX_XLATE_FILTER_NONE, _options);
+		pic = gfxr_pic_xlate_common(res, GFX_MASK_VISUAL, 1, 1, _driver->getMode(), _options);
 #endif
 		set_pic_id(res, old_ID);
 	}
@@ -590,12 +588,8 @@
 	if (!cel_data->data) {
 		if (!cel_data->palette)
 			cel_data->palette = view->palette->getref();
-#ifdef CUSTOM_GRAPHICS_OPTIONS
 		gfx_get_res_config(_options, cel_data);
-		gfx_xlate_pixmap(cel_data, _driver->getMode(), _options->view_xlate_filter);
-#else
-		gfx_xlate_pixmap(cel_data, _driver->getMode(), GFX_XLATE_FILTER_NONE);
-#endif
+		gfx_xlate_pixmap(cel_data, _driver->getMode());
 	}
 
 	return view;
@@ -678,9 +672,9 @@
 		}
 #ifdef CUSTOM_GRAPHICS_OPTIONS
 		gfx_get_res_config(_options, cursor);
-		gfx_xlate_pixmap(cursor, _driver->getMode(), _options->cursor_xlate_filter);
+		gfx_xlate_pixmap(cursor, _driver->getMode());
 #else
-		gfx_xlate_pixmap(cursor, _driver->getMode(), GFX_XLATE_FILTER_NONE);
+		gfx_xlate_pixmap(cursor, _driver->getMode());
 #endif
 
 		res->unscaled_data.pointer = cursor;

Modified: scummvm/trunk/engines/sci/gfx/gfx_support.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_support.cpp	2009-09-04 08:37:53 UTC (rev 43937)
+++ scummvm/trunk/engines/sci/gfx/gfx_support.cpp	2009-09-04 09:44:06 UTC (rev 43938)
@@ -218,7 +218,7 @@
 	byte *priority_pos = priority_dest;
 	unsigned int alpha_mask, alpha_min;
 	int bpp = mode->bytespp;
-	int bytes_per_alpha_pixel = pxm->alpha_map ? 1 : bpp;
+	int bytes_per_alpha_pixel = bpp;
 	int bytes_per_alpha_line =  bytes_per_alpha_pixel * pxm->width;
 	int xl = pxm->width, yl = pxm->height;
 	int xoffset = (dest_coords.x < 0) ? - dest_coords.x : 0;
@@ -290,7 +290,7 @@
 	else {
 		int shift_nr = 0;
 
-		alpha_mask = mode->alpha_mask;
+		alpha_mask = 0;
 		if (!alpha_mask && pxm->alpha_map) {
 			error("Invalid alpha mode: both pxm->alpha_map and alpha_mask are white");
 			return GFX_ERROR;

Modified: scummvm/trunk/engines/sci/gfx/gfx_system.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_system.h	2009-09-04 08:37:53 UTC (rev 43937)
+++ scummvm/trunk/engines/sci/gfx/gfx_system.h	2009-09-04 09:44:06 UTC (rev 43938)
@@ -75,9 +75,6 @@
 	 */
 	Palette *palette;
 
-	// TODO: remove those
-	uint32 red_mask, green_mask, blue_mask, alpha_mask;
-	short red_shift, green_shift, blue_shift, alpha_shift;
 	Graphics::PixelFormat format;
 };
 

Modified: scummvm/trunk/engines/sci/gfx/gfx_tools.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_tools.cpp	2009-09-04 08:37:53 UTC (rev 43937)
+++ scummvm/trunk/engines/sci/gfx/gfx_tools.cpp	2009-09-04 09:44:06 UTC (rev 43938)
@@ -51,26 +51,6 @@
 	mode->bytespp = format.bytesPerPixel;
 	mode->format = format;
 
-	// FIXME: I am not sure whether the following assignments are quite right.
-	// The only code using these are the built-in scalers of the SCI engine.
-	// And those are pretty weird, so I am not sure I interpreted them correctly.
-	// They also seem somewhat inefficient and and should probably just be
-	// replaced resp. rewritten from scratch.
-	if (format.bytesPerPixel > 1) {
-		mode->red_mask = format.ARGBToColor(0, 0xFF, 0, 0);
-		mode->green_mask = format.ARGBToColor(0, 0, 0xFF, 0);
-		mode->blue_mask = format.ARGBToColor(0, 0, 0, 0xFF);
-		mode->alpha_mask = format.ARGBToColor(0xFF, 0, 0, 0);
-		mode->red_shift = format.rShift;
-		mode->green_shift = format.gShift;
-		mode->blue_shift = format.bShift;
-		mode->alpha_shift = format.aShift;
-	} else {
-		mode->red_mask = mode->green_mask = mode->blue_mask = 0;
-		mode->alpha_mask = 0;
-		mode->red_shift = mode->green_shift = mode->blue_shift = 0;
-		mode->alpha_shift = 0;
-	}
 	mode->flags = flags;
 	mode->palette = palette;
 

Modified: scummvm/trunk/engines/sci/gfx/gfx_tools.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_tools.h	2009-09-04 08:37:53 UTC (rev 43937)
+++ scummvm/trunk/engines/sci/gfx/gfx_tools.h	2009-09-04 09:44:06 UTC (rev 43938)
@@ -36,12 +36,6 @@
 /** @name SCI graphics subsystem helper functions */
 /** @{ */
 
-enum gfx_xlate_filter_t {
-	GFX_XLATE_FILTER_NONE,
-	GFX_XLATE_FILTER_LINEAR,
-	GFX_XLATE_FILTER_TRILINEAR
-};
-
 /**
  * Allocates a new gfx_mode_t structure with the specified parameters
  *
@@ -176,9 +170,8 @@
  *
  * @param[in] pxm		The pixmap to translate
  * @param[in] mode		The mode according which to scale
- * @param[in] filter	How to filter the data
  */
-void gfx_xlate_pixmap(gfx_pixmap_t *pxm, gfx_mode_t *mode, gfx_xlate_filter_t filter);
+void gfx_xlate_pixmap(gfx_pixmap_t *pxm, gfx_mode_t *mode);
 
 #define GFX_CROSSBLIT_FLAG_DATA_IS_HOMED (1<<0) /**< Means that the first byte in the visual data refers to the point corresponding to (dest.x, dest.y) */
 

Modified: scummvm/trunk/engines/sci/gfx/operations.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/operations.cpp	2009-09-04 08:37:53 UTC (rev 43937)
+++ scummvm/trunk/engines/sci/gfx/operations.cpp	2009-09-04 09:44:06 UTC (rev 43938)
@@ -195,7 +195,7 @@
 	assert(pxm->palette->getParent() == driver->getMode()->palette);
 
 	if (pxm->palette_revision != pxm->palette->getRevision())
-		gfx_xlate_pixmap(pxm, driver->getMode(), GFX_XLATE_FILTER_NONE);
+		gfx_xlate_pixmap(pxm, driver->getMode());
 
 	if (!driver->getMode()->palette->isDirty())
 		return;
@@ -995,7 +995,7 @@
 	if (state->fullscreen_override) {
 		// We've been asked to re-draw the active full-screen image, essentially.
 		rect_t rect = gfx_rect(0, 0, 320, 200);
-		gfx_xlate_pixmap(state->fullscreen_override, state->driver->getMode(), GFX_XLATE_FILTER_NONE);
+		gfx_xlate_pixmap(state->fullscreen_override, state->driver->getMode());
 		gfxop_draw_pixmap(state, state->fullscreen_override, rect, Common::Point(0, 0));
 		_gfxop_update_box(state, rect);
 	}
@@ -1875,11 +1875,7 @@
 		gfx_pixmap_t *pxm = handle->text_pixmaps[i];
 
 		if (!pxm->data) {
-#ifdef CUSTOM_GRAPHICS_OPTIONS
-			gfx_xlate_pixmap(pxm, state->driver->getMode(), state->options->text_xlate_filter);
-#else
-			gfx_xlate_pixmap(pxm, state->driver->getMode(), GFX_XLATE_FILTER_NONE);
-#endif
+			gfx_xlate_pixmap(pxm, state->driver->getMode());
 		}
 		if (!pxm)
 			error("Could not find text pixmap %d/%d", i, handle->lines.size());

Modified: scummvm/trunk/engines/sci/gfx/res_pic.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/res_pic.cpp	2009-09-04 08:37:53 UTC (rev 43937)
+++ scummvm/trunk/engines/sci/gfx/res_pic.cpp	2009-09-04 09:44:06 UTC (rev 43938)
@@ -1556,7 +1556,7 @@
 				gfx_mode_t *mode = gfx_new_mode(pic->visual_map->index_width / 320,
 				           pic->visual_map->index_height / 200, format, view->palette, 0);
 
-				gfx_xlate_pixmap(view, mode, GFX_XLATE_FILTER_NONE);
+				gfx_xlate_pixmap(view, mode);
 				gfx_free_mode(mode);
 				// When the mode is freed, the associated view
 				// palette is freed too, so set it to NULL
@@ -1661,7 +1661,7 @@
 		Graphics::PixelFormat format(1, 0, 0, 0, 0, 0, 0, 0, 0); // 1 byte/p, which handles masks and the rest for us
 		gfx_mode_t *mode = gfx_new_mode(pic->visual_map->index_width / 320, pic->visual_map->index_height / 200, format, view->palette, 0);
 
-		gfx_xlate_pixmap(view, mode, GFX_XLATE_FILTER_NONE);
+		gfx_xlate_pixmap(view, mode);
 		gfx_free_mode(mode);
 
 		if (flags & DRAWPIC01_FLAG_OVERLAID_PIC)

Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp	2009-09-04 08:37:53 UTC (rev 43937)
+++ scummvm/trunk/engines/sci/sci.cpp	2009-09-04 09:44:06 UTC (rev 43938)
@@ -158,10 +158,6 @@
 	_gamestate->gfx_state = &gfx_state;
 
 	// Assign default values to the config manager, in case settings are missing
-	ConfMan.registerDefault("cursor_filter", "0");
-	ConfMan.registerDefault("view_filter", "0");
-	ConfMan.registerDefault("pic_filter", "0");
-	ConfMan.registerDefault("text_filter", "0");
 	ConfMan.registerDefault("dither_mode", "0");
 
 	// Default config:
@@ -172,10 +168,6 @@
 	gfx_options.pic0_dither_mode = (DitherMode)ConfMan.getInt("dither_mode");
 	gfx_options.pic0_brush_mode = GFX_BRUSH_MODE_RANDOM_ELLIPSES;
 	gfx_options.pic0_line_mode = GFX_LINE_MODE_CORRECT;
-	gfx_options.cursor_xlate_filter = (gfx_xlate_filter_t)ConfMan.getInt("cursor_filter");
-	gfx_options.view_xlate_filter = (gfx_xlate_filter_t)ConfMan.getInt("view_filter");
-	gfx_options.pic_xlate_filter = (gfx_xlate_filter_t)ConfMan.getInt("pic_filter");
-	gfx_options.text_xlate_filter = (gfx_xlate_filter_t)ConfMan.getInt("text_filter");
 	for (int i = 0; i < GFX_RESOURCE_TYPES_NR; i++) {
 		gfx_options.res_conf.assign[i] = NULL;
 		gfx_options.res_conf.mod[i] = NULL;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list