On Thu, 27 Mar 2008 22:12:27 +0000, "James Shaw" <[EMAIL PROTECTED]> wrote:
> At long last, I've done some netsurf hacking.  I attach a patch which
> uses librosprite to provide sprite rendering in netsurf.  I've hacked
> the netsurf Makefile to build against my local copy of librosprite --
> grep for -I../../ and -L../../ to find them.  If someone could fix
> these, or tell me how, that'd be great.

See http://jmb.drobe.co.uk/rosprite.p for a patch to librosprite that
allows it to be installed. The NetSurf Makefile can then use pkg-config to
get the appropriate CFLAGS/LIBS additions.

As for your patch, it looks mostly fine, apart from the following:

image/nssprite.c:

> +bool nssprite_convert(struct content *c, int width, int height)
> +{
> +       struct rosprite_mem_context* ctx;
> +       ERRCHK(rosprite_create_mem_context(c->source_data, c->total_size,
&ctx));
> +
> +       struct rosprite_area* sprite_area;
> +       ERRCHK(rosprite_load(rosprite_mem_reader, ctx, &sprite_area));

This leaks ctx if rosprite_load() fails.

content/content.c:

>  @@ -769,6 +776,7 @@
>        c->locked = true;
>        c->available_width = width;
>        if (handler_map[c->type].convert) {
> +               LOG(("calling content handler's convert function for type
%d", c->type));
>                if (!handler_map[c->type].convert(c, width, height)) {
>                        c->status = CONTENT_STATUS_ERROR;
>                        c->locked = false;

This change is spurious.

Then, assuming my changes to librosprite are ok, the Makefile diff should
look something like:

@@ -100,7 +100,7 @@
 LDFLAGS := -lxml2 -lz -lm -lcurl -lssl -lcrypto -lmng -ljpeg
 else
-LDFLAGS := $(shell $(PKG_CONFIG) --libs libxml-2.0 libcurl openssl)
+LDFLAGS := $(shell $(PKG_CONFIG) --libs libxml-2.0 libcurl openssl
librosprite)
 LDFLAGS += -lz -lm -lmng -ljpeg
 endif

 ifeq ($(TARGET),gtk)
@@ -112,7 +112,7 @@
        -D_XOPEN_SOURCE=600 \
        -D_POSIX_C_SOURCE=200112L \
        -D_NETBSD_SOURCE \
        $(WARNFLAGS) -I. -g -O \
        $(shell $(PKG_CONFIG) --cflags libglade-2.0 gtk+-2.0 librsvg-2.0) \
+       $(shell $(PKG_CONFIG) --cflags librosprite) \
        $(shell xml2-config --cflags)


J.


Reply via email to