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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Sep 4 12:15:13 CEST 2009


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

Log Message:
-----------
Removed the "reverse alpha" flag from the graphics driver code. Alpha values are now always 0 for transparent, up to 255 for opaque

Modified Paths:
--------------
    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

Modified: scummvm/trunk/engines/sci/gfx/gfx_pixmap_scale.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_pixmap_scale.cpp	2009-09-04 09:44:06 UTC (rev 43938)
+++ scummvm/trunk/engines/sci/gfx/gfx_pixmap_scale.cpp	2009-09-04 10:15:12 UTC (rev 43939)
@@ -44,8 +44,8 @@
 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 & 0;
-	SIZETYPE alpha_ormask = 0;
+	SIZETYPE alpha_color = 0;
+	SIZETYPE alpha_ormask = 0xffffffff & 0;
 	int xfact = (scale) ? mode->xfact : 1;
 	int yfact = (scale) ? mode->yfact : 1;
 	int widthc, heightc; // Width duplication counter
@@ -53,19 +53,14 @@
 	int bytespp = mode->bytespp;
 	int x, y;
 	int i;
-	byte byte_transparent = (mode->flags & GFX_MODE_FLAG_REVERSE_ALPHA) ?  0 : 255;
-	byte byte_opaque = (mode->flags & GFX_MODE_FLAG_REVERSE_ALPHA) ?  255 : 0;
+	byte byte_transparent = 0;
+	byte byte_opaque = 255;
 	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 = using_alpha;
 
-	if (mode->flags & GFX_MODE_FLAG_REVERSE_ALPHA) {
-		alpha_ormask = alpha_color;
-		alpha_color = 0;
-	}
-
 	assert(bytespp == COPY_BYTES);
 
 	if (separate_alpha_map && !alpha_dest)

Modified: scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp	2009-09-04 09:44:06 UTC (rev 43938)
+++ scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp	2009-09-04 10:15:12 UTC (rev 43939)
@@ -317,7 +317,6 @@
 	/* xfact */ 1, /* yfact */ 1,
 	/* xsize */ 1, /* ysize */ 1,
 	/* bytespp */ 1,
-	/* flags */ 0,
 	/* palette */ NULL,
 
 	Graphics::PixelFormat()

Modified: scummvm/trunk/engines/sci/gfx/gfx_support.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_support.cpp	2009-09-04 09:44:06 UTC (rev 43938)
+++ scummvm/trunk/engines/sci/gfx/gfx_support.cpp	2009-09-04 10:15:12 UTC (rev 43939)
@@ -128,7 +128,7 @@
  * BYTESPP: Bytes per pixel
  * USE_PRIORITY: Whether to care about the priority buffer
  */
