summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Pemberton <phil@philpem.me.uk>2003-06-05 13:17:55 +0000
committerPhilip Pemberton <phil@philpem.me.uk>2003-06-05 13:17:55 +0000
commit97dea9f287048685c295ba3418f1d0e540c6a10e (patch)
tree202a31a73300fc54e991c59de8659c22dd71c13a
parentde2c0f5d909e6192785fbaa68736631906f9db1a (diff)
downloadnetsurf-97dea9f287048685c295ba3418f1d0e540c6a10e.tar.gz
netsurf-97dea9f287048685c295ba3418f1d0e540c6a10e.tar.bz2
[project @ 2003-06-05 13:17:55 by philpem]
Added GIF decode support svn path=/import/netsurf/; revision=160
-rw-r--r--!NetSurf/Resources/intro,faf3
-rw-r--r--content/content.c6
-rw-r--r--content/content.h15
-rw-r--r--desktop/browser.c5
-rw-r--r--desktop/netsurf.c3
-rw-r--r--makefile3
-rw-r--r--render/html.c15
-rw-r--r--riscos/filetype.c3
-rw-r--r--riscos/plugin.c5
9 files changed, 43 insertions, 15 deletions
diff --git a/!NetSurf/Resources/intro,faf b/!NetSurf/Resources/intro,faf
index 8f27ea8c8..b1344798d 100644
--- a/!NetSurf/Resources/intro,faf
+++ b/!NetSurf/Resources/intro,faf
@@ -15,6 +15,8 @@ running <em>RISC OS</em>.</p>
<ul>
<li><a href="test1">Test page 1</a></li>
<li><a href="jpeg">JPEG image</a></li>
+<li><a href="png">PNG image</a></li>
+<li><a href="gif">GIF image</a></li>
<li><a href="text">Plain text</a></li>
</ul>
</div>
@@ -36,6 +38,7 @@ fetching</li>
<h2>In Progress</h2>
<ul>
<li><strong>PNGs <img src="png" alt=""> now partially supported</strong></li>
+<li><strong>GIFs <img src="gif" alt=""> now partially supported</strong></li>
<li>Improved memory handling (currently exits when memory is exhausted)</li>
<li>Forms (display but don't submit)</li>
<li><img style="float: left" src="jpeg" alt="">Images (JPEGs so far)</li>
diff --git a/content/content.c b/content/content.c
index 2a2cf700e..0538d52c3 100644
--- a/content/content.c
+++ b/content/content.c
@@ -1,5 +1,5 @@
/**
- * $Id: content.c,v 1.9 2003/05/10 11:13:34 bursa Exp $
+ * $Id: content.c,v 1.10 2003/06/05 13:17:55 philpem Exp $
*/
#include <assert.h>
@@ -11,6 +11,7 @@
#include "netsurf/render/textplain.h"
#include "netsurf/riscos/jpeg.h"
#include "netsurf/riscos/png.h"
+#include "netsurf/riscos/gif.h"
#include "netsurf/utils/utils.h"
@@ -20,6 +21,7 @@ struct mime_entry {
content_type type;
};
static const struct mime_entry mime_map[] = {
+ {"image/gif", CONTENT_GIF},
{"image/jpeg", CONTENT_JPEG},
{"image/png", CONTENT_PNG},
{"text/css", CONTENT_CSS},
@@ -49,6 +51,8 @@ static const struct handler_entry handler_map[] = {
{css_create, css_process_data, css_convert, css_revive, css_reformat, css_destroy, 0},
{nspng_create, nspng_process_data, nspng_convert, nspng_revive,
nspng_reformat, nspng_destroy, nspng_redraw},
+ {nsgif_create, nsgif_process_data, nsgif_convert, nsgif_revive,
+ nsgif_reformat, nsgif_destroy, nsgif_redraw}
};
diff --git a/content/content.h b/content/content.h
index 8a4fcbd17..c9fa9870b 100644
--- a/content/content.h
+++ b/content/content.h
@@ -1,5 +1,5 @@
/**
- * $Id: content.h,v 1.10 2003/05/10 11:13:34 bursa Exp $
+ * $Id: content.h,v 1.11 2003/06/05 13:17:55 philpem Exp $
*/
#ifndef _NETSURF_DESKTOP_CONTENT_H_
@@ -7,6 +7,7 @@
#include "libxml/HTMLparser.h"
#include "libpng/png.h"
+#include "libungif/gif_lib.h"
#include "oslib/osspriteop.h"
#include "netsurf/content/cache.h"
#include "netsurf/css/css.h"
@@ -34,6 +35,7 @@ typedef enum {
CONTENT_JPEG,
CONTENT_CSS,
CONTENT_PNG,
+ CONTENT_GIF,
CONTENT_OTHER
} content_type;
@@ -110,6 +112,17 @@ struct content
enum { PNG_PALETTE, PNG_DITHER, PNG_DEEP } type;
} png;
+ // Structure for the GIF handler
+ struct
+ {
+ GifFileType *giffile; // GIF file handler
+ char *data; // GIF data
+ unsigned long length; // Length of GIF data
+ unsigned long buffer_pos; // Position in the buffer
+ osspriteop_area *sprite_area; // Sprite area
+ char *sprite_image; // Sprite image
+ } gif;
+
} data;
struct cache_entry *cache;
diff --git a/desktop/browser.c b/desktop/browser.c
index 78a7636a7..21603de1e 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -1,5 +1,5 @@
/**
- * $Id: browser.c,v 1.38 2003/05/25 04:09:59 jmb Exp $
+ * $Id: browser.c,v 1.39 2003/06/05 13:17:55 philpem Exp $
*/
#include "netsurf/content/cache.h"
@@ -223,7 +223,8 @@ void browser_window_open_location_historical(struct browser_window* bw, const ch
fetchcache(url, 0, browser_window_callback, bw,
gui_window_get_width(bw->window), 0,
(1 << CONTENT_HTML) | (1 << CONTENT_TEXTPLAIN) |
- (1 << CONTENT_JPEG) | (1 << CONTENT_PNG));
+ (1 << CONTENT_JPEG) | (1 << CONTENT_PNG) |
+ (1 << CONTENT_GIF));
LOG(("end"));
}
diff --git a/desktop/netsurf.c b/desktop/netsurf.c
index bc62c0de0..a9912061a 100644
--- a/desktop/netsurf.c
+++ b/desktop/netsurf.c
@@ -1,5 +1,5 @@
/**
- * $Id: netsurf.c,v 1.9 2003/06/01 23:02:56 monkeyson Exp $
+ * $Id: netsurf.c,v 1.10 2003/06/05 13:17:55 philpem Exp $
*/
#include "netsurf/desktop/options.h"
@@ -34,6 +34,7 @@ void netsurf_init(int argc, char** argv)
fetch_init();
cache_init();
nspng_init();
+ nsgif_init();
}
diff --git a/makefile b/makefile
index e21c58e30..4b5f4c011 100644
--- a/makefile
+++ b/makefile
@@ -1,4 +1,4 @@
-# $Id: makefile,v 1.29 2003/06/05 11:03:20 bursa Exp $
+# $Id: makefile,v 1.30 2003/06/05 13:17:55 philpem Exp $
CC = riscos-gcc
OBJECTS = cache.o content.o fetch.o fetchcache.o \
@@ -16,6 +16,7 @@ WARNFLAGS = -W -Wall -Wundef -Wpointer-arith -Wbad-function-cast -Wcast-qual \
CFLAGS = $(WARNFLAGS) -I.. -I/usr/local/riscoslibs/include \
-Dfd_set=long -mpoke-function-name
LDFLAGS = \
+ /usr/local/riscoslibs/libungif/libungif.ro \
/usr/local/riscoslibs/libxml2/libxml2.ro \
/usr/local/riscoslibs/OSLib/OSLib32.ro \
/usr/local/riscoslibs/curl/libcurl.ro \
diff --git a/render/html.c b/render/html.c
index 8b572fd24..304de133c 100644
--- a/render/html.c
+++ b/render/html.c
@@ -1,5 +1,5 @@
/**
- * $Id: html.c,v 1.17 2003/05/10 11:13:34 bursa Exp $
+ * $Id: html.c,v 1.18 2003/06/05 13:17:55 philpem Exp $
*/
#include <assert.h>
@@ -119,7 +119,7 @@ int html_convert(struct content *c, unsigned int width, unsigned int height)
if (c->active != 0)
c->status = CONTENT_PENDING;
-
+
return 0;
}
@@ -226,7 +226,7 @@ void html_find_stylesheets(struct content *c, xmlNode *head)
}
xmlFree(media);
}
-
+
/* href='...' */
if (!(href = (char *) xmlGetProp(node, (const xmlChar *) "href")))
continue;
@@ -307,7 +307,7 @@ void html_find_stylesheets(struct content *c, xmlNode *head)
void html_fetch_image(struct content *c, char *url, struct box *box)
{
struct fetch_data *fetch_data;
-
+
/* add to object list */
c->data.html.object = xrealloc(c->data.html.object,
(c->data.html.object_count + 1) *
@@ -325,7 +325,8 @@ void html_fetch_image(struct content *c, char *url, struct box *box)
fetchcache(url, c->url,
html_image_callback,
fetch_data, 0, 0,
- (1 << CONTENT_JPEG) | (1 << CONTENT_PNG));
+ (1 << CONTENT_JPEG) | (1 << CONTENT_PNG) |
+ (1 << CONTENT_GIF));
}
@@ -416,7 +417,9 @@ void html_revive(struct content *c, unsigned int width, unsigned int height)
fetchcache(c->data.html.object[i].url, c->url,
html_image_callback,
fetch_data, 0, 0,
- (1 << CONTENT_JPEG) | (1 << CONTENT_PNG));
+ (1 << CONTENT_JPEG) |
+ (1 << CONTENT_PNG) |
+ (1 << CONTENT_GIF));
}
}
diff --git a/riscos/filetype.c b/riscos/filetype.c
index 520e2617a..ca50daf3b 100644
--- a/riscos/filetype.c
+++ b/riscos/filetype.c
@@ -1,5 +1,5 @@
/**
- * $Id: filetype.c,v 1.4 2003/05/10 11:13:34 bursa Exp $
+ * $Id: filetype.c,v 1.5 2003/06/05 13:17:55 philpem Exp $
*/
#include <stdlib.h>
@@ -15,6 +15,7 @@ struct type_entry {
char mime_type[16];
};
static const struct type_entry type_map[] = {
+ {0x695, "image/gif"},
{0xb60, "image/png"},
{0xc85, "image/jpeg"},
{0xf79, "text/css"},
diff --git a/riscos/plugin.c b/riscos/plugin.c
index 1d395ade2..526c347d6 100644
--- a/riscos/plugin.c
+++ b/riscos/plugin.c
@@ -1,5 +1,5 @@
/**
- * $Id: plugin.c,v 1.2 2003/06/02 21:09:50 jmb Exp $
+ * $Id: plugin.c,v 1.3 2003/06/05 13:17:55 philpem Exp $
*/
#include <assert.h>
@@ -41,7 +41,8 @@ void plugin_fetch(struct content* content, char* url, struct box* box,
/* OK, we have an image. Let's make the image handler
deal with it */
- if (mime_type == CONTENT_JPEG || mime_type == CONTENT_PNG) {
+ if (mime_type == CONTENT_JPEG || mime_type == CONTENT_PNG ||
+ mime_type == CONTENT_GIF) {
xfree(po);
LOG(("sending data to image handler"));