[Scummvm-cvs-logs] SF.net SVN: scummvm:[43941] scummvm/trunk/engines/sci
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Fri Sep 4 17:04:13 CEST 2009
Revision: 43941
http://scummvm.svn.sourceforge.net/scummvm/?rev=43941&view=rev
Author: thebluegr
Date: 2009-09-04 15:04:13 +0000 (Fri, 04 Sep 2009)
Log Message:
-----------
- Removed the gfx error defines. When resources are not found, or are corrupted, we should error out instead of piggy-banking an error flag to another function
- Do not try and set the position of the mouse cursor when it's hidden
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kgraphics.cpp
scummvm/trunk/engines/sci/gfx/gfx_gui.cpp
scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp
scummvm/trunk/engines/sci/gfx/gfx_resmgr.h
scummvm/trunk/engines/sci/gfx/gfx_support.cpp
scummvm/trunk/engines/sci/gfx/gfx_system.h
scummvm/trunk/engines/sci/gfx/gfx_tools.h
scummvm/trunk/engines/sci/gfx/gfx_widgets.cpp
scummvm/trunk/engines/sci/gfx/operations.cpp
scummvm/trunk/engines/sci/gfx/operations.h
scummvm/trunk/engines/sci/gfx/res_font.cpp
Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp 2009-09-04 14:57:27 UTC (rev 43940)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp 2009-09-04 15:04:13 UTC (rev 43941)
@@ -300,7 +300,7 @@
gfxop_set_pointer_cursor(s->gfx_state, cursor);
// Set pointer position, if requested
- if (argc >= 4) {
+ if (argc >= 4 && cursor != GFXOP_NO_POINTER) {
Common::Point newPos = Common::Point(argv[2].toSint16() + s->port->_bounds.x, argv[3].toSint16() + s->port->_bounds.y);
gfxop_set_pointer_position(s->gfx_state, newPos);
}
@@ -710,11 +710,8 @@
maxloops = gfxop_lookup_view_get_loops(s->gfx_state, view);
- if (maxloops == GFX_ERROR) {
- error("Invalid view.%03d", view);
+ if ((loop > 1) && (maxloops < 4))
return;
- } else if ((loop > 1) && (maxloops < 4))
- return;
PUT_SEL32V(obj, loop, loop);
}
@@ -900,11 +897,8 @@
warning("CelHigh called with %d parameters", argc);
}
- if (gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &width, &height, &offset)) {
- error("Invalid loop (%d) or cel (%d) in view.%d (0x%x), or view invalid", loop, cel, view, view);
- return NULL_REG;
- } else
- return make_reg(0, height);
+ gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &width, &height, &offset);
+ return make_reg(0, height);
}
reg_t kCelWide(EngineState *s, int, int argc, reg_t *argv) {
@@ -918,11 +912,8 @@
warning("CelHigh called with %d parameters", argc);
}
- if (gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &width, &height, &offset)) {
- error("Invalid loop (%d) or cel (%d) in view.%d (0x%x), or view invalid", loop, cel, view, view);
- return NULL_REG;
- } else
- return make_reg(0, width);
+ gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &width, &height, &offset);
+ return make_reg(0, width);
}
reg_t kNumLoops(EngineState *s, int, int argc, reg_t *argv) {
@@ -948,12 +939,7 @@
int view = GET_SEL32V(obj, view);
int cel = 0xffff;
- if (gfxop_check_cel(s->gfx_state, view, &loop, &cel)) {
- // OK, this is a hack and there's a
- // real function to calculate cel numbers...
- error("view.%d (0x%x) not found", view, view);
- return NULL_REG;
- }
+ gfxop_check_cel(s->gfx_state, view, &loop, &cel);
debugC(2, kDebugLevelGraphics, "NumCels(view.%d, %d) = %d\n", view, loop, cel + 1);
@@ -1085,27 +1071,23 @@
oldloop = loop = sign_extend_byte(GET_SEL32V(object, loop));
oldcel = cel = sign_extend_byte(GET_SEL32V(object, cel));
- if (gfxop_check_cel(s->gfx_state, view, &loop, &cel)) {
- xsize = ysize = xmod = ymod = 0;
- } else {
- Common::Point offset = Common::Point(0, 0);
+ Common::Point offset = Common::Point(0, 0);
- if (loop != oldloop) {
- loop = 0;
- PUT_SEL32V(object, loop, 0);
- debugC(2, kDebugLevelGraphics, "Resetting loop for %04x:%04x!\n", PRINT_REG(object));
- }
+ if (loop != oldloop) {
+ loop = 0;
+ PUT_SEL32V(object, loop, 0);
+ debugC(2, kDebugLevelGraphics, "Resetting loop for %04x:%04x!\n", PRINT_REG(object));
+ }
- if (cel != oldcel) {
- cel = 0;
- PUT_SEL32V(object, cel, 0);
- }
+ if (cel != oldcel) {
+ cel = 0;
+ PUT_SEL32V(object, cel, 0);
+ }
- gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &xsize, &ysize, &offset);
+ gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &xsize, &ysize, &offset);
- xmod = offset.x;
- ymod = offset.y;
- }
+ xmod = offset.x;
+ ymod = offset.y;
xbase = x - xmod - (xsize >> 1);
xend = xbase + xsize;
@@ -1176,16 +1158,12 @@
int xmod = 0, ymod = 0;
Common::Rect retval(0, 0, 0, 0);
- if (gfxop_check_cel(s->gfx_state, view, &loop, &cel)) {
- xsize = ysize = xmod = ymod = 0;
- } else {
- Common::Point offset = Common::Point(0, 0);
+ Common::Point offset = Common::Point(0, 0);
- gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &xsize, &ysize, &offset);
+ gfxop_get_cel_parameters(s->gfx_state, view, loop, cel, &xsize, &ysize, &offset);
- xmod = offset.x;
- ymod = offset.y;
- }
+ xmod = offset.x;
+ ymod = offset.y;
xbase = x - xmod - (xsize >> 1);
xend = xbase + xsize;
@@ -1913,9 +1891,7 @@
palette = 0;
// Clip loop and cel, write back if neccessary
- if (gfxop_check_cel(s->gfx_state, view_nr, &loop, &cel)) {
- return NULL;
- }
+ gfxop_check_cel(s->gfx_state, view_nr, &loop, &cel);
if (loop != oldloop)
loop = 0;
@@ -2421,18 +2397,8 @@
int priority = (argc > 5) ? argv[5].toSint16() : -1;
GfxView *new_view;
-/*
- if (!view) {
- error("Attempt to draw non-existing view.%03d", view);
- return;
- }
-*/
+ gfxop_check_cel(s->gfx_state, view, &loop, &cel);
- if (gfxop_check_cel(s->gfx_state, view, &loop, &cel)) {
- error("Attempt to draw non-existing view.%03d", view);
- return s->r_acc;
- }
-
debugC(2, kDebugLevelGraphics, "DrawCel((%d,%d), (view.%d, %d, %d), p=%d)\n", x, y, view, loop, cel, priority);
new_view = gfxw_new_view(s->gfx_state, Common::Point(x, y), view, loop, cel, 0, priority, -1,
Modified: scummvm/trunk/engines/sci/gfx/gfx_gui.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_gui.cpp 2009-09-04 14:57:27 UTC (rev 43940)
+++ scummvm/trunk/engines/sci/gfx/gfx_gui.cpp 2009-09-04 15:04:13 UTC (rev 43941)
@@ -455,12 +455,6 @@
font_height = gfxop_get_font_height(port->_visual->_gfxState, font_nr);
columns = (zone.height - 20);
- if (font_height <= 0) {
- error("Attempt to create list control with invalid font %d", font_nr);
- delete list;
- return NULL;
- }
-
columns /= font_height;
gfxw_set_id(list, ID.segment, ID.offset);
Modified: scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp 2009-09-04 14:57:27 UTC (rev 43940)
+++ scummvm/trunk/engines/sci/gfx/gfx_resmgr.cpp 2009-09-04 15:04:13 UTC (rev 43941)
@@ -76,7 +76,7 @@
_staticPalette = 0;
}
-int GfxResManager::calculatePic(gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic, int flags, int default_palette, int nr) {
+void GfxResManager::calculatePic(gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic, int flags, int default_palette, int nr) {
Resource *res = _resMan->findResource(ResourceId(kResourceTypePic, nr), 0);
int need_unscaled = unscaled_pic != NULL;
gfxr_pic0_params_t style, basic_style;
@@ -93,7 +93,7 @@
#endif
if (!res || !res->data)
- return GFX_ERROR;
+ error("calculatePic(): pic number %d not found", nr);
if (need_unscaled) {
if (_resMan->sciVersion() == SCI_VERSION_1_1)
@@ -132,8 +132,6 @@
if (unscaled_pic)
unscaled_pic->visual_map->loop = default_palette;
-
- return GFX_OK;
}
int GfxResManager::getOptionsHash(gfx_resource_type_t type) {
@@ -363,12 +361,9 @@
}
gfxr_clear_pic0(pic, SCI_TITLEBAR_SIZE);
}
- if (calculatePic(pic, unscaled_pic, flags, default_palette, num)) {
- gfxr_free_pic(pic);
- if (unscaled_pic)
- gfxr_free_pic(unscaled_pic);
- return NULL;
- }
+
+ calculatePic(pic, unscaled_pic, flags, default_palette, num);
+
if (!res) {
res = (gfx_resource_t *)malloc(sizeof(gfx_resource_t));
res->ID = GFXR_RES_ID(GFX_RESOURCE_TYPE_PIC, num);
Modified: scummvm/trunk/engines/sci/gfx/gfx_resmgr.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_resmgr.h 2009-09-04 14:57:27 UTC (rev 43940)
+++ scummvm/trunk/engines/sci/gfx/gfx_resmgr.h 2009-09-04 15:04:13 UTC (rev 43941)
@@ -225,10 +225,8 @@
* @param[in] default_palette The default palette to use for pic
* drawing (interpreter dependant)
* @param[in] nr pic resource number
- * @return GFX_ERROR if the resource could not be
- * found, GFX_OK otherwise
*/
- int calculatePic(gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic,
+ void calculatePic(gfxr_pic_t *scaled_pic, gfxr_pic_t *unscaled_pic,
int flags, int default_palette, int nr);
Modified: scummvm/trunk/engines/sci/gfx/gfx_support.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_support.cpp 2009-09-04 14:57:27 UTC (rev 43940)
+++ scummvm/trunk/engines/sci/gfx/gfx_support.cpp 2009-09-04 15:04:13 UTC (rev 43941)
@@ -194,7 +194,7 @@
}
}
-int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority, rect_t src_coords, rect_t dest_coords,
+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) {
int maxx = 320 * mode->xfact;
int maxy = 200 * mode->yfact;
@@ -217,9 +217,9 @@
// --???--
if (src_coords.y > yl)
- return GFX_OK;
+ return;
if (src_coords.x > xl)
- return GFX_OK;
+ return;
// --???--
if (dest_coords.x + xl >= maxx)
@@ -231,10 +231,10 @@
yl -= yoffset;
if (!pxm->data)
- return GFX_ERROR;
+ error("Attempted to crossblit an empty pixmap");
if (xl <= 0 || yl <= 0)
- return GFX_OK;
+ return;
// Set destination offsets
@@ -275,10 +275,8 @@
int shift_nr = 0;
alpha_mask = 0;
- if (!alpha_mask && pxm->alpha_map) {
+ if (!alpha_mask && pxm->alpha_map)
error("Invalid alpha mode: both pxm->alpha_map and alpha_mask are white");
- return GFX_ERROR;
- }
if (alpha_mask) {
while (!(alpha_mask & 0xff)) {
@@ -319,7 +317,6 @@
0, 0, 0, 0);
else {
error("Invalid mode->bytespp: %d", mode->bytespp);
- return GFX_ERROR;
}
} else { // priority
if (bpp > 0 && bpp < 5)
@@ -328,11 +325,8 @@
priority_pos, priority_line_width, priority_skip, priority);
else {
error("Invalid mode->bytespp: %d", mode->bytespp);
- return GFX_ERROR;
}
}
-
- return GFX_OK;
}
} // End of namespace Sci
Modified: scummvm/trunk/engines/sci/gfx/gfx_system.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_system.h 2009-09-04 14:57:27 UTC (rev 43940)
+++ scummvm/trunk/engines/sci/gfx/gfx_system.h 2009-09-04 15:04:13 UTC (rev 43941)
@@ -223,14 +223,6 @@
/** @name Constant values
* @{ */
-/** Return values */
-enum gfx_return_value_t {
- GFX_OK = 0, /**< Indicates "operation successful" */
- GFX_ERROR = -1, /**< Indicates "operation failed" */
- GFX_FATAL = -2 /**< Fatal error: Used by graphics drivers to indicate
- that they were unable to do anything useful */
-};
-
/** Map masks */
enum gfx_map_mask_t {
GFX_MASK_NONE = 0,
Modified: scummvm/trunk/engines/sci/gfx/gfx_tools.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_tools.h 2009-09-04 14:57:27 UTC (rev 43940)
+++ scummvm/trunk/engines/sci/gfx/gfx_tools.h 2009-09-04 15:04:13 UTC (rev 43941)
@@ -200,10 +200,8 @@
* @param[in] priority_skip Amount of bytes allocated by each priority
* value
* @param[in] flags Any crossblit flags
- * @return GFX_OK, or GFX_ERROR if the specified mode
- * was invalid or unsupported
*/
-int gfx_crossblit_pixmap(gfx_mode_t *mode, gfx_pixmap_t *pxm, int priority,
+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);
Modified: scummvm/trunk/engines/sci/gfx/gfx_widgets.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_widgets.cpp 2009-09-04 14:57:27 UTC (rev 43940)
+++ scummvm/trunk/engines/sci/gfx/gfx_widgets.cpp 2009-09-04 15:04:13 UTC (rev 43941)
@@ -537,10 +537,7 @@
error("Attempt to create view widget with NULL state");
}
- if (gfxop_get_cel_parameters(state, view_, loop_, cel_, &width, &height, &offset)) {
- error("Attempt to retrieve cel parameters for (%d/%d/%d) failed (Maybe the values weren't checked beforehand?)",
- view_, cel_, loop_);
- }
+ gfxop_get_cel_parameters(state, view_, loop_, cel_, &width, &height, &offset);
_pos = pos_;
_color.mask = ((priority < 0) ? 0 : GFX_MASK_PRIORITY) | ((control < 0) ? 0 : GFX_MASK_CONTROL);
@@ -743,14 +740,10 @@
_type = GFXW_DYN_VIEW;
- if (!state) {
+ if (!state)
error("Attempt to create view widget with NULL state");
- }
- if (gfxop_get_cel_parameters(state, view_, loop_, cel_, &width, &height, &offset)) {
- error("Attempt to retrieve cel parameters for (%d/%d/%d) failed (Maybe the values weren't checked beforehand?)",
- view_, cel_, loop_);
- }
+ gfxop_get_cel_parameters(state, view_, loop_, cel_, &width, &height, &offset);
_pos = pos_;
_color.mask = ((priority < 0) ? 0 : GFX_MASK_PRIORITY) | ((control < 0) ? 0 : GFX_MASK_CONTROL);
Modified: scummvm/trunk/engines/sci/gfx/operations.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/operations.cpp 2009-09-04 14:57:27 UTC (rev 43940)
+++ scummvm/trunk/engines/sci/gfx/operations.cpp 2009-09-04 15:04:13 UTC (rev 43941)
@@ -1059,8 +1059,10 @@
}
void gfxop_set_pointer_cursor(GfxState *state, int nr) {
- if (nr == GFXOP_NO_POINTER)
+ if (nr == GFXOP_NO_POINTER) {
_gfxop_set_pointer(state, NULL, NULL);
+ return;
+ }
gfx_pixmap_t *new_pointer = state->gfxResMan->getCursor(nr);
@@ -1502,8 +1504,7 @@
view = state->gfxResMan->getView(nr, &loop, &cel, 0);
if (!view) {
- warning("[GFX] Attempt to retrieve number of loops from invalid view %d", nr);
- return 0;
+ error("[GFX] Attempt to retrieve number of loops from invalid view %d", nr);
}
return view->loops_nr;
@@ -1525,27 +1526,21 @@
return view->loops[real_loop].cels_nr;
}
-int gfxop_check_cel(GfxState *state, int nr, int *loop, int *cel) {
+void gfxop_check_cel(GfxState *state, int nr, int *loop, int *cel) {
gfxr_view_t *testView = state->gfxResMan->getView(nr, loop, cel, 0);
- if (!testView) {
- warning("[GFX] Attempt to verify loop/cel values for invalid view %d", nr);
- return GFX_ERROR;
- }
-
- return GFX_OK;
+ if (!testView)
+ error("[GFX] Attempt to verify loop/cel values for invalid view %d", nr);
}
-int gfxop_overflow_cel(GfxState *state, int nr, int *loop, int *cel) {
+void gfxop_overflow_cel(GfxState *state, int nr, int *loop, int *cel) {
int loop_v = *loop;
int cel_v = *cel;
gfxr_view_t *testView = state->gfxResMan->getView(nr, &loop_v, &cel_v, 0);
- if (!testView) {
- warning("[GFX] Attempt to verify loop/cel values for invalid view %d", nr);
- return GFX_ERROR;
- }
+ if (!testView)
+ error("[GFX] Attempt to verify loop/cel values for invalid view %d", nr);
if (loop_v != *loop)
*loop = 0;
@@ -1553,28 +1548,22 @@
if (loop_v != *loop
|| cel_v != *cel)
*cel = 0;
-
- return GFX_OK;
}
-int gfxop_get_cel_parameters(GfxState *state, int nr, int loop, int cel, int *width, int *height, Common::Point *offset) {
+void gfxop_get_cel_parameters(GfxState *state, int nr, int loop, int cel, int *width, int *height, Common::Point *offset) {
gfxr_view_t *view = NULL;
gfx_pixmap_t *pxm = NULL;
view = state->gfxResMan->getView(nr, &loop, &cel, 0);
- if (!view) {
- warning("[GFX] Attempt to get cel parameters for invalid view %d", nr);
- return GFX_ERROR;
- }
+ if (!view)
+ error("[GFX] Attempt to get cel parameters for invalid view %d", nr);
pxm = view->loops[loop].cels[cel];
*width = pxm->index_width;
*height = pxm->index_height;
offset->x = pxm->xoffset;
offset->y = pxm->yoffset;
-
- return GFX_OK;
}
static void _gfxop_draw_cel_buffer(GfxState *state, int nr, int loop, int cel, Common::Point pos, gfx_color_t color, int static_buf, int palette) {
@@ -1706,12 +1695,12 @@
font = state->gfxResMan->getFont(font_nr);
if (!font)
- return GFX_ERROR;
+ error("gfxop_get_font_height(): Font number %d not found", font_nr);
return font->line_height;
}
-int gfxop_get_text_params(GfxState *state, int font_nr, const char *text, int maxwidth, int *width, int *height, int text_flags,
+void gfxop_get_text_params(GfxState *state, int font_nr, const char *text, int maxwidth, int *width, int *height, int text_flags,
int *lines_nr, int *lineheight, int *lastline_width) {
Common::Array<TextFragment> fragments;
bool textsplits;
@@ -1719,11 +1708,8 @@
font = state->gfxResMan->getFont(font_nr);
- if (!font) {
+ if (!font)
error("Attempt to calculate text size with invalid font #%d", font_nr);
- *width = *height = 0;
- return GFX_ERROR;
- }
#ifdef CUSTOM_GRAPHICS_OPTIONS
textsplits = gfxr_font_calculate_size(fragments, font, maxwidth, text, width, height, lineheight, lastline_width,
@@ -1732,16 +1718,11 @@
textsplits = gfxr_font_calculate_size(fragments, font, maxwidth, text, width, height, lineheight, lastline_width, text_flags);
#endif
- if (!textsplits) {
+ if (!textsplits)
error("Could not calculate text size");
- *width = *height = 0;
- return GFX_ERROR;
- }
if (lines_nr)
*lines_nr = fragments.size();
-
- return GFX_OK;
}
TextHandle *gfxop_new_text(GfxState *state, int font_nr, const Common::String &text, int maxwidth, gfx_alignment_t halign,
Modified: scummvm/trunk/engines/sci/gfx/operations.h
===================================================================
--- scummvm/trunk/engines/sci/gfx/operations.h 2009-09-04 14:57:27 UTC (rev 43940)
+++ scummvm/trunk/engines/sci/gfx/operations.h 2009-09-04 15:04:13 UTC (rev 43941)
@@ -452,9 +452,8 @@
* @param[in] nr Number of the view to use
* @param[in] loop Pointer to the variable storing the loop number to verify
* @param[in] cel Pointer to the variable storing the cel number to check
- * @return GFX_OK or GFX_ERROR if the view didn't exist
*/
-int gfxop_check_cel(GfxState *state, int nr, int *loop, int *cel);
+void gfxop_check_cel(GfxState *state, int nr, int *loop, int *cel);
/**
* Resets loop/cel values to zero if they have become invalid.
@@ -463,11 +462,8 @@
* @param[in] nr Number of the view to use
* @param[in] loop Pointer to the variable storing the loop number to verify
* @param[in] cel Pointer to the variable storing the cel number to check
- * @return GFX_OK or GFX_ERROR if the view didn't exist *loop is
- * clipped first, then *cel. The resulting setup will be a
- * valid view configuration.
*/
-int gfxop_overflow_cel(GfxState *state, int nr, int *loop, int *cel);
+void gfxop_overflow_cel(GfxState *state, int nr, int *loop, int *cel);
/**
* Retrieves the width and height of a cel.
@@ -479,10 +475,8 @@
* @param[in] width The variable the width will be stored in
* @param[in] height The variable the height will be stored in
* @param[in] offset The variable the cel's x/y offset will be stored in
- * @return GFX_OK if the lookup succeeded, GFX_ERROR if the
- * nr/loop/cel combination was invalid
*/
-int gfxop_get_cel_parameters(GfxState *state, int nr, int loop, int cel,
+void gfxop_get_cel_parameters(GfxState *state, int nr, int loop, int cel,
int *width, int *height, Common::Point *offset);
/**
@@ -582,7 +576,7 @@
*
* @param[in] state The state to work on
* @param[in] font_nr Number of the font to inspect
- * @return GFX_ERROR, GFX_FATAL, or the font line height
+ * @return The font line height
*/
int gfxop_get_font_height(GfxState *state, int font_nr);
@@ -601,9 +595,8 @@
* @param[out] lineheight Pixel height (SCI scale) of each text line
* @param[out] lastline_width Pixel offset (SCI scale) of the space after
* the last character in the last line
- * @return GFX_OK or GFX_ERROR if the font didn't exist
*/
-int gfxop_get_text_params(GfxState *state, int font_nr, const char *text,
+void gfxop_get_text_params(GfxState *state, int font_nr, const char *text,
int maxwidth, int *width, int *height, int flags,
int *lines_nr, int *lineheight, int *lastline_width);
Modified: scummvm/trunk/engines/sci/gfx/res_font.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/res_font.cpp 2009-09-04 14:57:27 UTC (rev 43940)
+++ scummvm/trunk/engines/sci/gfx/res_font.cpp 2009-09-04 15:04:13 UTC (rev 43941)
@@ -35,7 +35,7 @@
#define FONT_HEIGHT_OFFSET 4
#define FONT_MAXCHAR_OFFSET 2
-static int calc_char(byte *dest, int total_width, int total_height, byte *src, int size) {
+static void calc_char(byte *dest, int total_width, int total_height, byte *src, int size) {
int width = src[0];
int height = src[1];
int byte_width = (width + 7) >> 3;
@@ -45,12 +45,10 @@
if ((width >> 3) > total_width || height > total_height) {
error("Weird character: width=%d/%d, height=%d/%d", width, total_width, height, total_height);
- return GFX_ERROR;
}
if (byte_width * height + 2 > size) {
error("Character extends to %d of %d allowed bytes", byte_width * height + 2, size);
- return GFX_ERROR;
}
for (y = 0; y < height; y++) {
@@ -58,8 +56,6 @@
src += byte_width;
dest += total_width;
}
-
- return GFX_OK;
}
gfx_bitmap_font_t *gfxr_read_font(int id, byte *resource, int size) {
@@ -129,11 +125,7 @@
for (i = 0; i < chars_nr; i++) {
int offset = READ_LE_UINT16(resource + (i << 1) + 6);
- if (calc_char(font->data + (font->char_size * i), font->row_size, max_height, resource + offset, size - offset)) {
- error("Problem occured in font %04x, char %d/%d", id, i, chars_nr);
- gfxr_free_font(font);
- return NULL;
- }
+ calc_char(font->data + (font->char_size * i), font->row_size, max_height, resource + offset, size - offset);
}
return font;
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