1997-11-25 06:05:25 +08:00
|
|
|
#ifndef __TILE_H__
|
|
|
|
#define __TILE_H__
|
|
|
|
|
|
|
|
|
|
|
|
#define TILE_WIDTH 64
|
|
|
|
#define TILE_HEIGHT 64
|
1998-07-03 07:29:44 +08:00
|
|
|
|
|
|
|
/* Uncomment for verbose debugging on copy-on-write logic
|
1997-11-25 06:05:25 +08:00
|
|
|
#define TILE_DEBUG
|
1998-07-03 07:29:44 +08:00
|
|
|
*/
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <glib.h>
|
1998-06-21 02:34:38 +08:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
1997-11-25 06:05:25 +08:00
|
|
|
typedef struct _Tile Tile;
|
|
|
|
|
|
|
|
|
|
|
|
/* Initializes the fields of a tile to "good" values.
|
|
|
|
*/
|
|
|
|
void tile_init (Tile *tile,
|
|
|
|
int bpp);
|
|
|
|
|
|
|
|
|
1998-07-10 10:43:12 +08:00
|
|
|
/*
|
|
|
|
* tile_lock locks a tile into memory. This does what tile_ref used
|
|
|
|
* to do. It is the responsibility of the tile manager to take care
|
|
|
|
* of the copy-on-write semantics. Locks stack; a tile remains locked
|
|
|
|
* in memory as long as it's been locked more times than it has been
|
|
|
|
* released. tile_release needs to know whether the release was for
|
|
|
|
* write access. (This is a hack, and should be handled better.)
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
|
|
|
|
1998-07-10 10:43:12 +08:00
|
|
|
void tile_lock (Tile *);
|
|
|
|
void tile_release (Tile *, int);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
/* Allocate the data for the tile.
|
|
|
|
*/
|
|
|
|
void tile_alloc (Tile *tile);
|
|
|
|
|
|
|
|
/* Return the size in bytes of the tiles data.
|
|
|
|
*/
|
|
|
|
int tile_size (Tile *tile);
|
|
|
|
|
1998-08-12 01:35:34 +08:00
|
|
|
int tile_ewidth (Tile *tile);
|
|
|
|
int tile_eheight (Tile *tile);
|
|
|
|
int tile_bpp (Tile *tile);
|
|
|
|
|
|
|
|
int tile_is_valid (Tile *tile);
|
|
|
|
|
|
|
|
void tile_mark_valid (Tile *tile);
|
|
|
|
|
|
|
|
void *tile_data_pointer (Tile *tile, int xoff, int yoff);
|
|
|
|
|
1998-07-10 10:43:12 +08:00
|
|
|
/* tile_attach attaches a tile to a tile manager: this function
|
|
|
|
* increments the tile's share count and inserts a tilelink into the
|
|
|
|
* tile's link list. tile_detach reverses the process.
|
|
|
|
* If a tile's share count is zero after a tile_detach, the tile is
|
|
|
|
* discarded.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
1998-07-10 10:43:12 +08:00
|
|
|
|
|
|
|
void tile_attach (Tile *tile, void *tm, int tile_num);
|
|
|
|
void tile_detach (Tile *tile, void *tm, int tile_num);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
#endif /* __TILE_H__ */
|