summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--!NetSurf/Resources/en/licence.html,faf34
-rw-r--r--!NetSurf/Resources/it/licence.html,faf37
-rw-r--r--Docs/BUILDING-AmigaCross4
-rw-r--r--Docs/BUILDING-AmigaOS6
-rw-r--r--Docs/BUILDING-BeOS4
-rw-r--r--Docs/BUILDING-Framebuffer10
-rw-r--r--Docs/BUILDING-GTK10
-rw-r--r--Docs/BUILDING-ROCross2
-rw-r--r--Docs/env.sh2
-rw-r--r--Makefile1
-rw-r--r--Makefile.config.example7
-rw-r--r--Makefile.defaults10
-rw-r--r--amiga/Makefile.defaults4
-rw-r--r--amiga/Makefile.target1
-rw-r--r--atari/Makefile.defaults2
-rw-r--r--atari/Makefile.target1
-rw-r--r--beos/Makefile.target2
-rw-r--r--cocoa/Makefile.defaults1
-rw-r--r--framebuffer/Makefile.target2
-rw-r--r--image/Makefile1
-rw-r--r--image/image.c12
-rw-r--r--image/mng.c832
-rw-r--r--image/mng.h29
-rw-r--r--riscos/Makefile.target1
-rw-r--r--windows/Makefile.defaults3
-rw-r--r--windows/Makefile.target1
26 files changed, 18 insertions, 1001 deletions
diff --git a/!NetSurf/Resources/en/licence.html,faf b/!NetSurf/Resources/en/licence.html,faf
index 6375c56da..7b3aef628 100644
--- a/!NetSurf/Resources/en/licence.html,faf
+++ b/!NetSurf/Resources/en/licence.html,faf
@@ -158,12 +158,6 @@ version.</p>
<span><a href="#mit">MIT</a></span>
</dd>
-<dt><a href="http://www.libmng.com">libmng</a></dt>
-<dd>
-<span>&copy; 2000&ndash;2007 Gerard Juyn, Glenn Randers-Pehrson</span>
-<span><a href="#mng">MNG</a></span>
-</dd>
-
<dt><a href="http://ro-oslib.sourceforge.net/">OSLib</a></dt>
<dd>
<span>&copy; 1994&ndash;1998 Jonathan Coxhead and contributors</span>
@@ -642,34 +636,6 @@ ltmain.sh). Another support script, install-sh, is copyright by X Consortium
but is also freely distributable.
</div>
-<a name="mng" />
-<h3>MNG Licence</h3>
-<div class="licence">The MNG Library is supplied "AS IS". The Contributing Authors
-disclaim all warranties, expressed or implied, including, without
-limitation, the warranties of merchantability and of fitness for any
-purpose. The Contributing Authors assume no liability for direct,
-indirect, incidental, special, exemplary, or consequential damages,
-which may result from the use of the MNG Library, even if advised of
-the possibility of such damage.
-
-Permission is hereby granted to use, copy, modify, and distribute this
-source code, or portions hereof, for any purpose, without fee, subject
-to the following restrictions:
-
-1. The origin of this source code must not be misrepresented;
- you must not claim that you wrote the original software.
-
-2. Altered versions must be plainly marked as such and must not be
- misrepresented as being the original source.
-
-3. This Copyright notice may not be removed or altered from any source
- or altered source distribution.
-
-The Contributing Authors specifically permit, without fee, and
-encourage the use of this source code as a component to supporting
-the MNG and JNG file format in commercial products. If you use this
-source code in a product, acknowledgment would be highly appreciated.
-</div>
<a name="oslib" />
<h3>OSLib Licence</h3>
diff --git a/!NetSurf/Resources/it/licence.html,faf b/!NetSurf/Resources/it/licence.html,faf
index 1fa93b39e..b0a6c8ae3 100644
--- a/!NetSurf/Resources/it/licence.html,faf
+++ b/!NetSurf/Resources/it/licence.html,faf
@@ -150,13 +150,7 @@ dl.components > dd > span + span {
<span><a href="#mit">MIT</a></span>
</dd>
-<dt><a href="http://www.libmng.com">libmng</a></dt>
-<dd>
-<span>&copy; 2000&ndash;2007 Gerard Juyn, Glenn Randers-Pehrson</span>
-<span><a href="#mng">MNG</a></span>
-</dd>
-
-<dt><a href="http://ro-oslib.sourceforge.net/">OSLib</a></dt>
+q<dt><a href="http://ro-oslib.sourceforge.net/">OSLib</a></dt>
<dd>
<span>&copy; 1994&ndash;1998 Jonathan Coxhead and contributors</span>
<span><a href="#oslib">OSLib</a></span>
@@ -631,35 +625,6 @@ ltmain.sh). Another support script, install-sh, is copyright by X Consortium
but is also freely distributable.
</div>
-<a name="mng" />
-<h3>Licenza MNG</h3>
-<div class="licence">The MNG Library is supplied "AS IS". The Contributing Authors
-disclaim all warranties, expressed or implied, including, without
-limitation, the warranties of merchantability and of fitness for any
-purpose. The Contributing Authors assume no liability for direct,
-indirect, incidental, special, exemplary, or consequential damages,
-which may result from the use of the MNG Library, even if advised of
-the possibility of such damage.
-
-Permission is hereby granted to use, copy, modify, and distribute this
-source code, or portions hereof, for any purpose, without fee, subject
-to the following restrictions:
-
-1. The origin of this source code must not be misrepresented;
- you must not claim that you wrote the original software.
-
-2. Altered versions must be plainly marked as such and must not be
- misrepresented as being the original source.
-
-3. This Copyright notice may not be removed or altered from any source
- or altered source distribution.
-
-The Contributing Authors specifically permit, without fee, and
-encourage the use of this source code as a component to supporting
-the MNG and JNG file format in commercial products. If you use this
-source code in a product, acknowledgment would be highly appreciated.
-</div>
-
<a name="oslib" />
<h3>Licenza OSLib</h3>
<div class="licence">The copyright holder has granted a small relaxation of the
diff --git a/Docs/BUILDING-AmigaCross b/Docs/BUILDING-AmigaCross
index da2e2adf0..32762cd5b 100644
--- a/Docs/BUILDING-AmigaCross
+++ b/Docs/BUILDING-AmigaCross
@@ -70,10 +70,6 @@ openssl
libpng
-libmng
-http://www.aminet.net/dev/lib/libmng_so.lha
-http://www.aminet.net/dev/lib/libmng.lha
-
liblcms
http://www.aminet.net/dev/lib/liblcms_so.lha
http://www.aminet.net/dev/lib/liblcms_so.lha
diff --git a/Docs/BUILDING-AmigaOS b/Docs/BUILDING-AmigaOS
index 4dabf4f11..c15db573f 100644
--- a/Docs/BUILDING-AmigaOS
+++ b/Docs/BUILDING-AmigaOS
@@ -91,13 +91,13 @@
1> makelink sdk:local/newlib/lib/libcurl.so sobjs:libcurl-7.16.so soft
- libmng
+ libpng
--------
- NetSurf uses libMNG to display MNG and PNG files.
+ NetSurf uses libPNG to display PNG files.
It builds without any problems on OS4, or available from Aminet:
- http://www.aminet.net/package/dev/lib/libmng_so
+ http://www.aminet.net/package/dev/lib/libpng_so
OpenSSL
diff --git a/Docs/BUILDING-BeOS b/Docs/BUILDING-BeOS
index 83ced0e93..8d33a6808 100644
--- a/Docs/BUILDING-BeOS
+++ b/Docs/BUILDING-BeOS
@@ -89,10 +89,10 @@
TODO
- libmng
+ libpng
--------
- NetSurf uses libMNG to display MNG and PNG files.
+ NetSurf uses libPNG to display PNG files.
It should build just fine on BeOS.
diff --git a/Docs/BUILDING-Framebuffer b/Docs/BUILDING-Framebuffer
index 63ef02dd6..9cbd66065 100644
--- a/Docs/BUILDING-Framebuffer
+++ b/Docs/BUILDING-Framebuffer
@@ -218,7 +218,7 @@ Index: framebuffer/font_freetype.c
Debian-like OS:
- $ apt-get install libcurl3-dev libmng-dev
+ $ apt-get install libcurl3-dev libpng-dev
Recent OS versions might need libcurl4-dev instead of libcurl3-dev but
note that when it has not been built with OpenSSL, the SSL_CTX is not
@@ -228,15 +228,11 @@ Index: framebuffer/font_freetype.c
Fedora:
- $ yum install curl-devel libmng-devel lcms-devel
+ $ yum install curl-devel libpng-devel lcms-devel
Other:
- You'll need to install the development resources for libcurl3 and libmng.
-
- Note that if you don't require MNG or JNG image support, NetSurf can be
- configured to use libpng instead of libmng. If you wish to do this, install
- the libpng development package instead.
+ You'll need to install the development resources for libcurl3 and libpng.
The NetSurf project's libraries
---------------------------------
diff --git a/Docs/BUILDING-GTK b/Docs/BUILDING-GTK
index 35fcd02db..4641924f8 100644
--- a/Docs/BUILDING-GTK
+++ b/Docs/BUILDING-GTK
@@ -66,7 +66,7 @@
Debian-like OS:
- $ apt-get install libgtk2.0-dev libcurl3-dev libmng-dev
+ $ apt-get install libgtk2.0-dev libcurl3-dev libpng-dev
$ apt-get install librsvg2-dev libjpeg-dev
If you want to build with gtk 3 replace libgtk2.0-dev with libgtk-3-dev
@@ -84,17 +84,13 @@
Fedora:
- $ yum install curl-devel libmng-devel
+ $ yum install curl-devel libpng-devel
$ yum install librsvg2-devel expat-devel
Other:
You'll need to install the development resources for libglade2, libcurl3,
- libmng and librsvg.
-
- Note that if you don't require MNG or JNG image support, NetSurf can be
- configured to use libpng instead of libmng. If you wish to do this, install
- the libpng development package instead.
+ libpng and librsvg.
The NetSurf project's libraries
---------------------------------
diff --git a/Docs/BUILDING-ROCross b/Docs/BUILDING-ROCross
index f82ff2ad7..e28847f8d 100644
--- a/Docs/BUILDING-ROCross
+++ b/Docs/BUILDING-ROCross
@@ -56,8 +56,6 @@
$ ../autobuilder/build libpng12-0
- $ ../autobuilder/build libmng1
-
$ ../autobuilder/build oslib
B. NetSurf libraries
diff --git a/Docs/env.sh b/Docs/env.sh
index 8946e46e2..27ae2e92d 100644
--- a/Docs/env.sh
+++ b/Docs/env.sh
@@ -53,7 +53,7 @@ NS_BROWSER="netsurf"
# deb packages
NS_DEV_DEB="build-essential pkg-config git gperf"
NS_TOOL_DEB="flex bison"
-NS_GTK_DEB="libgtk2.0-dev libcurl3-dev libmng-dev librsvg2-dev libjpeg-dev libmozjs-dev"
+NS_GTK_DEB="libgtk2.0-dev libcurl3-dev libpng-dev librsvg2-dev libjpeg-dev libmozjs-dev"
#add target specific libraries
if [ "x${TARGET_ABI}" = "xriscos" ]; then
diff --git a/Makefile b/Makefile
index 32b1afd07..1638f3228 100644
--- a/Makefile
+++ b/Makefile
@@ -432,7 +432,6 @@ endif
include Makefile.defaults
$(eval $(call feature_enabled,JPEG,-DWITH_JPEG,-ljpeg,JPEG (libjpeg)))
-$(eval $(call feature_enabled,MNG,-DWITH_MNG,-lmng,JNG/MNG/PNG (libmng)))
$(eval $(call feature_enabled,HARU_PDF,-DWITH_PDF_EXPORT,-lhpdf -lpng,PDF export (haru)))
$(eval $(call feature_enabled,LIBICONV_PLUG,-DLIBICONV_PLUG,,glibc internal iconv))
diff --git a/Makefile.config.example b/Makefile.config.example
index a142d4610..8737e5372 100644
--- a/Makefile.config.example
+++ b/Makefile.config.example
@@ -8,10 +8,9 @@
# To see the available config options, look at Makefile.defaults, but make any
# alterations in your Makefile.config
-
-### To enable/disable MNG support, uncomment the appropriate line below.
-# override NETSURF_USE_MNG := YES
-# override NETSURF_USE_MNG := NO
+### To enable/disable PNG support, uncomment the appropriate line below.
+# override NETSURF_USE_PNG := YES
+# override NETSURF_USE_PNG := NO
### To enable/disable SVGTiny support, uncomment the appropriate line below.
# override NETSURF_USE_NSSVG := YES
diff --git a/Makefile.defaults b/Makefile.defaults
index 515f4a042..e11fa1fb6 100644
--- a/Makefile.defaults
+++ b/Makefile.defaults
@@ -43,16 +43,10 @@ NETSURF_USE_GIF := YES
# Valid options: YES, NO (highly recommended)
NETSURF_USE_JPEG := YES
-# Enable NetSurf's use of libpng for displaying PNGs. If MNG and PNG
-# are both enabled then NetSurf will choose libpng for PNGs, leaving
-# MNGs and JNGs to libmng.
-# Valid options: YES, NO (at least one of PNG/MNG highly recommended)
+# Enable NetSurf's use of libpng for displaying PNGs.
+# Valid options: YES, NO (highly recommended)
NETSURF_USE_PNG := YES
-# Enable NetSurf's use of libmng for displaying MNGs, JNGs and PNGs
-# Valid options: YES, NO (at least one of PNG/MNG highly recommended)
-NETSURF_USE_MNG := YES
-
# Enable NetSurf's use of libwebp for displaying WebPs
# Valid options: YES, NO
NETSURF_USE_WEBP := NO
diff --git a/amiga/Makefile.defaults b/amiga/Makefile.defaults
index 5ff1b69c3..35c35ae76 100644
--- a/amiga/Makefile.defaults
+++ b/amiga/Makefile.defaults
@@ -10,10 +10,6 @@
# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE := NO
- # Enable NetSurf's use of libmng for displaying MNGs, JNGs and PNGs
- # Valid options: YES, NO (at least one of PNG/MNG/DT highly recommended)
- NETSURF_USE_MNG := NO
-
# Enable NetSurf's use of libwebp for displaying WebPs
# Valid options: YES, NO
NETSURF_USE_WEBP := NO
diff --git a/amiga/Makefile.target b/amiga/Makefile.target
index 484c57dcb..b3220a142 100644
--- a/amiga/Makefile.target
+++ b/amiga/Makefile.target
@@ -23,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,MNG,,-llcms -ljpeg,PNG/JNG/MNG (libmng)))
$(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))
diff --git a/atari/Makefile.defaults b/atari/Makefile.defaults
index ccc9b49ce..d4ef0232b 100644
--- a/atari/Makefile.defaults
+++ b/atari/Makefile.defaults
@@ -22,8 +22,6 @@
# Valid options: YES, NO, AUTO
NETSURF_USE_NSSVG := AUTO
- NETSURF_USE_MNG := NO
-
# Enable Spidermonkey JavaScript engine
# Valid options: YES, NO
NETSURF_USE_MOZJS := NO
diff --git a/atari/Makefile.target b/atari/Makefile.target
index 283361355..bc79b0625 100644
--- a/atari/Makefile.target
+++ b/atari/Makefile.target
@@ -35,7 +35,6 @@ endif
FREETYPE_FONT_CFLAGS := $(shell freetype-config --cflags) -DWITH_FREETYPE_FONT_DRIVER
SPIDERMONKEY_CFLAGS := -DWITH_MOZJS -DXP_UNIX -DJS_HAS_FILE_OBJECT=0 -DJSOPTION_JIT=0 -DPOSIX_SOURCE -D_BSD_SOURCE
-$(eval $(call feature_enabled,MNG,-DWITH_MNG,-lmng,PNG/MNG/JNG (libmng)))
$(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng)))
$(eval $(call feature_enabled,MOZJS,$(SPIDERMONKEY_CFLAGS),-ljs,JavaScript (Spidermonkey)))
$(eval $(call feature_enabled,ATARI_FREETYPE_FONT,$(FREETYPE_FONT_CFLAGS),-lfreetype,(Freetype)))
diff --git a/beos/Makefile.target b/beos/Makefile.target
index 499ec16e9..81e2a951e 100644
--- a/beos/Makefile.target
+++ b/beos/Makefile.target
@@ -32,7 +32,6 @@ RSRC_BEOS = $(addprefix $(OBJROOT)/,$(subst /,_,$(patsubst %.rdef,%.rsrc,$(RDEF_
RESOURCES = $(RSRC_BEOS)
ifeq ($(HOST),beos)
CFLAGS += -I/boot/home/config/include \
- -I/boot/home/config/include/libmng \
-I/boot/home/config/include/hubbub \
-I/boot/home/config/include/libcss \
-I/boot/home/config/include/parserutils
@@ -42,7 +41,6 @@ ifeq ($(HOST),beos)
ifneq ($(wildcard /boot/develop/lib/*/libnetwork.so),)
# Haiku
CFLAGS += -I/boot/common/include \
- -I/boot/common/include/libmng \
-I/boot/common/include/hubbub \
-I/boot/common/include/libcss \
-I/boot/common/include/parserutils
diff --git a/cocoa/Makefile.defaults b/cocoa/Makefile.defaults
index b2f64ec56..24517490c 100644
--- a/cocoa/Makefile.defaults
+++ b/cocoa/Makefile.defaults
@@ -22,7 +22,6 @@
# Valid options: YES, NO, AUTO
NETSURF_USE_NSSVG := AUTO
- NETSURF_USE_MNG := NO
NETSURF_USE_BMP := NO
NETSURF_USE_GIF := NO
NETSURF_USE_PNG := NO
diff --git a/framebuffer/Makefile.target b/framebuffer/Makefile.target
index d423e298f..5c658925e 100644
--- a/framebuffer/Makefile.target
+++ b/framebuffer/Makefile.target
@@ -2,8 +2,6 @@
# Framebuffer target setup
# ----------------------------------------------------------------------------
-
-$(eval $(call feature_enabled,MNG,-DWITH_MNG,-lmng,PNG/MNG/JNG (libmng)))
$(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng) ))
ifeq ($(NETSURF_FB_FONTLIB),freetype)
diff --git a/image/Makefile b/image/Makefile
index becd944cd..9992c5443 100644
--- a/image/Makefile
+++ b/image/Makefile
@@ -6,7 +6,6 @@ S_IMAGE_NO :=
S_IMAGE_$(NETSURF_USE_BMP) += bmp.c ico.c
S_IMAGE_$(NETSURF_USE_GIF) += gif.c
S_IMAGE_$(NETSURF_USE_JPEG) += jpeg.c
-S_IMAGE_$(NETSURF_USE_MNG) += mng.c
S_IMAGE_$(NETSURF_USE_ROSPRITE) += nssprite.c
S_IMAGE_$(NETSURF_USE_PNG) += png.c
S_IMAGE_$(NETSURF_USE_NSSVG) += svg.c
diff --git a/image/image.c b/image/image.c
index becf221b9..97ab2c0a3 100644
--- a/image/image.c
+++ b/image/image.c
@@ -31,7 +31,6 @@
#include "image/gif.h"
#include "image/ico.h"
#include "image/jpeg.h"
-#include "image/mng.h"
#include "image/nssprite.h"
#include "image/png.h"
#include "image/rsvg.h"
@@ -73,18 +72,7 @@ nserror image_init(void)
return error;
#endif
-#ifdef WITH_MNG
- error = nsmng_init();
- if (error != NSERROR_OK)
- return error;
-
- error = nsjpng_init();
- if (error != NSERROR_OK)
- return error;
-#endif
-
#ifdef WITH_PNG
- /* Prefer libpng over libmng for pngs by registering later */
error = nspng_init();
if (error != NSERROR_OK)
return error;
diff --git a/image/mng.c b/image/mng.c
deleted file mode 100644
index 325d1d192..000000000
--- a/image/mng.c
+++ /dev/null
@@ -1,832 +0,0 @@
-/*
- * Copyright 2005 Richard Wilson <info@tinct.net>
- *
- * 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/mng, image/png, and image/jng (implementation).
- */
-
-#include <assert.h>
-#include <stdbool.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/time.h>
-#include <time.h>
-#include <libmng.h>
-#include "content/content_protected.h"
-#include "utils/nsoption.h"
-#include "desktop/plotters.h"
-#include "image/bitmap.h"
-#include "image/mng.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/schedule.h"
-#include "utils/utils.h"
-
-/* This implementation does not currently support dynamic MNGs or any
- * form of colour/gamma correction,
- */
-
-typedef struct nsmng_content
-{
- struct content base;
-
- bool opaque_test_pending;
- bool read_start;
- bool read_resume;
- int read_size;
- bool waiting;
- bool displayed;
- void *handle;
-
- struct bitmap *bitmap; /**< Created NetSurf bitmap */
-} nsmng_content;
-
-
-#ifndef MNG_INTERNAL_MEMMNGMT
-
-/**
- * Memory allocation callback for libmng.
- */
-
-static mng_ptr nsmng_alloc(mng_size_t n)
-{
- return calloc(1, n);
-}
-
-
-/**
- * Memory free callback for libmng.
- */
-
-static void nsmng_free(mng_ptr p, mng_size_t n)
-{
- free(p);
-}
-
-#endif
-
-/**
- * Broadcasts an error message and returns false
- *
- * \param c the content to broadcast for
- * \return Appropriate error
- */
-static nserror nsmng_broadcast_error(nsmng_content *c, mng_retcode code)
-{
- union content_msg_data msg_data;
- char error[100];
-
- assert(c != NULL);
-
- if (code == MNG_OUTOFMEMORY) {
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data);
- return NSERROR_NOMEM;
- }
-
- snprintf(error, sizeof error, messages_get("MNGError"), code);
- msg_data.error = error;
- content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data);
- return NSERROR_MNG_ERROR;
-}
-
-/* CALLBACKS REQUIRED FOR libmng READING */
-
-static mng_bool nsmng_openstream(mng_handle mng)
-{
- assert(mng != NULL);
- return MNG_TRUE;
-}
-
-static mng_bool nsmng_readdata(mng_handle mng, mng_ptr buffer, mng_uint32 size,
- mng_uint32 *bytesread)
-{
- nsmng_content *c;
- const char *data;
- unsigned long data_size;
-
- assert(mng != NULL);
- assert(buffer != NULL);
- assert(bytesread != NULL);
-
- /* Get our content back
- */
- c = (nsmng_content *) mng_get_userdata(mng);
- assert(c != NULL);
-
- /* Copy any data we have (maximum of 'size')
- */
- data = content__get_source_data(&c->base, &data_size);
-
- *bytesread = ((data_size - c->read_size) < size) ?
- (data_size - c->read_size) : size;
-
- if ((*bytesread) > 0) {
- memcpy(buffer, data + c->read_size, *bytesread);
- c->read_size += *bytesread;
- }
-
- /* Return success
- */
- return MNG_TRUE;
-}
-
-static mng_bool nsmng_closestream(mng_handle mng)
-{
- assert(mng != NULL);
- return MNG_TRUE;
-}
-
-static mng_bool nsmng_processheader(mng_handle mng, mng_uint32 width,
- mng_uint32 height)
-{
- nsmng_content *c;
- union content_msg_data msg_data;
- uint8_t *buffer;
-
- assert(mng != NULL);
-
- /* This function is called when the header has been read and we
- know the dimensions of the canvas.
- */
- c = (nsmng_content *) mng_get_userdata(mng);
- assert(c != NULL);
-
- c->bitmap = bitmap_create(width, height, BITMAP_NEW);
- if (c->bitmap == NULL) {
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data);
- LOG(("Insufficient memory to create canvas."));
- return MNG_FALSE;
- }
-
- /* Get the buffer to ensure that it is allocated and the calls in
- * nsmng_getcanvasline() succeed. */
- buffer = bitmap_get_buffer(c->bitmap);
- if (buffer == NULL) {
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data);
- LOG(("Insufficient memory to create canvas."));
- return MNG_FALSE;
- }
-
- /* Initialise the content size
- */
- c->base.width = width;
- c->base.height = height;
-
- /* Set the canvas style
- */
- if (mng_set_canvasstyle(mng, MNG_CANVAS_RGBA8) != MNG_NOERROR) {
- LOG(("Error setting canvas style."));
- }
-
- /* Return success
- */
- return MNG_TRUE;
-}
-
-
-/* END OF CALLBACKS REQUIRED FOR READING
-*/
-
-
-static bool nsmng_process_data(struct content *c, const char *data, unsigned int size)
-{
- nsmng_content *mng = (nsmng_content *) c;
- mng_retcode status;
-
- assert(c != NULL);
- assert(data != NULL);
-
- /* We only need to do any processing if we're starting/resuming reading.
- */
- if ((!mng->read_resume) && (!mng->read_start))
- return true;
-
- /* Try to start processing, or process some more data
- */
- if (mng->read_start) {
- status = mng_read(mng->handle);
- mng->read_start = false;
- } else {
- status = mng_read_resume(mng->handle);
- }
- mng->read_resume = (status == MNG_NEEDMOREDATA);
- if ((status != MNG_NOERROR) && (status != MNG_NEEDMOREDATA)) {
- LOG(("Failed to start/continue reading (%i).", status));
- return nsmng_broadcast_error(mng, status) == NSERROR_OK;
- }
-
- /* Continue onwards
- */
- return true;
-}
-
-/* START OF CALLBACKS REQUIRED FOR DISPLAYING
-*/
-
-
-static mng_ptr nsmng_getcanvasline(mng_handle mng, mng_uint32 line)
-{
- nsmng_content *c;
-
- assert(mng != NULL);
-
- /* Get our content back
- */
- c = (nsmng_content *) mng_get_userdata(mng);
- assert(c != NULL);
-
- /* Calculate the address
- */
- return bitmap_get_buffer(c->bitmap) +
- bitmap_get_rowstride(c->bitmap) * line;
-}
-
-static mng_bool nsmng_refresh(mng_handle mng, mng_uint32 x, mng_uint32 y,
- mng_uint32 w, mng_uint32 h)
-{
- union content_msg_data data;
- nsmng_content *c;
-
- assert(mng != NULL);
-
- /* Get our content back
- */
- c = (nsmng_content *) mng_get_userdata(mng);
- assert(c != NULL);
-
- /* Set the minimum redraw area
- */
- data.redraw.x = x;
- data.redraw.y = y;
- data.redraw.width = w;
- data.redraw.height = h;
-
- /* Set the redraw area to the whole canvas to ensure that if
- we can redraw something to trigger animation later then we do
- */
-/* data.redraw.x = 0;
- data.redraw.y = 0;
- data.redraw.width = c->width;
- data.redraw.height = c->height;
-*/
- /* Always redraw everything
- */
- data.redraw.full_redraw = true;
-
- /* Set the object characteristics
- */
- data.redraw.object = &c->base;
- data.redraw.object_x = 0;
- data.redraw.object_y = 0;
- data.redraw.object_width = c->base.width;
- data.redraw.object_height = c->base.height;
-
- /* Only attempt to force the redraw if we've been requested to
- * display the image in the first place (i.e. nsmng_redraw has
- * been called). This avoids the situation of forcibly redrawing
- * an image that shouldn't be shown (e.g. if the image is a fallback
- * for an object that can't be rendered)
- */
- if (c->displayed)
- content_broadcast(&c->base, CONTENT_MSG_REDRAW, data);
-
- return MNG_TRUE;
-}
-
-/**
- * Animates to the next frame
- */
-static void nsmng_animate(void *p)
-{
- nsmng_content *c;
-
- assert(p != NULL);
-
- c = (nsmng_content *) p;
-
- /* If we used the last animation we advance, if not we try again later
- */
- if (c->base.user_list->next == NULL) {
- c->waiting = true;
- } else {
- c->waiting = false;
- mng_display_resume(c->handle);
- c->opaque_test_pending = true;
- if (c->bitmap)
- bitmap_modified(c->bitmap);
- }
-}
-
-static mng_bool nsmng_settimer(mng_handle mng, mng_uint32 msecs)
-{
- nsmng_content *c;
-
- assert(mng != NULL);
-
- /* Get our content back
- */
- c = (nsmng_content *) mng_get_userdata(mng);
- assert(c != NULL);
-
- /* Perform the scheduling
- */
- schedule(msecs / 10, nsmng_animate, c);
- return MNG_TRUE;
-}
-
-/**
- * Get the wall-clock time in milliseconds since some fixed time.
- */
-
-static mng_uint32 nsmng_gettickcount(mng_handle mng)
-{
- static bool start = true;
- static time_t t0;
- struct timeval tv;
-#if defined(__SVR4) && defined(__sun) || defined(__NetBSD__) || \
- defined(__APPLE__)
- /* Solaris, NetBSD, and OS X don't have this structure, and ignore the
- * second parameter to gettimeofday()
- */
- int tz;
-#else
- struct timezone tz;
-#endif
- assert(mng != NULL);
-
- gettimeofday(&tv, &tz);
- if (start) {
- t0 = tv.tv_sec;
- start = false;
- }
-
- return (tv.tv_sec - t0) * 1000 + tv.tv_usec / 1000;
-}
-
-/* END OF CALLBACKS REQUIRED FOR DISPLAYING
-*/
-
-static mng_bool nsmng_errorproc(mng_handle mng, mng_int32 code,
- mng_int8 severity, mng_chunkid chunktype, mng_uint32 chunkseq,
- mng_int32 extra1, mng_int32 extra2, mng_pchar text)
-{
- nsmng_content *c;
- char chunk[5];
-
- assert(mng != NULL);
-
- c = (nsmng_content *) mng_get_userdata(mng);
- assert(c != NULL);
-
- chunk[0] = (char)((chunktype >> 24) & 0xFF);
- chunk[1] = (char)((chunktype >> 16) & 0xFF);
- chunk[2] = (char)((chunktype >> 8) & 0xFF);
- chunk[3] = (char)((chunktype ) & 0xFF);
- chunk[4] = '\0';
-
- LOG(("error playing '%s' chunk %s (%d):",
- content_get_url(&c->base), chunk, chunkseq));
- LOG(("code %d severity %d extra1 %d extra2 %d text:'%s'", code,
- severity, extra1, extra2, text));
-
- return (0);
-}
-
-static nserror nsmng_create_mng_data(nsmng_content *c)
-{
- mng_retcode code;
- union content_msg_data msg_data;
-
- assert(c != NULL);
-
- /* Initialise the library
- */
-#ifdef MNG_INTERNAL_MEMMNGMT
- c->handle = mng_initialize(c, MNG_NULL, MNG_NULL, MNG_NULL);
-#else
- c->handle = mng_initialize(c, nsmng_alloc, nsmng_free, MNG_NULL);
-#endif
- if (c->handle == MNG_NULL) {
- LOG(("Unable to initialise MNG library."));
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data);
- return NSERROR_NOMEM;
- }
-
- /* We need to decode in suspension mode
- */
- code = mng_set_suspensionmode(c->handle, MNG_TRUE);
- if (code) {
- LOG(("Unable to set suspension mode."));
- return nsmng_broadcast_error(c, code);
- }
-
- /* We need to register our callbacks
- */
- code = mng_setcb_openstream(c->handle, nsmng_openstream);
- if (code) {
- LOG(("Unable to set openstream callback."));
- return nsmng_broadcast_error(c, code);
- }
- code = mng_setcb_readdata(c->handle, nsmng_readdata);
- if (code) {
- LOG(("Unable to set readdata callback."));
- return nsmng_broadcast_error(c, code);
- }
- code = mng_setcb_closestream(c->handle, nsmng_closestream);
- if (code) {
- LOG(("Unable to set closestream callback."));
- return nsmng_broadcast_error(c, code);
- }
- code = mng_setcb_processheader(c->handle, nsmng_processheader);
- if (code) {
- LOG(("Unable to set processheader callback."));
- return nsmng_broadcast_error(c, code);
- }
-
- /* Register our callbacks for displaying
- */
- code = mng_setcb_getcanvasline(c->handle, nsmng_getcanvasline);
- if (code) {
- LOG(("Unable to set getcanvasline callback."));
- return nsmng_broadcast_error(c, code);
- }
- code = mng_setcb_refresh(c->handle, nsmng_refresh);
- if (code) {
- LOG(("Unable to set refresh callback."));
- return nsmng_broadcast_error(c, code);
- }
- code = mng_setcb_gettickcount(c->handle, nsmng_gettickcount);
- if (code) {
- LOG(("Unable to set gettickcount callback."));
- return nsmng_broadcast_error(c, code);
- }
- code = mng_setcb_settimer(c->handle, nsmng_settimer);
- if (code) {
- LOG(("Unable to set settimer callback."));
- return nsmng_broadcast_error(c, code);
- }
-
- /* register error handling function */
- code = mng_setcb_errorproc(c->handle, nsmng_errorproc);
- if (code) {
- LOG(("Unable to set errorproc"));
- return nsmng_broadcast_error(c, code);
- }
-
- /* Initialise the reading
- */
- c->read_start = true;
- c->read_resume = false;
- c->read_size = 0;
- c->waiting = false;
-
- c->displayed = false;
-
- return NSERROR_OK;
-}
-
-static nserror nsmng_create(const content_handler *handler,
- lwc_string *imime_type, const struct http_parameter *params,
- llcache_handle *llcache, const char *fallback_charset,
- bool quirks, struct content **c)
-{
- nsmng_content *mng;
- nserror error;
-
- mng = calloc(1, sizeof(nsmng_content));
- if (mng == NULL)
- return NSERROR_NOMEM;
-
- error = content__init(&mng->base, handler, imime_type, params,
- llcache, fallback_charset, quirks);
- if (error != NSERROR_OK) {
- free(mng);
- return error;
- }
-
- error = nsmng_create_mng_data(mng);
- if (error != NSERROR_OK) {
- free(mng);
- return error;
- }
-
- *c = (struct content *) mng;
-
- return NSERROR_OK;
-}
-
-
-
-static bool nsmng_convert(struct content *c)
-{
- nsmng_content *mng = (nsmng_content *) c;
- mng_retcode status;
- unsigned long size;
- char *title;
-
- assert(c != NULL);
-
- content__get_source_data(c, &size);
-
- /* by this point, the png should have been parsed
- * and the bitmap created, so ensure that's the case
- */
- if (mng->bitmap == NULL) {
- return nsmng_broadcast_error(mng, -1) == NSERROR_OK;
- }
-
-
- /* set title text */
- title = messages_get_buff("MNGTitle",
- nsurl_access_leaf(llcache_handle_get_url(c->llcache)),
- c->width, c->height);
- if (title != NULL) {
- content__set_title(c, title);
- free(title);
- }
-
- c->size += c->width * c->height * 4;
- content_set_ready(c);
- content_set_done(c);
- /* Done: update status bar */
- content_set_status(c, "");
-
- /* jmb: I'm really not sure that this should be here.
- * The *_convert functions are for converting a content into a
- * displayable format. They should not, however, do anything which
- * could cause the content to be displayed; the content may have
- * hidden visibility or be a fallback for an object; this
- * information is not available here (nor is there any need for it
- * to be).
- * The specific issue here is that mng_display calls the display
- * callbacks, which include nsmng_refresh. nsmng_refresh forces
- * a content to be redrawn regardless of whether it should be
- * displayed or not.
- */
- /* Start displaying
- */
- status = mng_display(mng->handle);
- if ((status != MNG_NOERROR) && (status != MNG_NEEDTIMERWAIT)) {
- LOG(("Unable to start display (%i)", status));
- return nsmng_broadcast_error(mng, status) == NSERROR_OK;
- }
- bitmap_modified(mng->bitmap);
-
- /* Optimise the plotting of MNG */
- mng->opaque_test_pending = false;
-
- return true;
-}
-
-static bool nsjpng_convert(struct content *c)
-{
- nsmng_content *mng = (nsmng_content *) c;
- mng_retcode status;
- unsigned long size;
- char *title;
- mng_handle handle;
-
- assert(c != NULL);
-
- content__get_source_data(c, &size);
-
- /* by this point, the png should have been parsed
- * and the bitmap created, so ensure that's the case
- */
- if (mng->bitmap == NULL) {
- return nsmng_broadcast_error(mng, -1) == NSERROR_OK;
- }
-
- /* set title text */
- title = messages_get_buff("PNGTitle",
- nsurl_access_leaf(llcache_handle_get_url(c->llcache)),
- c->width, c->height);
- if (title != NULL) {
- content__set_title(c, title);
- free(title);
- }
-
- c->size += c->width * c->height * 4;
- content_set_ready(c);
- content_set_done(c);
- /* Done: update status bar */
- content_set_status(c, "");
-
- /* jmb: I'm really not sure that this should be here.
- * The *_convert functions are for converting a content into a
- * displayable format. They should not, however, do anything which
- * could cause the content to be displayed; the content may have
- * hidden visibility or be a fallback for an object; this
- * information is not available here (nor is there any need for it
- * to be).
- * The specific issue here is that mng_display calls the display
- * callbacks, which include nsmng_refresh. nsmng_refresh forces
- * a content to be redrawn regardless of whether it should be
- * displayed or not.
- */
- /* Start displaying
- */
- status = mng_display(mng->handle);
- if ((status != MNG_NOERROR) && (status != MNG_NEEDTIMERWAIT)) {
- LOG(("Unable to start display (%i)", status));
- return nsmng_broadcast_error(mng, status) == NSERROR_OK;
- }
- bitmap_modified(mng->bitmap);
-
- /* Optimise the plotting of JNG/PNGs
- */
- mng->opaque_test_pending = true;
- bitmap_set_opaque(mng->bitmap, false);
-
- /* free associated memory */
-
- handle = mng->handle;
-
- mng_cleanup(&handle);
-
- mng->handle = NULL;
-
- return true;
-}
-
-static void nsmng_destroy(struct content *c)
-{
- nsmng_content *mng = (nsmng_content *) c;
-
- assert (c != NULL);
-
- /* Cleanup the MNG structure and release the canvas memory
- */
- schedule_remove(nsmng_animate, c);
-
- if (mng->handle != NULL) {
- mng_handle handle = mng->handle;
-
- mng_cleanup(&handle);
-
- mng->handle = NULL;
- }
-
- if (mng->bitmap) {
- bitmap_destroy(mng->bitmap);
- }
-}
-
-
-static bool nsmng_redraw(struct content *c, struct content_redraw_data *data,
- const struct rect *clip, const struct redraw_context *ctx)
-{
- nsmng_content *mng = (nsmng_content *) c;
- bool ret;
- bitmap_flags_t flags = BITMAPF_NONE;
-
- /* mark image as having been requested to display */
- mng->displayed = true;
-
- if ((mng->bitmap) &&
- (mng->opaque_test_pending)) {
- bitmap_set_opaque(mng->bitmap, bitmap_test_opaque(mng->bitmap));
- mng->opaque_test_pending = false;
- }
-
- if (data->repeat_x)
- flags |= BITMAPF_REPEAT_X;
- if (data->repeat_y)
- flags |= BITMAPF_REPEAT_Y;
-
- ret = ctx->plot->bitmap(data->x, data->y, data->width, data->height,
- mng->bitmap, data->background_colour, flags);
-
- /* Check if we need to restart the animation */
- if ((mng->waiting) &&
- (nsoption_bool(animate_images))) {
- nsmng_animate(c);
- }
-
- return ret;
-}
-
-
-static nserror nsmng_clone(const struct content *old, struct content **newc)
-{
- nsmng_content *mng;
- nserror error;
- const char *data;
- unsigned long size;
-
- mng = calloc(1, sizeof(nsmng_content));
- if (mng == NULL)
- return NSERROR_NOMEM;
-
- error = content__clone(old, &mng->base);
- if (error != NSERROR_OK) {
- content_destroy(&mng->base);
- return error;
- }
-
- /* Simply replay create/process/convert */
- error = nsmng_create_mng_data(mng);
- if (error != NSERROR_OK) {
- content_destroy(&mng->base);
- return error;
- }
-
- data = content__get_source_data(&mng->base, &size);
- if (size > 0) {
- if (nsmng_process_data(&mng->base, data, size) == false) {
- content_destroy(&mng->base);
- return NSERROR_CLONE_FAILED;
- }
- }
-
- if (old->status == CONTENT_STATUS_READY ||
- old->status == CONTENT_STATUS_DONE) {
- if (nsmng_convert(&mng->base) == false) {
- content_destroy(&mng->base);
- return NSERROR_CLONE_FAILED;
- }
- }
-
- *newc = (struct content *) mng;
-
- return NSERROR_OK;
-}
-
-static void *nsmng_get_internal(const struct content *c, void *context)
-{
- nsmng_content *mng = (nsmng_content *)c;
-
- return mng->bitmap;
-}
-
-static content_type nsmng_content_type(void)
-{
- return CONTENT_IMAGE;
-}
-
-/* register handler for mng types */
-static const content_handler nsmng_content_handler = {
- .create = nsmng_create,
- .process_data = nsmng_process_data,
- .data_complete = nsmng_convert,
- .destroy = nsmng_destroy,
- .redraw = nsmng_redraw,
- .clone = nsmng_clone,
- .get_internal = nsmng_get_internal,
- .type = nsmng_content_type,
- .no_share = false,
-};
-
-static const char *nsmng_types[] = {
- /* MNG types*/
- "image/mng",
- "image/x-mng",
- "video/mng",
- "video/x-mng",
-};
-
-CONTENT_FACTORY_REGISTER_TYPES(nsmng, nsmng_types, nsmng_content_handler);
-
-/* register handler for jng and png types */
-static const content_handler nsjpng_content_handler = {
- .create = nsmng_create,
- .process_data = nsmng_process_data,
- .data_complete = nsjpng_convert,
- .destroy = nsmng_destroy,
- .redraw = nsmng_redraw,
- .clone = nsmng_clone,
- .get_internal = nsmng_get_internal,
- .type = nsmng_content_type,
- .no_share = false,
-};
-
-
-static const char *nsjpng_types[] = {
- /* JNG types*/
- "image/jng",
- "image/x-jng",
- /* PNG types*/
- "image/png",
- "image/x-png"
-};
-
-CONTENT_FACTORY_REGISTER_TYPES(nsjpng, nsjpng_types, nsjpng_content_handler);
diff --git a/image/mng.h b/image/mng.h
deleted file mode 100644
index 7ad779904..000000000
--- a/image/mng.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2004 Richard Wilson <not_ginger_matt@users.sourceforge.net>
- *
- * 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/mng, image/png, and image/jng (interface).
- */
-
-#ifndef _NETSURF_IMAGE_MNG_H_
-#define _NETSURF_IMAGE_MNG_H_
-
-nserror nsmng_init(void);
-nserror nsjpng_init(void);
-
-#endif
diff --git a/riscos/Makefile.target b/riscos/Makefile.target
index 3d64e24f9..05e66c829 100644
--- a/riscos/Makefile.target
+++ b/riscos/Makefile.target
@@ -45,7 +45,6 @@ RESOURCES = $(TPD_RISCOS) split-messages
CFLAGS += $(WARNFLAGS) -Driscos -std=c99 -D_BSD_SOURCE -D_POSIX_C_SOURCE \
-mpoke-function-name -fno-strict-aliasing
-CFLAGS += -I$(GCCSDK_INSTALL_ENV)/include -I$(GCCSDK_INSTALL_ENV)/include/libmng
ifeq ($(HOST),riscos)
CFLAGS += -I<OSLib$$Dir> -mthrowback
endif
diff --git a/windows/Makefile.defaults b/windows/Makefile.defaults
index 68fb7af66..10c9abbf7 100644
--- a/windows/Makefile.defaults
+++ b/windows/Makefile.defaults
@@ -14,9 +14,6 @@
# Valid options: YES, NO
NETSURF_USE_LIBICONV_PLUG := NO
- # mng support does not currently build on windows
- NETSURF_USE_MNG := NO
-
# no pdf support
NETSURF_USE_HARU_PDF := NO
diff --git a/windows/Makefile.target b/windows/Makefile.target
index 1cdb4a61a..cad28b575 100644
--- a/windows/Makefile.target
+++ b/windows/Makefile.target
@@ -16,7 +16,6 @@ $(eval $(call feature_enabled,BMP,-DWITH_BMP,-lnsbmp,BMP (libnsbmp)))
$(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,MNG,,-llcms -ljpeg,PNG/JNG/MNG (libmng)))
ifneq ($(PKG_CONFIG),)
$(eval $(call pkg_config_find_and_add,zlib,ZLib))