Crossfire Client, Branches  R11627
image.c File Reference
#include <config.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#include <ctype.h>
#include "client.h"
#include "external.h"
+ Include dependency graph for image.c:

Go to the source code of this file.

Data Structures

struct  FD_Cache
 
struct  Image_Cache
 

Macros

#define IMAGE_HASH   8192
 
#define ROTATE_RIGHT(c)   if ((c) & 01) (c) = ((c) >>1) + 0x80000000; else (c) >>= 1;
 

Functions

void display_newpng (int face, uint8 *buf, int buflen, int setnum)
 
void Face2Cmd (uint8 *data, int len)
 
void finish_face_cmd (int pnum, uint32 checksum, int has_sum, char *face, int faceset)
 
void get_image_info (uint8 *data, int len)
 
void get_image_sums (char *data, int len)
 
void Image2Cmd (uint8 *data, int len)
 
static Cache_Entryimage_add_hash (char *imagename, char *filename, uint32 checksum, uint32 ispublic)
 
static Cache_Entryimage_find_cache_entry (char *imagename, uint32 checksum, int has_sum)
 
static sint32 image_find_hash (char *str)
 
static uint32 image_hash_name (char *str, int tablesize)
 
static void image_process_line (char *line, uint32 ispublic)
 
static void image_remove_hash (char *imagename, Cache_Entry *ce)
 
void init_common_cache_data (void)
 
static int load_image (char *filename, uint8 *data, int *len, uint32 *csum)
 
void requestface (int pnum, char *facename)
 
void reset_image_cache_data (void)
 

Variables

Face_Information face_info
 
char facecachedir [MAX_BUF]
 
static char * facetoname [MAXPIXMAPNUM]
 
struct FD_Cache fd_cache [MAX_FACE_SETS]
 
struct Image_Cache image_cache [IMAGE_HASH]
 
const char *const rcsid_common_image_c
 

Macro Definition Documentation

#define IMAGE_HASH   8192

Definition at line 165 of file image.c.

Referenced by image_add_hash(), image_find_hash(), and init_common_cache_data().

#define ROTATE_RIGHT (   c)    if ((c) & 01) (c) = ((c) >>1) + 0x80000000; else (c) >>= 1;

Definition at line 46 of file image.c.

Referenced by display_newpng(), and load_image().

Function Documentation

void display_newpng ( int  face,
uint8 buf,
int  buflen,
int  setnum 
)

Definition at line 535 of file image.c.

References CONFIG_CACHE, create_and_rescale_image_from_data(), Face_Information_struct::facesets, height, image_add_hash(), LOG(), LOG_WARNING, MAX_BUF, MAX_FACE_SETS, png_to_data(), FaceSets_struct::prefix, ROTATE_RIGHT, use_config, and width.

Referenced by Image2Cmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Face2Cmd ( uint8 data,
int  len 
)

Definition at line 491 of file image.c.

References checksum, CONFIG_CACHE, finish_face_cmd(), GetInt_String(), GetShort_String(), LOG(), LOG_WARNING, and use_config.

+ Here is the call graph for this function:

void finish_face_cmd ( int  pnum,
uint32  checksum,
int  has_sum,
char *  face,
int  faceset 
)

Definition at line 400 of file image.c.

References associate_cache_entry(), create_and_rescale_image_from_data(), Cache_Entry::filename, Cache_Entry::image_data, image_find_cache_entry(), image_remove_hash(), Cache_Entry::ispublic, load_image(), LOG(), LOG_WARNING, png_to_data(), and requestface().

Referenced by Face2Cmd(), and get_image_sums().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void get_image_sums ( char *  data,
int  len 
)

Definition at line 737 of file image.c.

References checksum, finish_face_cmd(), GetInt_String(), GetShort_String(), LOG(), LOG_WARNING, and replyinfo_last_face.

Referenced by ReplyInfoCmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Image2Cmd ( uint8 data,
int  len 
)

Definition at line 514 of file image.c.

References display_newpng(), GetInt_String(), LOG(), and LOG_WARNING.

+ Here is the call graph for this function:

static Cache_Entry* image_add_hash ( char *  imagename,
char *  filename,
uint32  checksum,
uint32  ispublic 
)
static

Definition at line 278 of file image.c.

References Image_Cache::cache_entry, checksum, Cache_Entry::checksum, Cache_Entry::filename, image_cache, Cache_Entry::image_data, IMAGE_HASH, image_hash_name(), Image_Cache::image_name, Cache_Entry::ispublic, LOG(), LOG_WARNING, and Cache_Entry::next.

Referenced by display_newpng(), and image_process_line().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static Cache_Entry* image_find_cache_entry ( char *  imagename,
uint32  checksum,
int  has_sum 
)
static

Definition at line 260 of file image.c.

References Image_Cache::cache_entry, Cache_Entry::checksum, image_cache, image_find_hash(), and Cache_Entry::next.

Referenced by finish_face_cmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static sint32 image_find_hash ( char *  str)
static

Definition at line 206 of file image.c.

References image_cache, IMAGE_HASH, image_hash_name(), LOG(), and LOG_WARNING.

Referenced by image_find_cache_entry(), and image_remove_hash().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static uint32 image_hash_name ( char *  str,
int  tablesize 
)
static

Definition at line 187 of file image.c.

Referenced by image_add_hash(), and image_find_hash().

+ Here is the caller graph for this function:

static void image_process_line ( char *  line,
uint32  ispublic 
)
static

Definition at line 318 of file image.c.

References checksum, image_add_hash(), LOG(), LOG_WARNING, and MAX_BUF.

Referenced by init_common_cache_data().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void image_remove_hash ( char *  imagename,
Cache_Entry ce 
)
static

Definition at line 226 of file image.c.

References Image_Cache::cache_entry, Cache_Entry::filename, image_cache, image_find_hash(), LOG(), LOG_ERROR, and Cache_Entry::next.

Referenced by finish_face_cmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void init_common_cache_data ( void  )

Definition at line 332 of file image.c.

References CONFIG_CACHE, draw_info(), FD_Cache::fd, fd_cache, image_cache, IMAGE_HASH, image_process_line(), MAX_BUF, MAX_FACE_SETS, MAXPIXMAPNUM, FD_Cache::name, NDI_RED, and want_config.

Referenced by init_cache_data().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static int load_image ( char *  filename,
uint8 data,
int *  len,
uint32 csum 
)
static

Definition at line 65 of file image.c.

References Face_Information_struct::cache_hits, face_info, fd_cache, LOG(), LOG_ERROR, LOG_WARNING, MAX_FACE_SETS, name, and ROTATE_RIGHT.

Referenced by finish_face_cmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void requestface ( int  pnum,
char *  facename 
)

Definition at line 381 of file image.c.

References Face_Information_struct::cache_misses, cs_print_string(), csocket, ClientSocket::fd, and strdup_local().

Referenced by finish_face_cmd().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void reset_image_cache_data ( void  )

Definition at line 474 of file image.c.

References CONFIG_CACHE, MAXPIXMAPNUM, and want_config.

Referenced by reset_image_data().

+ Here is the caller graph for this function:

Variable Documentation

char facecachedir[MAX_BUF]

Definition at line 379 of file image.c.

char* facetoname[MAXPIXMAPNUM]
static

Definition at line 172 of file image.c.

struct FD_Cache fd_cache[MAX_FACE_SETS]
const char* const rcsid_common_image_c
Initial value:
=
"$Id: image.c 9201 2008-06-01 17:32:45Z anmaster $"

Definition at line 1 of file image.c.