summaryrefslogtreecommitdiff
path: root/src/dicache.c
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2024-11-24 18:15:23 +0100
committerRodrigo Arias Mallo <rodarima@gmail.com>2024-11-24 19:08:41 +0100
commitb9e801cb940b45cfd9a4cf95bf5af68b084156b4 (patch)
tree655499d75bf733a773483caf22068e43c598defd /src/dicache.c
parent53fb37ae030c294e29e820cc4c34bca4d0ac2e27 (diff)
Add WebP image support
See: https://www.toomanyatoms.com/software/mobilized_dillo.html Authored-By: dogma
Diffstat (limited to 'src/dicache.c')
-rw-r--r--src/dicache.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/dicache.c b/src/dicache.c
index c9f4067b..e86f5655 100644
--- a/src/dicache.c
+++ b/src/dicache.c
@@ -19,14 +19,15 @@
#include "web.hh"
#include "dicache.h"
#include "dpng.h"
+#include "dwebp.h"
#include "dgif.h"
#include "djpeg.h"
#include "dsvg.h"
-
enum {
DIC_Gif,
DIC_Png,
+ DIC_Webp,
DIC_Jpeg,
DIC_Svg
};
@@ -390,6 +391,10 @@ static void *Dicache_image(int ImgType, const char *MimeType, void *Ptr,
DicEntry->Decoder = (CA_Callback_t)a_Gif_callback;
DicEntry->DecoderData =
a_Gif_new(web->Image, DicEntry->url, DicEntry->version);
+ } else if (ImgType == DIC_Webp) {
+ DicEntry->Decoder = (CA_Callback_t)a_Webp_callback;
+ DicEntry->DecoderData =
+ a_Webp_new(web->Image, DicEntry->url, DicEntry->version);
} else if (ImgType == DIC_Png) {
DicEntry->Decoder = (CA_Callback_t)a_Png_callback;
DicEntry->DecoderData =
@@ -422,6 +427,15 @@ void *a_Dicache_png_image(const char *Type, void *Ptr, CA_Callback_t *Call,
}
/**
+ * WEBP wrapper for Dicache_image()
+ */
+void *a_Dicache_webp_image(const char *Type, void *Ptr, CA_Callback_t *Call,
+ void **Data)
+{
+ return Dicache_image(DIC_Webp, Type, Ptr, Call, Data);
+}
+
+/**
* GIF wrapper for Dicache_image()
*/
void *a_Dicache_gif_image(const char *Type, void *Ptr, CA_Callback_t *Call,