diff options
author | Paweł Kołodziejski | 2009-02-21 08:56:49 +0000 |
---|---|---|
committer | Paweł Kołodziejski | 2009-02-21 08:56:49 +0000 |
commit | ecf0cbe94e8e57a29b5a920623d6884e371de2fc (patch) | |
tree | 122ce7e6b21d2a97eaa4f7a210778a9ed4247ec7 /engines/sci | |
parent | a58493656894693ef242c9e2d31185c24e822e41 (diff) | |
download | scummvm-rg350-ecf0cbe94e8e57a29b5a920623d6884e371de2fc.tar.gz scummvm-rg350-ecf0cbe94e8e57a29b5a920623d6884e371de2fc.tar.bz2 scummvm-rg350-ecf0cbe94e8e57a29b5a920623d6884e371de2fc.zip |
formating
svn-id: r38670
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/gfx/resmgr.cpp | 236 |
1 files changed, 83 insertions, 153 deletions
diff --git a/engines/sci/gfx/resmgr.cpp b/engines/sci/gfx/resmgr.cpp index b1bda530bf..7302b6868e 100644 --- a/engines/sci/gfx/resmgr.cpp +++ b/engines/sci/gfx/resmgr.cpp @@ -23,7 +23,7 @@ * */ -/* Resource manager core part */ +// Resource manager core part // FIXME/TODO: The name "(Graphics) resource manager", and the associated // filenames, are misleading. This should be renamed to "Graphics manager" @@ -37,7 +37,7 @@ #undef TIME_PICDRAWING -/* Invalid hash mode: Used to invalidate modified pics */ +// Invalid hash mode: Used to invalidate modified pics #define MODE_INVALID -1 struct param_struct { @@ -45,11 +45,8 @@ struct param_struct { gfx_driver_t *driver; }; - -gfx_resstate_t * -gfxr_new_resource_manager(int version, gfx_options_t *options, - gfx_driver_t *driver, void *misc_payload) { - gfx_resstate_t *state = (gfx_resstate_t*)sci_malloc(sizeof(gfx_resstate_t)); +gfx_resstate_t *gfxr_new_resource_manager(int version, gfx_options_t *options, gfx_driver_t *driver, void *misc_payload) { + gfx_resstate_t *state = (gfx_resstate_t *)sci_malloc(sizeof(gfx_resstate_t)); int ii; state->version = version; @@ -62,8 +59,7 @@ gfxr_new_resource_manager(int version, gfx_options_t *options, gfx_resource_type_t i = (gfx_resource_type_t) ii; sbtree_t *tree; int entries_nr; - int *resources = gfxr_interpreter_get_resources(state, i, version, - &entries_nr, misc_payload); + int *resources = gfxr_interpreter_get_resources(state, i, version, &entries_nr, misc_payload); if (!resources) state->resource_trees[i] = NULL; @@ -76,6 +72,7 @@ gfxr_new_resource_manager(int version, gfx_options_t *options, free(resources); } } + return state; } @@ -95,9 +92,7 @@ gfxr_new_resource_manager(int version, gfx_options_t *options, freecmd(resource->unscaled_data.type); \ resource->unscaled_data.type = NULL; - -void -gfxr_free_resource(gfx_driver_t *driver, gfx_resource_t *resource, int type) { +void gfxr_free_resource(gfx_driver_t *driver, gfx_resource_t *resource, int type) { if (!resource) return; @@ -128,9 +123,7 @@ gfxr_free_resource(gfx_driver_t *driver, gfx_resource_t *resource, int type) { #undef FREECMD - -void * -gfxr_sbtree_free_func(sbtree_t *tree, const int key, const void *value, void *args) { +void *gfxr_sbtree_free_func(sbtree_t *tree, const int key, const void *value, void *args) { struct param_struct *params = (struct param_struct *) args; int type = params->args[0]; gfx_driver_t *driver = params->driver; @@ -148,8 +141,7 @@ gfxr_sbtree_free_func(sbtree_t *tree, const int key, const void *value, void *ar #define ARG_ACTION_RESET 0 #define ARG_ACTION_DECREMENT 1 -void * -gfxr_sbtree_free_tagged_func(sbtree_t *tree, const int key, const void *value, void *args) { +void *gfxr_sbtree_free_tagged_func(sbtree_t *tree, const int key, const void *value, void *args) { struct param_struct *params = (struct param_struct *) args; int type = params->args[SBTREE_FREE_TAGGED_ARG_TYPE]; int tag_value = params->args[SBTREE_FREE_TAGGED_ARG_TAGVALUE]; @@ -167,12 +159,11 @@ gfxr_sbtree_free_tagged_func(sbtree_t *tree, const int key, const void *value, v (resource->lock_sequence_nr)--; return (void *) value; } - } else return NULL; + } else + return NULL; } - -void -gfxr_free_all_resources(gfx_driver_t *driver, gfx_resstate_t *state) { +void gfxr_free_all_resources(gfx_driver_t *driver, gfx_resstate_t *state) { struct param_struct params; int i; sbtree_t *tree = NULL; @@ -185,8 +176,7 @@ gfxr_free_all_resources(gfx_driver_t *driver, gfx_resstate_t *state) { } } -void -gfxr_free_resource_manager(gfx_driver_t *driver, gfx_resstate_t *state) { +void gfxr_free_resource_manager(gfx_driver_t *driver, gfx_resstate_t *state) { struct param_struct params; int i; sbtree_t *tree = NULL; @@ -195,24 +185,19 @@ gfxr_free_resource_manager(gfx_driver_t *driver, gfx_resstate_t *state) { if ((tree = state->resource_trees[i])) { params.args[0] = i; params.driver = driver; - sbtree_foreach(tree, (void *) ¶ms, gfxr_sbtree_free_func); + sbtree_foreach(tree, (void *)¶ms, gfxr_sbtree_free_func); sbtree_free(tree); } free(state); } - -void -gfxr_tag_resources(gfx_resstate_t *state) { +void gfxr_tag_resources(gfx_resstate_t *state) { (state->tag_lock_counter)++; } - - -void -gfxr_free_tagged_resources(gfx_driver_t *driver, gfx_resstate_t *state) { - /* Current heuristics: free tagged views and old pics */ +void gfxr_free_tagged_resources(gfx_driver_t *driver, gfx_resstate_t *state) { + // Current heuristics: free tagged views and old pics struct param_struct params; if (state->resource_trees[GFX_RESOURCE_TYPE_VIEW]) { @@ -234,26 +219,21 @@ gfxr_free_tagged_resources(gfx_driver_t *driver, gfx_resstate_t *state) { state->tag_lock_counter = 0; } - #define XLATE_AS_APPROPRIATE(key, entry) \ if (maps & key) { \ - if (res->unscaled_data.pic \ - && (force || !res->unscaled_data.pic->entry->data)) { \ + if (res->unscaled_data.pic&& (force || !res->unscaled_data.pic->entry->data)) { \ if (key == GFX_MASK_VISUAL) \ gfx_get_res_config(options, res->unscaled_data.pic->entry); \ gfx_xlate_pixmap(res->unscaled_data.pic->entry, mode, filter); \ - } if (scaled && res->scaled_data.pic \ - && (force || !res->scaled_data.pic->entry->data)) { \ + } if (scaled && res->scaled_data.pic && (force || !res->scaled_data.pic->entry->data)) { \ if (key == GFX_MASK_VISUAL) \ gfx_get_res_config(options, res->scaled_data.pic->entry); \ gfx_xlate_pixmap(res->scaled_data.pic->entry, mode, filter); \ } \ } -static gfxr_pic_t * -gfxr_pic_xlate_common(gfx_resource_t *res, int maps, int scaled, - int force, gfx_mode_t *mode, gfx_xlate_filter_t filter, int endianize, - gfx_options_t *options) { +static gfxr_pic_t *gfxr_pic_xlate_common(gfx_resource_t *res, int maps, int scaled, int force, gfx_mode_t *mode, + gfx_xlate_filter_t filter, int endianize, gfx_options_t *options) { XLATE_AS_APPROPRIATE(GFX_MASK_VISUAL, visual_map); XLATE_AS_APPROPRIATE(GFX_MASK_PRIORITY, priority_map); XLATE_AS_APPROPRIATE(GFX_MASK_CONTROL, control_map); @@ -261,23 +241,18 @@ gfxr_pic_xlate_common(gfx_resource_t *res, int maps, int scaled, if (endianize && (maps & GFX_MASK_VISUAL) && res->scaled_data.pic->visual_map) gfxr_endianness_adjust(res->scaled_data.pic->visual_map, mode); - return scaled ? res->scaled_data.pic : res->unscaled_data.pic; } #undef XLATE_AS_APPROPRIATE - -gfxr_pic_t * -gfxr_get_pic(gfx_resstate_t *state, int nr, int maps, int flags, int default_palette, int scaled) { +gfxr_pic_t *gfxr_get_pic(gfx_resstate_t *state, int nr, int maps, int flags, int default_palette, int scaled) { gfxr_pic_t *npic = NULL; gfx_resource_type_t restype = GFX_RESOURCE_TYPE_PIC; sbtree_t *tree = state->resource_trees[restype]; gfx_resource_t *res = NULL; - int hash = gfxr_interpreter_options_hash(restype, state->version, - state->options, state->misc_payload, 0); + int hash = gfxr_interpreter_options_hash(restype, state->version, state->options, state->misc_payload, 0); int must_post_process_pic = 0; - int need_unscaled = - (state->driver->mode->xfact != 1 || state->driver->mode->yfact != 1); + int need_unscaled = (state->driver->mode->xfact != 1 || state->driver->mode->yfact != 1); if (!tree) return NULL; @@ -292,14 +267,9 @@ gfxr_get_pic(gfx_resstate_t *state, int nr, int maps, int flags, int default_pal if (state->options->pic0_unscaled) { need_unscaled = 0; - pic = gfxr_interpreter_init_pic(state->version, - &mode_1x1_color_index, - GFXR_RES_ID(restype, nr), - state->misc_payload); - } else pic = gfxr_interpreter_init_pic(state->version, - state->driver->mode, - GFXR_RES_ID(restype, nr), - state->misc_payload); + pic = gfxr_interpreter_init_pic(state->version, &mode_1x1_color_index, GFXR_RES_ID(restype, nr), state->misc_payload); + } else + pic = gfxr_interpreter_init_pic(state->version, state->driver->mode, GFXR_RES_ID(restype, nr), state->misc_payload); if (!pic) { GFXERROR("Failed to allocate scaled pic"); @@ -309,25 +279,21 @@ gfxr_get_pic(gfx_resstate_t *state, int nr, int maps, int flags, int default_pal gfxr_interpreter_clear_pic(state->version, pic, state->misc_payload); if (need_unscaled) { - unscaled_pic = gfxr_interpreter_init_pic(state->version, - &mode_1x1_color_index, - GFXR_RES_ID(restype, nr), - state->misc_payload); + unscaled_pic = gfxr_interpreter_init_pic(state->version, &mode_1x1_color_index, GFXR_RES_ID(restype, nr), + state->misc_payload); if (!unscaled_pic) { GFXERROR("Failed to allocate unscaled pic"); return NULL; } - gfxr_interpreter_clear_pic(state->version, unscaled_pic, - state->misc_payload); + gfxr_interpreter_clear_pic(state->version, unscaled_pic, state->misc_payload); } #ifdef TIME_PICDRAWING - {long start_sec, start_usec; + { + long start_sec, start_usec; long end_sec, end_usec; sci_gettime(&start_sec, &start_usec); #endif - if (gfxr_interpreter_calculate_pic(state, pic, unscaled_pic, flags, - default_palette, nr, - state->misc_payload)) { + if (gfxr_interpreter_calculate_pic(state, pic, unscaled_pic, flags, default_palette, nr, state->misc_payload)) { gfxr_free_pic(state->driver, pic); if (unscaled_pic) gfxr_free_pic(state->driver, unscaled_pic); @@ -336,16 +302,15 @@ gfxr_get_pic(gfx_resstate_t *state, int nr, int maps, int flags, int default_pal } #ifdef TIME_PICDRAWING sci_gettime(&end_sec, &end_usec); - printf("\nTIME: %d for drawing pic.%03d\n", - (end_sec - start_sec) * 1000000 + (end_usec - start_usec), nr); + printf("\nTIME: %d for drawing pic.%03d\n", (end_sec - start_sec) * 1000000 + (end_usec - start_usec), nr); } #endif if (!res) { - res = (gfx_resource_t*)sci_malloc(sizeof(gfx_resource_t)); + res = (gfx_resource_t *)sci_malloc(sizeof(gfx_resource_t)); res->ID = GFXR_RES_ID(restype, nr); res->lock_sequence_nr = state->options->buffer_pics_nr; - sbtree_set(tree, nr, (void *) res); + sbtree_set(tree, nr, (void *)res); } else { gfxr_free_pic(state->driver, res->scaled_data.pic); if (res->unscaled_data.pic) @@ -356,24 +321,19 @@ gfxr_get_pic(gfx_resstate_t *state, int nr, int maps, int flags, int default_pal res->scaled_data.pic = pic; res->unscaled_data.pic = unscaled_pic; } else { - res->lock_sequence_nr = state->options->buffer_pics_nr; /* Update lock counter */ + res->lock_sequence_nr = state->options->buffer_pics_nr; // Update lock counter } must_post_process_pic = res->scaled_data.pic->visual_map->data == NULL; - /* If the pic was only just drawn, we'll have to antialiase and endianness-adjust it now */ + // If the pic was only just drawn, we'll have to antialiase and endianness-adjust it now - npic = gfxr_pic_xlate_common(res, maps, - scaled || state->options->pic0_unscaled, - 0, state->driver->mode, - state->options->pic_xlate_filter, 0, - state->options); + npic = gfxr_pic_xlate_common(res, maps, scaled || state->options->pic0_unscaled, 0, state->driver->mode, + state->options->pic_xlate_filter, 0, state->options); if (must_post_process_pic) { - if (scaled || state->options->pic0_unscaled && maps & GFX_MASK_VISUAL) - gfxr_antialiase(npic->visual_map, state->driver->mode, - state->options->pic0_antialiasing); + gfxr_antialiase(npic->visual_map, state->driver->mode, state->options->pic0_antialiasing); gfxr_endianness_adjust(npic->visual_map, state->driver->mode); } @@ -381,9 +341,7 @@ gfxr_get_pic(gfx_resstate_t *state, int nr, int maps, int flags, int default_pal return npic; } - -static void -set_pic_id(gfx_resource_t *res, int id) { +static void set_pic_id(gfx_resource_t *res, int id) { if (res->scaled_data.pic) { gfxr_pic_t *pic = res->scaled_data.pic; pic->control_map->ID = id; @@ -399,37 +357,30 @@ set_pic_id(gfx_resource_t *res, int id) { } } -static int -get_pic_id(gfx_resource_t *res) { +static int get_pic_id(gfx_resource_t *res) { if (res->scaled_data.pic) return res->scaled_data.pic->visual_map->ID; else return res->unscaled_data.pic->visual_map->ID; } -static void -_gfxr_unscale_pixmap_index_data(gfx_pixmap_t *pxm, gfx_mode_t *mode) { - int xmod = mode->xfact; /* Step size horizontally */ - int ymod = pxm->index_xl * mode->yfact; /* Vertical step size */ +static void _gfxr_unscale_pixmap_index_data(gfx_pixmap_t *pxm, gfx_mode_t *mode) { + int xmod = mode->xfact; // Step size horizontally + int ymod = pxm->index_xl * mode->yfact; // Vertical step size int maxpos = pxm->index_xl * pxm->index_yl; int pos; byte *dest = pxm->index_data; if (!(pxm->flags & GFX_PIXMAP_FLAG_SCALED_INDEX)) - return; /* It's not scaled! */ + return; // It's not scaled! for (pos = 0; pos < maxpos; pos += ymod) { int c; for (c = 0; c < pxm->index_xl; c += xmod) - * dest++ = pxm->index_data[pos + c]; /* No overwrite since - ** line and offset - ** readers move much - ** faster - ** (proof by in- - ** duction, trivial - ** and left to the - ** reader) */ + *dest++ = pxm->index_data[pos + c]; + // No overwrite since line and offset readers move much faster (proof by in-duction, trivial + // and left to the reader) } pxm->index_xl /= mode->xfact; @@ -437,33 +388,26 @@ _gfxr_unscale_pixmap_index_data(gfx_pixmap_t *pxm, gfx_mode_t *mode) { pxm->flags &= ~GFX_PIXMAP_FLAG_SCALED_INDEX; } - -gfxr_pic_t * -gfxr_add_to_pic(gfx_resstate_t *state, int old_nr, int new_nr, int maps, int flags, - int old_default_palette, int default_palette, int scaled) { +gfxr_pic_t *gfxr_add_to_pic(gfx_resstate_t *state, int old_nr, int new_nr, int maps, int flags, + int old_default_palette, int default_palette, int scaled) { gfx_resource_type_t restype = GFX_RESOURCE_TYPE_PIC; sbtree_t *tree = state->resource_trees[restype]; gfxr_pic_t *pic = NULL; gfx_resource_t *res = NULL; - int hash = gfxr_interpreter_options_hash(restype, state->version, - state->options, - state->misc_payload, 0); - int need_unscaled = !(state->options->pic0_unscaled) - && (state->driver->mode->xfact != 1 || state->driver->mode->yfact != 1); + int hash = gfxr_interpreter_options_hash(restype, state->version, state->options, state->misc_payload, 0); + int need_unscaled = !(state->options->pic0_unscaled) && (state->driver->mode->xfact != 1 || state->driver->mode->yfact != 1); if (!tree) { GFXERROR("No pics registered\n"); return NULL; } - res = (gfx_resource_t *) sbtree_get(tree, old_nr); + res = (gfx_resource_t *)sbtree_get(tree, old_nr); - if (!res || - (res->mode != MODE_INVALID - && res->mode != hash)) { + if (!res || (res->mode != MODE_INVALID && res->mode != hash)) { gfxr_get_pic(state, old_nr, 0, flags, old_default_palette, scaled); - res = (gfx_resource_t *) sbtree_get(tree, old_nr); + res = (gfx_resource_t *)sbtree_get(tree, old_nr); if (!res) { GFXWARN("Attempt to add pic %d to non-existing pic %d\n", new_nr, old_nr); @@ -471,46 +415,39 @@ gfxr_add_to_pic(gfx_resstate_t *state, int old_nr, int new_nr, int maps, int fla } } - if (state->options->pic0_unscaled) /* Unscale priority map, if we scaled it earlier */ + if (state->options->pic0_unscaled) // Unscale priority map, if we scaled it earlier _gfxr_unscale_pixmap_index_data(res->scaled_data.pic->priority_map, state->driver->mode); if (scaled) { res->lock_sequence_nr = state->options->buffer_pics_nr; gfxr_interpreter_calculate_pic(state, res->scaled_data.pic, need_unscaled ? res->unscaled_data.pic : NULL, - flags | DRAWPIC01_FLAG_OVERLAID_PIC, - default_palette, new_nr, state->misc_payload); + flags | DRAWPIC01_FLAG_OVERLAID_PIC, default_palette, new_nr, state->misc_payload); } - res->mode = MODE_INVALID; /* Invalidate */ + res->mode = MODE_INVALID; // Invalidate - if (state->options->pic0_unscaled) /* Scale priority map again, if needed */ + if (state->options->pic0_unscaled) // Scale priority map again, if needed res->scaled_data.pic->priority_map = gfx_pixmap_scale_index_data(res->scaled_data.pic->priority_map, state->driver->mode); { int old_ID = get_pic_id(res); - set_pic_id(res, GFXR_RES_ID(restype, new_nr)); /* To ensure that our graphical translation optoins work properly */ - pic = gfxr_pic_xlate_common(res, maps, scaled, 1, state->driver->mode, - state->options->pic_xlate_filter, 1, - state->options); + set_pic_id(res, GFXR_RES_ID(restype, new_nr)); // To ensure that our graphical translation optoins work properly + pic = gfxr_pic_xlate_common(res, maps, scaled, 1, state->driver->mode, state->options->pic_xlate_filter, 1, state->options); set_pic_id(res, old_ID); } if (scaled || state->options->pic0_unscaled && maps & GFX_MASK_VISUAL) - gfxr_antialiase(pic->visual_map, state->driver->mode, - state->options->pic0_antialiasing); + gfxr_antialiase(pic->visual_map, state->driver->mode, state->options->pic0_antialiasing); return pic; } -gfxr_view_t * -gfxr_get_view(gfx_resstate_t *state, int nr, int *loop, int *cel, int palette) { +gfxr_view_t *gfxr_get_view(gfx_resstate_t *state, int nr, int *loop, int *cel, int palette) { gfx_resource_type_t restype = GFX_RESOURCE_TYPE_VIEW; sbtree_t *tree = state->resource_trees[restype]; gfx_resource_t *res = NULL; - int hash = gfxr_interpreter_options_hash(restype, state->version, - state->options, state->misc_payload, - palette); + int hash = gfxr_interpreter_options_hash(restype, state->version, state->options, state->misc_payload, palette); gfxr_view_t *view = NULL; gfxr_loop_t *loop_data = NULL; gfx_pixmap_t *cel_data = NULL; @@ -527,12 +464,12 @@ gfxr_get_view(gfx_resstate_t *state, int nr, int *loop, int *cel, int palette) { return NULL; if (!res) { - res = (gfx_resource_t*)sci_malloc(sizeof(gfx_resource_t)); + res = (gfx_resource_t *)sci_malloc(sizeof(gfx_resource_t)); res->scaled_data.view = NULL; res->ID = GFXR_RES_ID(restype, nr); res->lock_sequence_nr = state->tag_lock_counter; res->mode = hash; - sbtree_set(tree, nr, (void *) res); + sbtree_set(tree, nr, (void *)res); } else { gfxr_free_view(state->driver, res->unscaled_data.view); } @@ -541,7 +478,7 @@ gfxr_get_view(gfx_resstate_t *state, int nr, int *loop, int *cel, int palette) { res->unscaled_data.view = view; } else { - res->lock_sequence_nr = state->tag_lock_counter; /* Update lock counter */ + res->lock_sequence_nr = state->tag_lock_counter; // Update lock counter view = res->unscaled_data.view; } @@ -592,8 +529,7 @@ gfxr_get_view(gfx_resstate_t *state, int nr, int *loop, int *cel, int palette) { extern gfx_bitmap_font_t gfxfont_5x8; extern gfx_bitmap_font_t gfxfont_6x10; -gfx_bitmap_font_t * -gfxr_get_font(gfx_resstate_t *state, int nr, int scaled) { +gfx_bitmap_font_t *gfxr_get_font(gfx_resstate_t *state, int nr, int scaled) { gfx_resource_type_t restype = GFX_RESOURCE_TYPE_FONT; sbtree_t *tree = NULL; gfx_resource_t *res = NULL; @@ -606,28 +542,26 @@ gfxr_get_font(gfx_resstate_t *state, int nr, int scaled) { tree = state->resource_trees[restype]; - hash = gfxr_interpreter_options_hash(restype, state->version, - state->options, state->misc_payload, 0); + hash = gfxr_interpreter_options_hash(restype, state->version, state->options, state->misc_payload, 0); if (!tree) return NULL; - res = (gfx_resource_t *) sbtree_get(tree, nr); + res = (gfx_resource_t *)sbtree_get(tree, nr); if (!res || res->mode != hash) { - gfx_bitmap_font_t *font = gfxr_interpreter_get_font(state, nr, - state->misc_payload); + gfx_bitmap_font_t *font = gfxr_interpreter_get_font(state, nr, state->misc_payload); if (!font) return NULL; if (!res) { - res = (gfx_resource_t*)sci_malloc(sizeof(gfx_resource_t)); + res = (gfx_resource_t *)sci_malloc(sizeof(gfx_resource_t)); res->scaled_data.font = NULL; res->ID = GFXR_RES_ID(restype, nr); res->lock_sequence_nr = state->tag_lock_counter; res->mode = hash; - sbtree_set(tree, nr, (void *) res); + sbtree_set(tree, nr, (void *)res); } else { gfxr_free_font(res->unscaled_data.font); } @@ -636,7 +570,7 @@ gfxr_get_font(gfx_resstate_t *state, int nr, int scaled) { return font; } else { - res->lock_sequence_nr = state->tag_lock_counter; /* Update lock counter */ + res->lock_sequence_nr = state->tag_lock_counter; // Update lock counter if (res->unscaled_data.pointer) return res->unscaled_data.font; else @@ -644,34 +578,30 @@ gfxr_get_font(gfx_resstate_t *state, int nr, int scaled) { } } - -gfx_pixmap_t * -gfxr_get_cursor(gfx_resstate_t *state, int nr) { +gfx_pixmap_t *gfxr_get_cursor(gfx_resstate_t *state, int nr) { gfx_resource_type_t restype = GFX_RESOURCE_TYPE_CURSOR; sbtree_t *tree = state->resource_trees[restype]; gfx_resource_t *res = NULL; - int hash = gfxr_interpreter_options_hash(restype, state->version, - state->options, state->misc_payload, 0); + int hash = gfxr_interpreter_options_hash(restype, state->version, state->options, state->misc_payload, 0); if (!tree) return NULL; - res = (gfx_resource_t *) sbtree_get(tree, nr); + res = (gfx_resource_t *)sbtree_get(tree, nr); if (!res || res->mode != hash) { - gfx_pixmap_t *cursor = gfxr_interpreter_get_cursor(state, nr, - state->misc_payload); + gfx_pixmap_t *cursor = gfxr_interpreter_get_cursor(state, nr, state->misc_payload); if (!cursor) return NULL; if (!res) { - res = (gfx_resource_t*)sci_malloc(sizeof(gfx_resource_t)); + res = (gfx_resource_t *)sci_malloc(sizeof(gfx_resource_t)); res->scaled_data.pointer = NULL; res->ID = GFXR_RES_ID(restype, nr); res->lock_sequence_nr = state->tag_lock_counter; res->mode = hash; - sbtree_set(tree, nr, (void *) res); + sbtree_set(tree, nr, (void *)res); } else { gfx_free_pixmap(state->driver, res->unscaled_data.pointer); } @@ -683,7 +613,7 @@ gfxr_get_cursor(gfx_resstate_t *state, int nr) { return cursor; } else { - res->lock_sequence_nr = state->tag_lock_counter; /* Update lock counter */ + res->lock_sequence_nr = state->tag_lock_counter; // Update lock counter return res->unscaled_data.pointer; } } |