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

aquadran at users.sourceforge.net aquadran at users.sourceforge.net
Sat Feb 21 09:16:05 CET 2009


Revision: 38668
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38668&view=rev
Author:   aquadran
Date:     2009-02-21 08:16:04 +0000 (Sat, 21 Feb 2009)

Log Message:
-----------
formating

Modified Paths:
--------------
    scummvm/trunk/engines/sci/gfx/font.cpp
    scummvm/trunk/engines/sci/gfx/gfx_driver.cpp
    scummvm/trunk/engines/sci/gfx/gfx_line.cpp
    scummvm/trunk/engines/sci/gfx/gfx_pixmap_scale.cpp
    scummvm/trunk/engines/sci/gfx/gfx_res_options.cpp
    scummvm/trunk/engines/sci/gfx/gfx_resource.cpp
    scummvm/trunk/engines/sci/gfx/gfx_support.cpp
    scummvm/trunk/engines/sci/gfx/gfx_tools.cpp

Modified: scummvm/trunk/engines/sci/gfx/font.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/font.cpp	2009-02-21 07:43:46 UTC (rev 38667)
+++ scummvm/trunk/engines/sci/gfx/font.cpp	2009-02-21 08:16:04 UTC (rev 38668)
@@ -30,8 +30,7 @@
 
 int font_counter = 0;
 
