Dillo v3.1.1-119-g140d9ebd
Loading...
Searching...
No Matches
dicache.h File Reference
#include "bitvec.h"
#include "image.hh"
#include "cache.h"
Include dependency graph for dicache.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  DICacheEntry
 

Macros

#define DIC_Last   -1
 Symbolic name to request the last version of an image.
 
#define DIF_Last   1
 Flags: Last version, Valid entry.
 
#define DIF_Valid   2
 

Typedefs

typedef struct DICacheEntry DICacheEntry
 

Enumerations

enum  DicEntryState {
  DIC_Empty , DIC_SetParms , DIC_SetCmap , DIC_Write ,
  DIC_Close , DIC_Abort
}
 

Functions

void a_Dicache_init (void)
 Initialize dicache data.
 
DICacheEntrya_Dicache_get_entry (const DilloUrl *Url, int version)
 Search a particular version of a URL in the Dicache.
 
void * a_Dicache_png_image (const char *Type, void *Ptr, CA_Callback_t *Call, void **Data)
 PNG wrapper for Dicache_image()
 
void * a_Dicache_gif_image (const char *Type, void *Ptr, CA_Callback_t *Call, void **Data)
 GIF wrapper for Dicache_image()
 
void * a_Dicache_jpeg_image (const char *Type, void *Ptr, CA_Callback_t *Call, void **Data)
 JPEG wrapper for Dicache_image()
 
void a_Dicache_callback (int Op, CacheClient_t *Client)
 This function is a cache client; (but feeds its clients from dicache)
 
void a_Dicache_set_parms (DilloUrl *url, int version, DilloImage *Image, uint_t width, uint_t height, DilloImgType type, double gamma)
 Set image's width, height & type.
 
void a_Dicache_set_cmap (DilloUrl *url, int version, int bg_color, const uchar_t *cmap, uint_t num_colors, int num_colors_max, int bg_index)
 Implement the set_cmap method for the Image.
 
void a_Dicache_new_scan (const DilloUrl *url, int version)
 Reset for a new scan from a multiple-scan image.
 
void a_Dicache_write (DilloUrl *url, int version, const uchar_t *buf, uint_t Y)
 Implement the write method (Write a scan line into the Dicache entry) buf: row buffer Y : row number.
 
void a_Dicache_close (DilloUrl *url, int version, CacheClient_t *Client)
 Implement the close method of the decoding process.
 
void a_Dicache_invalidate_entry (const DilloUrl *Url)
 Invalidate this entry.
 
DICacheEntrya_Dicache_ref (const DilloUrl *Url, int version)
 Refs the counter of a dicache entry.
 
void a_Dicache_unref (const DilloUrl *Url, int version)
 Unrefs the counter of a dicache entry (it counts cache clients).
 
void a_Dicache_cleanup (void)
 Free the imgbuf (RGB data) of unused entries.
 
void a_Dicache_freeall (void)
 Deallocate memory used by dicache module (Call this one at exit time, with no cache clients queued)
 

Macro Definition Documentation

◆ DIC_Last

#define DIC_Last   -1

Symbolic name to request the last version of an image.

Definition at line 14 of file dicache.h.

◆ DIF_Last

#define DIF_Last   1

Flags: Last version, Valid entry.

Definition at line 16 of file dicache.h.

◆ DIF_Valid

#define DIF_Valid   2

Definition at line 17 of file dicache.h.

Typedef Documentation

◆ DICacheEntry

typedef struct DICacheEntry DICacheEntry

Enumeration Type Documentation

◆ DicEntryState

Enumerator
DIC_Empty 

Just created the entry.

DIC_SetParms 

Parameters set.

DIC_SetCmap 

Color map set.

DIC_Write 

Feeding the entry.

DIC_Close 

Whole image got!

DIC_Abort 

Image transfer aborted.

Definition at line 21 of file dicache.h.

Function Documentation

◆ a_Dicache_callback()

◆ a_Dicache_cleanup()

void a_Dicache_cleanup ( void  )

◆ a_Dicache_close()

◆ a_Dicache_freeall()

void a_Dicache_freeall ( void  )

Deallocate memory used by dicache module (Call this one at exit time, with no cache clients queued)

Definition at line 586 of file dicache.c.

References a_Bitvec_free(), a_Imgbuf_unref(), a_Url_free(), DICacheEntry::BitVec, CachedIMGs, DICacheEntry::cmap, dFree(), dicache_size_total, dList_free(), dList_length(), dList_nth_data(), dList_remove_fast(), DICacheEntry::TotalSize, DICacheEntry::url, and DICacheEntry::v_imgbuf.

Referenced by main().

◆ a_Dicache_get_entry()

DICacheEntry * a_Dicache_get_entry ( const DilloUrl Url,
int  version 
)

Search a particular version of a URL in the Dicache.

Returns
a pointer to the entry if found; NULL otherwise.

Notes: DIC_Last means last version of the image. version zero is not allowed.

Definition at line 150 of file dicache.c.

References CachedIMGs, DIC_Last, Dicache_entry_cmp(), DIF_Valid, dList_find_sorted(), dReturn_val_if_fail, DICacheEntry::Flags, DICacheEntry::url, and DICacheEntry::version.

