Dillo v3.1.1-91-g6d5b3ee3
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 "dgif.h"
23#include "djpeg.h"
24#include "dsvg.h"
25
26
27enum {
32};
33
34
39static Dlist *CachedIMGs = NULL;
40
41static uint_t dicache_size_total; /* invariant: dicache_size_total is
42 * the sum of the image sizes (3*w*h)
43 * of all the images in the dicache. */
44
48static int Dicache_entry_cmp(const void *v1, const void *v2)
49{
50 const DICacheEntry *e1 = v1, *e2 = v2;
51
52 int st = a_Url_cmp(e1->url, e2->url);
53 if (st == 0) {
54 if (e2->version == DIC_Last)
55 st = (e1->Flags & DIF_Last ? 0 : -1);
56 else
57 st = (e1->version - e2->version);
58 }
59 return st;
60}
61
66{
67 CachedIMGs = dList_new(256);
69}
70
75{
76 DICacheEntry *entry = dNew(DICacheEntry, 1);
77
78 entry->width = 0;
79 entry->height = 0;
80 entry->Flags = DIF_Valid;
81 entry->SurvCleanup = 0;
83 entry->cmap = NULL;
84 entry->v_imgbuf = NULL;
85 entry->RefCount = 1;
86 entry->TotalSize = 0;
87 entry->ScanNumber = 0;
88 entry->BitVec = NULL;
89 entry->State = DIC_Empty;
90 entry->version = 1;
91
92 entry->Decoder = NULL;
93 entry->DecoderData = NULL;
94 entry->DecodedSize = 0;
95
96 return entry;
97}
98
104{
105 DICacheEntry e, *entry, *last;
106
107 entry = Dicache_entry_new();
108 e.url = (DilloUrl*)Url;
109 e.version = DIC_Last;
111 if (last) {
112 /* URL is already in CachedIMGs, make a new version */
113 last->Flags &= ~DIF_Last;
114 entry->version = last->version + 1;
115 }
116 entry->url = a_Url_dup(Url);
117 entry->Flags |= DIF_Last;
119
120 return entry;
121}
122
131{
132 DICacheEntry e;
133 DICacheEntry *entry = NULL;
134
135 dReturn_val_if_fail(version != 0, NULL);
136 e.url = (DilloUrl*)Url;
137 e.version = version;
139 if (entry && !(entry->Flags & DIF_Valid) && version == DIC_Last)
140 entry = NULL;
141 return entry;
142}
143
147static void Dicache_remove(const DilloUrl *Url, int version)
148{
149 DICacheEntry e, *entry;
150
151 _MSG("Dicache_remove url=%s\n", URL_STR(Url));
152 e.url = (DilloUrl*)Url;
153 e.version = version;
155 dReturn_if (entry == NULL);
156
157 _MSG("Dicache_remove Imgbuf=%p Decoder=%p DecoderData=%p\n",
158 entry->v_imgbuf, entry->Decoder, entry->DecoderData);
159 /* Eliminate this dicache entry */
160 dList_remove(CachedIMGs, entry);
162
163 /* entry cleanup */
164 a_Url_free(entry->url);
165 dFree(entry->cmap);
166 a_Bitvec_free(entry->BitVec);
167 a_Imgbuf_unref(entry->v_imgbuf);
168 if (entry->Decoder) {
169 entry->Decoder(CA_Abort, entry->DecoderData);
170 }
171 dFree(entry);
172}
173
180void a_Dicache_unref(const DilloUrl *Url, int version)
181{
182 DICacheEntry *entry;
183
184 if ((entry = a_Dicache_get_entry(Url, version))) {
185 _MSG("a_Dicache_unref: RefCount=%d State=%d ImgbufLastRef=%d\n",
186 entry->RefCount, entry->State,
187 entry->v_imgbuf ? a_Imgbuf_last_reference(entry->v_imgbuf) : -1);
188 if (entry->RefCount > 0) --entry->RefCount;
189 if (entry->RefCount == 0 && entry->v_imgbuf == NULL)
190 Dicache_remove(Url, version);
191 }
192}
193
197DICacheEntry* a_Dicache_ref(const DilloUrl *Url, int version)
198{
199 DICacheEntry *entry;
200
201 if ((entry = a_Dicache_get_entry(Url, version))) {
202 ++entry->RefCount;
203 }
204 return entry;
205}
206
213{
215 if (entry)
216 entry->Flags &= ~DIF_Valid;
217}
218
219
220/* ------------------------------------------------------------------------- */
221
228void a_Dicache_set_parms(DilloUrl *url, int version, DilloImage *Image,
229 uint_t width, uint_t height, DilloImgType type,
230 double gamma)
231{
232 DICacheEntry *DicEntry;
233
234 _MSG("a_Dicache_set_parms (%s)\n", URL_STR(url));
235 dReturn_if_fail ( Image != NULL && width && height );
236 /* Find the DicEntry for this Image */
237 DicEntry = a_Dicache_get_entry(url, version);
238 dReturn_if_fail ( DicEntry != NULL );
239 /* Parameters already set? Don't do it twice. */
240 dReturn_if_fail ( DicEntry->State < DIC_SetParms );
241
242 _MSG(" RefCount=%d version=%d\n", DicEntry->RefCount, DicEntry->version);
243
244 /* BUG: there's just one image-type now */
245 #define I_RGB 0
246 DicEntry->v_imgbuf =
247 a_Imgbuf_new(Image->layout, I_RGB, width, height, gamma);
248
249 DicEntry->TotalSize = width * height * 3;
250 DicEntry->width = width;
251 DicEntry->height = height;
252 DicEntry->type = type;
253 DicEntry->BitVec = a_Bitvec_new((int)height);
254 DicEntry->State = DIC_SetParms;
255
256 dicache_size_total += DicEntry->TotalSize;
257}
258
262void a_Dicache_set_cmap(DilloUrl *url, int version, int bg_color,
263 const uchar_t *cmap, uint_t num_colors,
264 int num_colors_max, int bg_index)
265{
266 DICacheEntry *DicEntry = a_Dicache_get_entry(url, version);
267
268 _MSG("a_Dicache_set_cmap\n");
269 dReturn_if_fail ( DicEntry != NULL );
270
271 dFree(DicEntry->cmap);
272 DicEntry->cmap = dNew0(uchar_t, 3 * num_colors_max);
273 memcpy(DicEntry->cmap, cmap, 3 * num_colors);
274 if (bg_index >= 0 && (uint_t)bg_index < num_colors) {
275 DicEntry->cmap[bg_index * 3] = (bg_color >> 16) & 0xff;
276 DicEntry->cmap[bg_index * 3 + 1] = (bg_color >> 8) & 0xff;
277 DicEntry->cmap[bg_index * 3 + 2] = (bg_color) & 0xff;
278 }
279
280 DicEntry->State = DIC_SetCmap;
281}
282
286void a_Dicache_new_scan(const DilloUrl *url, int version)
287{
288 DICacheEntry *DicEntry;
289
290 _MSG("a_Dicache_new_scan\n");
291 dReturn_if_fail ( url != NULL );
292 DicEntry = a_Dicache_get_entry(url, version);
293 dReturn_if_fail ( DicEntry != NULL );
294 if (DicEntry->State < DIC_SetParms) {
295 MSG("a_Dicache_new_scan before DIC_SetParms\n");
296 exit(1);
297 }
298 a_Bitvec_clear(DicEntry->BitVec);
299 DicEntry->ScanNumber++;
300 a_Imgbuf_new_scan(DicEntry->v_imgbuf);
301}
302
309void a_Dicache_write(DilloUrl *url, int version, const uchar_t *buf, uint_t Y)
310{
311 DICacheEntry *DicEntry;
312
313 _MSG("a_Dicache_write\n");
314 DicEntry = a_Dicache_get_entry(url, version);
315 dReturn_if_fail ( DicEntry != NULL );
316 dReturn_if_fail ( DicEntry->width > 0 && DicEntry->height > 0 );
317
318 /* update the common buffer in the imgbuf */
319 a_Imgbuf_update(DicEntry->v_imgbuf, buf, DicEntry->type,
320 DicEntry->cmap, DicEntry->width, DicEntry->height, Y);
321
322 a_Bitvec_set_bit(DicEntry->BitVec, (int)Y);
323 DicEntry->State = DIC_Write;
324}
325
329void a_Dicache_close(DilloUrl *url, int version, CacheClient_t *Client)
330{
331 DilloWeb *Web = Client->Web;
332 DICacheEntry *DicEntry = a_Dicache_get_entry(url, version);
333
334 dReturn_if_fail ( DicEntry != NULL );
335
336 /* a_Dicache_unref() may free DicEntry */
337 _MSG("a_Dicache_close RefCount=%d\n", DicEntry->RefCount - 1);
338 _MSG("a_Dicache_close DIC_Close=%d State=%d\n", DIC_Close, DicEntry->State);
339 _MSG(" a_Dicache_close imgbuf=%p Decoder=%p DecoderData=%p\n",
340 DicEntry->v_imgbuf, DicEntry->Decoder, DicEntry->DecoderData);
341
342 if (DicEntry->State < DIC_Close) {
343 DicEntry->State = DIC_Close;
344 dFree(DicEntry->cmap);
345 DicEntry->cmap = NULL;
346 DicEntry->Decoder = NULL;
347 DicEntry->DecoderData = NULL;
348 }
349 a_Dicache_unref(url, version);
350
351 a_Bw_close_client(Web->bw, Client->Key);
352}
353
354/* ------------------------------------------------------------------------- */
355
366static void *Dicache_image(int ImgType, const char *MimeType, void *Ptr,
367 CA_Callback_t *Call, void **Data)
368{
369 DilloWeb *web = Ptr;
370 DICacheEntry *DicEntry;
371
372 dReturn_val_if_fail(MimeType && Ptr, NULL);
373
374 if (!web->Image) {
375 web->Image =
376 a_Image_new_with_dw(web->bw->render_layout, NULL, web->bgColor, 0);
377 a_Image_ref(web->Image);
378 }
379
380 DicEntry = a_Dicache_get_entry(web->url, DIC_Last);
381 if (!DicEntry) {
382 /* Create an entry for this image... */
383 DicEntry = Dicache_add_entry(web->url);
384 /* Attach a decoder */
385 if (ImgType == DIC_Jpeg) {
387 DicEntry->DecoderData =
388 a_Jpeg_new(web->Image, DicEntry->url, DicEntry->version);
389 } else if (ImgType == DIC_Gif) {
391 DicEntry->DecoderData =
392 a_Gif_new(web->Image, DicEntry->url, DicEntry->version);
393 } else if (ImgType == DIC_Png) {
395 DicEntry->DecoderData =
396 a_Png_new(web->Image, DicEntry->url, DicEntry->version);
397 } else if (ImgType == DIC_Svg) {
399 DicEntry->DecoderData =
400 a_Svg_new(web->Image, DicEntry->url, DicEntry->version);
401 }
402 } else {
403 /* Repeated image */
404 a_Dicache_ref(DicEntry->url, DicEntry->version);
405 }
406 /* Survive three cleanup passes (set to zero = old behaviour). */
407 DicEntry->SurvCleanup = 3;
408
409 *Data = DicEntry->DecoderData;
411
412 return (a_Image_get_dw (web->Image));
413}
414
418void *a_Dicache_png_image(const char *Type, void *Ptr, CA_Callback_t *Call,
419 void **Data)
420{
421 return Dicache_image(DIC_Png, Type, Ptr, Call, Data);
422}
423
427void *a_Dicache_gif_image(const char *Type, void *Ptr, CA_Callback_t *Call,
428 void **Data)
429{
430 return Dicache_image(DIC_Gif, Type, Ptr, Call, Data);
431}
432
436void *a_Dicache_jpeg_image(const char *Type, void *Ptr, CA_Callback_t *Call,
437 void **Data)
438{
439 return Dicache_image(DIC_Jpeg, Type, Ptr, Call, Data);
440}
441
445void *a_Dicache_svg_image(const char *Type, void *Ptr, CA_Callback_t *Call,
446 void **Data)
447{
448 return Dicache_image(DIC_Svg, Type, Ptr, Call, Data);
449}
450
455{
456 uint_t i;
457 DilloWeb *Web = Client->Web;
458 DilloImage *Image = Web->Image;
459 DICacheEntry *DicEntry = a_Dicache_get_entry(Web->url, DIC_Last);
460
461 dReturn_if_fail ( DicEntry != NULL );
462
463 /* Copy the version number in the Client */
464 if (Client->Version == 0)
465 Client->Version = DicEntry->version;
466
467 /* Only call the decoder when necessary */
468 if (Op == CA_Send && DicEntry->State < DIC_Close &&
469 DicEntry->DecodedSize < Client->BufSize) {
470 DicEntry->Decoder(Op, Client);
471 DicEntry->DecodedSize = Client->BufSize;
472 } else if (Op == CA_Close || Op == CA_Abort) {
473 if (DicEntry->State < DIC_Close) {
474 DicEntry->Decoder(Op, Client);
475 } else {
476 a_Dicache_close(DicEntry->url, DicEntry->version, Client);
477 }
478 }
479
480 /* when the data stream is not an image 'v_imgbuf' remains NULL */
481 if (Op == CA_Send && DicEntry->v_imgbuf) {
482 if (Image->height == 0 && DicEntry->State >= DIC_SetParms) {
483 /* Set parms */
485 Image, DicEntry->v_imgbuf, DicEntry->url,
486 DicEntry->version, DicEntry->width, DicEntry->height,
487 DicEntry->type);
488 }
489 if (DicEntry->State == DIC_Write) {
490 if (DicEntry->ScanNumber == Image->ScanNumber) {
491 for (i = 0; i < DicEntry->height; ++i)
492 if (a_Bitvec_get_bit(DicEntry->BitVec, (int)i) &&
493 !a_Bitvec_get_bit(Image->BitVec, (int)i) )
494 a_Image_write(Image, i);
495 } else {
496 for (i = 0; i < DicEntry->height; ++i) {
497 if (a_Bitvec_get_bit(DicEntry->BitVec, (int)i) ||
498 !a_Bitvec_get_bit(Image->BitVec, (int)i) ||
499 DicEntry->ScanNumber > Image->ScanNumber + 1) {
500 a_Image_write(Image, i);
501 }
502 if (!a_Bitvec_get_bit(DicEntry->BitVec, (int)i))
503 a_Bitvec_clear_bit(Image->BitVec, (int)i);
504 }
505 Image->ScanNumber = DicEntry->ScanNumber;
506 }
507 }
508 } else if (Op == CA_Close) {
509 a_Image_close(Image);
510 a_Bw_close_client(Web->bw, Client->Key);
511 } else if (Op == CA_Abort) {
512 a_Image_abort(Image);
513 a_Bw_close_client(Web->bw, Client->Key);
514 }
515}
516
517/* ------------------------------------------------------------------------- */
518
523{
524 int i;
525 DICacheEntry *entry;
526
527 for (i = 0; (entry = dList_nth_data(CachedIMGs, i)); ++i) {
528 _MSG(" SurvCleanup = %d\n", entry->SurvCleanup);
529 if (entry->RefCount == 0 &&
530 (!entry->v_imgbuf || a_Imgbuf_last_reference(entry->v_imgbuf))) {
531 if (--entry->SurvCleanup >= 0)
532 continue; /* keep the entry one more pass */
533
534 /* free this unused entry */
535 Dicache_remove(entry->url, entry->version);
536 --i; /* adjust counter */
537 }
538 }
539 _MSG("a_Dicache_cleanup: length = %d\n", dList_length(CachedIMGs));
540}
541
542/* ------------------------------------------------------------------------- */
543
549{
550 DICacheEntry *entry;
551
552 /* Remove all the dicache entries */
553 while ((entry = dList_nth_data(CachedIMGs, dList_length(CachedIMGs)-1))) {
555 a_Url_free(entry->url);
556 dFree(entry->cmap);
557 a_Bitvec_free(entry->BitVec);
558 a_Imgbuf_unref(entry->v_imgbuf);
560 dFree(entry);
561 }
563}
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:228
DICacheEntry * a_Dicache_get_entry(const DilloUrl *Url, int version)
Search a particular version of a URL in the Dicache.
Definition dicache.c:130
void a_Dicache_cleanup(void)
Free the imgbuf (RGB data) of unused entries.
Definition dicache.c:522
static Dlist * CachedIMGs
List of DICacheEntry.
Definition dicache.c:39
static DICacheEntry * Dicache_entry_new(void)
Create, and initialize a new, empty, dicache entry.
Definition dicache.c:74
@ DIC_Svg
Definition dicache.c:31
@ DIC_Jpeg
Definition dicache.c:30
@ DIC_Png
Definition dicache.c:29
@ DIC_Gif
Definition dicache.c:28
void a_Dicache_invalidate_entry(const DilloUrl *Url)
Invalidate this entry.
Definition dicache.c:212
#define I_RGB
DICacheEntry * a_Dicache_ref(const DilloUrl *Url, int version)
Refs the counter of a dicache entry.
Definition dicache.c:197
void a_Dicache_new_scan(const DilloUrl *url, int version)
Reset for a new scan from a multiple-scan image.
Definition dicache.c:286
void a_Dicache_close(DilloUrl *url, int version, CacheClient_t *Client)
Implement the close method of the decoding process.
Definition dicache.c:329
void * a_Dicache_svg_image(const char *Type, void *Ptr, CA_Callback_t *Call, void **Data)
SVG wrapper for Dicache_image()
Definition dicache.c:445
void a_Dicache_init(void)
Initialize dicache data.
Definition dicache.c:65
void a_Dicache_unref(const DilloUrl *Url, int version)
Unrefs the counter of a dicache entry (it counts cache clients).
Definition dicache.c:180
void a_Dicache_callback(int Op, CacheClient_t *Client)
This function is a cache client; (but feeds its clients from dicache)
Definition dicache.c:454
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:309
static int Dicache_entry_cmp(const void *v1, const void *v2)
Compare function for image entries.
Definition dicache.c:48
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:366
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:548
static uint_t dicache_size_total
Definition dicache.c:41
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:262
static void Dicache_remove(const DilloUrl *Url, int version)
Actually free a dicache entry, given the URL and the version number.
Definition dicache.c:147
void * a_Dicache_jpeg_image(const char *Type, void *Ptr, CA_Callback_t *Call, void **Data)
JPEG wrapper for Dicache_image()
Definition dicache.c:436
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:103
void * a_Dicache_gif_image(const char *Type, void *Ptr, CA_Callback_t *Call, void **Data)
GIF wrapper for Dicache_image()
Definition dicache.c:427
void * a_Dicache_png_image(const char *Type, void *Ptr, CA_Callback_t *Call, void **Data)
PNG wrapper for Dicache_image()
Definition dicache.c:418
#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:442
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:407
void * a_Jpeg_new()
Definition jpeg.c:406
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