aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2009-10-25 02:36:51 +0000
committerFilippos Karapetis2009-10-25 02:36:51 +0000
commit452ae8a5769142a934676b7fdc721910e12aaf5e (patch)
treef1fe820946807350c94bba4a9a061c380b0a7755
parent9b6f2be526f8fee3c2451d2f180f70ee4e976f4e (diff)
downloadscummvm-rg350-452ae8a5769142a934676b7fdc721910e12aaf5e.tar.gz
scummvm-rg350-452ae8a5769142a934676b7fdc721910e12aaf5e.tar.bz2
scummvm-rg350-452ae8a5769142a934676b7fdc721910e12aaf5e.zip
Cleanup
svn-id: r45366
-rw-r--r--engines/sci/engine/game.cpp4
-rw-r--r--engines/sci/gfx/gfx_driver.cpp2
-rw-r--r--engines/sci/gfx/gfx_options.h7
-rw-r--r--engines/sci/gfx/gfx_support.cpp8
-rw-r--r--engines/sci/gfx/gfx_tools.cpp41
-rw-r--r--engines/sci/gfx/gfx_tools.h31
-rw-r--r--engines/sci/gfx/operations.cpp29
-rw-r--r--engines/sci/gfx/operations.h26
-rw-r--r--engines/sci/gui32/font.cpp3
-rw-r--r--engines/sci/gui32/font.h5
-rw-r--r--engines/sci/sci.cpp1
11 files changed, 15 insertions, 142 deletions
diff --git a/engines/sci/engine/game.cpp b/engines/sci/engine/game.cpp
index f3d5613637..b1c08ee2fe 100644
--- a/engines/sci/engine/game.cpp
+++ b/engines/sci/engine/game.cpp
@@ -182,12 +182,12 @@ int _reset_graphics_input(EngineState *s) {
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;
diff --git a/engines/sci/gfx/gfx_driver.cpp b/engines/sci/gfx/gfx_driver.cpp
index 8ac2e8e1d9..1ab8381022 100644
--- a/engines/sci/gfx/gfx_driver.cpp
+++ b/engines/sci/gfx/gfx_driver.cpp
@@ -115,7 +115,7 @@ void GfxDriver::drawPixmap(gfx_pixmap_t *pxm, int priority, rect_t src, rect_t d
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) {
diff --git a/engines/sci/gfx/gfx_options.h b/engines/sci/gfx/gfx_options.h
index 9665df3b9d..398cb379c9 100644
--- a/engines/sci/gfx/gfx_options.h
+++ b/engines/sci/gfx/gfx_options.h
@@ -55,16 +55,9 @@ struct gfx_options_t {
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
diff --git a/engines/sci/gfx/gfx_support.cpp b/engines/sci/gfx/gfx_support.cpp
index ca6815cd07..867e555907 100644
--- a/engines/sci/gfx/gfx_support.cpp
+++ b/engines/sci/gfx/gfx_support.cpp
@@ -152,7 +152,7 @@ void _gfx_crossblit_simple(byte *dest, byte *src, int dest_line_width, int src_l
}
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 @@ void gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority, rec
// 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
diff --git a/engines/sci/gfx/gfx_tools.cpp b/engines/sci/gfx/gfx_tools.cpp
index 290759374b..aa98d44332 100644
--- a/engines/sci/gfx/gfx_tools.cpp
+++ b/engines/sci/gfx/gfx_tools.cpp
@@ -83,24 +83,6 @@ void gfx_copy_pixmap_box_i(gfx_pixmap_t *dest, gfx_pixmap_t *src, rect_t box) {
}
}
-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 @@ gfx_pixmap_t *gfx_pixmap_alloc_index_data(gfx_pixmap_t *pixmap) {
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 @@ gfx_pixmap_t *gfx_pixmap_alloc_data(gfx_pixmap_t *pixmap, gfx_mode_t *mode) {
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;
diff --git a/engines/sci/gfx/gfx_tools.h b/engines/sci/gfx/gfx_tools.h
index 5e615d650a..57a70f50ad 100644
--- a/engines/sci/gfx/gfx_tools.h
+++ b/engines/sci/gfx/gfx_tools.h
@@ -79,16 +79,6 @@ void gfx_free_mode(gfx_mode_t *mode);
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_clone_pixmap(gfx_pixmap_t *pixmap, gfx_mode_t *mode);
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_free_index_data(gfx_pixmap_t *pixmap);
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_copy_pixmap_box_i(gfx_pixmap_t *dest, gfx_pixmap_t *src, rect_t box);
*/
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 @@ void gfx_xlate_pixmap(gfx_pixmap_t *pxm, gfx_mode_t *mode);
* 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);
/**
diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp
index 1d914ac1c2..0a51004f1d 100644
--- a/engines/sci/gfx/operations.cpp
+++ b/engines/sci/gfx/operations.cpp
@@ -131,7 +131,7 @@ static void _gfxop_grab_pixmap(GfxState *state, gfx_pixmap_t **pxmp, int x, int
*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 @@ void gfxop_set_color(GfxState *state, gfx_color_t *colorOut, gfx_color_t &colorI
(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 @@ void gfxop_get_text_params(GfxState *state, int font_nr, const char *text, int m
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 @@ TextHandle *gfxop_new_text(GfxState *state, int font_nr, const Common::String &t
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);
diff --git a/engines/sci/gfx/operations.h b/engines/sci/gfx/operations.h
index 4850d31669..0255130b37 100644
--- a/engines/sci/gfx/operations.h
+++ b/engines/sci/gfx/operations.h
@@ -285,9 +285,9 @@ void gfxop_disable_dirty_frames(GfxState *state);
/**
* 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_disable_dirty_frames(GfxState *state);
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 */
diff --git a/engines/sci/gui32/font.cpp b/engines/sci/gui32/font.cpp
index 5fd30b92aa..6fe4b7508b 100644
--- a/engines/sci/gui32/font.cpp
+++ b/engines/sci/gui32/font.cpp
@@ -114,8 +114,7 @@ bool gfxr_font_calculate_size(Common::Array<TextFragment> &fragments, gfx_bitmap
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 == ' ') {
diff --git a/engines/sci/gui32/font.h b/engines/sci/gui32/font.h
index b24d50fb05..d7b92db029 100644
--- a/engines/sci/gui32/font.h
+++ b/engines/sci/gui32/font.h
@@ -78,9 +78,8 @@ struct gfx_bitmap_font_t {
* 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
};
/**
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp
index 7710a9e8e3..817e0fbb45 100644
--- a/engines/sci/sci.cpp
+++ b/engines/sci/sci.cpp
@@ -164,7 +164,6 @@ Common::Error SciEngine::run() {
gfx_options.res_conf.assign[i] = NULL;
gfx_options.res_conf.mod[i] = NULL;
}
- gfx_options.workarounds = 0;
// Default config ends
#endif