-template <int BYTESPP, bool USE_PRIORITY, bool REVERSE_ALPHA>
+template <int BYTESPP, bool USE_PRIORITY>
 void _gfx_crossblit(byte *dest, byte *src, int bytes_per_dest_line, int bytes_per_src_line,
 	int xl, int yl, byte *alpha, int bytes_per_alpha_line, int bytes_per_alpha_pixel,
 	unsigned int alpha_test_mask, unsigned int alpha_min,
@@ -143,7 +143,7 @@
 		int priority_offset = 0;
 
 		for (x = 0; x < alpha_end; x += bytes_per_alpha_pixel) {
-			if (((alpha_test_mask & alpha[x]) < alpha_min) ^ REVERSE_ALPHA) {
+			if (((alpha_test_mask & alpha[x]) < alpha_min) ^ 1) {
 
 				if (USE_PRIORITY) {
 					if (priority_buffer[priority_offset] <= priority) {
@@ -169,35 +169,20 @@
 	}
 }
 
-
 static void (*crossblit_fns[5])(byte *, byte *, int, int, int, int, byte *, int, int, unsigned int, unsigned int, byte *, int, int, int) = { NULL,
-	_gfx_crossblit<1, false, false>,
-	_gfx_crossblit<2, false, false>,
-	_gfx_crossblit<3, false, false>,
-	_gfx_crossblit<4, false, false>
+	_gfx_crossblit<1, false>,
+	_gfx_crossblit<2, false>,
+	_gfx_crossblit<3, false>,
+	_gfx_crossblit<4, false>
 };
 
 static void (*crossblit_fns_P[5])(byte *, byte *, int, int, int, int, byte *, int, int, unsigned int, unsigned int, byte *, int, int, int) = { NULL,
-	_gfx_crossblit<1, true, false>,
-	_gfx_crossblit<2, true, false>,
-	_gfx_crossblit<3, true, false>,
-	_gfx_crossblit<4, true, false>
+	_gfx_crossblit<1, true>,
+	_gfx_crossblit<2, true>,
+	_gfx_crossblit<3, true>,
+	_gfx_crossblit<4, true>
 };
 
-static void (*crossblit_fns_RA[5])(byte *, byte *, int, int, int, int, byte *, int, int, unsigned int, unsigned int, byte *, int, int, int) = { NULL,
-	_gfx_crossblit<1, false, true>,
-	_gfx_crossblit<2, false, true>,
-	_gfx_crossblit<3, false, true>,
-	_gfx_crossblit<4, false, true>
-};
-
-static void (*crossblit_fns_P_RA[5])(byte *, byte *, int, int, int, int, byte *, int, int, unsigned int, unsigned int, byte *, int, int, int) = { NULL,
-	_gfx_crossblit<1, true, true>,
-	_gfx_crossblit<2, true, true>,
-	_gfx_crossblit<3, true, true>,
-	_gfx_crossblit<4, true, true>
-};
-
 void _gfx_crossblit_simple(byte *dest, byte *src, int dest_line_width, int src_line_width, int xl, int yl, int bpp) {
 	int line_width = xl * bpp;
 	int i;
@@ -223,7 +208,6 @@
 	int xl = pxm->width, yl = pxm->height;
 	int xoffset = (dest_coords.x < 0) ? - dest_coords.x : 0;
 	int yoffset = (dest_coords.y < 0) ? - dest_coords.y : 0;
-	int revalpha = mode->flags & GFX_MODE_FLAG_REVERSE_ALPHA;
 
 	if (src_coords.x + src_coords.width > xl)
 		src_coords.width = xl - src_coords.x;
@@ -322,8 +306,7 @@
 		else
 			alpha_min = ((alpha_mask >> 8) * gfx_crossblit_alpha_threshold) & alpha_mask;
 
-		if (revalpha)
-			alpha_min = 255 - alpha_min; // Since we use it for the reverse effect
+		alpha_min = 255 - alpha_min; // Since we use it for the reverse effect
 
 		if (!alpha_mask)
 			_gfx_crossblit_simple(dest, src, dest_line_width, pxm->width * bpp, xl, yl, bpp);
@@ -331,7 +314,7 @@
 
 			if (priority == GFX_NO_PRIORITY) {
 				if (bpp > 0 && bpp < 5)
-					((revalpha) ? crossblit_fns_RA : crossblit_fns)[bpp](dest, src, dest_line_width, pxm->width * bpp,
+					crossblit_fns[bpp](dest, src, dest_line_width, pxm->width * bpp,
 					        xl, yl, alpha, bytes_per_alpha_line, bytes_per_alpha_pixel, alpha_mask, alpha_min,
 					        0, 0, 0, 0);
 				else {
@@ -340,7 +323,7 @@
 				}
 			} else { // priority
 				if (bpp > 0 && bpp < 5)
-					((revalpha) ? crossblit_fns_P_RA : crossblit_fns_P)[bpp](dest, src, dest_line_width, pxm->width * bpp,
+					crossblit_fns_P[bpp](dest, src, dest_line_width, pxm->width * bpp,
 					        xl, yl, alpha, bytes_per_alpha_line, bytes_per_alpha_pixel, alpha_mask, alpha_min,
 					        priority_pos, priority_line_width, priority_skip, priority);
 				else {

Modified: scummvm/trunk/engines/sci/gfx/gfx_system.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_system.h	2009-09-04 09:44:06 UTC (rev 43938)
+++ scummvm/trunk/engines/sci/gfx/gfx_system.h	2009-09-04 10:15:12 UTC (rev 43939)
@@ -44,10 +44,6 @@
 
 #define GFX_MODE_IS_UNSCALED(mode) (((mode)->xfact == 1) && ((mode)->yfact == 1))
 
-/* Reverse Alpha: Alpha values 0 mean "transparent" if this is
-** enabled  */
-#define GFX_MODE_FLAG_REVERSE_ALPHA  (1<<1)
-
 /** Graphics mode description
  *
  * Color masks:
@@ -67,8 +63,6 @@
 	int xsize, ysize; /**< Horizontal and vertical size */
 	int bytespp; /**< Bytes per pixel */
 
-	uint32 flags; /**< GFX_MODE_FLAG_* Flags- see above */
-
 	/**
 	 * Palette or NULL to indicate non-palette mode.
 	 * Palette mode is only supported for bytespp = 1

Modified: scummvm/trunk/engines/sci/gfx/gfx_tools.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_tools.cpp	2009-09-04 09:44:06 UTC (rev 43938)
+++ scummvm/trunk/engines/sci/gfx/gfx_tools.cpp	2009-09-04 10:15:12 UTC (rev 43939)
@@ -50,8 +50,6 @@
 	mode->yfact = yfact;
 	mode->bytespp = format.bytesPerPixel;
 	mode->format = format;
-
-	mode->flags = flags;
 	mode->palette = palette;
 
 	return mode;


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