diff options
-rw-r--r-- | Makefile.defaults | 4 | ||||
-rw-r--r-- | amiga/Makefile.defaults | 4 | ||||
-rw-r--r-- | amiga/Makefile.target | 2 | ||||
-rw-r--r-- | atari/Makefile.defaults | 4 | ||||
-rw-r--r-- | cocoa/Makefile.defaults | 4 | ||||
-rw-r--r-- | gtk/Makefile.target | 2 | ||||
-rw-r--r-- | image/Makefile | 1 | ||||
-rw-r--r-- | image/image.c | 7 | ||||
-rw-r--r-- | image/webp.c | 229 | ||||
-rw-r--r-- | image/webp.h | 28 | ||||
-rw-r--r-- | monkey/Makefile.target | 4 |
11 files changed, 0 insertions, 289 deletions
diff --git a/Makefile.defaults b/Makefile.defaults index b8261ff64..e2d799950 100644 --- a/Makefile.defaults +++ b/Makefile.defaults @@ -47,10 +47,6 @@ NETSURF_USE_JPEG := YES # Valid options: YES, NO (highly recommended) NETSURF_USE_PNG := YES -# Enable NetSurf's use of libwebp for displaying WebPs -# Valid options: YES, NO -NETSURF_USE_WEBP := NO - # Enable NetSurf's use of gstreamer for displaying videos # Valid options: YES, NO NETSURF_USE_VIDEO := NO diff --git a/amiga/Makefile.defaults b/amiga/Makefile.defaults index cfd6a7629..0674a9de2 100644 --- a/amiga/Makefile.defaults +++ b/amiga/Makefile.defaults @@ -14,10 +14,6 @@ endif # Valid options: YES, NO, AUTO NETSURF_USE_ROSPRITE := NO -# Enable NetSurf's use of libwebp for displaying WebPs -# Valid options: YES, NO -NETSURF_USE_WEBP := NO - # Enable NetSurf to display Amiga icons # Valid options: YES, NO (recommended) NETSURF_USE_AMIGA_ICON := YES diff --git a/amiga/Makefile.target b/amiga/Makefile.target index 10e759b16..5c7bc3b45 100644 --- a/amiga/Makefile.target +++ b/amiga/Makefile.target @@ -14,7 +14,6 @@ NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG -NETSURF_FEATURE_WEBP_CFLAGS := -DWITH_WEBP NETSURF_FEATURE_NSSVG_CFLAGS := -DWITH_NS_SVG NETSURF_FEATURE_VIDEO_CFLAGS := -DWITH_VIDEO @@ -24,7 +23,6 @@ ifeq ($(HOST),amiga) $(eval $(call feature_enabled,GIF,-DWITH_GIF,-lnsgif,GIF (libnsgif))) $(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng) )) $(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny,SVG (libsvgtiny))) - $(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp,WebP (libwebp))) $(eval $(call feature_enabled,VIDEO,-DWITH_VIDEO -I /SDK/local/newlib/include/glib-2.0,-lgstreamer-0.10 -lglib-2.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lintl -lffi,Video (libgstreamer))) $(eval $(call feature_enabled,JS,-DXP_UNIX -DWITH_JS -DJS_VERSION=185,-lstdc++ -lmozjs185,JavaScript)) $(eval $(call feature_enabled,MOZJS,-DXP_AMIGA -DWITH_MOZJS -DJS_VERSION=170 -DJSVERSION_LATEST=170 -DJSOPTION_JIT=0 -DJSCLASS_GLOBAL_FLAGS=0,-ljs -lfdlibm,JavaScript)) diff --git a/atari/Makefile.defaults b/atari/Makefile.defaults index 211c8e65d..b738b48a2 100644 --- a/atari/Makefile.defaults +++ b/atari/Makefile.defaults @@ -10,10 +10,6 @@ NETSURF_USE_LIBICONV_PLUG := NO # Valid options: YES, NO, AUTO NETSURF_USE_ROSPRITE := NO -# Enable NetSurf's use of libwebp for displaying WebPs -# Valid options: YES, NO -NETSURF_USE_WEBP := NO - # Enable NetSurf's use of librsvg in conjunction with Cairo to display SVGs # Valid options: YES, NO, AUTO NETSURF_USE_RSVG := AUTO diff --git a/cocoa/Makefile.defaults b/cocoa/Makefile.defaults index 50da6674d..17c5df92e 100644 --- a/cocoa/Makefile.defaults +++ b/cocoa/Makefile.defaults @@ -10,10 +10,6 @@ NETSURF_USE_LIBICONV_PLUG := NO # Valid options: YES, NO, AUTO NETSURF_USE_ROSPRITE := NO -# Enable NetSurf's use of libwebp for displaying WebPs -# Valid options: YES, NO -NETSURF_USE_WEBP := NO - # Enable NetSurf's use of librsvg in conjunction with Cairo to display SVGs # Valid options: YES, NO, AUTO NETSURF_USE_RSVG := AUTO diff --git a/gtk/Makefile.target b/gtk/Makefile.target index d03f4f94d..8378c1096 100644 --- a/gtk/Makefile.target +++ b/gtk/Makefile.target @@ -14,7 +14,6 @@ NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG -NETSURF_FEATURE_WEBP_CFLAGS := -DWITH_WEBP NETSURF_FEATURE_JS_CFLAGS := -DWITH_JS -DJS_HAS_FILE_OBJECT=0 NETSURF_FEATURE_MOZJS_CFLAGS := -DWITH_MOZJS -DJS_HAS_FILE_OBJECT=0 NETSURF_FEATURE_VIDEO_CFLAGS := -DWITH_VIDEO @@ -27,7 +26,6 @@ $(eval $(call pkg_config_find_and_add_enabled,GIF,libnsgif,GIF)) $(eval $(call pkg_config_find_and_add_enabled,RSVG,librsvg-2.0,SVG)) $(eval $(call pkg_config_find_and_add_enabled,NSSVG,libsvgtiny,SVG)) $(eval $(call pkg_config_find_and_add_enabled,ROSPRITE,librosprite,Sprite)) -$(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp,WebP (libwebp))) $(eval $(call pkg_config_find_and_add_enabled,MOZJS,mozjs185,JavaScript)) $(eval $(call pkg_config_find_and_add_enabled,JS,mozilla-js,JavaScript)) $(eval $(call pkg_config_find_and_add_enabled,VIDEO,gstreamer-0.10,Video)) diff --git a/image/Makefile b/image/Makefile index 9992c5443..5851a1c43 100644 --- a/image/Makefile +++ b/image/Makefile @@ -10,7 +10,6 @@ S_IMAGE_$(NETSURF_USE_ROSPRITE) += nssprite.c S_IMAGE_$(NETSURF_USE_PNG) += png.c S_IMAGE_$(NETSURF_USE_NSSVG) += svg.c S_IMAGE_$(NETSURF_USE_RSVG) += rsvg.c -S_IMAGE_$(NETSURF_USE_WEBP) += webp.c S_IMAGE_$(NETSURF_USE_VIDEO) += video.c S_IMAGE := $(addprefix image/,$(S_IMAGE_YES)) diff --git a/image/image.c b/image/image.c index 339f7751e..49dc2b8b9 100644 --- a/image/image.c +++ b/image/image.c @@ -34,7 +34,6 @@ #include "image/png.h" #include "image/rsvg.h" #include "image/svg.h" -#include "image/webp.h" #include "image/image.h" /** @@ -94,12 +93,6 @@ nserror image_init(void) return error; #endif -#ifdef WITH_WEBP - error = webp_init(); - if (error != NSERROR_OK) - return error; -#endif /* WITH_WEBP */ - return NSERROR_OK; } diff --git a/image/webp.c b/image/webp.c deleted file mode 100644 index fc4356c01..000000000 --- a/image/webp.c +++ /dev/null @@ -1,229 +0,0 @@ - /* - * Copyright 2010 Chris Young <chris@unsatisfactorysoftware.co.uk> - * - * This file is part of NetSurf, http://www.netsurf-browser.org/ - * - * NetSurf is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * NetSurf is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/** \file - * Content for image/webp (libwebp implementation). - * - */ - -#include <assert.h> -#include <string.h> -#include <stdlib.h> -#include <webp/decode.h> -#include "desktop/plotters.h" -#include "image/bitmap.h" -#include "content/content_protected.h" -#include "utils/log.h" -#include "utils/messages.h" -#include "utils/utils.h" - -typedef struct webp_content -{ - struct content base; - - struct bitmap *bitmap; /**< Created NetSurf bitmap */ -} webp_content; - - -static nserror webp_create(const content_handler *handler, - lwc_string *imime_type, const http_parameter *params, - llcache_handle *llcache, const char *fallback_charset, - bool quirks, struct content **c) -{ - webp_content *webp; - nserror error; - - webp = calloc(1, sizeof(webp_content)); - if (webp == NULL) - return NSERROR_NOMEM; - - error = content__init(&webp->base, handler, imime_type, params, - llcache, fallback_charset, quirks); - if (error != NSERROR_OK) { - free(webp); - return error; - } - - *c = (struct content *) webp; - - return NSERROR_OK; -} - -/** - * Convert a CONTENT_WEBP for display. - * - * No conversion is necessary. We merely read the WebP dimensions. - */ - -static bool webp_convert(struct content *c) -{ - webp_content *webp = (webp_content *)c; - union content_msg_data msg_data; - const uint8_t *data; - unsigned char *imagebuf = NULL; - unsigned long size; - int width = 0, height = 0; - char *title; - int res = 0; - uint8_t *res_p = NULL; - - data = (uint8_t *)content__get_source_data(c, &size); - - res = WebPGetInfo(data, size, &width, &height); - if (res == 0) { - msg_data.error = messages_get("NoMemory"); - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); - return false; - } - - webp->bitmap = bitmap_create(width, height, BITMAP_NEW | BITMAP_OPAQUE); - if (!webp->bitmap) { - msg_data.error = messages_get("NoMemory"); - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); - return false; - } - - imagebuf = bitmap_get_buffer(webp->bitmap); - if (!imagebuf) { - msg_data.error = messages_get("NoMemory"); - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); - return false; - } - unsigned int row_width = bitmap_get_rowstride(webp->bitmap); - - res_p = WebPDecodeRGBAInto(data, size, imagebuf, - row_width * height, row_width); - if (res_p == NULL) { - msg_data.error = messages_get("NoMemory"); - content_broadcast(c, CONTENT_MSG_ERROR, msg_data); - return false; - } - - c->width = width; - c->height = height; - - /* set title */ - title = messages_get_buff("WebPTitle", - nsurl_access_leaf(llcache_handle_get_url(c->llcache)), - c->width, c->height); - if (title != NULL) { - content__set_title(c, title); - free(title); - } - - bitmap_modified(webp->bitmap); - - content_set_ready(c); - content_set_done(c); - - content_set_status(c, ""); - return true; -} - - -/** - * Destroy a CONTENT_WEBP and free all resources it owns. - */ - -static void webp_destroy(struct content *c) -{ - webp_content *webp = (webp_content *)c; - - if (webp->bitmap != NULL) - bitmap_destroy(webp->bitmap); -} - - -/** - * Redraw a CONTENT_WEBP. - */ - -static bool webp_redraw(struct content *c, struct content_redraw_data *data, - const struct rect *clip, const struct redraw_context *ctx) -{ - webp_content *webp = (webp_content *)c; - bitmap_flags_t flags = BITMAPF_NONE; - - if (data->repeat_x) - flags |= BITMAPF_REPEAT_X; - if (data->repeat_y) - flags |= BITMAPF_REPEAT_Y; - - return ctx->plot->bitmap(data->x, data->y, data->width, data->height, - webp->bitmap, data->background_colour, flags); -} - - -static nserror webp_clone(const struct content *old, struct content **newc) -{ - webp_content *webp; - nserror error; - - webp = calloc(1, sizeof(webp_content)); - if (webp == NULL) - return NSERROR_NOMEM; - - error = content__clone(old, &webp->base); - if (error != NSERROR_OK) { - content_destroy(&webp->base); - return error; - } - - /* Simply replay convert */ - if (old->status == CONTENT_STATUS_READY || - old->status == CONTENT_STATUS_DONE) { - if (webp_convert(&webp->base) == false) { - content_destroy(&webp->base); - return NSERROR_CLONE_FAILED; - } - } - - *newc = (struct content *) webp; - - return NSERROR_OK; -} - -static void *webp_get_internal(const struct content *c, void *context) -{ - webp_content *webp = (webp_content *)c; - - return webp->bitmap; -} - -static content_type webp_content_type(void) -{ - return CONTENT_IMAGE; -} - -static const content_handler webp_content_handler = { - .create = webp_create, - .data_complete = webp_convert, - .destroy = webp_destroy, - .redraw = webp_redraw, - .clone = webp_clone, - .get_internal = webp_get_internal, - .type = webp_content_type, - .no_share = false, -}; - -static const char *webp_types[] = { - "image/webp" -}; - -CONTENT_FACTORY_REGISTER_TYPES(webp, webp_types, webp_content_handler); - diff --git a/image/webp.h b/image/webp.h deleted file mode 100644 index 0abfec8ec..000000000 --- a/image/webp.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2010 Chris Young <chris@unsatisfactorysoftware.co.uk> - * - * This file is part of NetSurf, http://www.netsurf-browser.org/ - * - * NetSurf is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. - * - * NetSurf is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/** \file - * Content for image/webp (libwebp interface). - */ - -#ifndef _NETSURF_WEBP_H_ -#define _NETSURF_WEBP_H_ - -nserror webp_init(void); - -#endif diff --git a/monkey/Makefile.target b/monkey/Makefile.target index e07af903d..cb7bf1717 100644 --- a/monkey/Makefile.target +++ b/monkey/Makefile.target @@ -17,7 +17,6 @@ NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG -NETSURF_FEATURE_WEBP_CFLAGS := -DWITH_WEBP NETSURF_FEATURE_JS_CFLAGS := -DWITH_JS -DJS_HAS_FILE_OBJECT=0 NETSURF_FEATURE_MOZJS_CFLAGS := -DWITH_MOZJS -DJS_HAS_FILE_OBJECT=0 @@ -30,9 +29,6 @@ $(eval $(call pkg_config_find_and_add_enabled,PNG,libpng,PNG )) $(eval $(call pkg_config_find_and_add_enabled,MOZJS,mozjs185,JavaScript)) $(eval $(call pkg_config_find_and_add_enabled,JS,mozilla-js,JavaScript)) -# no pkg-config for this library -$(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp -lvpx,WebP (libwebp))) - CWARNFLAGS += -Werror CFLAGS += -std=c99 -Dmonkey -Dnsmonkey -g \ |