~ubuntu-branches/ubuntu/dapper/vice/dapper

« back to all changes in this revision

Viewing changes to src/raster/raster-cache.c

  • Committer: Bazaar Package Importer
  • Author(s): Zed Pobre
  • Date: 2004-08-26 13:35:51 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040826133551-gcje8j31q5cqgdq2
Tags: 1.14-3
Apply patch from Spiro Trikaliotis <vice@trikaliotis.net> to fix a
problem that some users were experiencing with a floating point
exception on startup related to the fullscreen option being enabled
during compile.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 *
5
5
 * Written by
6
6
 *  Ettore Perazzoli <ettore@comm2000.it>
7
 
 *  Andreas Boose <boose@linux.rz.fh-hannover.de>
 
7
 *  Andreas Boose <viceteam@t-online.de>
8
8
 *
9
9
 * This file is part of VICE, the Versatile Commodore Emulator.
10
10
 * See README for copyright notice.
29
29
 
30
30
#include <string.h>
31
31
 
 
32
#include "lib.h"
32
33
#include "raster-cache.h"
33
 
#include "utils.h"
34
 
 
35
 
void raster_cache_init(raster_cache_t *cache)
 
34
#include "raster-sprite-status.h"
 
35
 
 
36
 
 
37
void raster_cache_new(raster_cache_t *cache, raster_sprite_status_t *status)
36
38
{
37
39
    unsigned int i;
38
40
 
39
 
    for (i = 0; i < RASTER_CACHE_MAX_SPRITES; i++)
40
 
        raster_sprite_cache_init(&(cache->sprites[i]));
41
 
 
42
 
    memset(cache->background_data, 0, RASTER_CACHE_MAX_TEXTCOLS);
43
 
    memset(cache->foreground_data, 0, RASTER_CACHE_MAX_TEXTCOLS);
44
 
    memset(cache->color_data_1, 0, RASTER_CACHE_MAX_TEXTCOLS);
45
 
    memset(cache->color_data_2, 0, RASTER_CACHE_MAX_TEXTCOLS);
46
 
    memset(cache->color_data_3, 0, RASTER_CACHE_MAX_TEXTCOLS);
 
41
    memset(cache, 0, sizeof(raster_cache_t));
 
42
 
 
43
    if (status != NULL) {
 
44
        for (i = 0; i < RASTER_CACHE_MAX_SPRITES; i++)
 
45
            (status->cache_init_func)(&(cache->sprites[i]));
 
46
 
 
47
        cache->gfx_msk = lib_calloc(1, RASTER_CACHE_GFX_MSK_SIZE);
 
48
    }
47
49
 
48
50
    cache->is_dirty = 1;
49
51
}
50
52
 
51
 
raster_cache_t *raster_cache_new(void) 
52
 
{
53
 
    raster_cache_t *new_cache;
54
 
 
55
 
    new_cache = (raster_cache_t *)xmalloc(sizeof(raster_cache_t));
56
 
    raster_cache_init(new_cache);
57
 
 
58
 
    return new_cache;
 
53
void raster_cache_destroy(raster_cache_t *cache, raster_sprite_status_t *status)
 
54
{
 
55
    if (status != NULL) {
 
56
        lib_free(cache->gfx_msk);
 
57
    }
 
58
}
 
59
 
 
60
void raster_cache_realloc(raster_cache_t **cache, unsigned int screen_height)
 
61
{
 
62
    *cache = lib_realloc(*cache, sizeof(raster_cache_t) * screen_height);
59
63
}
60
64