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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun Mar 1 05:29:09 CET 2009


Revision: 39001
          http://scummvm.svn.sourceforge.net/scummvm/?rev=39001&view=rev
Author:   fingolfin
Date:     2009-03-01 04:29:09 +0000 (Sun, 01 Mar 2009)

Log Message:
-----------
SCI: pass gfx_pixmap_color_t instead of r,g,b triple, makes calling code a bit easier to read :)

Modified Paths:
--------------
    scummvm/trunk/engines/sci/gfx/operations.cpp

Modified: scummvm/trunk/engines/sci/gfx/operations.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/operations.cpp	2009-03-01 04:07:04 UTC (rev 39000)
+++ scummvm/trunk/engines/sci/gfx/operations.cpp	2009-03-01 04:29:09 UTC (rev 39001)
@@ -1002,13 +1002,13 @@
 
 #define COLOR_MIX(type, dist) ((color1.type * dist) + (color2.type * (1.0 - dist)))
 
-int _gfxop_matchColor(gfx_state_t *state, byte r, byte g, byte b) {
+int _gfxop_matchColor(gfx_state_t *state, const gfx_pixmap_color_t &color) {
 	int i, delta, bestindex = -1, bestdelta = 200000;
 
 	for (i = 0; i < state->static_palette_entries; i++) {
-		int dr = abs(state->static_palette[i].r - r);
-		int dg = abs(state->static_palette[i].g - g);
-		int db = abs(state->static_palette[i].b - b);
+		int dr = abs(state->static_palette[i].r - color.r);
+		int dg = abs(state->static_palette[i].g - color.g);
+		int db = abs(state->static_palette[i].b - color.b);
 
 		delta = dr * dr + dg * dg + db * db;
 
@@ -1092,8 +1092,7 @@
 
 	if (shade_type == GFX_BOX_SHADE_FLAT) {
 		if (color1.visual.global_index == -1)
-			color1.visual.global_index = _gfxop_matchColor(state, color1.visual.r, color1.visual.g,
-				color1.visual.b);
+			color1.visual.global_index = _gfxop_matchColor(state, color1.visual);
 		return drv->draw_filled_rect(drv, new_box, color1, color1, GFX_SHADE_FLAT);
 	} else {
 		if (PALETTE_MODE) {
@@ -1942,10 +1941,9 @@
 
 		if (!pxm->data) {
 			// Matching pixmap's colors to current system palette if needed
-			for (int i = 0; i < pxm->colors_nr; i++) {
-				if (pxm->colors[i].global_index == -1)
-					pxm->colors[i].global_index = _gfxop_matchColor(state, pxm->colors[i].r, pxm->colors[i].g,
-					pxm->colors[i].b);
+			for (int j = 0; j < pxm->colors_nr; j++) {
+				if (pxm->colors[j].global_index == -1)
+					pxm->colors[j].global_index = _gfxop_matchColor(state, pxm->colors[j]);
 			}
 
 			gfx_xlate_pixmap(pxm, state->driver->mode, state->options->text_xlate_filter);


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