Dillo v3.1.1-111-gd4f56d0d
Loading...
Searching...
No Matches
dicache.c
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 2024 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#include <string.h> /* for memset */
14#include <stdlib.h>
15
16#include "msg.h"
17#include "image.hh"
18#include "imgbuf.hh"
19#include "web.hh"
20#include "dicache.h"
21#include "dpng.h"
22#include "dwebp.h"
23#include "dgif.h"
24#include "djpeg.h"
25#include "dsvg.h"
26
27enum {
33};
34
35
40static Dlist *CachedIMGs = NULL;
41
42static uint_t dicache_size_total; /* invariant: dicache_size_total is
43 * the sum of the image sizes (3*w*h)
44 * of all the images in the dicache. */
45
49static int Dicache_entry_cmp(const void *v1, const void *v2)
50{
51 const DICacheEntry *e1 = v1, *e2 = v2;
52
53 int st = a_Url_cmp(e1->url, e2->url);
54 if (st == 0) {
55 if (e2->version == DIC_Last)
56 st = (e1->Flags & DIF_Last ? 0 : -1);
57 else
58 st = (e1->version - e2->version);
59 }
60 return st;
61}
62
67{
68 CachedIMGs = dList_new(256);
70}
71
76{
77 DICacheEntry *entry = dNew(DICacheEntry, 1);
78
79 entry->width = 0;
80 entry->height = 0;
81 entry->Flags = DIF_Valid;
82 entry->SurvCleanup = 0;
84 entry->cmap = NULL;
85 entry->v_imgbuf = NULL;
86 entry->RefCount = 1;
87 entry->TotalSize = 0;
88 entry->ScanNumber = 0;
89 entry->BitVec = NULL;
90 entry->State = DIC_Empty;
91 entry->version = 1;
92
93 entry->Decoder = NULL;
94 entry->DecoderData = NULL;
95 entry->DecodedSize = 0;
96
97 return entry;
98}
99
105{
106 DICacheEntry e, *entry, *last;
107
108 entry = Dicache_entry_new();
109 e.url = (DilloUrl*)Url;
110 e.version = DIC_Last;
112 if (last) {
113 /* URL is already in CachedIMGs, make a new version */
114 last->Flags &= ~DIF_Last;
115 entry->version = last->version + 1;
116 }
117 entry->url = a_Url_dup(Url);
118 entry->Flags |= DIF_Last;
120
121 return entry;
122}
123
132{
133 DICacheEntry e;
134 DICacheEntry *entry = NULL;
135
136 dReturn_val_if_fail(version != 0, NULL);
137 e.url = (DilloUrl*)Url;
138 e.version = version;
140 if (entry && !(entry->Flags & DIF_Valid) && version == DIC_Last)
141 entry = NULL;
142 return entry;
143}
144
148static void Dicache_remove(const DilloUrl *Url, int version)
149{
150 DICacheEntry e, *entry;
151
152 _MSG("Dicache_remove url=%s\n", URL_STR(Url));
153 e.url = (DilloUrl*)Url;
154 e.version = version;
156 dReturn_if (entry == NULL);
157
158 _MSG("Dicache_remove Imgbuf=%p Decoder=%p DecoderData=%p\n",
159 entry->v_imgbuf, entry->Decoder, entry->DecoderData);
160 /* Eliminate this dicache entry */
161 dList_remove(CachedIMGs, entry);
163
164 /* entry cleanup */
165 a_Url_free(entry->url);
166 dFree(entry->cmap);
167 a_Bitvec_free(entry->BitVec);
168 a_Imgbuf_unref(entry->v_imgbuf);
169 if (entry->Decoder) {
170 entry->Decoder(CA_Abort, entry->DecoderData);
171 }
172 dFree(entry);
173}
174
181void a_Dicache_unref(const DilloUrl *Url, int version)
182{
183 DICacheEntry *entry;
184
185 if ((entry = a_Dicache_get_entry(Url, version))) {
186 _MSG("a_Dicache_unref: RefCount=%d State=%d ImgbufLastRef=%d\n",
187 entry->RefCount, entry->State,
188 entry->v_imgbuf ? a_Imgbuf_last_reference(entry->v_imgbuf) : -1);
189 if (entry->RefCount > 0) --entry->RefCount;
190 if (entry->RefCount == 0 && entry->v_imgbuf == NULL)
191 Dicache_remove(Url, version);
192 }
193}
194
198DICacheEntry* a_Dicache_ref(const DilloUrl *Url, int version)
199{
200 DICacheEntry *entry;
201
202 if ((entry = a_Dicache_get_entry(Url, version))) {
203 ++entry->RefCount;
204 }
205 return entry;
206}
207
214{
216 if (entry)
217 entry->Flags &= ~DIF_Valid;
218}
219
220
221/* ------------------------------------------------------------------------- */
222
229void a_Dicache_set_parms(DilloUrl *url, int version, DilloImage *Image,
230 uint_t width, uint_t height, DilloImgType type,
231 double gamma)
232{
233 DICacheEntry *DicEntry;
234
235 _MSG("a_Dicache_set_parms (%s)\n", URL_STR(url));
236 dReturn_if_fail ( Image != NULL && width && height );
237 /* Find the DicEntry for this Image */
238 DicEntry = a_Dicache_get_entry(url, version);
239 dReturn_if_fail ( DicEntry != NULL );
240 /* Parameters already set? Don't do it twice. */
241 dReturn_if_fail ( DicEntry->State < DIC_SetParms );
242
243 _MSG(" RefCount=%d version=%d\n", DicEntry->RefCount, DicEntry->version);
244
245 /* BUG: there's just one image-type now */
246 #define I_RGB 0
247 DicEntry->v_imgbuf =
248 a_Imgbuf_new(Image->layout, I_RGB, width, height, gamma);
249
250 DicEntry->TotalSize = width * height * 3;
251 DicEntry->width = width;
252 DicEntry->height = height;
253 DicEntry->type = type;
254 DicEntry->BitVec = a_Bitvec_new((int)height);
255 DicEntry->State = DIC_SetParms;
256
257 dicache_size_total += DicEntry->TotalSize;
258}
259
263void a_Dicache_set_cmap(DilloUrl *url, int version, int bg_color,
264 const uchar_t *cmap, uint_t num_colors,
265 int num_colors_max, int bg_index)
266{
267 DICacheEntry *DicEntry = a_Dicache_get_entry(url, version);
268
269 _MSG("a_Dicache_set_cmap\n");
270 dReturn_if_fail ( DicEntry != NULL );
271
272 dFree(DicEntry->cmap);
273 DicEntry->cmap = dNew0(uchar_t, 3 * num_colors_max);
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;
279 }
280
281 DicEntry->State = DIC_SetCmap;
282}
283
287void a_Dicache_new_scan(const DilloUrl *url, int version)
288{
289 DICacheEntry *DicEntry;
290
291 _MSG("a_Dicache_new_scan\n");
292 dReturn_if_fail ( url != NULL );
293 DicEntry = a_Dicache_get_entry(url, version);
294 dReturn_if_fail ( DicEntry != NULL );
295 if (DicEntry->State < DIC_SetParms) {
296 MSG("a_Dicache_new_scan before DIC_SetParms\n");
297 exit(1);
298 }
299 a_Bitvec_clear(DicEntry->BitVec);
300 DicEntry->ScanNumber++;
301 a_Imgbuf_new_scan(DicEntry->v_imgbuf);
302}
303
310void a_Dicache_write(DilloUrl *url, int version, const uchar_t *buf, uint_t Y)
311{
312 DICacheEntry *DicEntry;
313
314 _MSG("a_Dicache_write\n");
315 DicEntry = a_Dicache_get_entry(url, version);
316 dReturn_if_fail ( DicEntry != NULL );
317 dReturn_if_fail ( DicEntry->width > 0 && DicEntry->height > 0 );
318
319 /* update the common buffer in the imgbuf */
320 a_Imgbuf_update(DicEntry->v_imgbuf, buf, DicEntry->type,
321 DicEntry->cmap, DicEntry->width, DicEntry->height, Y);
322
323 a_Bitvec_set_bit(DicEntry->BitVec, (int)Y);
324 DicEntry->State = DIC_Write;
325}
326
330void a_Dicache_close(DilloUrl *url, int version, CacheClient_t *Client)
331{
332 DilloWeb *Web = Client->Web;
333 DICacheEntry *DicEntry = a_Dicache_get_entry(url, version);
334
335 dReturn_if_fail ( DicEntry != NULL );
336
337 /* a_Dicache_unref() may free DicEntry */
338 _MSG("a_Dicache_close RefCount=%d\n", DicEntry->RefCount - 1);
339 _MSG("a_Dicache_close DIC_Close=%d State=%d\n", DIC_Close, DicEntry->State);
340 _MSG(" a_Dicache_close imgbuf=%p Decoder=%p DecoderData=%p\n",
341 DicEntry->v_imgbuf, DicEntry->Decoder, DicEntry->DecoderData);
342
343 if (DicEntry->State < DIC_Close) {
344 DicEntry->State = DIC_Close;
345 dFree(DicEntry->cmap);
346 DicEntry->cmap = NULL;
347 DicEntry->Decoder = NULL;
348 DicEntry->DecoderData = NULL;
349 }
350 a_Dicache_unref(url, version);
351
352 a_Bw_close_client(Web->bw, Client->Key);
353}
354
355/* ------------------------------------------------------------------------- */
356
367static void *Dicache_image(int ImgType, const char *MimeType, void *Ptr,
368 CA_Callback_t *Call, void **Data)
369{
370 DilloWeb *web = Ptr;
371 DICacheEntry *DicEntry;
372
373 dReturn_val_if_fail(MimeType && Ptr, NULL);
374
375 if (!web->Image) {
376 web->Image =
377 a_Image_new_with_dw(web->bw->render_layout, NULL, web->bgColor, 0);
378 a_Image_ref(web->Image);
379 }
380
381 DicEntry = a_Dicache_get_entry(web->url, DIC_Last);
382 if (!DicEntry) {
383 /* Create an entry for this image... */
384 DicEntry = Dicache_add_entry(web->url);
385 /* Attach a decoder */
386 if (ImgType == DIC_Jpeg) {
388 DicEntry->DecoderData =
389 a_Jpeg_new(web->Image, DicEntry->url, DicEntry->version);
390 } else if (ImgType == DIC_Gif) {
392 DicEntry->DecoderData =
393 a_Gif_new(web->Image, DicEntry->url, DicEntry->version);
394 } else if (ImgType == DIC_Webp) {
396 DicEntry->DecoderData =
397 a_Webp_new(web->Image, DicEntry->url, DicEntry->version);
398 } else if (ImgType == DIC_Png) {
400 DicEntry->DecoderData =
401 a_Png_new(web->Image, DicEntry->url, DicEntry->version);
402 } else if (ImgType == DIC_Svg) {
404 DicEntry->DecoderData =
405 a_Svg_new(web->Image, DicEntry->url, DicEntry->version);
406 }
407 } else {
408 /* Repeated image */
409 a_Dicache_ref(DicEntry->url, DicEntry->version);
410 }
411 /* Survive three cleanup passes (set to zero = old behaviour). */
412 DicEntry->SurvCleanup = 3;
413
414 *Data = DicEntry->DecoderData;
416
417 return (a_Image_get_dw (web->Image));
418}
419
423void *a_Dicache_png_image(const char *Type, void *Ptr, CA_Callback_t *Call,
424 void **Data)
425{
426 return Dicache_image(DIC_Png, Type, Ptr, Call, Data);
427}
428
432void *a_Dicache_webp_image(const char *Type, void *Ptr, CA_Callback_t *Call,
433 void **Data)
434{
435 return Dicache_image(DIC_Webp, Type, Ptr, Call, Data);
436}
437
441void *a_Dicache_gif_image(const char *Type, void *Ptr, CA_Callback_t *Call,
442 void **Data)
443{
444 return Dicache_image(DIC_Gif, Type, Ptr, Call, Data);
445}
446
450void *a_Dicache_jpeg_image(const char *Type, void *Ptr, CA_Callback_t *Call,
451 void **Data)
452{
453 return Dicache_image(DIC_Jpeg, Type, Ptr, Call, Data);
454}
455
459void *a_Dicache_svg_image(const char *Type, void *Ptr, CA_Callback_t *Call,
460 void **Data)
461{
462 return Dicache_image(DIC_Svg, Type, Ptr, Call, Data);
463}
464
469{
470 uint_t i;
471 DilloWeb *Web = Client->Web;
472 DilloImage *Image = Web->Image;
473 DICacheEntry *DicEntry = a_Dicache_get_entry(Web->url, DIC_Last);
474
475 dReturn_if_fail ( DicEntry != NULL );
476
477 /* Copy the version number in the Client */
478 if (Client->Version == 0)
479 Client->Version = DicEntry->version;
480
481 /* Only call the decoder when necessary */
482 if (Op == CA_Send && DicEntry->State < DIC_Close &&
483 DicEntry->DecodedSize < Client->BufSize) {
484 DicEntry->Decoder(Op, Client);
485 DicEntry->DecodedSize = Client->BufSize;
486 } else if (Op == CA_Close || Op == CA_Abort) {
487 if (DicEntry->State < DIC_Close) {
488 DicEntry->Decoder(Op, Client);
489 } else {
490 a_Dicache_close(DicEntry->url, DicEntry->version, Client);
491 }
492 }
493
494 /* when the data stream is not an image 'v_imgbuf' remains NULL */
495 if (Op == CA_Send && DicEntry->v_imgbuf) {
496 if (Image->height == 0 && DicEntry->State >= DIC_SetParms) {
497 /* Set parms */
499 Image, DicEntry->v_imgbuf, DicEntry->url,
500 DicEntry->version, DicEntry->width, DicEntry->height,
501 DicEntry->type);
502 }
503 if (DicEntry->State == DIC_Write) {
504 if (DicEntry->ScanNumber == Image->ScanNumber) {
505 for (i = 0; i < DicEntry->height; ++i)
506 if (a_Bitvec_get_bit(DicEntry->BitVec, (int)i) &&
507 !a_Bitvec_get_bit(Image->BitVec, (int)i) )
508 a_Image_write(Image, i);
509 } else {
510 for (i = 0; i < DicEntry->height; ++i) {
511 if (a_Bitvec_get_bit(DicEntry->BitVec, (int)i) ||
512 !a_Bitvec_get_bit(Image->BitVec, (int)i) ||
513 DicEntry->ScanNumber > Image->ScanNumber + 1) {
514 a_Image_write(Image, i);
515 }
516 if (!a_Bitvec_get_bit(DicEntry->BitVec, (int)i))
517 a_Bitvec_clear_bit(Image->BitVec, (int)i);
518 }
519 Image->ScanNumber = DicEntry->ScanNumber;
520 }
521 }
522 } else if (Op == CA_Close) {
523 a_Image_close(Image);
524 a_Bw_close_client(Web->bw, Client->Key);
525 } else if (Op == CA_Abort) {
526 a_Image_abort(Image);
527 a_Bw_close_client(Web->bw, Client->Key);
528 }
529}
530
531/* ------------------------------------------------------------------------- */
532
537{
538 int i;
539 DICacheEntry *entry;
540
541 for (i = 0; (entry = dList_nth_data(CachedIMGs, i)); ++i) {
542 _MSG(" SurvCleanup = %d\n", entry->SurvCleanup);
543 if (entry->RefCount == 0 &&
544 (!entry->v_imgbuf || a_Imgbuf_last_reference(entry->v_imgbuf))) {
545 if (--entry->SurvCleanup >= 0)
546 continue; /* keep the entry one more pass */
547
548 /* free this unused entry */
549 Dicache_remove(entry->url, entry->version);
550 --i; /* adjust counter */
551 }
552 }
553 _MSG("a_Dicache_cleanup: length = %d\n", dList_length(CachedIMGs));
554}
555
556/* ------------------------------------------------------------------------- */
557
563{
564 DICacheEntry *entry;
565
566 /* Remove all the dicache entries */
567 while ((entry = dList_nth_data(CachedIMGs, dList_length(CachedIMGs)-1))) {
569 a_Url_free(entry->url);
570 dFree(entry->cmap);
571 a_Bitvec_free(entry->BitVec);
572 a_Imgbuf_unref(entry->v_imgbuf);
574 dFree(entry);
575 }
577}
void a_Bitvec_clear(bitvec_t *bvec)
Clear a bitvec.
Definition bitvec.c:35
bitvec_t * a_Bitvec_new(int num_bits)
Create a new bitvec with 'num_bits' size.
Definition bitvec.c:23
void a_Bitvec_set_bit(bitvec_t *bvec, int pos)
Set a bit.
Definition bitvec.c:63
void a_Bitvec_free(bitvec_t *bvec)
Free a bitvec.
Definition bitvec.c:43
int a_Bitvec_get_bit(bitvec_t *bvec, int pos)
Get a bit.
Definition bitvec.c:54
#define a_Bitvec_clear_bit(bvec, pos)
Definition bitvec.h:31
#define _MSG(...)
Definition bookmarks.c:45
#define MSG(...)
Definition bookmarks.c:46
void a_Bw_close_client(BrowserWindow *bw, int ClientKey)
Close a cache-client upon successful retrieval.
Definition bw.c:167
#define CA_Send
Definition cache.h:15
void(* CA_Callback_t)(int Op, CacheClient_t *Client)
Callback type for cache clients.
Definition cache.h:43
#define CA_Abort
Definition cache.h:17
#define CA_Close
Definition cache.h:16
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:229
DICacheEntry * a_Dicache_get_entry(const DilloUrl *Url, int version)
Search a particular version of a URL in the Dicache.
Definition dicache.c:131
void a_Dicache_cleanup(void)
Free the imgbuf (RGB data) of unused entries.
Definition dicache.c:536
static Dlist * CachedIMGs
List of DICacheEntry.
Definition dicache.c:40
static DICacheEntry * Dicache_entry_new(void)
Create, and initialize a new, empty, dicache entry.
Definition dicache.c:75
@ DIC_Svg
Definition dicache.c:32
@ DIC_Jpeg
Definition dicache.c:31
@ DIC_Png
Definition dicache.c:29
@ DIC_Webp
Definition dicache.c:30
@ DIC_Gif
Definition dicache.c:28
void a_Dicache_invalidate_entry(const DilloUrl *Url)
Invalidate this entry.
Definition dicache.c:213
#define I_RGB
DICacheEntry * a_Dicache_ref(const DilloUrl *Url, int version)
Refs the counter of a dicache entry.
Definition dicache.c:198
void a_Dicache_new_scan(const DilloUrl *url, int version)
Reset for a new scan from a multiple-scan image.
Definition dicache.c:287
void a_Dicache_close(DilloUrl *url, int version, CacheClient_t *Client)
Implement the close method of the decoding process.
Definition dicache.c:330
void * a_Dicache_svg_image(const char *Type, void *Ptr, CA_Callback_t *Call, void **Data)
SVG wrapper for Dicache_image()
Definition dicache.c:459
void a_Dicache_init(void)
Initialize dicache data.
Definition dicache.c:66
void a_Dicache_unref(const DilloUrl *Url, int version)
Unrefs the counter of a dicache entry (it counts cache clients).
Definition dicache.c:181
void a_Dicache_callback(int Op, CacheClient_t *Client)
This function is a cache client; (but feeds its clients from dicache)
Definition dicache.c:468
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:310
static int Dicache_entry_cmp(const void *v1, const void *v2)
Compare function for image entries.
Definition dicache.c:49
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.
Definition dicache.c:367
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:562
static uint_t dicache_size_total
Definition dicache.c:42
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:263
static void Dicache_remove(const DilloUrl *Url, int version)
Actually free a dicache entry, given the URL and the version number.
Definition dicache.c:148
void * a_Dicache_jpeg_image(const char *Type, void *Ptr, CA_Callback_t *Call, void **Data)
JPEG wrapper for Dicache_image()
Definition dicache.c:450
static DICacheEntry * Dicache_add_entry(const DilloUrl *Url)
Add a new entry in the dicache (a single URL may have several entries)
Definition dicache.c:104
void * a_Dicache_webp_image(const char *Type, void *Ptr, CA_Callback_t *Call, void **Data)
WEBP wrapper for Dicache_image()
Definition dicache.c:432
void * a_Dicache_gif_image(const char *Type, void *Ptr, CA_Callback_t *Call, void **Data)
GIF wrapper for Dicache_image()
Definition dicache.c:441
void * a_Dicache_png_image(const char *Type, void *Ptr, CA_Callback_t *Call, void **Data)
PNG wrapper for Dicache_image()
Definition dicache.c:423
#define DIF_Last
Flags: Last version, Valid entry.
Definition dicache.h:16
#define DIF_Valid
Definition dicache.h:17
@ DIC_Close
Whole image got!
Definition dicache.h:26
@ DIC_SetCmap
Color map set.
Definition dicache.h:24
@ DIC_SetParms
Parameters set.
Definition dicache.h:23
@ DIC_Write
Feeding the entry.
Definition dicache.h:25
@ DIC_Empty
Just created the entry.
Definition dicache.h:22
#define DIC_Last
Symbolic name to request the last version of an image.
Definition dicache.h:14
void dList_insert_sorted(Dlist *lp, void *data, dCompareFunc func)
Insert an element into a sorted list.
Definition dlib.c:769
void dFree(void *mem)
Definition dlib.c:68
Dlist * dList_new(int size)
Create a new empty list.
Definition dlib.c:548
int dList_length(Dlist *lp)
For completing the ADT.
Definition dlib.c:613
void * dList_nth_data(Dlist *lp, int n0)
Return the nth data item, NULL when not found or 'n0' is out of range.
Definition dlib.c:662
void dList_remove_fast(Dlist *lp, const void *data)
Remove a data item without preserving order.
Definition dlib.c:623
void * dList_find_sorted(Dlist *lp, const void *data, dCompareFunc func)
Search a sorted list.
Definition dlib.c:796
void dList_free(Dlist *lp)
Free a list (not its elements)
Definition dlib.c:564
void dList_remove(Dlist *lp, const void *data)
Definition dlib.c:641
#define dReturn_if_fail(expr)
Definition dlib.h:72
#define dNew0(type, count)
Definition dlib.h:51
#define dReturn_val_if_fail(expr, val)
Definition dlib.h:76
#define dReturn_if(expr)
Definition dlib.h:64
#define dNew(type, count)
Definition dlib.h:49
void * a_Png_new(DilloImage *Image, DilloUrl *url, int version)
Create the image state data that must be kept between calls.
Definition png.c:448
void a_Png_callback(int Op, CacheClient_t *Client)
void a_Gif_callback()
Definition gif.c:1024
void * a_Gif_new()
Definition gif.c:1023
void * a_Imgbuf_new(void *layout, int img_type, uint_t width, uint_t height, double gamma)
Create a new Imgbuf.
Definition imgbuf.cc:93
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.
Definition imgbuf.cc:121
int a_Imgbuf_last_reference(void *v_imgbuf)
Last reference for this Imgbuf?
Definition imgbuf.cc:113
void a_Imgbuf_unref(void *v_imgbuf)
Decrement reference count for an Imgbuf.
Definition imgbuf.cc:84
void a_Imgbuf_new_scan(void *v_imgbuf)
Reset for a new scan from a multiple-scan image.
Definition imgbuf.cc:135
void a_Jpeg_callback()
Definition jpeg.c:423
void * a_Jpeg_new()
Definition jpeg.c:422
void a_Image_ref(DilloImage *Image)
Add a reference to an Image struct Do nothing if the argument is NULL.
Definition image.cc:100
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.
Definition image.cc:59
void * a_Image_get_dw(DilloImage *Image)
Return the image renderer as a widget.
Definition image.cc:72
void a_Image_abort(DilloImage *Image)
Implement the abort method.
Definition image.cc:153
void a_Image_write(DilloImage *Image, uint_t y)
Implement the write method.
Definition image.cc:130
void a_Image_close(DilloImage *Image)
Implement the close method.
Definition image.cc:144
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.
Definition image.cc:109
The DilloImage data-structure and methods.
DilloImgType
Definition image.hh:42
@ DILLO_IMG_TYPE_NOTSET
Definition image.hh:47
void * render_layout
All the rendering is done by this.
Definition bw.h:34
Data structure for cache clients.
Definition cache.h:48
int Key
Primary Key for this client.
Definition cache.h:49
int Version
Dicache version of this Url (0 if not used)
Definition cache.h:51
uint_t BufSize
Valid size of cache-data.
Definition cache.h:53
void * Web
Pointer to the Web structure of our client.
Definition cache.h:56
int RefCount
Reference Counter.
Definition dicache.h:42
uint_t ScanNumber
Current decoding scan.
Definition dicache.h:39
int version
Version number, used for different versions of the same URL image.
Definition dicache.h:43
uchar_t * cmap
Color map.
Definition dicache.h:36
uint_t DecodedSize
Size of already decoded data.
Definition dicache.h:46
short SurvCleanup
Cleanup-pass survival for unused images.
Definition dicache.h:35
DilloImgType type
Image type.
Definition dicache.h:32
short Flags
See Flags.
Definition dicache.h:34
DicEntryState State
Current status for this entry.
Definition dicache.h:41
DilloUrl * url
Image URL for this entry.
Definition dicache.h:31
CA_Callback_t Decoder
Client function.
Definition dicache.h:47
uint_t TotalSize
Amount of memory the image takes up.
Definition dicache.h:38
uint_t width
Definition dicache.h:33
bitvec_t * BitVec
Bit vector for decoded rows.
Definition dicache.h:40
uint_t height
As taken from image data.
Definition dicache.h:33
void * DecoderData
Client function data.
Definition dicache.h:48
void * v_imgbuf
Void pointer to an Imgbuf object.
Definition dicache.h:37
Definition url.h:88
Definition dlib.h:131
void * layout
Definition image.hh:61
uint_t ScanNumber
Current decoding scan.
Definition image.hh:71
uint_t height
Definition image.hh:65
bitvec_t * BitVec
Bit vector for decoded rows.
Definition image.hh:70
DilloUrl * url
Requested URL.
Definition web.hh:25
BrowserWindow * bw
The requesting browser window [reference].
Definition web.hh:28
DilloImage * Image
For image urls [reference].
Definition web.hh:31
int32_t bgColor
for image backgrounds
Definition web.hh:33
void a_Svg_callback()
Definition svg.c:168
void * a_Svg_new()
Definition svg.c:167
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.
Definition url.c:506
void a_Url_free(DilloUrl *url)
Free a DilloUrl.
Definition url.c:208
DilloUrl * a_Url_dup(const DilloUrl *ori)
Duplicate a Url structure.
Definition url.c:477
#define URL_STR(u)
Definition url.h:76
void a_Webp_callback()
Definition webp.c:217
void * a_Webp_new()
Definition webp.c:216