58 st = (e1->
version - e2->version);
114 last->
Flags &= ~DIF_Last;
158 _MSG(
"Dicache_remove Imgbuf=%p Decoder=%p DecoderData=%p\n",
186 _MSG(
"a_Dicache_unref: RefCount=%d State=%d ImgbufLastRef=%d\n",
217 entry->
Flags &= ~DIF_Valid;
250 DicEntry->
TotalSize = width * height * 3;
251 DicEntry->
width = width;
252 DicEntry->
height = height;
253 DicEntry->
type = type;
265 int num_colors_max,
int bg_index)
269 _MSG(
"a_Dicache_set_cmap\n");
274 memcpy(DicEntry->
cmap, cmap, 3 * num_colors);
275 if (bg_index >= 0 && (
uint_t)bg_index < num_colors) {
276 DicEntry->
cmap[bg_index * 3] = (bg_color >> 16) & 0xff;
277 DicEntry->
cmap[bg_index * 3 + 1] = (bg_color >> 8) & 0xff;
278 DicEntry->
cmap[bg_index * 3 + 2] = (bg_color) & 0xff;
291 _MSG(
"a_Dicache_new_scan\n");
296 MSG(
"a_Dicache_new_scan before DIC_SetParms\n");
314 _MSG(
"a_Dicache_write\n");
338 _MSG(
"a_Dicache_close RefCount=%d\n", DicEntry->
RefCount - 1);
340 _MSG(
" a_Dicache_close imgbuf=%p Decoder=%p DecoderData=%p\n",
346 DicEntry->
cmap = NULL;
390 }
else if (ImgType ==
DIC_Gif) {
398 }
else if (ImgType ==
DIC_Png) {
402 }
else if (ImgType ==
DIC_Svg) {
505 for (i = 0; i < DicEntry->
height; ++i)
510 for (i = 0; i < DicEntry->
height; ++i) {
void a_Bitvec_clear(bitvec_t *bvec)
Clear a bitvec.
bitvec_t * a_Bitvec_new(int num_bits)
Create a new bitvec with 'num_bits' size.
void a_Bitvec_set_bit(bitvec_t *bvec, int pos)
Set a bit.
void a_Bitvec_free(bitvec_t *bvec)
Free a bitvec.
int a_Bitvec_get_bit(bitvec_t *bvec, int pos)
Get a bit.
#define a_Bitvec_clear_bit(bvec, pos)
void a_Bw_close_client(BrowserWindow *bw, int ClientKey)
Close a cache-client upon successful retrieval.
void(* CA_Callback_t)(int Op, CacheClient_t *Client)
Callback type for cache clients.
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.
DICacheEntry * a_Dicache_get_entry(const DilloUrl *Url, int version)
Search a particular version of a URL in the Dicache.
void a_Dicache_cleanup(void)
Free the imgbuf (RGB data) of unused entries.
static Dlist * CachedIMGs
List of DICacheEntry.
static DICacheEntry * Dicache_entry_new(void)
Create, and initialize a new, empty, dicache entry.
void a_Dicache_invalidate_entry(const DilloUrl *Url)
Invalidate this entry.
DICacheEntry * a_Dicache_ref(const DilloUrl *Url, int version)
Refs the counter of a dicache entry.
void a_Dicache_new_scan(const DilloUrl *url, int version)
Reset for a new scan from a multiple-scan image.
void a_Dicache_close(DilloUrl *url, int version, CacheClient_t *Client)
Implement the close method of the decoding process.
void * a_Dicache_svg_image(const char *Type, void *Ptr, CA_Callback_t *Call, void **Data)
SVG wrapper for Dicache_image()
void a_Dicache_init(void)
Initialize dicache data.
void a_Dicache_unref(const DilloUrl *Url, int version)
Unrefs the counter of a dicache entry (it counts cache clients).
void a_Dicache_callback(int Op, CacheClient_t *Client)
This function is a cache client; (but feeds its clients from dicache)
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.
static int Dicache_entry_cmp(const void *v1, const void *v2)
Compare function for image entries.
static void * Dicache_image(int ImgType, const char *MimeType, void *Ptr, CA_Callback_t *Call, void **Data)
Generic MIME handler for GIF, JPEG, PNG and SVG.
void a_Dicache_freeall(void)
Deallocate memory used by dicache module (Call this one at exit time, with no cache clients queued)
static uint_t dicache_size_total
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.
static void Dicache_remove(const DilloUrl *Url, int version)
Actually free a dicache entry, given the URL and the version number.
void * a_Dicache_jpeg_image(const char *Type, void *Ptr, CA_Callback_t *Call, void **Data)
JPEG wrapper for Dicache_image()
static DICacheEntry * Dicache_add_entry(const DilloUrl *Url)
Add a new entry in the dicache (a single URL may have several entries)
void * a_Dicache_webp_image(const char *Type, void *Ptr, CA_Callback_t *Call, void **Data)
WEBP 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_png_image(const char *Type, void *Ptr, CA_Callback_t *Call, void **Data)
PNG wrapper for Dicache_image()
#define DIF_Last
Flags: Last version, Valid entry.
@ DIC_Close
Whole image got!
@ DIC_SetCmap
Color map set.
@ DIC_SetParms
Parameters set.
@ DIC_Write
Feeding the entry.
@ DIC_Empty
Just created the entry.
#define DIC_Last
Symbolic name to request the last version of an image.
void dList_insert_sorted(Dlist *lp, void *data, dCompareFunc func)
Insert an element into a sorted list.
Dlist * dList_new(int size)
Create a new empty list.
int dList_length(Dlist *lp)
For completing the ADT.
void * dList_nth_data(Dlist *lp, int n0)
Return the nth data item, NULL when not found or 'n0' is out of range.
void dList_remove_fast(Dlist *lp, const void *data)
Remove a data item without preserving order.
void * dList_find_sorted(Dlist *lp, const void *data, dCompareFunc func)
Search a sorted list.
void dList_free(Dlist *lp)
Free a list (not its elements)
void dList_remove(Dlist *lp, const void *data)
#define dReturn_if_fail(expr)
#define dNew0(type, count)
#define dReturn_val_if_fail(expr, val)
#define dNew(type, count)
void * a_Png_new(DilloImage *Image, DilloUrl *url, int version)
Create the image state data that must be kept between calls.
void a_Png_callback(int Op, CacheClient_t *Client)
void * a_Imgbuf_new(void *layout, int img_type, uint_t width, uint_t height, double gamma)
Create a new Imgbuf.
void a_Imgbuf_update(void *v_imgbuf, const uchar_t *buf, DilloImgType type, uchar_t *cmap, uint_t width, uint_t height, uint_t y)
Update the root buffer of an imgbuf.
int a_Imgbuf_last_reference(void *v_imgbuf)
Last reference for this Imgbuf?
void a_Imgbuf_unref(void *v_imgbuf)
Decrement reference count for an Imgbuf.
void a_Imgbuf_new_scan(void *v_imgbuf)
Reset for a new scan from a multiple-scan image.
void a_Image_ref(DilloImage *Image)
Add a reference to an Image struct Do nothing if the argument is NULL.
DilloImage * a_Image_new_with_dw(void *layout, const char *alt_text, int32_t bg_color, int32_t fg_color)
Create and initialize a new image structure with an image widget.
void * a_Image_get_dw(DilloImage *Image)
Return the image renderer as a widget.
void a_Image_abort(DilloImage *Image)
Implement the abort method.
void a_Image_write(DilloImage *Image, uint_t y)
Implement the write method.
void a_Image_close(DilloImage *Image)
Implement the close method.
void a_Image_set_parms(DilloImage *Image, void *v_imgbuf, DilloUrl *url, int version, uint_t width, uint_t height, DilloImgType type)
Set initial parameters of the image.
The DilloImage data-structure and methods.
void * render_layout
All the rendering is done by this.
Data structure for cache clients.
int Key
Primary Key for this client.
int Version
Dicache version of this Url (0 if not used)
uint_t BufSize
Valid size of cache-data.
void * Web
Pointer to the Web structure of our client.
int RefCount
Reference Counter.
uint_t ScanNumber
Current decoding scan.
int version
Version number, used for different versions of the same URL image.
uint_t DecodedSize
Size of already decoded data.
short SurvCleanup
Cleanup-pass survival for unused images.
DilloImgType type
Image type.
DicEntryState State
Current status for this entry.
DilloUrl * url
Image URL for this entry.
CA_Callback_t Decoder
Client function.
uint_t TotalSize
Amount of memory the image takes up.
bitvec_t * BitVec
Bit vector for decoded rows.
uint_t height
As taken from image data.
void * DecoderData
Client function data.
void * v_imgbuf
Void pointer to an Imgbuf object.
uint_t ScanNumber
Current decoding scan.
bitvec_t * BitVec
Bit vector for decoded rows.
DilloUrl * url
Requested URL.
BrowserWindow * bw
The requesting browser window [reference].
DilloImage * Image
For image urls [reference].
int32_t bgColor
for image backgrounds
int a_Url_cmp(const DilloUrl *A, const DilloUrl *B)
Compare two Url's to check if they're the same, or which one is bigger.
void a_Url_free(DilloUrl *url)
Free a DilloUrl.
DilloUrl * a_Url_dup(const DilloUrl *ori)
Duplicate a Url structure.