Dillo v3.2.0-88-g47ab7c70
Loading...
Searching...
No Matches
dicache.h
Go to the documentation of this file.
1/*
2 * File: dicache.c
3 *
4 * Copyright 2000-2007 Jorge Arellano Cid <jcid@dillo.org>
5 * Copyright 2025 Rodrigo Arias Mallo <rodarima@gmail.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef __DICACHE_H__
14#define __DICACHE_H__
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20
21#include "bitvec.h"
22#include "image.hh"
23#include "cache.h"
24#include "dlib/dlib.h"
25
27#define DIC_Last -1
29#define DIF_Last 1
30#define DIF_Valid 2
31
32
33/* These will reflect the entry's "state" */
42
63
64
65void a_Dicache_init (void);
66
67DICacheEntry *a_Dicache_get_entry(const DilloUrl *Url, int version);
68
69void *a_Dicache_png_image(const char *Type, void *Ptr, CA_Callback_t *Call,
70 void **Data);
71void *a_Dicache_gif_image(const char *Type, void *Ptr, CA_Callback_t *Call,
72 void **Data);
73void *a_Dicache_jpeg_image(const char *Type, void *Ptr, CA_Callback_t *Call,
74 void **Data);
75void a_Dicache_callback(int Op, CacheClient_t *Client);
76
77void a_Dicache_set_parms(DilloUrl *url, int version, DilloImage *Image,
78 uint_t width, uint_t height, DilloImgType type,
79 double gamma);
80void a_Dicache_set_cmap(DilloUrl *url, int version, int bg_color,
81 const uchar_t *cmap, uint_t num_colors,
82 int num_colors_max, int bg_index);
83void a_Dicache_new_scan(const DilloUrl *url, int version);
84void a_Dicache_write(DilloUrl *url, int version, const uchar_t *buf, uint_t Y);
85void a_Dicache_close(DilloUrl *url, int version, CacheClient_t *Client);
86
88DICacheEntry* a_Dicache_ref(const DilloUrl *Url, int version);
89void a_Dicache_unref(const DilloUrl *Url, int version);
90void a_Dicache_cleanup(void);
91void a_Dicache_freeall(void);
93
94
95#ifdef __cplusplus
96}
97#endif /* __cplusplus */
98#endif /* __DICACHE_H__ */
void(* CA_Callback_t)(int Op, CacheClient_t *Client)
Callback type for cache clients.
Definition cache.h:55
unsigned char uchar_t
Definition d_size.h:17
unsigned int uint_t
Definition d_size.h:20
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.
Definition dicache.c:262
DICacheEntry * a_Dicache_get_entry(const DilloUrl *Url, int version)
Search a particular version of a URL in the Dicache.
Definition dicache.c:156
void a_Dicache_cleanup(void)
Free the imgbuf (RGB data) of unused entries.
Definition dicache.c:574
void a_Dicache_invalidate_entry(const DilloUrl *Url)
Invalidate this entry.
Definition dicache.c:246
DICacheEntry * a_Dicache_ref(const DilloUrl *Url, int version)
Refs the counter of a dicache entry.
Definition dicache.c:231
void a_Dicache_new_scan(const DilloUrl *url, int version)
Reset for a new scan from a multiple-scan image.
Definition dicache.c:320
void a_Dicache_close(DilloUrl *url, int version, CacheClient_t *Client)
Implement the close method of the decoding process.
Definition dicache.c:363
void a_Dicache_init(void)
Initialize dicache data.
Definition dicache.c:82
void a_Dicache_unref(const DilloUrl *Url, int version)
Unrefs the counter of a dicache entry (it counts cache clients).
Definition dicache.c:214
void a_Dicache_callback(int Op, CacheClient_t *Client)
This function is a cache client; (but feeds its clients from dicache)
Definition dicache.c:506
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 dicache.c:343
void a_Dicache_freeall(void)
Deallocate memory used by dicache module (Call this one at exit time, with no cache clients queued)
Definition dicache.c:600
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 dicache.c:296
DicEntryState
Definition dicache.h:34
@ DIC_Close
Whole image got!
Definition dicache.h:39
@ DIC_Abort
Image transfer aborted.
Definition dicache.h:40
@ DIC_SetCmap
Color map set.
Definition dicache.h:37
@ DIC_SetParms
Parameters set.
Definition dicache.h:36
@ DIC_Write
Feeding the entry.
Definition dicache.h:38
@ DIC_Empty
Just created the entry.
Definition dicache.h:35
void * a_Dicache_jpeg_image(const char *Type, void *Ptr, CA_Callback_t *Call, void **Data)
JPEG wrapper for Dicache_image()
Definition dicache.c:488
Dstr * a_Dicache_stats(void)
Definition dicache.c:617
void * a_Dicache_gif_image(const char *Type, void *Ptr, CA_Callback_t *Call, void **Data)
GIF wrapper for Dicache_image()
Definition dicache.c:479
void * a_Dicache_png_image(const char *Type, void *Ptr, CA_Callback_t *Call, void **Data)
PNG wrapper for Dicache_image()
Definition dicache.c:461
The DilloImage data-structure and methods.
DilloImgType
Definition image.hh:42
Data structure for cache clients.
Definition cache.h:60
int RefCount
Reference Counter.
Definition dicache.h:55
uint_t ScanNumber
Current decoding scan.
Definition dicache.h:52
int version
Version number, used for different versions of the same URL image.
Definition dicache.h:56
uchar_t * cmap
Color map.
Definition dicache.h:49
uint_t DecodedSize
Size of already decoded data.
Definition dicache.h:59
short SurvCleanup
Cleanup-pass survival for unused images.
Definition dicache.h:48
DilloImgType type
Image type.
Definition dicache.h:45
short Flags
See Flags.
Definition dicache.h:47
DicEntryState State
Current status for this entry.
Definition dicache.h:54
DilloUrl * url
Image URL for this entry.
Definition dicache.h:44
CA_Callback_t Decoder
Client function.
Definition dicache.h:60
uint_t TotalSize
Amount of memory the image takes up.
Definition dicache.h:51
uint_t width
Definition dicache.h:46
bitvec_t * BitVec
Bit vector for decoded rows.
Definition dicache.h:53
uint_t height
As taken from image data.
Definition dicache.h:46
void * DecoderData
Client function data.
Definition dicache.h:61
void * v_imgbuf
Void pointer to an Imgbuf object.
Definition dicache.h:50
Definition url.h:88
Definition dlib.h:114