Referenced by a_Cache_stop_client(), a_Dicache_callback(), a_Dicache_close(), a_Dicache_invalidate_entry(), a_Dicache_new_scan(), a_Dicache_ref(), a_Dicache_set_cmap(), a_Dicache_set_parms(), a_Dicache_unref(), a_Dicache_write(), and Dicache_image().

◆ a_Dicache_gif_image()

void * a_Dicache_gif_image ( const char *  Type,
void *  Ptr,
CA_Callback_t Call,
void **  Data 
)

GIF wrapper for Dicache_image()

Definition at line 465 of file dicache.c.

◆ a_Dicache_init()

void a_Dicache_init ( void  )

Initialize dicache data.

Definition at line 76 of file dicache.c.

References _MSG, CachedIMGs, DIC_MAX, dicache_size_total, disabled_formats, dList_new(), dStriAsciiStr(), format_name, DilloPrefs::ignore_image_formats, and prefs.

Referenced by main().

◆ a_Dicache_invalidate_entry()

void a_Dicache_invalidate_entry ( const DilloUrl Url)

Invalidate this entry.

This is used for the reloading mechanism. Can't erase current versions, but a_Dicache_get_entry(url, DIC_Last) must return NULL.

Definition at line 232 of file dicache.c.

References a_Dicache_get_entry(), DIC_Last, and DICacheEntry::Flags.

Referenced by Cache_entry_remove().

◆ a_Dicache_jpeg_image()

void * a_Dicache_jpeg_image ( const char *  Type,
void *  Ptr,
CA_Callback_t Call,
void **  Data 
)

JPEG wrapper for Dicache_image()

Definition at line 474 of file dicache.c.

◆ a_Dicache_new_scan()

void a_Dicache_new_scan ( const DilloUrl url,
int  version 
)

◆ a_Dicache_png_image()

void * a_Dicache_png_image ( const char *  Type,
void *  Ptr,
CA_Callback_t Call,
void **  Data 
)

PNG wrapper for Dicache_image()

Definition at line 447 of file dicache.c.

◆ a_Dicache_ref()

DICacheEntry * a_Dicache_ref ( const DilloUrl Url,
int  version 
)

Refs the counter of a dicache entry.

Definition at line 217 of file dicache.c.

References a_Dicache_get_entry(), and DICacheEntry::RefCount.

Referenced by Dicache_image().

◆ a_Dicache_set_cmap()

void a_Dicache_set_cmap ( DilloUrl url,
int  version,
int  bg_color,
const uchar_t cmap,
uint_t  num_colors,
int  num_colors_max,
int  bg_index 
)

Implement the set_cmap method for the Image.

Definition at line 282 of file dicache.c.

References _MSG, a_Dicache_get_entry(), DICacheEntry::cmap, dFree(), DIC_SetCmap, dNew0, dReturn_if_fail, and DICacheEntry::State.

◆ a_Dicache_set_parms()

void a_Dicache_set_parms ( DilloUrl url,
int  version,
DilloImage Image,
uint_t  width,
uint_t  height,
DilloImgType  type,
double  gamma 
)

Set image's width, height & type.

  • 'width' and 'height' come from the image data.
  • HTML width and height attrs are handled with setNonCssHint.
  • CSS sizing is handled by the CSS engine.

Definition at line 248 of file dicache.c.

References _MSG, a_Bitvec_new(), a_Dicache_get_entry(), a_Imgbuf_new(), DICacheEntry::BitVec, DIC_SetParms, dicache_size_total, dReturn_if_fail, DICacheEntry::height, I_RGB, _DilloImage::layout, DICacheEntry::RefCount, DICacheEntry::State, DICacheEntry::TotalSize, DICacheEntry::type, URL_STR, DICacheEntry::v_imgbuf, DICacheEntry::version, and DICacheEntry::width.

Referenced by Png_datainfo_callback().

◆ a_Dicache_unref()

void a_Dicache_unref ( const DilloUrl Url,
int  version 
)

Unrefs the counter of a dicache entry (it counts cache clients).

If there're no clients and no imgbuf, remove the entry. Otherwise, let a_Dicache_cleanup() do the job later (keeping it cached meanwhile for e.g. reload, repush, back/fwd).

Definition at line 200 of file dicache.c.

References _MSG, a_Dicache_get_entry(), a_Imgbuf_last_reference(), Dicache_remove(), DICacheEntry::RefCount, DICacheEntry::State, and DICacheEntry::v_imgbuf.

Referenced by a_Cache_stop_client(), and a_Dicache_close().

◆ a_Dicache_write()

void a_Dicache_write ( DilloUrl url,
int  version,
const uchar_t buf,
uint_t  Y 
)

Implement the write method (Write a scan line into the Dicache entry) buf: row buffer Y : row number.

Definition at line 329 of file dicache.c.

References _MSG, a_Bitvec_set_bit(), a_Dicache_get_entry(), a_Imgbuf_update(), DICacheEntry::BitVec, DICacheEntry::cmap, DIC_Write, dReturn_if_fail, DICacheEntry::height, DICacheEntry::State, DICacheEntry::type, DICacheEntry::v_imgbuf, and DICacheEntry::width.

Referenced by Png_datarow_callback().