[Scummvm-cvs-logs] SF.net SVN: scummvm:[45366] scummvm/trunk/engines/sci
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Sun Oct 25 03:36:51 CET 2009
Revision: 45366
http://scummvm.svn.sourceforge.net/scummvm/?rev=45366&view=rev
Author: thebluegr
Date: 2009-10-25 02:36:51 +0000 (Sun, 25 Oct 2009)
Log Message:
-----------
Cleanup
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/game.cpp
scummvm/trunk/engines/sci/gfx/gfx_driver.cpp
scummvm/trunk/engines/sci/gfx/gfx_options.h
scummvm/trunk/engines/sci/gfx/gfx_support.cpp
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/operations.h
scummvm/trunk/engines/sci/gui32/font.cpp
scummvm/trunk/engines/sci/gui32/font.h
scummvm/trunk/engines/sci/sci.cpp
Modified: scummvm/trunk/engines/sci/engine/game.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/game.cpp 2009-10-25 00:13:08 UTC (rev 45365)
+++ scummvm/trunk/engines/sci/engine/game.cpp 2009-10-25 02:36:51 UTC (rev 45366)
@@ -182,12 +182,12 @@
for (int i = 0; i < 16; i++) {
gfxop_set_color(s->gfx_state, &(s->ega_colors[i]), gfx_sci0_image_colors[sci0_palette][i].r,
gfx_sci0_image_colors[sci0_palette][i].g, gfx_sci0_image_colors[sci0_palette][i].b, 0, -1, -1);
- gfxop_set_system_color(s->gfx_state, i, &(s->ega_colors[i]));
+ s->gfx_state->driver->getMode()->palette->makeSystemColor(i, s->ega_colors[i].visual);
}
} else {
// Allocate SCI1 system colors
gfx_color_t black = { PaletteEntry(0, 0, 0), 0, 0, 0, GFX_MASK_VISUAL };
- gfxop_set_system_color(s->gfx_state, 0, &black);
+ s->gfx_state->driver->getMode()->palette->makeSystemColor(0, black.visual);
// Check for Amiga palette file.
Common::File file;
Modified: scummvm/trunk/engines/sci/gfx/gfx_driver.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_driver.cpp 2009-10-25 00:13:08 UTC (rev 45365)
+++ scummvm/trunk/engines/sci/gfx/gfx_driver.cpp 2009-10-25 02:36:51 UTC (rev 45366)
@@ -115,7 +115,7 @@
gfx_crossblit_pixmap(_mode, pxm, priority, src, dest, destBuffer,
_mode->xsize,
destPriority,
- _screen->_width, 1, 0);
+ _screen->_width, 1);
}
void GfxDriver::grabPixmap(rect_t src, gfx_pixmap_t *pxm, gfx_map_mask_t map) {
Modified: scummvm/trunk/engines/sci/gfx/gfx_options.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_options.h 2009-10-25 00:13:08 UTC (rev 45365)
+++ scummvm/trunk/engines/sci/gfx/gfx_options.h 2009-10-25 02:36:51 UTC (rev 45366)
@@ -55,16 +55,9 @@
gfx_line_mode_t pic0_line_mode;
gfx_res_fullconf_t res_conf; /* Resource customisation: Per-resource palettes etc. */
-
- int workarounds; // Workaround flags - see below
#endif
};
-#ifdef CUSTOM_GRAPHICS_OPTIONS
-/* SQ3 counts whitespaces towards the total text size, as does gfxop_get_text_params() if this is set: */
-#define GFX_WORKAROUND_WHITESPACE_COUNT (1 << 0)
-#endif
-
} // End of namespace Sci
#endif // SCI_GFX_GFX_OPTIONS_H
Modified: scummvm/trunk/engines/sci/gfx/gfx_support.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_support.cpp 2009-10-25 00:13:08 UTC (rev 45365)
+++ scummvm/trunk/engines/sci/gfx/gfx_support.cpp 2009-10-25 02:36:51 UTC (rev 45366)
@@ -152,7 +152,7 @@
}
void 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) {
+ byte *dest, int dest_line_width, byte *priority_dest, int priority_line_width, int priority_skip) {
int maxx = 320 * mode->scaleFactor;
int maxy = 200 * mode->scaleFactor;
byte *src = pxm->data;
@@ -193,13 +193,11 @@
// Set destination offsets
// Set x offsets
- if (!(flags & GFX_CROSSBLIT_FLAG_DATA_IS_HOMED))
- dest += dest_coords.x;
+ dest += dest_coords.x;
priority_pos += dest_coords.x * priority_skip;
// Set y offsets
- if (!(flags & GFX_CROSSBLIT_FLAG_DATA_IS_HOMED))
- dest += dest_coords.y * dest_line_width;
+ dest += dest_coords.y * dest_line_width;
priority_pos += dest_coords.y * priority_line_width;
// Set source offsets
Modified: scummvm/trunk/engines/sci/gfx/gfx_tools.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_tools.cpp 2009-10-25 00:13:08 UTC (rev 45365)
+++ scummvm/trunk/engines/sci/gfx/gfx_tools.cpp 2009-10-25 02:36:51 UTC (rev 45366)
@@ -83,24 +83,6 @@
}
}
-gfx_pixmap_t *gfx_clone_pixmap(gfx_pixmap_t *pxm, gfx_mode_t *mode) {
- gfx_pixmap_t *clone = (gfx_pixmap_t *)malloc(sizeof(gfx_pixmap_t));
- *clone = *pxm;
- clone->index_data = NULL;
- clone->palette = NULL;
- clone->data = NULL;
- clone->palette_revision = -1;
- gfx_pixmap_alloc_data(clone, mode);
-
- memcpy(clone->data, pxm->data, clone->data_size);
- if (clone->alpha_map) {
- clone->alpha_map = (byte *) malloc(clone->width * clone->height);
- memcpy(clone->alpha_map, pxm->alpha_map, clone->width * clone->height);
- }
-
- 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 *)malloc(sizeof(gfx_pixmap_t));
@@ -154,17 +136,6 @@
return pixmap;
}
-gfx_pixmap_t *gfx_pixmap_free_index_data(gfx_pixmap_t *pixmap) {
- if (!pixmap->index_data) {
- warning("[GFX] Attempt to free pixmap index data twice");
- return pixmap;
- }
-
- free(pixmap->index_data);
- pixmap->index_data = NULL;
- return pixmap;
-}
-
gfx_pixmap_t *gfx_pixmap_alloc_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode) {
int size;
@@ -189,18 +160,6 @@
return pixmap;
}
-gfx_pixmap_t *gfx_pixmap_free_data(gfx_pixmap_t *pixmap) {
- if (!pixmap->data) {
- warning("[GFX] Attempt to free pixmap data twice");
- return pixmap;
- }
-
- free(pixmap->data);
- pixmap->data = NULL;
-
- return pixmap;
-}
-
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;
Modified: scummvm/trunk/engines/sci/gfx/gfx_tools.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_tools.h 2009-10-25 00:13:08 UTC (rev 45365)
+++ scummvm/trunk/engines/sci/gfx/gfx_tools.h 2009-10-25 02:36:51 UTC (rev 45366)
@@ -79,16 +79,6 @@
gfx_pixmap_t *gfx_new_pixmap(int xl, int yl, int resid, int loop, int cel);
/**
- * Clones a pixmap, minus its index data, palette and driver-specific
- * handles
- *
- * @param[in] pixmap The pixmap to clone
- * @param[in] mode The mode to be applied to the pixmap
- * @return The clone
- */
-gfx_pixmap_t *gfx_clone_pixmap(gfx_pixmap_t *pixmap, gfx_mode_t *mode);
-
-/**
* Allocates the index_data field of a pixmap
*
* @param[in] pixmap The pixmap to allocate for
@@ -97,14 +87,6 @@
gfx_pixmap_t *gfx_pixmap_alloc_index_data(gfx_pixmap_t *pixmap);
/**
- * Frees the index_data field of a pixmap
- *
- * @param[in] pixmap The pixmap to modify
- * @return The pixmap
- */
-gfx_pixmap_t *gfx_pixmap_free_index_data(gfx_pixmap_t *pixmap);
-
-/**
* Allocates the data field of a pixmap
*
* @param[in] pixmap The pixmap to allocate for
@@ -114,14 +96,6 @@
gfx_pixmap_t *gfx_pixmap_alloc_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode);
/**
- * Frees the memory allocated for a pixmap's data field
- *
- * @param[in] pixmap The pixmap to modify
- * @return The pixmap
- */
-gfx_pixmap_t *gfx_pixmap_free_data(gfx_pixmap_t *pixmap);
-
-/**
* Frees all memory associated with a pixmap
*
* @param[in] pxm The pixmap to free
@@ -176,8 +150,6 @@
*/
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) */
-
/**
* Transfers the non-transparent part of a pixmap to a linear pixel
* buffer.
@@ -202,11 +174,10 @@
* line of the priority buffer
* @param[in] priority_skip Amount of bytes allocated by each priority
* value
- * @param[in] flags Any crossblit flags
*/
void 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);
+ byte *priority_dest, int priority_line_width, int priority_skip);
/**
Modified: scummvm/trunk/engines/sci/gfx/operations.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/operations.cpp 2009-10-25 00:13:08 UTC (rev 45365)
+++ scummvm/trunk/engines/sci/gfx/operations.cpp 2009-10-25 02:36:51 UTC (rev 45366)
@@ -131,7 +131,7 @@
*pxmp = gfx_new_pixmap(unscaled_xl, unscaled_yl, GFX_RESID_NONE, 0, 0);
else
if (xl * yl > (*pxmp)->width * (*pxmp)->height) {
- gfx_pixmap_free_data(*pxmp);
+ free((*pxmp)->data);
(*pxmp)->data = NULL;
}
@@ -514,19 +514,6 @@
(colorIn.mask & GFX_MASK_CONTROL) ? colorIn.control : -1);
}
-void gfxop_set_system_color(GfxState *state, unsigned int index, gfx_color_t *color) {
- if (index >= SCREEN_PALETTE->size()) {
- error("Attempt to set invalid color index %02x as system color", color->visual.getParentIndex());
- }
-
- SCREEN_PALETTE->makeSystemColor(index, color->visual);
-}
-
-void gfxop_free_color(GfxState *state, gfx_color_t *color) {
- // FIXME: implement. (And call in the appropriate places!)
-}
-
-
// Generic drawing operations
static int line_check_bar(int *start, int *length, int clipstart, int cliplength) {
@@ -1460,12 +1447,7 @@
if (!font)
error("Attempt to calculate text size with invalid font #%d", font_nr);
-#ifdef CUSTOM_GRAPHICS_OPTIONS
- textsplits = gfxr_font_calculate_size(fragments, font, maxwidth, text, width, height, lineheight, lastline_width,
- (state->options->workarounds & GFX_WORKAROUND_WHITESPACE_COUNT) | text_flags);
-#else
textsplits = gfxr_font_calculate_size(fragments, font, maxwidth, text, width, height, lineheight, lastline_width, text_flags);
-#endif
if (!textsplits)
error("Could not calculate text size");
@@ -1498,15 +1480,8 @@
handle->valign = valign;
handle->line_height = font->line_height;
- bool result;
-#ifdef CUSTOM_GRAPHICS_OPTIONS
- result = gfxr_font_calculate_size(handle->lines, font, maxwidth, handle->_text.c_str(), &(handle->width), &(handle->height),
- NULL, NULL, ((state->options->workarounds & GFX_WORKAROUND_WHITESPACE_COUNT) ?
- kFontCountWhitespace : 0) | flags);
-#else
- result = gfxr_font_calculate_size(handle->lines, font, maxwidth, handle->_text.c_str(), &(handle->width), &(handle->height),
+ bool result = gfxr_font_calculate_size(handle->lines, font, maxwidth, handle->_text.c_str(), &(handle->width), &(handle->height),
NULL, NULL, flags);
-#endif
if (!result) {
error("Could not calculate text parameters in font #%d", font_nr);
Modified: scummvm/trunk/engines/sci/gfx/operations.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/operations.h 2009-10-25 00:13:08 UTC (rev 45365)
+++ scummvm/trunk/engines/sci/gfx/operations.h 2009-10-25 02:36:51 UTC (rev 45366)
@@ -285,9 +285,9 @@
/**
* Maps an r/g/b value to a color and sets a gfx_color_t structure.
*
- * In palette mode, this may allocate a new color. Use gfxop_free_color() to
- * free that color. If any of the r/g/b values are less than zero, the resulting
- * color will not affect the visual map when used for drawing
+ * In palette mode, this may allocate a new color. If any of the r/g/b values
+ * are less than zero, the resulting color will not affect the visual map when
+ * used for drawing
*
* @param[in] state The current state
* @param[in] color Pointer to the structure to write to
@@ -309,26 +309,6 @@
void gfxop_set_color(GfxState *state, gfx_color_t *color, int r, int g, int b,
int a, int priority, int control);
-/**
- * Designates a color as a 'system color'.
- *
- * system colors are permanent colors that cannot be deallocated. as such, they must be used with caution.
- *
- * @param[in] state The affected state
- * @param[in] index The index for the new system color
- * @param[in] color The color to designate as a system color
- */
-void gfxop_set_system_color(GfxState *state, unsigned int index, gfx_color_t *color);
-
-/**
- * Frees a color allocated by gfxop_set_color().
- *
- * This function is a no-op in non-index mode, or if color is a system color.
- *
- * @param[in] state The state affected
- * @param[in] color The color to de-allocate
- */
-void gfxop_free_color(GfxState *state, gfx_color_t *color);
/** @} */
/** @name Pointer and IO ops */
Modified: scummvm/trunk/engines/sci/gui32/font.cpp
===================================================================
--- scummvm/trunk/engines/sci/gui32/font.cpp 2009-10-25 00:13:08 UTC (rev 45365)
+++ scummvm/trunk/engines/sci/gui32/font.cpp 2009-10-25 02:36:51 UTC (rev 45366)
@@ -114,8 +114,7 @@
fragments.push_back(TextFragment(text));
localmaxwidth = localmaxwidth - last_breakpoint;
- if (!(flags & kFontCountWhitespace))
- localmaxwidth -= last_break_width;
+ localmaxwidth -= last_break_width;
last_breakpoint = localmaxwidth = 0;
} else if (*text == ' ') {
Modified: scummvm/trunk/engines/sci/gui32/font.h
===================================================================
--- scummvm/trunk/engines/sci/gui32/font.h 2009-10-25 00:13:08 UTC (rev 45365)
+++ scummvm/trunk/engines/sci/gui32/font.h 2009-10-25 02:36:51 UTC (rev 45366)
@@ -78,9 +78,8 @@
* SCI0, SCI01 and SCI1 all use the same font format.
*/
enum fontFlags {
- kFontCountWhitespace = 1 << 0, ///< In SQ3, whitespace is included in text size
- kFontNoNewlines = 1 << 1, ///< Don't treat newline characters
- kFontIgnoreLF = 1 << 2 ///< Interpret CR LF sequences as a single newline, rather than two
+ kFontNoNewlines = 1 << 0, ///< Don't treat newline characters
+ kFontIgnoreLF = 1 << 1 ///< Interpret CR LF sequences as a single newline, rather than two
};
/**
Modified: scummvm/trunk/engines/sci/sci.cpp
===================================================================
--- scummvm/trunk/engines/sci/sci.cpp 2009-10-25 00:13:08 UTC (rev 45365)
+++ scummvm/trunk/engines/sci/sci.cpp 2009-10-25 02:36:51 UTC (rev 45366)
@@ -164,7 +164,6 @@
gfx_options.res_conf.assign[i] = NULL;
gfx_options.res_conf.mod[i] = NULL;
}
- gfx_options.workarounds = 0;
// Default config ends
#endif
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