-void
-gfxr_free_font(gfx_bitmap_font_t *font) {
+void gfxr_free_font(gfx_bitmap_font_t *font) {
 	if (font->widths)
 		free(font->widths);
 
@@ -43,10 +42,7 @@
 	free(font);
 }
 
-
-
-void
-scale_char(byte *dest, byte *src, int width, int height, int newwidth, int xfact, int yfact) {
+void scale_char(byte *dest, byte *src, int width, int height, int newwidth, int xfact, int yfact) {
 	int x, y;
 
 	for (y = 0; y < height; y++) {
@@ -85,9 +81,8 @@
 	}
 }
 
-gfx_bitmap_font_t *
-gfxr_scale_font_unfiltered(gfx_bitmap_font_t *orig_font, gfx_mode_t *mode) {
-	gfx_bitmap_font_t *font = (gfx_bitmap_font_t*)sci_malloc(sizeof(gfx_bitmap_font_t));
+gfx_bitmap_font_t *gfxr_scale_font_unfiltered(gfx_bitmap_font_t *orig_font, gfx_mode_t *mode) {
+	gfx_bitmap_font_t *font = (gfx_bitmap_font_t *)sci_malloc(sizeof(gfx_bitmap_font_t));
 	int height = orig_font->height * mode->yfact;
 	int width = 0;
 	int byte_width;
@@ -115,18 +110,14 @@
 
 	for (i = 0; i < font->chars_nr; i++) {
 		font->widths[i] = orig_font->widths[i] * mode->xfact;
-		scale_char(font->data + font->char_size * i,
-		           orig_font->data + orig_font->char_size * i,
-		           orig_font->row_size, orig_font->height,
-		           font->row_size,
-		           mode->xfact, mode->yfact);
+		scale_char(font->data + font->char_size * i, orig_font->data + orig_font->char_size * i,
+		           orig_font->row_size, orig_font->height, font->row_size, mode->xfact, mode->yfact);
 	}
+
 	return font;
 }
 
-
-gfx_bitmap_font_t *
-gfxr_scale_font(gfx_bitmap_font_t *orig_font, gfx_mode_t *mode, gfxr_font_scale_filter_t filter) {
+gfx_bitmap_font_t *gfxr_scale_font(gfx_bitmap_font_t *orig_font, gfx_mode_t *mode, gfxr_font_scale_filter_t filter) {
 	GFXWARN("This function hasn't been tested yet");
 
 	switch (filter) {
@@ -140,16 +131,10 @@
 	}
 }
 
-
-
-
-text_fragment_t *
-gfxr_font_calculate_size(gfx_bitmap_font_t *font, int max_width, const char *text,
-                         int *width, int *height,
-                         int *lines, int *line_height_p, int *last_offset_p,
-                         int flags) {
+text_fragment_t *gfxr_font_calculate_size(gfx_bitmap_font_t *font, int max_width, const char *text, int *width, int *height, 
+                         int *lines, int *line_height_p, int *last_offset_p, int flags) {
 	int est_char_width = font->widths[(font->chars_nr > 'M')? 'M' : font->chars_nr - 1];
-	/* 'M' is typically among the widest chars */
+	// 'M' is typically among the widest chars
 	int fragments_nr;
 	text_fragment_t *fragments;
 	int lineheight = font->line_height;
@@ -168,13 +153,11 @@
 	if (max_width > 1) fragments_nr = 3 + (strlen(text) * est_char_width) * 3 / (max_width << 1);
 	else fragments_nr = 1;
 
-	fragments = (text_fragment_t*)sci_calloc(sizeof(text_fragment_t), fragments_nr);
+	fragments = (text_fragment_t *)sci_calloc(sizeof(text_fragment_t), fragments_nr);
 
-
 	fragments[0].offset = text;
 
 	while ((foo = *text++)) {
-
 		if (foo >= font->chars_nr) {
 			GFXWARN("Invalid char 0x%02x (max. 0x%02x) encountered in text string '%s', font %04x\n",
 			        foo, font->chars_nr, text, font->ID);
@@ -186,16 +169,14 @@
 			}
 		}
 
-		if (((foo == '\n') || (foo == 0x0d))
-		        && !(flags & GFXR_FONT_FLAG_NO_NEWLINES)) {
-
+		if (((foo == '\n') || (foo == 0x0d)) && !(flags & GFXR_FONT_FLAG_NO_NEWLINES)) {
 			fragments[current_fragment-1].length = text - 1 - fragments[current_fragment-1].offset;
 
 			if (*text)
 				maxheight += lineheight;
 
 			if (foo == 0x0d && *text == '\n')
-				text++; /* Interpret DOS-style CR LF as single NL */
+				text++; // Interpret DOS-style CR LF as single NL
 
 			fragments[current_fragment++].offset = text;
 
@@ -207,27 +188,26 @@
 
 			localmaxwidth = 0;
 
-		} else { /* foo != '\n' */
+		} else { // foo != '\n'
 			localmaxwidth += font->widths[foo];
 
 			if (localmaxwidth > max_allowed_width) {
-				int blank_break = 1; /* break is at a blank char, i.e. not within a word */
+				int blank_break = 1; // break is at a blank char, i.e. not within a word
 
 				maxheight += lineheight;
 
-				if (last_breakpoint == 0) { /* Text block too long and without whitespace? */
+				if (last_breakpoint == 0) { // Text block too long and without whitespace?
 					last_breakpoint = localmaxwidth - font->widths[foo];
 					last_break_width = 0;
 					--text;
-					blank_break = 0; /* non-blank break */
+					blank_break = 0; // non-blank break
 				} else {
 					text = breakpoint_ptr + 1;
 					assert(breakpoint_ptr);
 				}
 
 				if (last_breakpoint == 0) {
-					GFXWARN("Warning: maxsize %d too small for '%s'\n",
-					        max_allowed_width, text);
+					GFXWARN("Warning: maxsize %d too small for '%s'\n", max_allowed_width, text);
 				}
 
 				if (last_breakpoint > maxwidth)
@@ -271,9 +251,7 @@
 	return fragments;
 }
 
-
-static inline void
-render_char(byte *dest, byte *src, int width, int line_width, int lines, int bytes_per_src_line, int fg0, int fg1, int bg) {
+static inline void render_char(byte *dest, byte *src, int width, int line_width, int lines, int bytes_per_src_line, int fg0, int fg1, int bg) {
 	int x, y;
 
 	for (y = 0; y < lines; y++) {
@@ -301,10 +279,9 @@
 	}
 }
 
-gfx_pixmap_t *
-gfxr_draw_font(gfx_bitmap_font_t *font, const char *stext, int characters,
+gfx_pixmap_t *gfxr_draw_font(gfx_bitmap_font_t *font, const char *stext, int characters,
                gfx_pixmap_color_t *fg0, gfx_pixmap_color_t *fg1, gfx_pixmap_color_t *bg) {
-	unsigned char *text = (unsigned char *) stext;
+	unsigned char *text = (unsigned char *)stext;
 	int height = font->height;
 	int width = 0;
 	gfx_pixmap_t *pxm;
@@ -334,7 +311,7 @@
 		hack = 1;
 		fg0 = fg1 = bg = &dummy;
 	}
-	pxm->colors = (gfx_pixmap_color_t*)sci_malloc(sizeof(gfx_pixmap_color_t) * pxm->colors_nr);
+	pxm->colors = (gfx_pixmap_color_t *)sci_malloc(sizeof(gfx_pixmap_color_t) * pxm->colors_nr);
 #ifdef SATISFY_PURIFY
 	memset(pxm->colors, 0, sizeof(gfx_pixmap_color_t) * pxm->colors_nr);
 #endif
@@ -345,17 +322,20 @@
 	if (fg0 || hack) {
 		memcpy(pxm->colors + i, fg0, sizeof(gfx_pixmap_color_t));
 		fore_0 = i++;
-	} else fore_0 = pxm->color_key;
+	} else
+		fore_0 = pxm->color_key;
 
 	if (fg1 || hack) {
 		memcpy(pxm->colors + i, fg1, sizeof(gfx_pixmap_color_t));
 		fore_1 = i++;
-	} else fore_1 = pxm->color_key;
+	} else
+		fore_1 = pxm->color_key;
 
 	if (bg || hack) {
 		memcpy(pxm->colors + i, bg, sizeof(gfx_pixmap_color_t));
 		back = i++;
-	} else back = pxm->color_key;
+	} else
+		back = pxm->color_key;
 
 	offset = pxm->index_data;
 
@@ -365,12 +345,10 @@
 		width = font->widths[ch];
 
 		render_char(offset, font->data + (ch * font->char_size), width,
-		            pxm->index_xl, pxm->index_yl, font->row_size,
-		            fore_0, fore_1, back);
+		            pxm->index_xl, pxm->index_yl, font->row_size, fore_0, fore_1, back);
 
 		offset += width;
 	}
 
 	return pxm;
 }
-

Modified: scummvm/trunk/engines/sci/gfx/gfx_driver.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_driver.cpp	2009-02-21 07:43:46 UTC (rev 38667)
+++ scummvm/trunk/engines/sci/gfx/gfx_driver.cpp	2009-02-21 08:16:04 UTC (rev 38668)
@@ -61,8 +61,7 @@
 	for (i = 0; i < 2; i++) {
 		S->priority[i] = gfx_pixmap_alloc_index_data(gfx_new_pixmap(S->xsize, S->ysize, GFX_RESID_NONE, -i, -777));
 		if (!S->priority[i]) {
-			printf("Out of memory: Could not allocate priority maps! (%dx%d)\n",
-			       S->xsize, S->ysize);
+			printf("Out of memory: Could not allocate priority maps! (%dx%d)\n", S->xsize, S->ysize);
 			return GFX_FATAL;
 		}
 	}
@@ -71,27 +70,22 @@
 		S->visual[i] = NULL;
 		S->visual[i] = new byte[S->xsize * S->ysize];
 		if (!S->visual[i]) {
-			printf("Out of memory: Could not allocate visual buffers! (%dx%d)\n",
-			       S->xsize, S->ysize);
+			printf("Out of memory: Could not allocate visual buffers! (%dx%d)\n", S->xsize, S->ysize);
 			return GFX_FATAL;
 		}
 		memset(S->visual[i], 0, S->xsize * S->ysize);
 	}
 
-	drv->mode = gfx_new_mode(xfact, yfact, bytespp,
-	                         0, 0, 0, 0,
-	                         0, 0, 0, 0, 256, 0);
+	drv->mode = gfx_new_mode(xfact, yfact, bytespp, 0, 0, 0, 0, 0, 0, 0, 0, 256, 0);
 
 	return GFX_OK;
 }
 
-static int
-scummvm_init(struct _gfx_driver *drv) {
+static int scummvm_init(struct _gfx_driver *drv) {
 	return scummvm_init_specific(drv, 1, 1, GFX_COLOR_MODE_INDEX);
 }
 
-static void
-scummvm_exit(struct _gfx_driver *drv) {
+static void scummvm_exit(struct _gfx_driver *drv) {
 	int i;
 	if (S) {
 		for (i = 0; i < 2; i++) {
@@ -117,9 +111,8 @@
 
 // Drawing operations
 
-/* This code shamelessly lifted from the SDL_gfxPrimitives package */
-static void
-lineColor2(byte *dst, int16 x1, int16 y1, int16 x2, int16 y2, uint32 color) {
+// This code shamelessly lifted from the SDL_gfxPrimitives package
+static void lineColor2(byte *dst, int16 x1, int16 y1, int16 x2, int16 y2, uint32 color) {
 	int pixx, pixy;
 	int x, y;
 	int dx, dy;
@@ -148,7 +141,7 @@
 		pixy = swaptmp;
 	}
 
-	/* Draw */
+	// Draw
 	x = 0;
 	y = 0;
 	for (; x < dx; x++, pixel += pixx) {
@@ -161,10 +154,8 @@
 	}
 }
 
-static int
-scummvm_draw_line(struct _gfx_driver *drv, Common::Point start, Common::Point end,
-                  gfx_color_t color,
-                  gfx_line_mode_t line_mode, gfx_line_style_t line_style) {
+static int scummvm_draw_line(struct _gfx_driver *drv, Common::Point start, Common::Point end,
+                  gfx_color_t color, gfx_line_mode_t line_mode, gfx_line_style_t line_style) {
 	uint32 scolor = color.visual.global_index;
 	int xsize = S->xsize;
 	int ysize = S->ysize;
@@ -177,21 +168,17 @@
 		nend.x = CLIP<int16>(end.x, 0, xsize - 1);
 		nend.y = CLIP<int16>(end.y, 0, ysize - 1);
 
-		lineColor2(S->visual[1], (int16)nstart.x, (int16)nstart.y,
-		           (int16)nend.x, (int16)nend.y, scolor);
+		lineColor2(S->visual[1], (int16)nstart.x, (int16)nstart.y, (int16)nend.x, (int16)nend.y, scolor);
 
 		if (color.mask & GFX_MASK_PRIORITY) {
-			gfx_draw_line_pixmap_i(S->priority[0], nstart, nend,
-			                       color.priority);
+			gfx_draw_line_pixmap_i(S->priority[0], nstart, nend, color.priority);
 		}
 	}
 
 	return GFX_OK;
 }
 
-static int
-scummvm_draw_filled_rect(struct _gfx_driver *drv, rect_t rect,
-                         gfx_color_t color1, gfx_color_t color2,
+static int scummvm_draw_filled_rect(struct _gfx_driver *drv, rect_t rect, gfx_color_t color1, gfx_color_t color2,
                          gfx_rectangle_fill_t shade_mode) {
 	if (color1.mask & GFX_MASK_VISUAL) {
 		for (int i = rect.y; i < rect.y + rect.yl; i++) {
@@ -205,32 +192,25 @@
 	return GFX_OK;
 }
 
-
 // Pixmap operations
 
-static int
-scummvm_draw_pixmap(struct _gfx_driver *drv, gfx_pixmap_t *pxm, int priority,
-                    rect_t src, rect_t dest, gfx_buffer_t buffer) {
+static int scummvm_draw_pixmap(struct _gfx_driver *drv, gfx_pixmap_t *pxm, int priority, 
+							   rect_t src, rect_t dest, gfx_buffer_t buffer) {
 	int bufnr = (buffer == GFX_BUFFER_STATIC) ? 2 : 1;
 	int pribufnr = bufnr - 1;
 
 	if (dest.xl != src.xl || dest.yl != src.yl) {
-		printf("Attempt to scale pixmap (%dx%d)->(%dx%d): Not supported\n",
-		       src.xl, src.yl, dest.xl, dest.yl);
+		printf("Attempt to scale pixmap (%dx%d)->(%dx%d): Not supported\n", src.xl, src.yl, dest.xl, dest.yl);
 		return GFX_ERROR;
 	}
 
-	gfx_crossblit_pixmap(drv->mode, pxm, priority, src, dest,
-	                     S->visual[bufnr], S->xsize,
-	                     S->priority[pribufnr]->index_data,
-	                     S->priority[pribufnr]->index_xl, 1, 0);
+	gfx_crossblit_pixmap(drv->mode, pxm, priority, src, dest, S->visual[bufnr], S->xsize,
+	                     S->priority[pribufnr]->index_data, S->priority[pribufnr]->index_xl, 1, 0);
 
 	return GFX_OK;
 }
 
-static int
-scummvm_grab_pixmap(struct _gfx_driver *drv, rect_t src, gfx_pixmap_t *pxm,
-                    gfx_map_mask_t map) {
+static int scummvm_grab_pixmap(struct _gfx_driver *drv, rect_t src, gfx_pixmap_t *pxm, gfx_map_mask_t map) {
 	if (src.x < 0 || src.y < 0) {
 		printf("Attempt to grab pixmap from invalid coordinates (%d,%d)\n", src.x, src.y);
 		return GFX_ERROR;
@@ -263,19 +243,16 @@
 	return GFX_OK;
 }
 
-
 // Buffer operations
 
-static int
-scummvm_update(struct _gfx_driver *drv, rect_t src, Common::Point dest, gfx_buffer_t buffer) {
+static int scummvm_update(struct _gfx_driver *drv, rect_t src, Common::Point dest, gfx_buffer_t buffer) {
 	//TODO
 	int data_source = (buffer == GFX_BUFFER_BACK) ? 2 : 1;
 	int data_dest = data_source - 1;
 
 	/*
 	if (src.x != dest.x || src.y != dest.y) {
-		printf("Updating %d (%d,%d)(%dx%d) to (%d,%d) on %d\n", buffer, src.x, src.y,
-			src.xl, src.yl, dest.x, dest.y, data_dest);
+		printf("Updating %d (%d,%d)(%dx%d) to (%d,%d) on %d\n", buffer, src.x, src.y, src.xl, src.yl, dest.x, dest.y, data_dest);
 	} else {
 		printf("Updating %d (%d,%d)(%dx%d) to %d\n", buffer, src.x, src.y, src.xl, src.yl, data_dest);
 	}
@@ -294,14 +271,11 @@
 			gfx_copy_pixmap_box_i(S->priority[0], S->priority[1], src);
 		break;
 	case GFX_BUFFER_FRONT:
-		memcpy(S->visual[data_dest], S->visual[data_source],
-		       S->xsize * S->ysize);
+		memcpy(S->visual[data_dest], S->visual[data_source], S->xsize * S->ysize);
 
-		g_system->copyRectToScreen(S->visual[data_dest] + src.x + src.y * S->xsize,
-		                           S->xsize, dest.x, dest.y, src.xl, src.yl);
+		g_system->copyRectToScreen(S->visual[data_dest] + src.x + src.y * S->xsize, S->xsize, dest.x, dest.y, src.xl, src.yl);
 		/*
-		g_system->copyRectToScreen(S->visual[data_dest],
-			S->xsize, 0, 0, S->xsize, S->ysize);
+		g_system->copyRectToScreen(S->visual[data_dest], S->xsize, 0, 0, S->xsize, S->ysize);
 		*/
 		S->update_screen = true;
 		break;
@@ -310,28 +284,22 @@
 		return GFX_ERROR;
 	}
 
-
 	return GFX_OK;
 }
 
-static int
-scummvm_set_static_buffer(struct _gfx_driver *drv, gfx_pixmap_t *pic, gfx_pixmap_t *priority) {
+static int scummvm_set_static_buffer(struct _gfx_driver *drv, gfx_pixmap_t *pic, gfx_pixmap_t *priority) {
 	memcpy(S->visual[2], pic->data, S->xsize * S->ysize);
-	/*gfx_crossblit_pixmap(drv->mode, pic, 0, rect, rect,
-			S->visual[2], S->xsize,
-			S->priority[1]->index_data,
-			S->priority[1]->index_xl, 1, 0);*/
+	/*gfx_crossblit_pixmap(drv->mode, pic, 0, rect, rect, S->visual[2], S->xsize, S->priority[1]->index_data,
+							S->priority[1]->index_xl, 1, 0);*/
 
 	gfx_copy_pixmap_box_i(S->priority[1], priority, gfx_rect(0, 0, S->xsize, S->ysize));
 
 	return GFX_OK;
 }
 
-
 // Mouse pointer operations
 
-static int
-scummvm_set_pointer(struct _gfx_driver *drv, gfx_pixmap_t *pointer) {
+static int scummvm_set_pointer(struct _gfx_driver *drv, gfx_pixmap_t *pointer) {
 	if (pointer == NULL) {
 		g_system->showMouse(false);
 	} else {
@@ -344,11 +312,9 @@
 	return GFX_OK;
 }
 
-
 // Palette operations
 
-static int
-scummvm_set_palette(struct _gfx_driver *drv, int index, byte red, byte green, byte blue) {
+static int scummvm_set_palette(struct _gfx_driver *drv, int index, byte red, byte green, byte blue) {
 	if (index < 0 || index > 255) {
 		GFXERROR("Attempt to set invalid palette entry %d\n", index);
 		return GFX_ERROR;
@@ -356,14 +322,13 @@
 
 	byte color[] = {red, green, blue, 255};
 	g_system->setPalette(color, index, 1);
+
 	return GFX_OK;
 }
 
-
 // Event management
 
-static sci_event_t
-scummvm_get_event(struct _gfx_driver *drv) {
+static sci_event_t scummvm_get_event(struct _gfx_driver *drv) {
 	sci_event_t input = { SCI_EVT_NONE, 0, 0, 0 };
 
 	Common::EventManager *em = g_system->getEventManager();
@@ -513,14 +478,12 @@
 	return input;
 }
 
-static int
-scummvm_usec_sleep(struct _gfx_driver *drv, long usecs) {
+static int scummvm_usec_sleep(struct _gfx_driver *drv, long usecs) {
 	g_system->delayMillis(usecs / 1000);
 	return GFX_OK;
 }
 
-gfx_driver_t
-gfx_driver_scummvm = {
+gfx_driver_t gfx_driver_scummvm = {
 	NULL,
 	0, 0,
 	0,		// flags here

Modified: scummvm/trunk/engines/sci/gfx/gfx_line.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_line.cpp	2009-02-21 07:43:46 UTC (rev 38667)
+++ scummvm/trunk/engines/sci/gfx/gfx_line.cpp	2009-02-21 08:16:04 UTC (rev 38668)
@@ -25,25 +25,24 @@
 
 #define LINEMACRO(startx, starty, deltalinear, deltanonlinear, linearvar, nonlinearvar, \
                   linearend, nonlinearstart, linearmod, nonlinearmod) \
-   x = (startx); y = (starty); \
-   incrNE = ((deltalinear) > 0)? (deltalinear) : -(deltalinear); \
-   incrNE <<= 1; \
-   deltanonlinear <<= 1; \
-   incrE = ((deltanonlinear) > 0) ? -(deltanonlinear) : (deltanonlinear);  \
-   d = nonlinearstart-1;  \
-   while (linearvar != (linearend)) { \
-     memcpy(buffer + linewidth * y + x, &color, PIXELWIDTH); \
-     linearvar += linearmod; \
-     if ((d+=incrE) < 0) { \
-       d += incrNE; \
-       nonlinearvar += nonlinearmod; \
-     }; \
-   }; \
-   memcpy(buffer + linewidth * y + x, &color, PIXELWIDTH);
+	x = (startx); y = (starty); \
+	incrNE = ((deltalinear) > 0) ? (deltalinear) : -(deltalinear); \
+	incrNE <<= 1; \
+	deltanonlinear <<= 1; \
+	incrE = ((deltanonlinear) > 0) ? -(deltanonlinear) : (deltanonlinear);  \
+	d = nonlinearstart - 1;  \
+	while (linearvar != (linearend)) { \
+		memcpy(buffer + linewidth * y + x, &color, PIXELWIDTH); \
+		linearvar += linearmod; \
+		if ((d += incrE) < 0) { \
+			d += incrNE; \
+			nonlinearvar += nonlinearmod; \
+		}; \
+	}; \
+	memcpy(buffer + linewidth * y + x, &color, PIXELWIDTH);
 
 
-static inline
-void DRAWLINE_FUNC(byte *buffer, int linewidth, Common::Point start, Common::Point end, unsigned int color) {
+static inline void DRAWLINE_FUNC(byte *buffer, int linewidth, Common::Point start, Common::Point end, unsigned int color) {
 	int dx, dy, incrE, incrNE, d, finalx, finaly;
 	int x = start.x;
 	int y = start.y;
@@ -59,29 +58,29 @@
 
 	if (dx > dy) {
 		if (finalx < x) {
-			if (finaly < y) { /* llu == left-left-up */
+			if (finaly < y) { // llu == left-left-up
 				LINEMACRO(x, y, dx, dy, x, y, finalx, dx, -PIXELWIDTH, -1);
 			} else {         /* lld */
 				LINEMACRO(x, y, dx, dy, x, y, finalx, dx, -PIXELWIDTH, 1);
 			}
-		} else { /* x1 >= x */
-			if (finaly < y) { /* rru */
+		} else { // x1 >= x
+			if (finaly < y) { // rru
 				LINEMACRO(x, y, dx, dy, x, y, finalx, dx, PIXELWIDTH, -1);
-			} else {         /* rrd */
+			} else {         // rrd
 				LINEMACRO(x, y, dx, dy, x, y, finalx, dx, PIXELWIDTH, 1);
 			}
 		}
-	} else { /* dx <= dy */
+	} else { // dx <= dy
 		if (finaly < y) {
-			if (finalx < x) { /* luu */
+			if (finalx < x) { // luu
 				LINEMACRO(x, y, dy, dx, y, x, finaly, dy, -1, -PIXELWIDTH);
 			} else {         /* ruu */
 				LINEMACRO(x, y, dy, dx, y, x, finaly, dy, -1, PIXELWIDTH);
 			}
-		} else { /* y1 >= y */
-			if (finalx < x) { /* ldd */
+		} else { // y1 >= y
+			if (finalx < x) { // ldd
 				LINEMACRO(x, y, dy, dx, y, x, finaly, dy, 1, -PIXELWIDTH);
-			} else {         /* rdd */
+			} else {         // rdd
 				LINEMACRO(x, y, dy, dx, y, x, finaly, dy, 1, PIXELWIDTH);
 			}
 		}
@@ -89,5 +88,4 @@
 }
 
 
-
 #undef LINEMACRO

Modified: scummvm/trunk/engines/sci/gfx/gfx_pixmap_scale.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_pixmap_scale.cpp	2009-02-21 07:43:46 UTC (rev 38667)
+++ scummvm/trunk/engines/sci/gfx/gfx_pixmap_scale.cpp	2009-02-21 08:16:04 UTC (rev 38668)
@@ -29,33 +29,18 @@
 ** EXTRA_BYTE_OFFSET: Extra source byte offset for copying (used on big-endian machines in 24 bit mode)
 */
 
-/* set optimisations for Win32: */
-/* g on: enable global optimizations */
-/* t on: use fast code */
-/* y on: suppress creation of frame pointers on stack */
-/* s off: disable minimize size code */
-#ifdef WIN32
-#	include <memory.h>
-#	ifndef SATISFY_PURIFY
-#		pragma optimize( "s", off )
-#		pragma optimize( "gty", on )
-#		pragma intrinsic( memcpy, memset )
-#	endif
-#endif
-
 #include "sci/include/sci_memory.h"
 
 #define EXTEND_COLOR(x) (unsigned) ((((unsigned) x) << 24) | (((unsigned) x) << 16) | (((unsigned) x) << 8) | ((unsigned) x))
 #define PALETTE_MODE mode->palette
 
-void
-FUNCNAME(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) {
+void FUNCNAME(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_ormask = 0;
 	int xfact = (scale) ? mode->xfact : 1;
 	int yfact = (scale) ? mode->yfact : 1;
-	int widthc, heightc; /* Width duplication counter */
+	int widthc, heightc; // Width duplication counter
 	int line_width = xfact * pxm->index_xl;
 	int bytespp = mode->bytespp;
 	int x, y;
@@ -76,9 +61,9 @@
 	assert(bytespp == COPY_BYTES);
 
 	if (separate_alpha_map && !alpha_dest)
-		alpha_dest = pxm->alpha_map = (byte*)sci_malloc(pxm->index_xl * xfact * pxm->index_yl * yfact);
+		alpha_dest = pxm->alpha_map = (byte *)sci_malloc(pxm->index_xl * xfact * pxm->index_yl * yfact);
 
-	/* Calculate all colors */
+	// Calculate all colors
 	for (i = 0; i < pxm->colors_nr; i++) {
 		int col;
 
@@ -96,7 +81,7 @@
 	if (!separate_alpha_map && pxm->color_key != GFX_PIXMAP_COLOR_KEY_NONE)
 		result_colors[pxm->color_key] = alpha_color;
 
-	src = pxm->index_data; /* Workaround for gcc 4.2.3 bug on EMT64 */
+	src = pxm->index_data; // Workaround for gcc 4.2.3 bug on EMT64
 	for (y = 0; y < pxm->index_yl; y++) {
 		byte *prev_dest = dest;
 		byte *prev_alpha_dest = alpha_dest;
@@ -106,23 +91,22 @@
 			SIZETYPE col = result_colors[isalpha = *src++] << (EXTRA_BYTE_OFFSET * 8);
 			isalpha = (isalpha == pxm->color_key) && using_alpha;
 
-			/* O(n) loops. There is an O(ln(n)) algorithm for this, but its slower for small n (which we're optimizing for here).
-			** And, anyway, most of the time is spent in memcpy() anyway. */
+			// O(n) loops. There is an O(ln(n)) algorithm for this, but its slower for small n (which we're optimizing for here).
+			// And, anyway, most of the time is spent in memcpy() anyway.
 
 			for (widthc = 0; widthc < xfact; widthc++) {
 				memcpy(dest, &col, COPY_BYTES);
 				dest += COPY_BYTES;
 			}
 
-			if (separate_alpha_map) { /* Set separate alpha map */
+			if (separate_alpha_map) { // Set separate alpha map
 				memset(alpha_dest, (isalpha) ? byte_transparent : byte_opaque, xfact);
 				alpha_dest += xfact;
 			}
 		}
 
-		/* Copies each line. O(n) iterations; again, this could be optimized to O(ln(n)) for very high resolutions,
-		** but that wouldn't really help that much, as the same amount of data still would have to be transferred.
-		*/
+		// Copies each line. O(n) iterations; again, this could be optimized to O(ln(n)) for very high resolutions,
+		// but that wouldn't really help that much, as the same amount of data still would have to be transferred.
 		for (heightc = 1; heightc < yfact; heightc++) {
 			memcpy(dest, prev_dest, line_width * bytespp);
 			dest += line_width * bytespp;
@@ -135,15 +119,13 @@
 }
 
 
+// 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))
 
-/* 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++) { \
+				for (subx = 0; subx < ((DO_X_STEP) ? (xfact >> 1) : 1); subx++) { \
                                         unsigned int intensity; \
 					wrcolor = 0; \
 					for (i = 0; i < 3; i++) { \
@@ -165,11 +147,11 @@
 				} \
                                 if (DO_X_STEP) \
 				        column_step = -column_step
-/* End of macro definition */
+// End of macro definition
 
 
 #define Y_CALC_INTENSITY_CENTER 0
-#define Y_CALC_INTENSITY_NORMAL otherline[i]*line_valuator
+#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++) { \
@@ -191,7 +173,7 @@
 					WRITE_XPART(X_CALC_INTENSITY_CENTER, 0); \
 				} \
 				/*-- right half --*/ \
-				MAKE_PIXEL((x+1 == pxm->index_xl), othercolumn, ctexel, src[+1]); \
+				MAKE_PIXEL((x + 1 == pxm->index_xl), othercolumn, ctexel, src[+1]); \
 				WRITE_XPART(X_CALC_INTENSITY_NORMAL, 1); \
 				if (DO_Y_STEP) \
                                         line_valuator -= line_step; \
@@ -200,13 +182,10 @@
 			} \
 			if (DO_Y_STEP) \
 			        line_step = -line_step
-/* End of macro definition */
+// End of macro definition
 
 
-
-
-void
-FUNCNAME_LINEAR(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) {
+void FUNCNAME_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);
@@ -242,15 +221,15 @@
 	shifts[3] = mode->alpha_shift;
 
 	if (separate_alpha_map && !alpha_dest)
-		alpha_dest = pxm->alpha_map = (byte*)sci_malloc(pxm->index_xl * xfact * pxm->index_yl * yfact);
+		alpha_dest = pxm->alpha_map = (byte *)sci_malloc(pxm->index_xl * xfact * pxm->index_yl * yfact);
 
 	for (y = 0; y < pxm->index_yl; y++) {
 		byte *linepos = dest;
 		byte *alpha_linepos = alpha_dest;
 
 		for (x = 0; x < pxm->index_xl; x++) {
-			int otherline[4]; /* the above line or the line below */
-			int ctexel[4]; /* Current texel */
+			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;
@@ -274,7 +253,7 @@
 
 			MAKE_PIXEL(0, ctexel, zero, *src);
 
-			/*-- Upper half --*/
+			//-- Upper half --
 			MAKE_PIXEL((y == 0), otherline, ctexel, src[-pxm->index_xl]);
 			WRITE_YPART(1, Y_CALC_INTENSITY_NORMAL);
 
@@ -282,7 +261,7 @@
 				WRITE_YPART(0, Y_CALC_INTENSITY_CENTER);
 			}
 
-			/*-- Lower half --*/
+			//-- Lower half --
 			line_valuator -= line_step;
 			MAKE_PIXEL((y + 1 == pxm->index_yl), otherline, ctexel, src[pxm->index_xl]);
 			WRITE_YPART(1, Y_CALC_INTENSITY_NORMAL);
@@ -298,33 +277,31 @@
 }
 
 
+//----------------------
+//** Trilinear filter **
+//----------------------
 
-/*----------------------*/
-/*** Trilinear filter ***/
-/*----------------------*/
 
-
 #ifndef GFX_GET_PIXEL_DELTA
 #define GFX_GET_PIXEL_DELTA
-static inline void
-gfx_get_pixel_delta(unsigned int *color, int *delta, unsigned int *pixel0, unsigned int *pixel1) {
+static inline 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 */
+	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 */
+	} 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 */
+	} else if (transp0 && transp1) { // Transparent
 		delta[3] = 0;
 		color[3] = 0xffffff;
-	} else { /* Opaque */
+	} else { // Opaque
 		memcpy(color, pixel0, sizeof(int) * 4);
 		for (j = 0; j < 4; j++)
 			delta[j] = ((pixel1[j] >> 8) - (pixel0[j] >> 8));
@@ -332,9 +309,9 @@
 }
 
 
-static inline void
-gfx_apply_delta(unsigned int *color, int *delta, int factor) {
+static inline void gfx_apply_delta(unsigned int *color, int *delta, int factor) {
 	int i;
+
 	for (i = 0; i < 4; i++)
 		color[i] += delta[i] * factor;
 }
@@ -353,10 +330,9 @@
 				rec[3] = 0; \
 			}
 
-#define REVERSE_ALPHA(foo) ((inverse_alpha)? ~(foo) : (foo))
+#define REVERSE_ALPHA(foo) ((inverse_alpha) ? ~(foo) : (foo))
 
-void
-FUNCNAME_TRILINEAR(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) {
+void FUNCNAME_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;
@@ -369,8 +345,8 @@
 	int separate_alpha_map = (!mode->alpha_mask) && using_alpha;
 	unsigned int masks[4], shifts[4];
 	unsigned int pixels[4][4];
-	/* 0 1
-	** 2 3 */
+	// 0 1
+	// 2 3
 	int x, y;
 	byte inverse_alpha = mode->flags & GFX_MODE_FLAG_REVERSE_ALPHA;
 
@@ -392,7 +368,7 @@
 	shifts[3] = mode->alpha_shift;
 
 	if (!(pxm->index_xl && pxm->index_yl))
-		return; /* Duh. */
+		return;
 
 	if (separate_alpha_map && !alpha_dest)
 		alpha_dest = pxm->alpha_map = (byte*)sci_malloc(pxm->index_xl * xfact * pxm->index_yl * yfact);
@@ -438,10 +414,9 @@
 			MAKE_PIXEL_TRILINEAR((y && x), pixels[0], *src);
 			MAKE_PIXEL_TRILINEAR((y && (x < pxm->index_xl)), pixels[1], src[1]);
 			MAKE_PIXEL_TRILINEAR(((y < pxm->index_yl) && x), pixels[2], src[pxm->index_xl]);
-			MAKE_PIXEL_TRILINEAR(((y < pxm->index_yl) && (x < pxm->index_xl)),
-			                     pixels[3], src[pxm->index_xl + 1]);
+			MAKE_PIXEL_TRILINEAR(((y < pxm->index_yl) && (x < pxm->index_xl)), pixels[3], src[pxm->index_xl + 1]);
 
-			/* OptimizeMe */
+			// Optimize Me
 
 			gfx_get_pixel_delta(leftcolor, leftdelta, pixels[0], pixels[2]);
 			gfx_get_pixel_delta(rightcolor, rightdelta, pixels[1], pixels[3]);
@@ -510,8 +485,3 @@
 #undef SIZETYPE
 #undef EXTEND_COLOR
 
-/* reset to original optimisations for Win32: */
-/* (does not reset intrinsics) */
-#ifdef WIN32
-#  pragma optimize( "", on )
-#endif

Modified: scummvm/trunk/engines/sci/gfx/gfx_res_options.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_res_options.cpp	2009-02-21 07:43:46 UTC (rev 38667)
+++ scummvm/trunk/engines/sci/gfx/gfx_res_options.cpp	2009-02-21 08:16:04 UTC (rev 38668)
@@ -29,11 +29,11 @@
 
 #include <ctype.h>
 
-/*#define DEBUG*/
+//#define DEBUG
 
-static inline int
-matches_patternlist(gfx_res_pattern_t *patterns, int nr, int val) {
+static inline int matches_patternlist(gfx_res_pattern_t *patterns, int nr, int val) {
 	int i;
+
 	for (i = 0; i < nr; i++)
 		if (patterns[i].min <= val
 		        && patterns[i].max >= val)
@@ -43,21 +43,17 @@
 }
 
 #ifdef DEBUG
-static void
-print_pattern(gfx_res_pattern_t *pat) {
-	error("[%d..%d]",
-	        pat->min, pat->max);
+static void print_pattern(gfx_res_pattern_t *pat) {
+	error("[%d..%d]", pat->min, pat->max);
 }
 #endif
 
-static inline int
-resource_matches_patternlists(gfx_res_conf_t *conf,
-                              int type, int nr, int loop, int cel) {
+static inline int resource_matches_patternlists(gfx_res_conf_t *conf, int type, int nr, int loop, int cel) {
 	int loc;
 #ifdef DEBUG
 	int i;
-	error("[DEBUG:gfx-res] Trying to match against %d/%d/%d choices\n",
-	        conf->patterns_nr, conf->loops_nr, conf->cels_nr);
+
+	error("[DEBUG:gfx-res] Trying to match against %d/%d/%d choices\n", conf->patterns_nr, conf->loops_nr, conf->cels_nr);
 	for (i = 0; i < conf->patterns_nr; i++) {
 		error("[DEBUG:gfx-res] Pat #%d: ", i);
 		print_pattern(conf->patterns + i);
@@ -76,10 +72,7 @@
 		error("\n");
 	}
 #endif
-	if (conf->patterns_nr &&
-	        !matches_patternlist(conf->patterns,
-	                             conf->patterns_nr,
-	                             nr))
+	if (conf->patterns_nr && !matches_patternlist(conf->patterns, conf->patterns_nr, nr))
 		return 0;
 
 	if (type == GFX_RESOURCE_TYPE_CURSOR)
@@ -102,17 +95,12 @@
 	if (!conf->cels_nr)
 		return 1;
 
-	return matches_patternlist(conf->patterns + loc,
-	                           conf->cels_nr,
-	                           cel);
+	return matches_patternlist(conf->patterns + loc, conf->cels_nr, cel);
 }
 
-static inline gfx_res_conf_t *
-find_match(gfx_res_conf_t *conflist,
-           int type, int nr, int loop, int cel) {
+static inline gfx_res_conf_t *find_match(gfx_res_conf_t *conflist, int type, int nr, int loop, int cel) {
 	while (conflist) {
-		if (resource_matches_patternlists(conflist,
-		                                  type, nr, loop, cel)) {
+		if (resource_matches_patternlists(conflist, type, nr, loop, cel)) {
 #ifdef DEBUG
 			error("[DEBUG:gfx-res] Found match");
 #endif
@@ -121,12 +109,12 @@
 
 		conflist = conflist->next;
 	}
+
 	return NULL;
 }
 
-void
-apply_assign(gfx_res_assign_t *conf, gfx_pixmap_t *pxm) {
-	/* Has a dynamically allocated palette? Must clean up */
+void apply_assign(gfx_res_assign_t *conf, gfx_pixmap_t *pxm) {
+	// Has a dynamically allocated palette? Must clean up
 	if (!(pxm->flags & GFX_PIXMAP_FLAG_EXTERNAL_PALETTE)) {
 		if (pxm->colors)
 			free(pxm->colors);
@@ -137,19 +125,18 @@
 	pxm->colors = conf->assign.palette.colors;
 }
 
-void
-apply_mod(gfx_res_mod_t *mod, gfx_pixmap_t *pxm) {
+void apply_mod(gfx_res_mod_t *mod, gfx_pixmap_t *pxm) {
 	gfx_pixmap_color_t *pal = pxm->colors;
 	int i, pal_size = pxm->colors_nr;
 
-	/* Does not have a dynamically allocated palette? Must dup current one */
+	// Does not have a dynamically allocated palette? Must dup current one
 	if (pxm->flags & GFX_PIXMAP_FLAG_EXTERNAL_PALETTE) {
 		int size = sizeof(gfx_pixmap_color_t) * pal_size;
 		pxm->colors = (gfx_pixmap_color_t*)sci_malloc(size);
 		memcpy(pxm->colors, pal, size);
 		pal = pxm->colors;
 		pxm->flags &= ~GFX_PIXMAP_FLAG_EXTERNAL_PALETTE;
-		/* Flag for later deallocation */
+		// Flag for later deallocation
 	}
 
 	switch (mod->type) {
@@ -177,8 +164,7 @@
 	}
 }
 
-int
-gfx_get_res_config(gfx_options_t *options, gfx_pixmap_t *pxm) {
+int gfx_get_res_config(gfx_options_t *options, gfx_pixmap_t *pxm) {
 	int restype = GFXR_RES_TYPE(pxm->ID);
 	int nr = GFXR_RES_NR(pxm->ID);
 	int loop = pxm->loop;
@@ -187,23 +173,20 @@
 	gfx_res_conf_t *conf;
 
 #ifdef DEBUG
-	error("[DEBUG:gfx-res] Trying to conf %d/%d/%d/%d (ID=%d)\n",
-	        restype, nr, loop, cel, pxm->ID);
+	error("[DEBUG:gfx-res] Trying to conf %d/%d/%d/%d (ID=%d)\n", restype, nr, loop, cel, pxm->ID);
 #endif
 
 	if (pxm->ID < 0 || restype < 0 || restype >= GFX_RESOURCE_TYPES_NR)
-		return 1; /* Not appropriate */
+		return 1; // Not appropriate
 
-	conf = find_match(options->res_conf.assign[restype],
-	                  restype, nr, loop, cel);
+	conf = find_match(options->res_conf.assign[restype], restype, nr, loop, cel);
 
 	if (conf)
 		apply_assign(&(conf->conf.assign), pxm);
 
 	conf = options->res_conf.mod[restype];
 	while (conf) {
-		conf = find_match(conf,
-		                  restype, nr, loop, cel);
+		conf = find_match(conf, restype, nr, loop, cel);
 		if (conf) {
 			apply_mod(&(conf->conf.mod), pxm);
 			conf = conf->next;

Modified: scummvm/trunk/engines/sci/gfx/gfx_resource.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resource.cpp	2009-02-21 07:43:46 UTC (rev 38667)
+++ scummvm/trunk/engines/sci/gfx/gfx_resource.cpp	2009-02-21 08:16:04 UTC (rev 38668)
@@ -38,8 +38,7 @@
 };
 
 
-static void
-gfxr_free_loop(gfx_driver_t *driver, gfxr_loop_t *loop) {
+static void gfxr_free_loop(gfx_driver_t *driver, gfxr_loop_t *loop) {
 	int i;
 
 	if (loop->cels) {
@@ -51,8 +50,7 @@
 	}
 }
 
-void
-gfxr_free_view(gfx_driver_t *driver, gfxr_view_t *view) {
+void gfxr_free_view(gfx_driver_t *driver, gfxr_view_t *view) {
 	int i;
 
 	if (view->colors && !(view->flags & GFX_PIXMAP_FLAG_EXTERNAL_PALETTE))
@@ -67,10 +65,9 @@
 	free(view);
 }
 
-
-static void
-pixmap_endianness_reverse_2_simple(byte *data, int area) {
+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];
@@ -80,8 +77,7 @@
 	}
 }
 
-static void
-pixmap_endianness_reverse_2(byte *data, int area) {
+static void pixmap_endianness_reverse_2(byte *data, int area) {
 	int c;
 	int sl = sizeof(unsigned long);
 
@@ -90,14 +86,13 @@
 
 		memcpy(&temp, data, sl);
 
-		/* The next line will give warnings on 32 bit archs, but
-		** that's OK.  */
+		// 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 /* SIZEOF_INT < 8 */
+#endif
 
 		memcpy(data, &temp, sl);
 
@@ -107,9 +102,9 @@
 	pixmap_endianness_reverse_2_simple(data, area & (sl - 1));
 }
 
-static void
-pixmap_endianness_reverse_3_simple(byte *data, int area) {
+static void pixmap_endianness_reverse_3_simple(byte *data, int area) {
 	int c;
+
 	for (c = 0; c < area; c++) {
 		byte val0 = data[0];
 
@@ -120,9 +115,9 @@
 	}
 }
 
-static void
-pixmap_endianness_reverse_4_simple(byte *data, int area) {
+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];
@@ -137,8 +132,7 @@
 	}
 }
 
-static void
-pixmap_endianness_reverse_4(byte *data, int area) {
+static void pixmap_endianness_reverse_4(byte *data, int area) {
 	int c;
 	int sl = sizeof(unsigned long);
 
@@ -147,8 +141,7 @@
 
 		memcpy(&temp, data, sl);
 
-		/* The next lines will give warnings on 32 bit archs, but
-		** that's OK.  */
+		// The next lines will give warnings on 32 bit archs, but that's OK.
 #if SIZEOF_LONG < 8
 		temp = 0l;
 #else
@@ -156,7 +149,7 @@
 		       | ((temp & 0x0000ffff0000ffffl) << 16);
 		temp = ((temp & 0xff00ff00ff00ff00l) >> 8)
 		       | ((temp & 0x00ff00ff00ff00ffl) << 8);
-#endif /* SIZEOF_LONG < 8 */
+#endif
 
 		memcpy(data, &temp, sl);
 
@@ -166,8 +159,7 @@
 	pixmap_endianness_reverse_4_simple(data, area & (sl - 1));
 }
 
-gfx_pixmap_t *
-gfxr_endianness_adjust(gfx_pixmap_t *pixmap, gfx_mode_t *mode) {
+gfx_pixmap_t *gfxr_endianness_adjust(gfx_pixmap_t *pixmap, gfx_mode_t *mode) {
 	int bytespp;
 	byte *data;
 
@@ -189,13 +181,11 @@
 		break;
 
 	case 2:
-		pixmap_endianness_reverse_2(data, pixmap->xl
-		                            * pixmap->yl);
+		pixmap_endianness_reverse_2(data, pixmap->xl * pixmap->yl);
 		break;
 
 	case 3:
-		pixmap_endianness_reverse_3_simple(data, pixmap->xl
-		                                   * pixmap->yl);
+		pixmap_endianness_reverse_3_simple(data, pixmap->xl * pixmap->yl);
 		break;
 
 	case 4:
@@ -210,8 +200,7 @@
 	return pixmap;
 }
 
-
-/* Now construct the pixmap scaling functions */
+// Now construct the pixmap scaling functions
 #define EXTRA_BYTE_OFFSET 0
 #define SIZETYPE guint8
 #define FUNCNAME _gfx_xlate_pixmap_unfiltered_1
@@ -232,7 +221,7 @@
 #ifdef WORDS_BIGENDIAN
 # undef EXTRA_BYTE_OFFSET
 # define EXTRA_BYTE_OFFSET 1
-#endif /* WORDS_BIGENDIAN */
+#endif // WORDS_BIGENDIAN
 #define SIZETYPE guint32
 #define FUNCNAME _gfx_xlate_pixmap_unfiltered_3
 #define FUNCNAME_LINEAR _gfx_xlate_pixmap_linear_3
@@ -243,7 +232,7 @@
 #ifdef WORDS_BIGENDIAN
 # undef EXTRA_BYTE_OFFSET
 # define EXTRA_BYTE_OFFSET 0
-#endif /* WORDS_BIGENDIAN */
+#endif // WORDS_BIGENDIAN
 
 #define SIZETYPE guint32
 #define FUNCNAME _gfx_xlate_pixmap_unfiltered_4
@@ -255,8 +244,7 @@
 #undef EXTRA_BYTE_OFFSET
 #undef SIZETYPE
 
-static inline void
-_gfx_xlate_pixmap_unfiltered(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) {
+static inline void _gfx_xlate_pixmap_unfiltered(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) {
 	switch (mode->bytespp) {
 
 	case 1:
@@ -289,9 +277,8 @@
 	}
 }
 
-static inline void
-_gfx_xlate_pixmap_linear(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) {
-	if (mode->palette || !scale) { /* fall back to unfiltered */
+static inline 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;
 	}
@@ -324,9 +311,8 @@
 
 }
 
-static inline void
-_gfx_xlate_pixmap_trilinear(gfx_mode_t *mode, gfx_pixmap_t *pxm, int scale) {
-	if (mode->palette || !scale) { /* fall back to unfiltered */
+static inline 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;
 	}
@@ -335,7 +321,6 @@
 	pxm->yl = pxm->index_yl * mode->yfact;
 
 	switch (mode->bytespp) {
-
 	case 1:
 		_gfx_xlate_pixmap_trilinear_1(mode, pxm, scale);
 		break;
@@ -356,15 +341,12 @@
 		GFXERROR("Invalid mode->bytespp=%d\n", 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, gfx_xlate_filter_t filter) {
 	int was_allocated = 0;
 
-	if (mode->palette
-	        && !(pxm->flags & GFX_PIXMAP_FLAG_PALETTE_ALLOCATED)) {
+	if (mode->palette && !(pxm->flags & GFX_PIXMAP_FLAG_PALETTE_ALLOCATED)) {
 		int i;
 
 		for (i = 0; i < pxm->colors_nr; i++) {
@@ -374,7 +356,7 @@
 				pxm->colors[i].global_index = 0;
 			}
 			/*
-			GFXDEBUG("alloc(%02x/%02x/%02x) -> %d\n",  pxm->colors[i].r,pxm->colors[i].g,pxm->colors[i].b,pxm->colors[i].global_index);
+			GFXDEBUG("alloc(%02x/%02x/%02x) -> %d\n", pxm->colors[i].r, pxm->colors[i].g, pxm->colors[i].b, pxm->colors[i].global_index);
 			*/
 		}
 
@@ -384,17 +366,16 @@
 
 	if (!pxm->data) {
 		pxm->data = (byte*)sci_malloc(mode->xfact * mode->yfact * pxm->index_xl * pxm->index_yl * mode->bytespp + 1);
-		/* +1: Eases coying on BE machines in 24 bpp packed mode */
-		/* Assume that memory, if allocated already, will be sufficient */
+		// +1: Eases coying on BE machines in 24 bpp packed mode
+		// Assume that memory, if allocated already, will be sufficient
 
-		/* Allocate alpha map */
+		// Allocate alpha map
 		if (!mode->alpha_mask && pxm->colors_nr < GFX_PIC_COLORS)
 			pxm->alpha_map = (byte*)sci_malloc(mode->xfact * mode->yfact * pxm->index_xl * pxm->index_yl + 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;
@@ -418,9 +399,7 @@
 	}
 }
 
-
-void
-gfxr_free_pic(gfx_driver_t *driver, gfxr_pic_t *pic) {
+void gfxr_free_pic(gfx_driver_t *driver, gfxr_pic_t *pic) {
 	gfx_free_pixmap(driver, pic->visual_map);
 	gfx_free_pixmap(driver, pic->priority_map);
 	gfx_free_pixmap(driver, pic->control_map);
@@ -435,4 +414,3 @@
 	pic->undithered_buffer = 0;
 	free(pic);
 }
-

Modified: scummvm/trunk/engines/sci/gfx/gfx_support.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_support.cpp	2009-02-21 07:43:46 UTC (rev 38667)
+++ scummvm/trunk/engines/sci/gfx/gfx_support.cpp	2009-02-21 08:16:04 UTC (rev 38668)
@@ -56,8 +56,7 @@
 #undef PIXELWIDTH
 #undef DRAWLINE_FUNC
 
-inline void
-gfx_draw_line_buffer(byte *buffer, int linewidth, int pixelwidth, Common::Point start, Common::Point end, unsigned int color) {
+inline void gfx_draw_line_buffer(byte *buffer, int linewidth, int pixelwidth, Common::Point start, Common::Point end, unsigned int color) {
 	switch (pixelwidth) {
 
 	case 1:
@@ -83,19 +82,11 @@
 	}
 }
 
-
-
-
-void
-gfx_draw_line_pixmap_i(gfx_pixmap_t *pxm, Common::Point start, Common::Point end, int color) {
+void gfx_draw_line_pixmap_i(gfx_pixmap_t *pxm, Common::Point start, Common::Point end, int color) {
 	gfx_draw_line_buffer(pxm->index_data, pxm->index_xl, 1, start, end, color);
 }
 
-
-
-
-void
-gfx_draw_box_buffer(byte *buffer, int linewidth, rect_t zone, int color) {
+void gfx_draw_box_buffer(byte *buffer, int linewidth, rect_t zone, int color) {
 	byte *dest = buffer + zone.x + (linewidth * zone.y);
 	int i;
 
@@ -108,16 +99,14 @@
 	}
 }
 
-
-void
-gfx_draw_box_pixmap_i(gfx_pixmap_t *pxm, rect_t box, int color) {
+void gfx_draw_box_pixmap_i(gfx_pixmap_t *pxm, rect_t box, int color) {
 	gfx_clip_box_basic(&box, pxm->index_xl - 1, pxm->index_yl - 1);
 
 	gfx_draw_box_buffer(pxm->index_data, pxm->index_xl, box, color);
 }
 
 
-/* Import various crossblit functions */
+// Import various crossblit functions
 #undef USE_PRIORITY
 #undef FUNCTION_NAME
 #undef BYTESPP
@@ -174,7 +163,7 @@
 #undef FUNCTION_NAME
 #undef BYTESPP
 
-/* Reverse alpha versions */
+// Reverse alpha versions
 #undef USE_PRIORITY
 #undef FUNCTION_NAME
 #undef BYTESPP
@@ -239,33 +228,30 @@
         _gfx_crossblit_16,
         _gfx_crossblit_24,
         _gfx_crossblit_32
-                                                                                                                    };
+};
 
 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_8_P,
         _gfx_crossblit_16_P,
         _gfx_crossblit_24_P,
         _gfx_crossblit_32_P
-                                                                                                                                             };
+};
 
 static void (*crossblit_fns_RA[5])(byte *, byte *, int, int, int, int, byte *, int, int, unsigned int, unsigned int) = { NULL,
         _gfx_crossblit_8_RA,
         _gfx_crossblit_16_RA,
         _gfx_crossblit_24_RA,
         _gfx_crossblit_32_RA
-                                                                                                                       };
+};
 
 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_8_P_RA,
         _gfx_crossblit_16_P_RA,
         _gfx_crossblit_24_P_RA,
         _gfx_crossblit_32_P_RA
-                                                                                                                                                };
+};
 
-
-void
-_gfx_crossblit_simple(byte *dest, byte *src, int dest_line_width, int src_line_width,
-                      int xl, int yl, int bpp) {
+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;
 
@@ -276,12 +262,8 @@
 	}
 }
 
-int
-gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority,
-                     rect_t src_coords,
-                     rect_t dest_coords, byte *dest, int dest_line_width,
-                     byte *priority_dest, int priority_line_width,
-                     int priority_skip, int flags) {
+int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority, rect_t src_coords, rect_t dest_coords,
+						 byte *dest, int dest_line_width, byte *priority_dest, int priority_line_width, int priority_skip, int flags) {
 	int maxx = 320 * mode->xfact;
 	int maxy = 200 * mode->yfact;
 	byte *src = pxm->data;
@@ -302,12 +284,12 @@
 	if (src_coords.y + src_coords.yl > yl)
 		src_coords.yl = yl - src_coords.y;
 
-	/** --???-- **/
+	// --???--
 	if (src_coords.y > yl)
 		return GFX_OK;
 	if (src_coords.x > xl)
 		return GFX_OK;
-	/** --???-- **/
+	// --???--
 
 	if (dest_coords.x + xl >= maxx)
 		xl = maxx - dest_coords.x;
@@ -323,19 +305,19 @@
 	if (xl <= 0 || yl <= 0)
 		return GFX_OK;
 
-	/* Set destination offsets */
+	// Set destination offsets
 
-	/* Set x offsets */
+	// Set x offsets
 	if (!(flags & GFX_CROSSBLIT_FLAG_DATA_IS_HOMED))
 		dest += dest_coords.x * bpp;
 	priority_pos += dest_coords.x * priority_skip;
 
-	/* Set y offsets */
+	// Set y offsets
 	if (!(flags & GFX_CROSSBLIT_FLAG_DATA_IS_HOMED))
 		dest += dest_coords.y * dest_line_width;
 	priority_pos += dest_coords.y * priority_line_width;
 
-	/* Set source offsets */
+	// Set source offsets
 	if (xoffset += src_coords.x) {
 		dest_coords.x = 0;
 		src += xoffset * bpp;
@@ -349,13 +331,13 @@
 		alpha += yoffset * bytes_per_alpha_line;
 	}
 
-	/* Adjust length for clip box */
+	// Adjust length for clip box
 	if (xl > src_coords.xl)
 		xl = src_coords.xl;
 	if (yl > src_coords.yl)
 		yl = src_coords.yl;
 
-	/* now calculate alpha */
+	// now calculate alpha
 	if (pxm->alpha_map)
 		alpha_mask = 0xff;
 	else {
@@ -388,28 +370,25 @@
 			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->xl * bpp,
-			                      xl, yl, bpp);
+			_gfx_crossblit_simple(dest, src, dest_line_width, pxm->xl * bpp, xl, yl, bpp);
 		else
 
 			if (priority == GFX_NO_PRIORITY) {
 				if (bpp > 0 && bpp < 5)
 					((revalpha) ? crossblit_fns_RA : crossblit_fns)[bpp](dest, src, dest_line_width, pxm->xl * bpp,
-					        xl, yl, alpha, bytes_per_alpha_line, bytes_per_alpha_pixel,
-					        alpha_mask, alpha_min);
+					        xl, yl, alpha, bytes_per_alpha_line, bytes_per_alpha_pixel, alpha_mask, alpha_min);
 				else {
 					GFXERROR("Invalid mode->bytespp: %d\n", mode->bytespp);
 					return GFX_ERROR;
 				}
-			} else { /* priority */
+			} else { // priority
 				if (bpp > 0 && bpp < 5)
 					((revalpha) ? crossblit_fns_P_RA : crossblit_fns_P)[bpp](dest, src, dest_line_width, pxm->xl * bpp,
 					        xl, yl, alpha, bytes_per_alpha_line, bytes_per_alpha_pixel,
-					        alpha_mask, alpha_min, priority_pos,
-					        priority_line_width, priority_skip, priority);
+					        alpha_mask, alpha_min, priority_pos, priority_line_width, priority_skip, priority);
 				else {
 					GFXERROR("Invalid mode->bytespp: %d\n", mode->bytespp);
 					return GFX_ERROR;
@@ -418,7 +397,3 @@
 
 	return GFX_OK;
 }
-
-
-
-

Modified: scummvm/trunk/engines/sci/gfx/gfx_tools.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_tools.cpp	2009-02-21 07:43:46 UTC (rev 38667)
+++ scummvm/trunk/engines/sci/gfx/gfx_tools.cpp	2009-02-21 08:16:04 UTC (rev 38668)
@@ -26,18 +26,9 @@
 #include "sci/include/sci_memory.h"
 #include "sci/include/gfx_tools.h"
 
-/* set optimisations for Win32: */
-#ifdef WIN32
-#	include <memory.h>
-#	ifndef SATISFY_PURIFY
-#		pragma intrinsic( memcpy, memset )
-#	endif
-#endif
-
 rect_t gfx_rect_fullscreen = {0, 0, 320, 200};
 
-void
-gfx_clip_box_basic(rect_t *box, int maxx, int maxy) {
+void gfx_clip_box_basic(rect_t *box, int maxx, int maxy) {
 	if (box->x < 0)
 		box->x = 0;
 
@@ -51,15 +42,10 @@
 		box->yl = maxy - box->y + 1;
 }
 
-
-gfx_mode_t *
-gfx_new_mode(int xfact, int yfact, int bytespp, unsigned int red_mask, unsigned int green_mask,
+gfx_mode_t *gfx_new_mode(int xfact, int yfact, int bytespp, unsigned int red_mask, unsigned int green_mask,
              unsigned int blue_mask, unsigned int alpha_mask, int red_shift, int green_shift,
              int blue_shift, int alpha_shift, int palette, int flags) {
-	gfx_mode_t *mode = (gfx_mode_t*)sci_malloc(sizeof(gfx_mode_t));
-#ifdef SATISFY_PURIFY
-	memset(mode, 0, sizeof(gfx_mode_t));
-#endif
+	gfx_mode_t *mode = (gfx_mode_t *)sci_malloc(sizeof(gfx_mode_t));
 
 	mode->xfact = xfact;
 	mode->yfact = yfact;
@@ -75,20 +61,16 @@
 	mode->flags = flags;
 
 	if (palette) {
-		mode->palette = (gfx_palette_t*)sci_malloc(sizeof(gfx_palette_t));
-#ifdef SATISFY_PURIFY
-		memset(mode->palette, 0, sizeof(gfx_palette_t));
-#endif
+		mode->palette = (gfx_palette_t *)sci_malloc(sizeof(gfx_palette_t));
 		mode->palette->max_colors_nr = palette;
-		mode->palette->colors = (gfx_palette_color_t*)sci_calloc(sizeof(gfx_palette_color_t), palette); /* Initialize with empty entries */
-	} else mode->palette = NULL;
+		mode->palette->colors = (gfx_palette_color_t *)sci_calloc(sizeof(gfx_palette_color_t), palette); // Initialize with empty entries
+	} else
+		mode->palette = NULL;
 
 	return mode;
 }
 
-
-void
-gfx_free_mode(gfx_mode_t *mode) {
+void gfx_free_mode(gfx_mode_t *mode) {
 	if (mode->palette) {
 		free(mode->palette->colors);
 		free(mode->palette);
@@ -96,10 +78,7 @@
 	free(mode);
 }
 
-
-
-void
-gfx_copy_pixmap_box_i(gfx_pixmap_t *dest, gfx_pixmap_t *src, rect_t box) {
+void gfx_copy_pixmap_box_i(gfx_pixmap_t *dest, gfx_pixmap_t *src, rect_t box) {
 	int width, height;
 	int offset;
 
@@ -122,10 +101,8 @@
 	}
 }
 
-
-gfx_pixmap_t *
-gfx_clone_pixmap(gfx_pixmap_t *pxm, gfx_mode_t *mode) {
-	gfx_pixmap_t *clone = (gfx_pixmap_t*)sci_malloc(sizeof(gfx_pixmap_t));
+gfx_pixmap_t *gfx_clone_pixmap(gfx_pixmap_t *pxm, gfx_mode_t *mode) {
+	gfx_pixmap_t *clone = (gfx_pixmap_t *)sci_malloc(sizeof(gfx_pixmap_t));
 	*clone = *pxm;
 	clone->index_data = NULL;
 	clone->colors = NULL;
@@ -141,12 +118,8 @@
 	return clone;
 }
 
-gfx_pixmap_t *
-gfx_new_pixmap(int xl, int yl, int resid, int loop, int cel) {
-	gfx_pixmap_t *pxm = (gfx_pixmap_t*)sci_malloc(sizeof(gfx_pixmap_t));
-#ifdef SATISFY_PURIFY
-	memset(pxm, 0, sizeof(gfx_pixmap_t));
-#endif
+gfx_pixmap_t *gfx_new_pixmap(int xl, int yl, int resid, int loop, int cel) {
+	gfx_pixmap_t *pxm = (gfx_pixmap_t *)sci_malloc(sizeof(gfx_pixmap_t));
 
 	pxm->alpha_map = NULL;
 	pxm->data = NULL;
@@ -170,16 +143,13 @@
 	return pxm;
 }
 
-
-void
-gfx_free_pixmap(gfx_driver_t *driver, gfx_pixmap_t *pxm) {
+void gfx_free_pixmap(gfx_driver_t *driver, gfx_pixmap_t *pxm) {
 	if (driver) {
-		if (driver->mode->palette
-		        && pxm->flags & GFX_PIXMAP_FLAG_PALETTE_ALLOCATED
-		        && !(pxm->flags & GFX_PIXMAP_FLAG_DONT_UNALLOCATE_PALETTE)
-		        && !(pxm->flags & GFX_PIXMAP_FLAG_EXTERNAL_PALETTE)) {
+		if (driver->mode->palette && pxm->flags & GFX_PIXMAP_FLAG_PALETTE_ALLOCATED
+		        && !(pxm->flags & GFX_PIXMAP_FLAG_DONT_UNALLOCATE_PALETTE) && !(pxm->flags & GFX_PIXMAP_FLAG_EXTERNAL_PALETTE)) {
 			int i;
 			int error = 0;
+
 			GFXDEBUG("UNALLOCATING %d\n", pxm->colors_nr);
 			for (i = 0; i < pxm->colors_nr; i++)
 				if (gfx_free_color(driver->mode->palette, pxm->colors + i))
@@ -207,9 +177,7 @@
 	free(pxm);
 }
 
-
-gfx_pixmap_t *
-gfx_pixmap_alloc_index_data(gfx_pixmap_t *pixmap) {
+gfx_pixmap_t *gfx_pixmap_alloc_index_data(gfx_pixmap_t *pixmap) {
 	int size;
 
 	if (pixmap->index_data) {
@@ -228,9 +196,7 @@
 	return pixmap;
 }
 
-
-gfx_pixmap_t *
-gfx_pixmap_free_index_data(gfx_pixmap_t *pixmap) {
+gfx_pixmap_t *gfx_pixmap_free_index_data(gfx_pixmap_t *pixmap) {
 	if (!pixmap->index_data) {
 		GFXWARN("Attempt to free pixmap index data twice");
 		return pixmap;
@@ -241,9 +207,7 @@
 	return pixmap;
 }
 
-
-gfx_pixmap_t *
-gfx_pixmap_alloc_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode) {
+gfx_pixmap_t *gfx_pixmap_alloc_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode) {
 	int size;
 
 	if (pixmap->data) {
@@ -267,9 +231,7 @@
 	return pixmap;
 }
 
-
-gfx_pixmap_t *
-gfx_pixmap_free_data(gfx_pixmap_t *pixmap) {
+gfx_pixmap_t *gfx_pixmap_free_data(gfx_pixmap_t *pixmap) {
 	if (!pixmap->data) {
 		GFXWARN("Attempt to free pixmap data twice");
 		return pixmap;
@@ -277,14 +239,13 @@
 
 	free(pixmap->data);
 	pixmap->data = NULL;
+
 	return pixmap;
 }
 
-
-int
-gfx_alloc_color(gfx_palette_t *pal, gfx_pixmap_color_t *color) {
+int gfx_alloc_color(gfx_palette_t *pal, gfx_pixmap_color_t *color) {
 	int i;
-	int dr, dg, db; /* deltas */
+	int dr, dg, db;
 	int bestdelta = 1 + ((0x100 * 0x100) * 3);
 	int bestcolor = -1;
 	int firstfree = -1;
@@ -338,18 +299,16 @@
 		pal->colors[firstfree].lockers = 1;
 		color->global_index = firstfree;
 
-		return 42; /* positive value to indicate that this color still needs to be set */
+		return 42; // positive value to indicate that this color still needs to be set
 	}
 
 	color->global_index = bestcolor;
 
-//	GFXWARN("Out of palette colors- doing approximated mapping");
+	//GFXWARN("Out of palette colors- doing approximated mapping");
 	return GFX_OK;
 }
 
-
-int
-gfx_free_color(gfx_palette_t *pal, gfx_pixmap_color_t *color) {
+int gfx_free_color(gfx_palette_t *pal, gfx_pixmap_color_t *color) {
 	gfx_palette_color_t *palette_color = pal->colors + color->global_index;
 
 	if (!pal)
@@ -362,14 +321,12 @@
 	}
 
 	if (color->global_index >= pal->max_colors_nr) {
-		GFXERROR("Attempt to free invalid color index %d (%02x/%02x/%02x)",
-		         color->global_index, color->r, color->g, color->b);
+		GFXERROR("Attempt to free invalid color index %d (%02x/%02x/%02x)", color->global_index, color->r, color->g, color->b);
 		return GFX_ERROR;
 	}
 
 	if (!palette_color->lockers) {
-		GFXERROR("Attempt to free unused color index %d (%02x/%02x/%02x)",
-		         color->global_index, color->r, color->g, color->b);
+		GFXERROR("Attempt to free unused color index %d (%02x/%02x/%02x)", color->global_index, color->r, color->g, color->b);
 		return GFX_ERROR;
 	}
 
@@ -377,12 +334,11 @@
 		--(palette_color->lockers);
 
 	color->global_index = GFX_COLOR_INDEX_UNMAPPED;
+
 	return GFX_OK;
 }
 
-
-gfx_pixmap_t *
-gfx_pixmap_scale_index_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode) {
+gfx_pixmap_t *gfx_pixmap_scale_index_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode) {
 	byte *old_data, *new_data, *initial_new_data;
 	byte *linestart;
 	int linewidth;
@@ -398,7 +354,7 @@
 		return NULL;
 
 	if (pixmap->flags & GFX_PIXMAP_FLAG_SCALED_INDEX)
-		return pixmap; /* Already done */
+		return pixmap; // Already done
 
 	old_data = pixmap->index_data;
 
@@ -410,7 +366,7 @@
 	xl = pixmap->index_xl;
 	yl = pixmap->index_yl;
 	linewidth = xfact * xl;
-	initial_new_data = new_data = (byte *) sci_malloc(linewidth * yfact * yl);
+	initial_new_data = new_data = (byte *)sci_malloc(linewidth * yfact * yl);
 
 	for (yc = 0; yc < yl; yc++) {
 


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