home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2002 April / pcpro0402.iso / essentials / graphics / Gimp / gimp-src-20001226.exe / src / gimp / app / tile_pvt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-12-13  |  2.6 KB  |  83 lines

  1. #ifndef __TILE_PVT_H__
  2. #define __TILE_PVT_H__
  3.  
  4. #ifdef USE_PTHREADS
  5. #include <pthread.h>
  6. #endif
  7.  
  8.  
  9. #include <sys/types.h>
  10. #include <glib.h>
  11.  
  12. #include "config.h"
  13. #include "tile.h"
  14.  
  15. typedef struct _TileLink TileLink;
  16.  
  17. struct _TileLink
  18. {
  19.   TileLink *next;
  20.   int tile_num;       /* the number of this tile within the drawable */
  21.   void *tm;           /* A pointer to the tile manager for this tile.
  22.                *  We need this in order to call the tile managers 
  23.                *  validate proc whenever the tile is referenced yet 
  24.                *  invalid.
  25.                */
  26. };
  27.  
  28. struct _Tile
  29. {
  30.   short ref_count;    /* reference count. when the reference count is
  31.                 *  non-zero then the "data" for this tile must
  32.                *  be valid. when the reference count for a tile
  33.                *  is 0 then the "data" for this tile must be
  34.                *  NULL.
  35.                */
  36.   short write_count;  /* write count: number of references that are
  37.              for write access */ 
  38.   short share_count;  /* share count: number of tile managers that
  39.              hold this tile */
  40.   guint dirty : 1;    /* is the tile dirty? has it been modified? */
  41.   guint valid : 1;    /* is the tile valid? */
  42.  
  43.   unsigned char  bpp;     /* the bytes per pixel (1, 2, 3 or 4) */
  44.   unsigned short ewidth;  /* the effective width of the tile */
  45.   unsigned short eheight; /* the effective height of the tile */
  46.                           /*  a tile's effective width and height may be smaller
  47.                *  (but not larger) than TILE_WIDTH and TILE_HEIGHT.
  48.                *  this is to handle edge tiles of a drawable.
  49.                */
  50.  
  51.   TileRowHint *rowhint;   /* An array of hints for rendering purposes */
  52.  
  53.   guchar *data;       /* the data for the tile. this may be NULL in which
  54.                *  case the tile data is on disk.
  55.                */
  56.  
  57.   int swap_num; /* the index into the file table of the file to be used
  58.          *  for swapping. swap_num 1 is always the global swap file.
  59.          */
  60.   off_t swap_offset;  /* the offset within the swap file of the tile data.
  61.                *  if the tile data is in memory this will be set to -1.
  62.                */
  63.   TileLink *tlink;
  64.  
  65.   Tile *next;
  66.   Tile *prev;          /* List pointers for the tile cache lists */
  67.   void *listhead;     /* Pointer to the head of the list this tile is on */
  68. #ifdef USE_PTHREADS
  69.   pthread_mutex_t mutex;
  70. #endif
  71. };
  72.  
  73. #ifdef USE_PTHREADS
  74. #define TILE_MUTEX_LOCK(tile) pthread_mutex_lock(&((tile)->mutex))
  75. #define TILE_MUTEX_UNLOCK(tile) pthread_mutex_unlock(&((tile)->mutex))
  76. #else
  77. #define TILE_MUTEX_LOCK(tile) /* nothing */
  78. #define TILE_MUTEX_UNLOCK(tile) /* nothing */
  79. #endif
  80.  
  81.  
  82. #endif /* __TILE_PVT_H__ */
  83.