r10861 chris_y - /trunk/netsurf/amiga/menu.c
by netsurf@semichrome.net
Author: chris_y
Date: Sun Oct 3 17:34:29 2010
New Revision: 10861
URL: http://source.netsurf-browser.org?rev=10861&view=rev
Log:
Simplify detection of valid filetypes for ASL
Modified:
trunk/netsurf/amiga/menu.c
Modified: trunk/netsurf/amiga/menu.c
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/menu.c?rev=10861&r1...
==============================================================================
--- trunk/netsurf/amiga/menu.c (original)
+++ trunk/netsurf/amiga/menu.c Sun Oct 3 17:34:29 2010
@@ -825,20 +825,7 @@
mt = fetch_mimetype(fname);
- if(!strcmp(mt,"text/html")) ret = TRUE;
- else if(!strcmp(mt,"text/plain")) ret = TRUE;
- else if(!strcmp(mt,"image/jpeg")) ret = TRUE;
- else if(!strcmp(mt,"image/gif")) ret = TRUE;
- else if(!strcmp(mt,"image/png")) ret = TRUE;
- else if(!strcmp(mt,"image/jng")) ret = TRUE;
- else if(!strcmp(mt,"image/mng")) ret = TRUE;
- else if(!strcmp(mt,"image/bmp")) ret = TRUE;
- else if(!strcmp(mt,"image/ico")) ret = TRUE;
- else if(!strcmp(mt,"image/x-riscos-sprite")) ret = TRUE;
-#ifdef WITH_NS_SVG
- else if(!strcmp(mt,"image/svg")) ret = TRUE;
-#endif
-
+ if(content_lookup(mt) != CONTENT_OTHER) ret = TRUE;
free(mt);
return ret;
}
12 years, 8 months
r10860 chris_y - in /trunk/netsurf: !NetSurf/Resources/de/ !NetSurf/Resources/en/ !NetSurf/Resources/fr/ !NetSurf/Resources/it/ !NetSurf/Resources/nl/ ./ amiga/dist/ amiga/pkg/ content/ image/
by netsurf@semichrome.net
Author: chris_y
Date: Sun Oct 3 15:41:31 2010
New Revision: 10860
URL: http://source.netsurf-browser.org?rev=10860&view=rev
Log:
WebP image support, needs libwebp (from trunk/libwebp) and libvpx.
Only enabled for Amiga build currently, may have colour issues on little-endian CPUs
Added:
trunk/netsurf/image/webp.c (with props)
trunk/netsurf/image/webp.h (with props)
Modified:
trunk/netsurf/!NetSurf/Resources/de/Messages
trunk/netsurf/!NetSurf/Resources/en/Messages
trunk/netsurf/!NetSurf/Resources/fr/Messages
trunk/netsurf/!NetSurf/Resources/it/Messages
trunk/netsurf/!NetSurf/Resources/nl/Messages
trunk/netsurf/Makefile
trunk/netsurf/Makefile.defaults
trunk/netsurf/Makefile.sources
trunk/netsurf/amiga/dist/Install
trunk/netsurf/amiga/pkg/makepackage
trunk/netsurf/content/content.c
trunk/netsurf/content/content_protected.h
trunk/netsurf/content/content_type.h
Modified: trunk/netsurf/!NetSurf/Resources/de/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/de/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/de/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/de/Messages Sun Oct 3 15:41:31 2010
@@ -642,6 +642,7 @@
PNGTitle:PNG Bild (%lux%lu, %lu bytes)
JNGTitle:JNG Bild (%lux%lu, %lu bytes)
MNGTitle:MNG Bild (%lux%lu, %lu bytes)
+WebPTitle:WebP Bild (%lux%lu, %lu bytes)
SpriteTitle:Sprite Bild (%lux%lu, %lu bytes)
ArtWorksTitle:ArtWorks Bild (%lux%lu, %lu bytes)
Modified: trunk/netsurf/!NetSurf/Resources/en/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/en/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/en/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/en/Messages Sun Oct 3 15:41:31 2010
@@ -653,6 +653,7 @@
PNGTitle:PNG image (%lux%lu, %lu bytes)
JNGTitle:JNG image (%lux%lu, %lu bytes)
MNGTitle:MNG image (%lux%lu, %lu bytes)
+WebPTitle:WebP image (%lux%lu, %lu bytes)
SpriteTitle:Sprite image (%lux%lu, %lu bytes)
ArtWorksTitle:ArtWorks image (%lux%lu, %lu bytes)
Modified: trunk/netsurf/!NetSurf/Resources/fr/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/fr/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/fr/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/fr/Messages Sun Oct 3 15:41:31 2010
@@ -642,6 +642,7 @@
PNGTitle:Image PNG (%lux%lu, %lu octets)
JNGTitle:Image JNG (%lux%lu, %lu octets)
MNGTitle:Image MNG (%lux%lu, %lu octets)
+WebPTitle:Image WebP (%lux%lu, %lu octets)
SpriteTitle:Image Sprite (%lux%lu, %lu octets)
ArtWorksTitle:Image ArtWorks (%lux%lu, %lu octets)
Modified: trunk/netsurf/!NetSurf/Resources/it/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/it/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/it/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/it/Messages Sun Oct 3 15:41:31 2010
@@ -647,6 +647,7 @@
PNGTitle:Immagine PNG (%lux%lu, %lu byte)
JNGTitle:Immagine JNG (%lux%lu, %lu byte)
MNGTitle:Immagine MNG (%lux%lu, %lu byte)
+WebPTitle:Immagine WebP (%lux%lu, %lu byte)
SpriteTitle:Immagine Sprite (%lux%lu, %lu byte)
ArtWorksTitle:Immagine ArtWorks (%lux%lu, %lu byte)
Modified: trunk/netsurf/!NetSurf/Resources/nl/Messages
URL: http://source.netsurf-browser.org/trunk/netsurf/%21NetSurf/Resources/nl/M...
==============================================================================
--- trunk/netsurf/!NetSurf/Resources/nl/Messages (original)
+++ trunk/netsurf/!NetSurf/Resources/nl/Messages Sun Oct 3 15:41:31 2010
@@ -642,6 +642,7 @@
PNGTitle:PNG image (%lux%lu, %lu bytes)
JNGTitle:JNG image (%lux%lu, %lu bytes)
MNGTitle:MNG image (%lux%lu, %lu bytes)
+WebPTitle:WebP image (%lux%lu, %lu bytes)
SpriteTitle:Sprite image (%lux%lu, %lu bytes)
ArtWorksTitle:ArtWorks image (%lux%lu, %lu bytes)
Modified: trunk/netsurf/Makefile
URL: http://source.netsurf-browser.org/trunk/netsurf/Makefile?rev=10860&r1=108...
==============================================================================
--- trunk/netsurf/Makefile (original)
+++ trunk/netsurf/Makefile Sun Oct 3 15:41:31 2010
@@ -516,6 +516,7 @@
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
$(eval $(call feature_enabled,ROSPRITE,-DWITH_NSSPRITE,-lrosprite,Sprite (librosprite)))
@@ -524,6 +525,7 @@
$(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 -lvpx,WebP (libwebp)))
CFLAGS += -D__USE_INLINE__ -std=c99 -I . -I /SDK/local/common/include/libpng12 -Dnsamiga
LDFLAGS += -lxml2 -lcurl -lpthread -lregex -lauto
Modified: trunk/netsurf/Makefile.defaults
URL: http://source.netsurf-browser.org/trunk/netsurf/Makefile.defaults?rev=108...
==============================================================================
--- trunk/netsurf/Makefile.defaults (original)
+++ trunk/netsurf/Makefile.defaults Sun Oct 3 15:41:31 2010
@@ -53,6 +53,10 @@
# Valid options: YES, NO (at least one of PNG/MNG highly recommended)
NETSURF_USE_MNG := YES
+# Enable NetSurf's use of libwebp/libvpx for displaying WebPs
+# Valid options: YES, NO
+NETSURF_USE_WEBP := NO
+
# Enable NetSurf's use of libharu for PDF export and GTK printing support.
# There is no auto-detection available for this, as it does not have a
# pkg-config file.
@@ -200,6 +204,10 @@
# Enable NetSurf's use of librosprite for displaying RISC OS Sprites
# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE := YES
+
+ # Enable NetSurf's use of libwebp/libvpx for displaying WebPs
+ # Valid options: YES, NO
+ NETSURF_USE_WEBP := YES
# Enable NetSurf's use of libsvgtiny for displaying SVGs
# (NB: Requires NETSURF_AMIGA_USE_CAIRO)
Modified: trunk/netsurf/Makefile.sources
URL: http://source.netsurf-browser.org/trunk/netsurf/Makefile.sources?rev=1086...
==============================================================================
--- trunk/netsurf/Makefile.sources (original)
+++ trunk/netsurf/Makefile.sources Sun Oct 3 15:41:31 2010
@@ -24,7 +24,8 @@
$(addprefix desktop/,$(S_DESKTOP))
# S_IMAGE are sources related to image management
-S_IMAGE := bmp.c gif.c ico.c jpeg.c mng.c nssprite.c png.c svg.c rsvg.c
+S_IMAGE := bmp.c gif.c ico.c jpeg.c mng.c nssprite.c png.c svg.c rsvg.c \
+ webp.c
S_IMAGE := $(addprefix image/,$(S_IMAGE))
# S_PDF are sources of the pdf plotter + the ones for paged-printing
Modified: trunk/netsurf/amiga/dist/Install
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/dist/Install?rev=10...
==============================================================================
--- trunk/netsurf/amiga/dist/Install (original)
+++ trunk/netsurf/amiga/dist/Install Sun Oct 3 15:41:31 2010
@@ -110,7 +110,11 @@
(if (= #same 0) ;if #sobj is newer than that pointed to by #sobj_link
(
+ (if (exists (#sobj2))
+ (delete #sobj2 (optional "force")) ;prevent dodgy recursive links
+ )
(set #linkcmd (cat "makelink " #sobj2 " SObjs:" #sobj " soft"))
+ (transcript "Running " #linkcmd)
(run #linkcmd)
)
)
@@ -445,6 +449,7 @@
(p_linksobj "libz.so.1.2.5" "libz.so")
(p_linksobj "libz.so.1.2.5" "libz.so.1")
(p_linksobj "libz.so.1.2.5" "libz.so.1.2")
+ (p_linksobj "libvpx.so.0.9.2" "libvpx.so.0")
; (p_linksobj "libpng14.so.14" "libpng.so")
)
)
@@ -505,6 +510,7 @@
(p_setmimetype "bmp" "image/bmp")
(p_setmimetype "ico" "image/ico")
(p_setmimetype "sprite" "image/x-riscos-sprite")
+(p_setmimetype "webp" "image/webp")
(p_setmimetype "lha" "application/x-lha")
(p_setmimetype "zip" "application/x-zip")
Modified: trunk/netsurf/amiga/pkg/makepackage
URL: http://source.netsurf-browser.org/trunk/netsurf/amiga/pkg/makepackage?rev...
==============================================================================
--- trunk/netsurf/amiga/pkg/makepackage (original)
+++ trunk/netsurf/amiga/pkg/makepackage Sun Oct 3 15:41:31 2010
@@ -20,6 +20,6 @@
makedir ram:NetSurf/Rexx
copy amiga/dist/Rexx/~(.svn) ram:NetSurf/Rexx/ COM
makedir ram:NetSurf/SObjs
-copy sobjs:libjpeg.so.8 sobjs:libhubbub.so.0 sobjs:libhpdf-2.2.0.so.0.0 sobjs:libmng.so.1 sobjs:liblcms.so sobjs:libxml2.so sobjs:libparserutils.so.0 sobjs:libnsgif.so.0 sobjs:libnsbmp.so.0 sobjs:libcss.so.0 sobjs:libwapcaplet.so.0 sobjs:libcurl.so sobjs:libsvgtiny.so.0 sobjs:libz.so.1.2.5 sobjs:libiconv.so ram:NetSurf/SObjs clone
+copy sobjs:libjpeg.so.8 sobjs:libhubbub.so.0 sobjs:libhpdf-2.2.0.so.0.0 sobjs:libmng.so.1 sobjs:liblcms.so sobjs:libxml2.so sobjs:libparserutils.so.0 sobjs:libnsgif.so.0 sobjs:libnsbmp.so.0 sobjs:libcss.so.0 sobjs:libwapcaplet.so.0 sobjs:libcurl.so sobjs:libsvgtiny.so.0 sobjs:libz.so.1.2.5 sobjs:libiconv.so sobjs:libvpx.so.0.9.2 ram:NetSurf/SObjs clone
;sobjs:libssl-0.9.8.so sobjs:libexpat.so sobjs:libpng14.so.14
;sobjs:libgcc.so sobjs:libc.so sobjs:libpthread.so
Modified: trunk/netsurf/content/content.c
URL: http://source.netsurf-browser.org/trunk/netsurf/content/content.c?rev=108...
==============================================================================
--- trunk/netsurf/content/content.c (original)
+++ trunk/netsurf/content/content.c Sun Oct 3 15:41:31 2010
@@ -77,6 +77,9 @@
#ifdef WITH_PNG
#include "image/png.h"
#endif
+#ifdef WITH_WEBP
+#include "image/webp.h"
+#endif
#include "utils/http.h"
#include "utils/log.h"
#include "utils/messages.h"
@@ -153,6 +156,9 @@
#ifdef WITH_BMP
{"image/vnd.microsoft.icon", CONTENT_ICO},
#endif
+#ifdef WITH_WEBP
+ {"image/webp", CONTENT_WEBP},
+#endif
#ifdef WITH_ARTWORKS
{"image/x-artworks", CONTENT_ARTWORKS},
#endif
@@ -230,6 +236,9 @@
#endif
#if defined(WITH_NS_SVG) || defined(WITH_RSVG)
"SVG",
+#endif
+#ifdef WITH_WEBP
+ "WEBP",
#endif
"OTHER",
"UNKNOWN"
@@ -360,6 +369,11 @@
0, rsvg_destroy, 0, 0, 0, rsvg_redraw, 0, 0, 0, rsvg_clone,
false},
#endif
+#ifdef WITH_WEBP
+ {0, 0, webp_convert,
+ 0, webp_destroy, 0, 0, 0, webp_redraw, 0,
+ 0, 0, webp_clone, false},
+#endif
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, false}
};
#define HANDLER_MAP_COUNT (sizeof(handler_map) / sizeof(handler_map[0]))
Modified: trunk/netsurf/content/content_protected.h
URL: http://source.netsurf-browser.org/trunk/netsurf/content/content_protected...
==============================================================================
--- trunk/netsurf/content/content_protected.h (original)
+++ trunk/netsurf/content/content_protected.h Sun Oct 3 15:41:31 2010
@@ -75,6 +75,9 @@
#ifdef WITH_RSVG
#include "image/rsvg.h"
#endif
+#ifdef WITH_WEBP
+#include "image/webp.h"
+#endif
struct bitmap;
@@ -146,6 +149,9 @@
#endif
#ifdef WITH_PNG
struct content_png_data png;
+#endif
+#ifdef WITH_WEBP
+ struct content_webp_data webp;
#endif
} data;
Modified: trunk/netsurf/content/content_type.h
URL: http://source.netsurf-browser.org/trunk/netsurf/content/content_type.h?re...
==============================================================================
--- trunk/netsurf/content/content_type.h (original)
+++ trunk/netsurf/content/content_type.h Sun Oct 3 15:41:31 2010
@@ -68,6 +68,9 @@
#if defined(WITH_NS_SVG) || defined(WITH_RSVG)
CONTENT_SVG,
#endif
+#ifdef WITH_WEBP
+ CONTENT_WEBP,
+#endif
/* these must be the last two */
CONTENT_OTHER,
CONTENT_UNKNOWN /**< content-type not received yet */
Added: trunk/netsurf/image/webp.c
URL: http://source.netsurf-browser.org/trunk/netsurf/image/webp.c?rev=10860&vi...
==============================================================================
--- trunk/netsurf/image/webp.c (added)
+++ trunk/netsurf/image/webp.c Sun Oct 3 15:41:31 2010
@@ -1,0 +1,137 @@
+ /*
+ * Copyright 2010 Chris Young <chris(a)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 "utils/config.h"
+#ifdef WITH_WEBP
+
+#include <assert.h>
+#include <string.h>
+#include <stdlib.h>
+#include <webpimg.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"
+
+/**
+ * Convert a CONTENT_WEBP for display.
+ *
+ * No conversion is necessary. We merely read the WebP dimensions.
+ */
+
+bool webp_convert(struct content *c)
+{
+ union content_msg_data msg_data;
+ const char *data;
+ unsigned long size;
+ uint8 *Y = NULL, *U = NULL, *V = NULL;
+ uint32 width = 0, height = 0;
+ char title[100];
+ WebPResult res = webp_success;
+
+ data = content__get_source_data(c, &size);
+
+ res = WebPDecode(data, size, &Y, &U, &V, &width, &height);
+ if (res != webp_success) {
+ msg_data.error = messages_get("NoMemory");
+ content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ if(Y) free(Y);
+ return false;
+ }
+
+ c->bitmap = bitmap_create(width, height, BITMAP_NEW | BITMAP_OPAQUE);
+ if (!c->bitmap) {
+ msg_data.error = messages_get("NoMemory");
+ content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ if(Y) free(Y);
+ return false;
+ }
+ unsigned char* imagebuf = bitmap_get_buffer(c->bitmap);
+ if (!imagebuf) {
+ msg_data.error = messages_get("NoMemory");
+ content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ if(Y) free(Y);
+ return false;
+ }
+ unsigned int row_width = bitmap_get_rowstride(c->bitmap) / 4;
+
+ YUV420toRGBA(Y, U, V, row_width, width, height, imagebuf);
+
+ if(Y) free(Y);
+
+ /* I think we may need to reverse the byte order here, as it is fixed
+ * to RGBA on both big- and little-endian platforms. */
+
+ c->width = width;
+ c->height = height;
+ snprintf(title, sizeof(title), messages_get("WebPTitle"),
+ width, height, size);
+ content__set_title(c, title);
+
+ bitmap_modified(c->bitmap);
+ c->status = CONTENT_STATUS_DONE;
+
+ return true;
+}
+
+
+/**
+ * Destroy a CONTENT_WEBP and free all resources it owns.
+ */
+
+void webp_destroy(struct content *c)
+{
+ if (c->bitmap != NULL)
+ bitmap_destroy(c->bitmap);
+}
+
+
+/**
+ * Redraw a CONTENT_WEBP.
+ */
+
+bool webp_redraw(struct content *c, int x, int y,
+ int width, int height,
+ int clip_x0, int clip_y0, int clip_x1, int clip_y1,
+ float scale, colour background_colour)
+{
+ return plot.bitmap(x, y, width, height,
+ c->bitmap, background_colour, BITMAPF_NONE);
+}
+
+
+bool webp_clone(const struct content *old, struct content *new_content)
+{
+ /* Simply replay convert */
+ if (old->status == CONTENT_STATUS_READY ||
+ old->status == CONTENT_STATUS_DONE) {
+ if (webp_convert(new_content) == false)
+ return false;
+ }
+
+ return true;
+}
+
+#endif
Propchange: trunk/netsurf/image/webp.c
------------------------------------------------------------------------------
amiga:protection = ----rw-d ---- ----
Added: trunk/netsurf/image/webp.h
URL: http://source.netsurf-browser.org/trunk/netsurf/image/webp.h?rev=10860&vi...
==============================================================================
--- trunk/netsurf/image/webp.h (added)
+++ trunk/netsurf/image/webp.h Sun Oct 3 15:41:31 2010
@@ -1,0 +1,47 @@
+/*
+ * Copyright 2010 Chris Young <chris(a)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_
+
+#include "utils/config.h"
+#ifdef WITH_WEBP
+
+#include <stdbool.h>
+
+struct content;
+
+struct content_webp_data {
+/* empty */
+};
+
+bool webp_convert(struct content *c);
+void webp_destroy(struct content *c);
+bool webp_redraw(struct content *c, int x, int y,
+ int width, int height,
+ int clip_x0, int clip_y0, int clip_x1, int clip_y1,
+ float scale, colour background_colour);
+bool webp_clone(const struct content *old, struct content *new_content);
+
+#endif /* WITH_WEBP */
+
+#endif
Propchange: trunk/netsurf/image/webp.h
------------------------------------------------------------------------------
amiga:protection = ----rw-d ---- ----
12 years, 8 months
r10859 chris_y - in /trunk/libwebp: LICENSE PATENTS README makefile webpimg.c webpimg.h
by netsurf@semichrome.net
Author: chris_y
Date: Sun Oct 3 15:37:28 2010
New Revision: 10859
URL: http://source.netsurf-browser.org?rev=10859&view=rev
Log:
Initial import of Google's libwebp, with the following changes:
* Alpha bug fixed (webp bug #8)
* Makefile modified to only create libwebp and create it as a static link library
To build, type make
Installation is a manual process - copy libwebp.a to lib and webpimg.h to include
Added:
trunk/libwebp/LICENSE (with props)
trunk/libwebp/PATENTS (with props)
trunk/libwebp/README (with props)
trunk/libwebp/makefile (with props)
trunk/libwebp/webpimg.c (with props)
trunk/libwebp/webpimg.h (with props)
Added: trunk/libwebp/LICENSE
URL: http://source.netsurf-browser.org/trunk/libwebp/LICENSE?rev=10859&view=auto
==============================================================================
--- trunk/libwebp/LICENSE (added)
+++ trunk/libwebp/LICENSE Sun Oct 3 15:37:28 2010
@@ -1,0 +1,29 @@
+Copyright (c) 2010, Google Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ * Neither the name of Google nor the names of its contributors may
+ be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Propchange: trunk/libwebp/LICENSE
------------------------------------------------------------------------------
amiga:protection = ----r--- r--- ----
Added: trunk/libwebp/PATENTS
URL: http://source.netsurf-browser.org/trunk/libwebp/PATENTS?rev=10859&view=auto
==============================================================================
--- trunk/libwebp/PATENTS (added)
+++ trunk/libwebp/PATENTS Sun Oct 3 15:37:28 2010
@@ -1,0 +1,22 @@
+Additional IP Rights Grant (Patents)
+
+"This implementation" means the copyrightable works distributed by
+Google as part of the WebM Project.
+
+Google hereby grants to you a perpetual, worldwide, non-exclusive,
+no-charge, royalty-free, irrevocable (except as stated in this section)
+patent license to make, have made, use, offer to sell, sell, import,
+transfer, and otherwise run, modify and propagate the contents of this
+implementation of VP8, where such license applies only to those patent
+claims, both currently owned by Google and acquired in the future,
+licensable by Google that are necessarily infringed by this
+implementation of VP8. This grant does not include claims that would be
+infringed only as a consequence of further modification of this
+implementation. If you or your agent or exclusive licensee institute or
+order or agree to the institution of patent litigation against any
+entity (including a cross-claim or counterclaim in a lawsuit) alleging
+that this implementation of VP8 or any code incorporated within this
+implementation of VP8 constitutes direct or contributory patent
+infringement, or inducement of patent infringement, then any patent
+rights granted to you under this License for this implementation of VP8
+shall terminate as of the date such litigation is filed.
Propchange: trunk/libwebp/PATENTS
------------------------------------------------------------------------------
amiga:protection = ----r--- r--- ----
Added: trunk/libwebp/README
URL: http://source.netsurf-browser.org/trunk/libwebp/README?rev=10859&view=auto
==============================================================================
--- trunk/libwebp/README (added)
+++ trunk/libwebp/README Sun Oct 3 15:37:28 2010
@@ -1,0 +1,10 @@
+This library contains encoder/decoder for WEBP image and a
+command line tool to convert between images of differnt format.
+
+See http://code.google.com/speed/webp
+
+
+It is released under the same license as the WebM project.
+See http://www.webmproject.org/license/software/ or the
+file "COPYING" file for details. An additional intellectual
+property rights grant can be found in the file PATENTS.
Propchange: trunk/libwebp/README
------------------------------------------------------------------------------
amiga:protection = ----r--- r--- ----
Added: trunk/libwebp/makefile
URL: http://source.netsurf-browser.org/trunk/libwebp/makefile?rev=10859&view=auto
==============================================================================
--- trunk/libwebp/makefile (added)
+++ trunk/libwebp/makefile Sun Oct 3 15:37:28 2010
@@ -1,0 +1,43 @@
+#/*===========================================================================*
+# - Copyright 2010 Google Inc.
+# -
+# - Licensed under the Apache License, Version 2.0 (the "License");
+# - you may not use this file except in compliance with the License.
+# - You may obtain a copy of the License at
+# -
+# - http://www.apache.org/licenses/LICENSE-2.0
+# -
+# - Unless required by applicable law or agreed to in writing, software
+# - distributed under the License is distributed on an "AS IS" BASIS,
+# - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# - See the License for the specific language governing permissions and
+# - limitations under the License.
+#*===========================================================================*/
+
+CC = gcc -Werror -fPIC
+AR = ar
+
+OPTIMIZE = -O2
+OPTIONS =
+INCLUDES =
+
+CFLAGS = $(OPTIMIZE) $(OPTIONS)
+VPX_LIB = -lvpx -lpthread
+
+######################################################################
+
+all: libwebp.a
+
+
+######################################################################
+
+libwebp.a: libwebp.o
+ $(AR) -q libwebp.a libwebp.o
+
+libwebp.o: webpimg.c
+ $(CC) -c $(CFLAGS) -o libwebp.o webpimg.c
+
+clean:
+ rm *.o *.a
+
+######################################################################
Propchange: trunk/libwebp/makefile
------------------------------------------------------------------------------
amiga:protection = ----rw-d r--- ----
Added: trunk/libwebp/webpimg.c
URL: http://source.netsurf-browser.org/trunk/libwebp/webpimg.c?rev=10859&view=...
==============================================================================
--- trunk/libwebp/webpimg.c (added)
+++ trunk/libwebp/webpimg.c Sun Oct 3 15:37:28 2010
@@ -1,0 +1,784 @@
+/*===========================================================================*
+ - Copyright 2010 Google Inc.
+ -
+ - This code is licensed under the same terms as WebM:
+ - Software License Agreement: http://www.webmproject.org/license/software/
+ - Additional IP Rights Grant: http://www.webmproject.org/license/additional/
+ *===========================================================================*/
+
+/*
+ * Encoding/Decoding of WebP still image compression format.
+ *
+ * 1. WebPDecode: Takes an array of bytes (string) corresponding to the WebP
+ * encoded image and generates output in the YUV format with
+ * the color components U, V subsampled to 1/2 resolution along
+ * each dimension.
+ *
+ * 2. YUV420toRGBA: Converts from YUV (with color subsampling) such as produced
+ * by the WebPDecode routine into 32 bits per pixel RGBA data
+ * array. This data array can be directly used by the Leptonica
+ * Pix in-memory image format.
+ *
+ * 3. WebPEncode: Takes a Y, U, V data buffers (with color components U and V
+ * subsampled to 1/2 resolution) and generates the WebP string
+ *
+ * 4. RGBAToYUV420: Generates Y, U, V data (with color subsampling) from 32 bits
+ * per pixel RGBA data buffer. The resulting YUV data can be
+ * directly fed into the WebPEncode routine.
+ *
+ * 5. AdjustColorspace:
+ *
+ * 6. AdjustColorspaceBack:
+ */
+
+#include "webpimg.h"
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+
+#include "vpx/vpx_decoder.h"
+#include "vpx/vp8dx.h"
+#include "vpx/vpx_encoder.h"
+#include "vpx/vp8cx.h"
+
+/*---------------------------------------------------------------------*
+ * color conversions *
+ *---------------------------------------------------------------------*/
+
+static inline int clip(float v, int a, int b) {
+ return (v > b) ? b : (v < 0) ? 0 : (int)(v);
+}
+enum {
+ COLOR_RED = 0,
+ COLOR_GREEN = 1,
+ COLOR_BLUE = 2,
+ ALPHA_CHANNEL = 3
+};
+
+/* endian neutral extractions of RGBA from a 32 bit pixel */
+static const uint32 RED_SHIFT =
+ 8 * (sizeof(uint32) - 1 - COLOR_RED); /* 24 */
+static const uint32 GREEN_SHIFT =
+ 8 * (sizeof(uint32) - 1 - COLOR_GREEN); /* 16 */
+static const uint32 BLUE_SHIFT =
+ 8 * (sizeof(uint32) - 1 - COLOR_BLUE); /* 8 */
+static const uint32 ALPHA_SHIFT =
+ 8 * (sizeof(uint32) - 1 - ALPHA_CHANNEL); /* 0 */
+
+static inline int GetRed(const uint32* rgba) {
+ return (int)((*rgba >> RED_SHIFT) & 0xff);
+}
+
+static inline int GetGreen(const uint32* rgba) {
+ return (int)((*rgba >> GREEN_SHIFT) & 0xff);
+}
+
+static inline int GetBlue(const uint32* rgba) {
+ return (int)((*rgba >> BLUE_SHIFT) & 0xff);
+}
+
+enum { YUV_FRAC = 16 };
+
+static inline int clip_uv(int v) {
+ v = (v + (257 << (YUV_FRAC + 2 - 1))) >> (YUV_FRAC + 2);
+ return ((v & ~0xff) == 0) ? v : v < 0 ? 0u : 255u;
+}
+
+
+/* YUV <-----> RGB conversions */
+/* The exact naming is Y'CbCr, following the ITU-R BT.601 standard.
+ * More information at: http://en.wikipedia.org/wiki/YCbCr
+ */
+static inline int GetLumaY(int r, int g, int b) {
+ const int kRound = (1 << (YUV_FRAC - 1)) + (16 << YUV_FRAC);
+ // Y = 0.2569 * R + 0.5044 * G + 0.0979 * B + 16
+ const int luma = 16839 * r + 33059 * g + 6420 * b;
+ return (luma + kRound) >> YUV_FRAC;
+}
+
+static inline int GetLumaYfromPtr(uint32* rgba) {
+ const int r = GetRed(rgba);
+ const int g = GetGreen(rgba);
+ const int b = GetBlue(rgba);
+ return GetLumaY(r, g, b);
+}
+
+static inline int GetChromaU(int r, int g, int b) {
+ // U = -0.1483 * R - 0.2911 * G + 0.4394 * B + 128
+ return clip_uv(-9719 * r - 19081 * g + 28800 * b);
+}
+
+static inline int GetChromaV(int r, int g, int b) {
+ // V = 0.4394 * R - 0.3679 * G - 0.0715 * B + 128
+ return clip_uv(+28800 * r - 24116 * g - 4684 * b);
+}
+
+/* Converts YUV to RGB and writes into a 32 bit pixel in endian
+ * neutral fashion
+ */
+enum { RGB_FRAC = 16, RGB_HALF = (1 << RGB_FRAC) / 2,
+ RGB_RANGE_MIN = -227, RGB_RANGE_MAX = 256 + 226 };
+
+static int init_done = 0;
+static int16_t kVToR[256], kUToB[256];
+static int32_t kVToG[256], kUToG[256];
+static uint8_t kClip[RGB_RANGE_MAX - RGB_RANGE_MIN];
+
+static void InitTables() {
+ int i;
+ for (i = 0; i < 256; ++i) {
+ kVToR[i] = (89858 * (i - 128) + RGB_HALF) >> RGB_FRAC;
+ kUToG[i] = -22014 * (i - 128) + RGB_HALF;
+ kVToG[i] = -45773 * (i - 128);
+ kUToB[i] = (113618 * (i - 128) + RGB_HALF) >> RGB_FRAC;
+ }
+ for (i = RGB_RANGE_MIN; i < RGB_RANGE_MAX; ++i) {
+ const int j = ((i - 16) * 76283 + RGB_HALF) >> RGB_FRAC;
+ kClip[i - RGB_RANGE_MIN] = (j < 0) ? 0 : (j > 255) ? 255 : j;
+ }
+
+ init_done = 1;
+}
+
+static void ToRGB(int y, int u, int v, uint32* const dst) {
+ const int r_off = kVToR[v];
+ const int g_off = (kVToG[v] + kUToG[u]) >> RGB_FRAC;
+ const int b_off = kUToB[u];
+ const int r = kClip[y + r_off - RGB_RANGE_MIN];
+ const int g = kClip[y + g_off - RGB_RANGE_MIN];
+ const int b = kClip[y + b_off - RGB_RANGE_MIN];
+ *dst = (r << RED_SHIFT) | (g << GREEN_SHIFT) | (b << BLUE_SHIFT) | (0xff << ALPHA_SHIFT);
+}
+
+static inline uint32 get_le32(const uint8* const data) {
+ return data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24);
+}
+
+/* Returns the difference (in dB) between two images represented in YUV format
+ *
+ * Input:
+ * Y1/U1/V1: The Y/U/V data of the first image
+ * Y2/U2/V2: The Y/U/V data of the second image
+ *
+ * Returns the PSNR (http://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio)
+ * value computed bewteen the two images
+ */
+double GetPSNRYuv(const uint8* Y1,
+ const uint8* U1,
+ const uint8* V1,
+ const uint8* Y2,
+ const uint8* U2,
+ const uint8* V2,
+ int y_width,
+ int y_height) {
+ int x, y, row_idx;
+ const int uv_width = ((y_width + 1) >> 1);
+ const int uv_height = ((y_height + 1) >> 1);
+ double sse = 0., count = 0.;
+ for (y = 0; y < y_height; ++y) {
+ count += y_width;
+ row_idx = y * y_width;
+ for (x = 0; x < y_width; ++x) {
+ double diff = Y1[row_idx + x] - Y2[row_idx + x];
+ sse += diff * diff;
+ }
+ }
+ for (y = 0; y < uv_height; ++y) {
+ count += 2 * uv_width;
+ row_idx = y * uv_width;
+ for (x = 0; x < uv_width; ++x) {
+ const double diff_U = U1[row_idx + x] - U2[row_idx + x];
+ const double diff_V = V1[row_idx + x] - V2[row_idx + x];
+ sse += diff_U * diff_U + diff_V * diff_V;
+ }
+ }
+ return -4.3429448 * log(sse / (255. * 255. * count));
+}
+
+/* Returns the difference (in dB) between two images. One represented
+ * using Y,U,V vectors and the other is webp image data.
+ * Input:
+ * Y1/U1/V1: The Y/U/V data of the first image
+ * imgdata: data buffer containing webp image
+ * imgdata_size: size of the imgdata buffer
+ *
+ * Returns the PSNR value computed bewteen the two images
+ */
+double WebPGetPSNR(const uint8* Y1,
+ const uint8* U1,
+ const uint8* V1,
+ uint8* imgdata,
+ int imgdata_size) {
+ uint8* Y2 = NULL;
+ uint8* U2 = NULL;
+ uint8* V2 = NULL;
+ int w = 0, h = 0;
+ double psnr = 0;
+
+ WebPDecode(imgdata,
+ imgdata_size,
+ &Y2,
+ &U2,
+ &V2,
+ &w,
+ &h);
+
+ psnr = GetPSNRYuv(Y1, U1, V1, Y2, U2, V2, w, h);
+ free(Y2);
+
+ return psnr;
+}
+
+/*---------------------------------------------------------------------*
+ * Reading WebP *
+ *---------------------------------------------------------------------*/
+
+/* RIFF layout is:
+ * 0ffset tag
+ * 0...3 "RIFF" 4-byte tag
+ * 4...7 size of image data (including metadata) starting at offset 8
+ * 8...11 "WEBP" our form-type signature
+ * 12..15 "VP8 " 4-byte tags, describing the raw video format used
+ * 16..19 size of the raw WebP image data, starting at offset 20
+ * 20.... the WebP bytes
+ * There can be extra chunks after the "VP8 " chunk (ICMT, ICOP, ...)
+ * All 32-bits sizes are in little-endian order.
+ * Note: chunk data must be padded to multiple of 2 in size
+ */
+
+int SkipRiffHeader(const uint8** data_ptr, int *data_size_ptr) {
+ /* 20 bytes RIFF header 10 bytes VP8 header */
+ const int kHeaderSize = (20 + 10);
+
+ uint32 chunk_size = 0xffffffffu;
+ if (*data_size_ptr >= kHeaderSize && !memcmp(*data_ptr, "RIFF", 4)) {
+ if (memcmp(*data_ptr + 8, "WEBP", 4)) {
+ return 0; /* wrong image file signature */
+ }
+ const uint32 riff_size = get_le32(*data_ptr + 4);
+ if (memcmp(*data_ptr + 12, "VP8 ", 4)) {
+ return 0; /* invalid compression format */
+ }
+ chunk_size = get_le32(*data_ptr + 16);
+ if ((chunk_size > riff_size + 8) || (chunk_size & 1)) {
+ return 0; /* inconsistent size information. */
+ }
+ /* We have a RIFF container. Skip it. */
+ *data_ptr += 20;
+ *data_size_ptr -= 20;
+ }
+ return chunk_size;
+}
+
+/* Generate RGBA row from an YUV row (with width upsampling of chrome data)
+ * Input:
+ * 1, 2, 3. y_src, u_src, v_src - Pointers to input Y, U, V row data
+ * respectively. We reuse these variables, they iterate over all pixels in
+ * the row.
+ * 4. y_width: width of the Y image plane (aka image width)
+ * Output:
+ * 5. rgb_sat: pointer to the output rgb row. We reuse this variable, it
+ * iterates over all pixels in the row.
+ */
+static void YUV420toRGBLine(uint8* y_src,
+ uint8* u_src,
+ uint8* v_src,
+ int y_width,
+ uint32* rgb_dst) {
+ int x;
+ for (x = 0; x < (y_width >> 1); ++x) {
+ const int U = u_src[0];
+ const int V = v_src[0];
+ ToRGB(y_src[0], U, V, rgb_dst);
+ ToRGB(y_src[1], U, V, rgb_dst + 1);
+ ++u_src;
+ ++v_src;
+ y_src += 2;
+ rgb_dst += 2;
+ }
+ if (y_width & 1) { /* Rightmost pixel */
+ ToRGB(y_src[0], (*u_src), (*v_src), rgb_dst);
+ }
+}
+
+/* Converts from YUV (with color subsampling) such as produced by the WebPDecode
+ * routine into 32 bits per pixel RGBA data array. This data array can be
+ * directly used by the Leptonica Pix in-memory image format.
+ * Input:
+ * 1, 2, 3. Y, U, V: the input data buffers
+ * 4. pixwpl: the desired words per line corresponding to the supplied
+ * output pixdata.
+ * 5. width, height: the dimensions of the image whose data resides in Y,
+ * U, V.
+ * Output:
+ * 6. pixdata: the output data buffer. Caller should allocate
+ * height * pixwpl bytes of memory before calling this routine.
+ */
+void YUV420toRGBA(uint8* Y,
+ uint8* U,
+ uint8* V,
+ int words_per_line,
+ int width,
+ int height,
+ uint32* pixdata) {
+ int y_width = width;
+ int y_stride = y_width;
+ int uv_width = ((y_width + 1) >> 1);
+ int uv_stride = uv_width;
+ int y;
+
+ if (!init_done)
+ InitTables();
+
+ /* note that the U, V upsampling in height is happening here as the U, V
+ * buffers sent to successive odd-even pair of lines is same.
+ */
+ for (y = 0; y < height; ++y) {
+ YUV420toRGBLine(Y + y * y_stride,
+ U + (y >> 1) * uv_stride,
+ V + (y >> 1) * uv_stride,
+ width,
+ pixdata + y * words_per_line);
+ }
+}
+
+static WebPResult VPXDecode(const uint8* data,
+ int data_size,
+ uint8** p_Y,
+ uint8** p_U,
+ uint8** p_V,
+ int* p_width,
+ int* p_height) {
+ if (!data || data_size <= 10 || !p_Y || !p_U || !p_V
+ || *p_Y != NULL || *p_U != NULL || *p_V != NULL) {
+ return webp_failure;
+ }
+ vpx_codec_ctx_t dec;
+ if (vpx_codec_dec_init(&dec,
+ &vpx_codec_vp8_dx_algo, NULL, 0) != VPX_CODEC_OK) {
+ return webp_failure;
+ }
+
+ vp8_postproc_cfg_t ppcfg;
+ ppcfg.post_proc_flag = VP8_NOFILTERING;
+ vpx_codec_control(&dec, VP8_SET_POSTPROC, &ppcfg);
+
+ WebPResult result = webp_failure;
+ if (vpx_codec_decode(&dec, data, data_size, NULL, 0) == VPX_CODEC_OK) {
+ vpx_codec_iter_t iter = NULL;
+ vpx_image_t* const img = vpx_codec_get_frame(&dec, &iter);
+ if (img) {
+ int y_width = img->d_w;
+ int y_height = img->d_h;
+ int y_stride = y_width;
+ int uv_width = (y_width + 1) >> 1;
+ int uv_stride = uv_width;
+ int uv_height = ((y_height + 1) >> 1);
+ int y;
+
+ *p_width = y_width;
+ *p_height = y_height;
+ if ((*p_Y = (uint8 *)(calloc(y_stride * y_height
+ + 2 * uv_stride * uv_height,
+ sizeof(uint8)))) != NULL) {
+ *p_U = *p_Y + y_height * y_stride;
+ *p_V = *p_U + uv_height * uv_stride;
+ for (y = 0; y < y_height; ++y) {
+ memcpy(*p_Y + y * y_stride,
+ img->planes[0] + y * img->stride[0],
+ y_width);
+ }
+ for (y = 0; y < uv_height; ++y) {
+ memcpy(*p_U + y * uv_stride,
+ img->planes[1] + y * img->stride[1],
+ uv_width);
+ memcpy(*p_V + y * uv_stride,
+ img->planes[2] + y * img->stride[2],
+ uv_width);
+ }
+ result = webp_success;
+ }
+ }
+ }
+ vpx_codec_destroy(&dec);
+
+ return result;
+}
+
+WebPResult WebPDecode(const uint8* data,
+ int data_size,
+ uint8** p_Y,
+ uint8** p_U,
+ uint8** p_V,
+ int* p_width,
+ int* p_height) {
+
+ const uint32 chunk_size = SkipRiffHeader(&data, &data_size);
+ if (!chunk_size) {
+ return webp_failure; /* unsupported RIFF header */
+ }
+
+ return VPXDecode(data, data_size, p_Y, p_U, p_V, p_width, p_height);
+}
+
+/*---------------------------------------------------------------------*
+ * Writing WebP *
+ *---------------------------------------------------------------------*/
+
+/* Takes a pair of RGBA row data as input and generates 2 rows of Y data and one
+ * row of subsampled U, V data as output
+ * Input:
+ * 1, 2. rgb_line1, rgb_line2 - input rgba rows
+ * 3. width - image width
+ * Outout:
+ * 4, 5, 6: Output Y, U, V row
+ */
+static void RGBALinepairToYUV420(uint32* rgb_line1,
+ uint32* rgb_line2,
+ int width,
+ uint8* Y_dst1,
+ uint8* Y_dst2,
+ uint8* u_dst,
+ uint8* v_dst) {
+ int x;
+ for (x = (width >> 1); x > 0; --x) {
+ Y_dst1[0] = GetLumaYfromPtr(rgb_line1 + 0);
+ Y_dst1[1] = GetLumaYfromPtr(rgb_line1 + 1);
+ Y_dst2[0] = GetLumaYfromPtr(rgb_line2 + 0);
+ Y_dst2[1] = GetLumaYfromPtr(rgb_line2 + 1);
+ const int sum_r =
+ GetRed(rgb_line1 + 0) + GetRed(rgb_line1 + 1) +
+ GetRed(rgb_line2 + 0) + GetRed(rgb_line2 + 1);
+ const int sum_g =
+ GetGreen(rgb_line1 + 0) + GetGreen(rgb_line1 + 1) +
+ GetGreen(rgb_line2 + 0) + GetGreen(rgb_line2 + 1);
+ const int sum_b =
+ GetBlue(rgb_line1 + 0) + GetBlue(rgb_line1 + 1) +
+ GetBlue(rgb_line2 + 0) + GetBlue(rgb_line2 + 1);
+ *u_dst++ = GetChromaU(sum_r, sum_g, sum_b);
+ *v_dst++ = GetChromaV(sum_r, sum_g, sum_b);
+ rgb_line1 += 2;
+ rgb_line2 += 2;
+ Y_dst1 += 2;
+ Y_dst2 += 2;
+ }
+ if (width & 1) { /* rightmost pixel. */
+ Y_dst1[0] = GetLumaYfromPtr(rgb_line1);
+ Y_dst2[0] = GetLumaYfromPtr(rgb_line2);
+ const int sum_r = GetRed(rgb_line1) + GetRed(rgb_line2);
+ const int sum_g = GetGreen(rgb_line1) + GetGreen(rgb_line2);
+ const int sum_b = GetBlue(rgb_line1) + GetBlue(rgb_line2);
+ *u_dst = GetChromaU(2 * sum_r, 2 * sum_g, 2 * sum_b);
+ *v_dst = GetChromaV(2 * sum_r, 2 * sum_g, 2 * sum_b);
+ }
+}
+
+/* Generates Y, U, V data (with color subsampling) from 32 bits
+ * per pixel RGBA data buffer. The resulting YUV data can be directly fed into
+ * the WebPEncode routine.
+ * Input:
+ * 1. pixdatainput rgba data buffer
+ * 2. words per line corresponding to pixdata
+ * 3, 4. image width and height respectively
+ * Output:
+ * 5, 6, 7. Output YUV data buffers
+ */
+void RGBAToYUV420(uint32* pixdata,
+ int words_per_line,
+ int width,
+ int height,
+ uint8* Y,
+ uint8* U,
+ uint8* V) {
+ int y_width = width;
+ int y_height = height;
+ int y_stride = y_width;
+ int uv_width = ((y_width + 1) >> 1);
+ int uv_stride = uv_width;
+ int y;
+
+ for (y = 0; y < (y_height >> 1); ++y) {
+ RGBALinepairToYUV420(pixdata + 2 * y * words_per_line,
+ pixdata + (2 * y + 1) * words_per_line,
+ y_width,
+ Y + 2 * y * y_stride,
+ Y + (2 * y + 1) * y_stride,
+ U + y * uv_stride,
+ V + y * uv_stride);
+ }
+ if (y_height & 1) {
+ RGBALinepairToYUV420(pixdata + (y_height - 1) * words_per_line,
+ pixdata + (y_height - 1) * words_per_line,
+ y_width,
+ Y + (y_height - 1) * y_stride,
+ Y + (y_height - 1) * y_stride,
+ U + (y_height >> 1) * uv_stride,
+ V + (y_height >> 1) * uv_stride);
+ }
+}
+
+static int codec_ctl(vpx_codec_ctx_t *enc,
+ enum vp8e_enc_control_id id,
+ int value) {
+ const vpx_codec_err_t res = vpx_codec_control_(enc, id, value);
+ if (res != VPX_CODEC_OK) {
+ return webp_failure;
+ }
+ return webp_success;
+}
+
+static void SetupParams(vpx_codec_enc_cfg_t* cfg,
+ int QP) {
+ cfg->g_threads = 2;
+ cfg->rc_min_quantizer = QP;
+ cfg->rc_max_quantizer = QP;
+ cfg->kf_mode = VPX_KF_FIXED;
+}
+
+/* VPXEncode: Takes a Y, U, V data buffers (with color components U and V
+ * subsampled to 1/2 resolution) and generates the VPX string.
+ * Output VPX string is placed in the *p_out buffer. container_size
+ * indicates number of bytes to be left blank at the beginning of
+ * *p_out buffer to accommodate for a container header.
+ *
+ * Return: success/failure
+ */
+static WebPResult VPXEncode(const uint8* Y,
+ const uint8* U,
+ const uint8* V,
+ int y_width,
+ int y_height,
+ int y_stride,
+ int uv_width,
+ int uv_height,
+ int uv_stride,
+ int QP,
+ int container_size,
+ unsigned char** p_out,
+ int* p_out_size_bytes) {
+ *p_out = NULL;
+ *p_out_size_bytes = 0;
+
+ /* validate input parameters. */
+ if (!p_out || !Y || !U || !V
+ || y_width <= 0 || y_height <= 0 || uv_width <= 0 || uv_height <= 0
+ || y_stride < y_width || uv_stride < uv_width
+ || QP < 0 || QP > 63) {
+ return webp_failure;
+ }
+
+ vpx_codec_iface_t* const iface = &vpx_codec_vp8_cx_algo;
+
+ vpx_codec_err_t res;
+ vpx_codec_enc_cfg_t cfg;
+ res = vpx_codec_enc_config_default(iface, &cfg, 0);
+ if (res != VPX_CODEC_OK) {
+ return webp_failure;
+ }
+
+ SetupParams(&cfg, QP);
+ cfg.g_w = y_width;
+ cfg.g_h = y_height;
+
+ vpx_codec_ctx_t enc;
+ res = vpx_codec_enc_init(&enc, iface, &cfg, 0);
+
+ WebPResult result = webp_failure;
+
+ if (res == VPX_CODEC_OK) {
+ codec_ctl(&enc, VP8E_SET_CPUUSED, 3);
+ codec_ctl(&enc, VP8E_SET_NOISE_SENSITIVITY, 0);
+ codec_ctl(&enc, VP8E_SET_SHARPNESS, 0);
+ codec_ctl(&enc, VP8E_SET_ENABLEAUTOALTREF, 0);
+ codec_ctl(&enc, VP8E_SET_ARNR_MAXFRAMES, 0);
+ codec_ctl(&enc, VP8E_SET_ARNR_TYPE, 0);
+ codec_ctl(&enc, VP8E_SET_ARNR_STRENGTH, 0);
+ codec_ctl(&enc, VP8E_SET_STATIC_THRESHOLD, 0);
+ codec_ctl(&enc, VP8E_SET_TOKEN_PARTITIONS, 2);
+
+ vpx_image_t img;
+ vpx_img_wrap(&img, IMG_FMT_I420,
+ y_width, y_height, 16, (uint8*)(Y));
+ img.planes[PLANE_Y] = (uint8*)(Y);
+ img.planes[PLANE_U] = (uint8*)(U);
+ img.planes[PLANE_V] = (uint8*)(V);
+ img.stride[PLANE_Y] = y_stride;
+ img.stride[PLANE_U] = uv_stride;
+ img.stride[PLANE_V] = uv_stride;
+
+ res = vpx_codec_encode(&enc, &img, 0, 1, 0, VPX_DL_BEST_QUALITY);
+
+ if (res == VPX_CODEC_OK) {
+ vpx_codec_iter_t iter = NULL;
+ const vpx_codec_cx_pkt_t* pkt = vpx_codec_get_cx_data(&enc, &iter);
+ if (pkt != NULL) {
+ *p_out = (unsigned char*)(calloc(container_size + pkt->data.frame.sz,
+ 1));
+
+ memcpy(*p_out + container_size,
+ (const void*)(pkt->data.frame.buf),
+ pkt->data.frame.sz);
+ *p_out_size_bytes = container_size + pkt->data.frame.sz;
+
+ result = webp_success;
+ }
+ }
+ }
+
+ vpx_codec_destroy(&enc);
+
+ return result;
+}
+
+WebPResult WebPEncode(const uint8* Y,
+ const uint8* U,
+ const uint8* V,
+ int y_width,
+ int y_height,
+ int y_stride,
+ int uv_width,
+ int uv_height,
+ int uv_stride,
+ int QP,
+ unsigned char** p_out,
+ int* p_out_size_bytes,
+ double *psnr) {
+
+ const int kRiffHeaderSize = 20;
+
+ if (VPXEncode(Y, U, V,
+ y_width, y_height, y_stride,
+ uv_width, uv_height, uv_stride,
+ QP, kRiffHeaderSize,
+ p_out, p_out_size_bytes) != webp_success) {
+ return webp_failure;
+ }
+
+ /* Write RIFF header */
+ const int img_size_bytes = *p_out_size_bytes - kRiffHeaderSize;
+ const int chunk_size = (img_size_bytes + 1) & ~1; /* make size even */
+ const int riff_size = chunk_size + 12;
+ const uint8_t kRiffHeader[20] = { 'R', 'I', 'F', 'F',
+ (riff_size >> 0) & 255,
+ (riff_size >> 8) & 255,
+ (riff_size >> 16) & 255,
+ (riff_size >> 24) & 255,
+ 'W', 'E', 'B', 'P',
+ 'V', 'P', '8', ' ',
+ (chunk_size >> 0) & 255,
+ (chunk_size >> 8) & 255,
+ (chunk_size >> 16) & 255,
+ (chunk_size >> 24) & 255 };
+ memcpy(*p_out, kRiffHeader, kRiffHeaderSize);
+
+ if (psnr) {
+ *psnr = WebPGetPSNR(Y, U, V, *p_out, *p_out_size_bytes);
+ }
+
+ return webp_success;
+}
+
+void AdjustColorspace(uint8* Y, uint8* U, uint8* V, int width, int height) {
+ int y_width = width;
+ int y_height = height;
+ int y_stride = y_width;
+ int uv_width = ((y_width + 1) >> 1);
+ int uv_height = ((y_height + 1) >> 1);
+ int uv_stride = uv_width;
+ int x, y;
+ /* convert luma */
+ for (y = 0; y < y_height; ++y) {
+ uint8* const Yrow = Y + y * y_stride;
+ for (x = 0; x < y_width; ++x) {
+ /* maps [0..255] to [16..235] */
+ Yrow[x] = ((Yrow[x] * 55 + 32) >> 6) + 16;
+ }
+ }
+ /* convert chroma */
+ for (y = 0; y < uv_height; ++y) {
+ uint8* const Urow = U + y * uv_stride;
+ uint8* const Vrow = V + y * uv_stride;
+ for (x = 0; x < uv_width; ++x) {
+ /* maps [0..255] to [16..240] */
+ Urow[x] = (((Urow[x] - 127) * 7) >> 3) + 128;
+ Vrow[x] = (((Vrow[x] - 127) * 7) >> 3) + 128;
+ }
+ }
+}
+
+void AdjustColorspaceBack(uint8* Y, uint8* U, uint8* V, int width, int height) {
+ int y_width = width;
+ int y_height = height;
+ int y_stride = y_width;
+ int uv_width = ((y_width + 1) >> 1);
+ int uv_height = ((y_height + 1) >> 1);
+ int uv_stride = uv_width;
+ int x, y;
+ /* convert luma */
+ for (y = 0; y < y_height; ++y) {
+ uint8* const Yrow = Y + y * y_stride;
+ for (x = 0; x < y_width; ++x) {
+ /* maps [16..235] to [0..255] */
+ const int v = ((Yrow[x] - 16) * 149 + 64) >> 7;
+ Yrow[x] = (v < 0) ? 0 : (v > 255) ? 255u : v;
+ }
+ }
+ /* convert chroma */
+ for (y = 0; y < uv_height; ++y) {
+ uint8* const Urow = U + y * uv_stride;
+ uint8* const Vrow = V + y * uv_stride;
+ for (x = 0; x < uv_width; ++x) {
+ /* maps [0..255] to [16..240] */
+ const int ru = (((Urow[x] - 128) * 73) >> 6) + 128;
+ const int rv = (((Vrow[x] - 128) * 73) >> 6) + 128;
+ Urow[x] = (ru < 0) ? 0 : (ru > 255) ? 255u : ru;
+ Vrow[x] = (rv < 0) ? 0 : (rv > 255) ? 255u : rv;
+ }
+ }
+}
+
+WebPResult WebPGetInfo(const uint8* data,
+ int data_size,
+ int *width,
+ int *height) {
+ if (width) *width = 0;
+ if (height) *height = 0;
+ const uint32 chunk_size = SkipRiffHeader(&data, &data_size);
+ if (!chunk_size) {
+ return webp_failure; /* unsupported RIFF header */
+ }
+ /* Validate raw video data */
+ if (data_size < 10) {
+ return webp_failure; /* not enough data */
+ }
+ /* check signature */
+ if (data[3] != 0x9d || data[4] != 0x01 || data[5] != 0x2a) {
+ return webp_failure; /* Wrong signature. */
+ }
+ const uint32 bits = data[0] | (data[1] << 8) | (data[2] << 16);
+ const int key_frame = !(bits & 1);
+ if (!key_frame) { /* Not a keyframe. */
+ return webp_failure;
+ }
+ const int profile = (bits >> 1) & 7;
+ const int show_frame = (bits >> 4) & 1;
+ const uint32 partition_length = (bits >> 5);
+ if (profile > 3) {
+ return webp_failure; /* unknown profile */
+ }
+ if (!show_frame) {
+ return webp_failure; /* first frame is invisible! */
+ }
+ if (partition_length >= chunk_size) {
+ return webp_failure; /* inconsistent size information. */
+ }
+ const int w = ((data[7] << 8) | data[6]) & 0x3fff;
+ const int h = ((data[9] << 8) | data[8]) & 0x3fff;
+ if (width) *width = w;
+ if (height) *height = h;
+
+ return webp_success;
+}
Propchange: trunk/libwebp/webpimg.c
------------------------------------------------------------------------------
amiga:protection = ----rwed ---- ----
Propchange: trunk/libwebp/webpimg.c
------------------------------------------------------------------------------
svn:executable = *
Added: trunk/libwebp/webpimg.h
URL: http://source.netsurf-browser.org/trunk/libwebp/webpimg.h?rev=10859&view=...
==============================================================================
--- trunk/libwebp/webpimg.h (added)
+++ trunk/libwebp/webpimg.h Sun Oct 3 15:37:28 2010
@@ -1,0 +1,182 @@
+/*===========================================================================*
+ - Copyright 2010 Google Inc.
+ -
+ - This code is licensed under the same terms as WebM:
+ - Software License Agreement: http://www.webmproject.org/license/software/
+ - Additional IP Rights Grant: http://www.webmproject.org/license/additional/
+ *===========================================================================*/
+
+/*
+ * Encoding/Decoding of WebP still image compression format.
+ *
+ * 1. WebPDecode: Takes an array of bytes (string) corresponding to the WebP
+ * encoded image and generates output in the YUV format with
+ * the color components U, V subsampled to 1/2 resolution along
+ * each dimension.
+ *
+ * 2. YUV420toRGBA: Converts from YUV (with color subsampling) such as produced
+ * by the WebPDecode routine into 32 bits per pixel RGBA data
+ * array. This data array can be directly used by the Leptonica
+ * Pix in-memory image format.
+ *
+ * 3. WebPEncode: Takes a Y, U, V data buffers (with color components U and V
+ * subsampled to 1/2 resolution) and generates the WebP string
+ *
+ * 4. RGBAToYUV420: Generates Y, U, V data (with color subsampling) from 32 bits
+ * per pixel RGBA data buffer. The resulting YUV data can be
+ * directly fed into the WebPEncode routine.
+ *
+ * 5. AdjustColorspace:
+ *
+ * 6. AdjustColorspaceBack:
+ */
+
+#ifndef THIRD_PARTY_VP8_VP8IMG_H_
+#define THIRD_PARTY_VP8_VP8IMG_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+//#include <exec/types.h>
+typedef unsigned char uint8;
+typedef unsigned int uint32;
+typedef enum WebPResultType {
+ webp_success = 0,
+ webp_failure = -1
+} WebPResult;
+
+/* Takes an array of bytes (string) corresponding to the WebP
+ * encoded image and generates output in the YUV format with
+ * the color components U, V subsampled to 1/2 resolution along
+ * each dimension.
+ * Input:
+ * 1. data: the WebP data stream (array of bytes)
+ * 2. data_size: count of bytes in the WebP data stream
+ *
+ * Output:
+ * 3. p_Y/p_U/p_V : pointer to the Y/U/V data buffer (this routine will
+ * allocate memory for the buffer, fill the buffer with
+ * appropriate data and transfer owner ship of the buffer
+ * to caller. Caller is reponsible for freeing the memory).
+ * Note that the memory for Y, U, V buffers is alloacted
+ * in one chunk, hence one should call free(*p_Y) only.
+ * Do not try to free the U and V buffers.
+ *
+ * 6. p_width: this routine returns the width of the decoded image here
+ * 7. p_height: this routine returns the width of the decoded image here
+ * Return: success/failure
+ */
+WebPResult WebPDecode(const uint8* data,
+ int data_size,
+ uint8** p_Y,
+ uint8** p_U,
+ uint8** p_V,
+ int* p_width,
+ int* p_height);
+
+/* WebPEncode: Takes a Y, U, V data buffers (with color components U and V
+ * subsampled to 1/2 resolution) and generates the WebP string.
+ * Input:
+ * 1, 2, 3. Y, U, V: The input YUV data buffers
+ * 4, 5. y_width, y_height: The width and height of the image whose data
+ * is in Y, U, V. This matches the Y plane. The U
+ * and V planes typically have 1/2 width and
+ * height.
+ * 6. y_stride: The width (in bytes) of one row of Y data. This may not
+ * match width if there is end of row padding (e.g., for 32
+ * bit row aligment).
+ * 7. QP: the quantization parameter. This parameter controls the
+ * compression vs quality tradeoff. Use smaller numbers for better
+ * quality (compression will be lesser) and vice versa. 20 is a
+ * good optimal value.
+ * Output:
+ * 8. p_out: the output array of bytes corresponding to the encoded WebP
+ * image. This routine allocates memory for the buffer, fills it
+ * with appropriate values and transfers ownership to caller.
+ * Caller responsible for freeing of memory.
+ * Return: success/failure
+ */
+WebPResult WebPEncode(const uint8* Y,
+ const uint8* U,
+ const uint8* V,
+ int y_width,
+ int y_height,
+ int y_stride,
+ int uv_width,
+ int uv_height,
+ int uv_stride,
+ int QP,
+ unsigned char** p_out,
+ int* p_out_size_bytes,
+ double* psnr);
+
+/* Converts from YUV (with color subsampling) such as produced by the WebPDecode
+ * routine into 32 bits per pixel RGBA data array. This data array can be
+ * directly used by the Leptonica Pix in-memory image format.
+ * Input:
+ * 1, 2, 3. Y, U, V: the input data buffers
+ * 4. pixwpl: the desired words per line corresponding to the supplied
+ * output pixdata.
+ * 5. width, height: the dimensions of the image whose data resides in Y,
+ * U, V.
+ * Output:
+ * 6. pixdata: the output data buffer. Caller should allocate
+ * height * pixwpl bytes of memory before calling this routine.
+ */
+void YUV420toRGBA(uint8* Y,
+ uint8* U,
+ uint8* V,
+ int words_per_line,
+ int width,
+ int height,
+ uint32* pixdata);
+
+/* Generates Y, U, V data (with color subsampling) from 32 bits
+ * per pixel RGBA data buffer. The resulting YUV data can be directly fed into
+ * the WebPEncode routine.
+ * Input:
+ * 1. pix data input rgba data buffer
+ * 2. words per line corresponding to pixdata
+ * 3, 4. image width and height respectively
+ * Output:
+ * 5, 6, 7. Output YUV data buffers
+ */
+void RGBAToYUV420(uint32* pixdata,
+ int words_per_line,
+ int width,
+ int height,
+ uint8* Y,
+ uint8* U,
+ uint8* V);
+
+/* This function adjust from YUV420J (jpeg decoding) to YUV420 (webp input)
+ * Hints: http://en.wikipedia.org/wiki/YCbCr
+ */
+void AdjustColorspace(uint8* Y, uint8* U, uint8* V, int width, int height);
+
+/* Inverse function: convert from YUV420 to YUV420J */
+void AdjustColorspaceBack(uint8* Y, uint8* U, uint8* V, int width, int height);
+
+/* Checks WebP image header and outputs height and width information of
+ * the image
+ *
+ * Input:
+ * 1. data: the WebP data stream (array of bytes)
+ * 2. data_size: count of bytes in the WebP data stream
+ *
+ * Outut:
+ * width/height: width and height of the image
+ *
+ * Return: success/failure
+ */
+WebPResult WebPGetInfo(const uint8* data,
+ int data_size,
+ int *width,
+ int *height);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* THIRD_PARTY_VP8_VP8IMG_H_ */
Propchange: trunk/libwebp/webpimg.h
------------------------------------------------------------------------------
amiga:protection = ----rwed ---- ----
Propchange: trunk/libwebp/webpimg.h
------------------------------------------------------------------------------
svn:executable = *
12 years, 8 months
r10857 jmb - in /branches/jmb/treeview-redux/gtk: gtk_treeview.c gtk_treeview.h
by netsurf@semichrome.net
Author: jmb
Date: Sat Oct 2 11:58:37 2010
New Revision: 10857
URL: http://source.netsurf-browser.org?rev=10857&view=rev
Log:
Apply some consistency to the GTK treeview binding.
Modified:
branches/jmb/treeview-redux/gtk/gtk_treeview.c
branches/jmb/treeview-redux/gtk/gtk_treeview.h
Modified: branches/jmb/treeview-redux/gtk/gtk_treeview.c
URL: http://source.netsurf-browser.org/branches/jmb/treeview-redux/gtk/gtk_tre...
==============================================================================
--- branches/jmb/treeview-redux/gtk/gtk_treeview.c (original)
+++ branches/jmb/treeview-redux/gtk/gtk_treeview.c Sat Oct 2 11:58:37 2010
@@ -48,17 +48,17 @@
const char tree_directory_icon_name[] = "directory.png";
const char tree_content_icon_name[] = "content.png";
-static void gtk_tree_redraw_request(int x, int y, int width, int height,
+static void nsgtk_tree_redraw_request(int x, int y, int width, int height,
void *data);
-static void tree_resized(struct tree *tree, int width, int height, void *data);
-static void tree_scroll_visible(int y, int height, void *data);
-static void tree_get_window_dimensions(int *width, int *height, void *data);
-
-const struct treeview_table gtk_tree_callbacks = {
- .redraw_request = gtk_tree_redraw_request,
- .resized = tree_resized,
- .scroll_visible = tree_scroll_visible,
- .get_window_dimensions = tree_get_window_dimensions
+static void nsgtk_tree_resized(struct tree *tree, int width, int height, void *data);
+static void nsgtk_tree_scroll_visible(int y, int height, void *data);
+static void nsgtk_tree_get_window_dimensions(int *width, int *height, void *data);
+
+static const struct treeview_table nsgtk_tree_callbacks = {
+ .redraw_request = nsgtk_tree_redraw_request,
+ .resized = nsgtk_tree_resized,
+ .scroll_visible = nsgtk_tree_scroll_visible,
+ .get_window_dimensions = nsgtk_tree_get_window_dimensions
};
struct nsgtk_treeview *nsgtk_treeview_create(unsigned int flags,
@@ -77,7 +77,7 @@
tv->window = window;
tv->scrolled = scrolled;
tv->drawing_area = drawing_area;
- tv->tree = tree_create(flags, >k_tree_callbacks, tv);
+ tv->tree = tree_create(flags, &nsgtk_tree_callbacks, tv);
tv->mouse_state = 0;
gtk_widget_modify_bg(GTK_WIDGET(drawing_area), GTK_STATE_NORMAL,
@@ -116,7 +116,7 @@
return tv->tree;
}
-void gtk_tree_redraw_request(int x, int y, int width, int height, void *data)
+void nsgtk_tree_redraw_request(int x, int y, int width, int height, void *data)
{
struct nsgtk_treeview *tw = data;
@@ -130,7 +130,7 @@
*
* \param tree the tree to update the owner of
*/
-void tree_resized(struct tree *tree, int width, int height, void *data)
+void nsgtk_tree_resized(struct tree *tree, int width, int height, void *data)
{
struct nsgtk_treeview *tw = data;
@@ -194,7 +194,7 @@
* \param height height of the element
* \param data user data assigned to the tree on tree creation
*/
-void tree_scroll_visible(int y, int height, void *data)
+void nsgtk_tree_scroll_visible(int y, int height, void *data)
{
int y0, y1;
gdouble page;
@@ -225,7 +225,7 @@
* \param width will be updated to window width if not NULL
* \param height will be updated to window height if not NULL
*/
-void tree_get_window_dimensions(int *width, int *height, void *data)
+void nsgtk_tree_get_window_dimensions(int *width, int *height, void *data)
{
struct nsgtk_treeview *tw = data;
GtkAdjustment *vadj;
Modified: branches/jmb/treeview-redux/gtk/gtk_treeview.h
URL: http://source.netsurf-browser.org/branches/jmb/treeview-redux/gtk/gtk_tre...
==============================================================================
--- branches/jmb/treeview-redux/gtk/gtk_treeview.h (original)
+++ branches/jmb/treeview-redux/gtk/gtk_treeview.h Sat Oct 2 11:58:37 2010
@@ -47,6 +47,4 @@
gboolean nsgtk_tree_window_keypress_event(GtkWidget *widget, GdkEventKey *event,
gpointer g);
-extern const struct treeview_table gtk_tree_callbacks;
-
#endif /*__NSGTK_TREEVIEW_H__*/
12 years, 8 months