mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-23 20:46:50 +03:00
Update to use official libwebp 0.1
Remove libvpx references as no longer needed. svn path=/trunk/netsurf/; revision=12115
This commit is contained in:
parent
99ef43c9fe
commit
7ec2cc7f8e
@ -53,7 +53,7 @@ NETSURF_USE_PNG := YES
|
|||||||
# Valid options: YES, NO (at least one of PNG/MNG highly recommended)
|
# Valid options: YES, NO (at least one of PNG/MNG highly recommended)
|
||||||
NETSURF_USE_MNG := YES
|
NETSURF_USE_MNG := YES
|
||||||
|
|
||||||
# Enable NetSurf's use of libwebp/libvpx for displaying WebPs
|
# Enable NetSurf's use of libwebp for displaying WebPs
|
||||||
# Valid options: YES, NO
|
# Valid options: YES, NO
|
||||||
NETSURF_USE_WEBP := NO
|
NETSURF_USE_WEBP := NO
|
||||||
|
|
||||||
@ -220,7 +220,7 @@ ifeq ($(TARGET),amiga)
|
|||||||
# Valid options: YES, NO, AUTO
|
# Valid options: YES, NO, AUTO
|
||||||
NETSURF_USE_ROSPRITE := YES
|
NETSURF_USE_ROSPRITE := YES
|
||||||
|
|
||||||
# Enable NetSurf's use of libwebp/libvpx for displaying WebPs
|
# Enable NetSurf's use of libwebp for displaying WebPs
|
||||||
# Valid options: YES, NO
|
# Valid options: YES, NO
|
||||||
NETSURF_USE_WEBP := YES
|
NETSURF_USE_WEBP := YES
|
||||||
|
|
||||||
@ -340,7 +340,7 @@ ifeq ($(TARGET),atari)
|
|||||||
# Valid options: YES, NO, AUTO
|
# Valid options: YES, NO, AUTO
|
||||||
NETSURF_USE_ROSPRITE := NO
|
NETSURF_USE_ROSPRITE := NO
|
||||||
|
|
||||||
# Enable NetSurf's use of libwebp/libvpx for displaying WebPs
|
# Enable NetSurf's use of libwebp for displaying WebPs
|
||||||
# Valid options: YES, NO
|
# Valid options: YES, NO
|
||||||
NETSURF_USE_WEBP := NO
|
NETSURF_USE_WEBP := NO
|
||||||
|
|
||||||
@ -379,7 +379,7 @@ ifeq ($(TARGET),cocoa)
|
|||||||
# Valid options: YES, NO, AUTO
|
# Valid options: YES, NO, AUTO
|
||||||
NETSURF_USE_ROSPRITE := NO
|
NETSURF_USE_ROSPRITE := NO
|
||||||
|
|
||||||
# Enable NetSurf's use of libwebp/libvpx for displaying WebPs
|
# Enable NetSurf's use of libwebp for displaying WebPs
|
||||||
# Valid options: YES, NO
|
# Valid options: YES, NO
|
||||||
NETSURF_USE_WEBP := NO
|
NETSURF_USE_WEBP := NO
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ ifeq ($(HOST),amiga)
|
|||||||
$(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng) ))
|
$(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,NSSVG,-DWITH_NS_SVG,-lsvgtiny,SVG (libsvgtiny)))
|
||||||
$(eval $(call feature_enabled,MNG,,-llcms -ljpeg,PNG/JNG/MNG (libmng)))
|
$(eval $(call feature_enabled,MNG,,-llcms -ljpeg,PNG/JNG/MNG (libmng)))
|
||||||
$(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp -lvpx,WebP (libwebp)))
|
$(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp,WebP (libwebp)))
|
||||||
$(eval $(call feature_enabled,AMIGA_ICON,-DWITH_AMIGA_ICON,,Amiga icon ))
|
$(eval $(call feature_enabled,AMIGA_ICON,-DWITH_AMIGA_ICON,,Amiga icon ))
|
||||||
$(eval $(call feature_enabled,PLUGINS,-DWITH_PLUGIN,,DataTypes images))
|
$(eval $(call feature_enabled,PLUGINS,-DWITH_PLUGIN,,DataTypes images))
|
||||||
|
|
||||||
|
2
amiga/dist/Install
vendored
2
amiga/dist/Install
vendored
@ -484,8 +484,6 @@
|
|||||||
(p_linksobj "libz.so.1.2.5" "libz.so")
|
(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")
|
||||||
(p_linksobj "libz.so.1.2.5" "libz.so.1.2")
|
(p_linksobj "libz.so.1.2.5" "libz.so.1.2")
|
||||||
(p_linksobj "libvpx.so.0.9.5" "libvpx.so.0")
|
|
||||||
; (p_linksobj "libpng14.so.14" "libpng.so")
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -24,5 +24,5 @@ makedir ram:NetSurf/Libs
|
|||||||
copy libs:parserutils.library libs:nsgif.library libs:nsbmp.library libs:iconv.library libs:hubbub.library ram:NetSurf/Libs
|
copy libs:parserutils.library libs:nsgif.library libs:nsbmp.library libs:iconv.library libs:hubbub.library ram:NetSurf/Libs
|
||||||
; libs:css.library libs:wapcaplet.library
|
; libs:css.library libs:wapcaplet.library
|
||||||
makedir ram:NetSurf/SObjs
|
makedir ram:NetSurf/SObjs
|
||||||
copy sobjs:libjpeg.so.8 sobjs:libmng.so.1 sobjs:liblcms.so sobjs:libxml2.so.9 sobjs:libcurl.so.7 sobjs:librtmp.so.0 sobjs:libsvgtiny.so.0 sobjs:libz.so.1.2.5 sobjs:libvpx.so.0.9.5 sobjs:libssl.so.1.0.0 sobjs:libcrypto.so.1.0.0 sobjs:libcss.so.0 sobjs:libwapcaplet.so.0 sobjs:libpng12.so ram:NetSurf/SObjs clone
|
copy sobjs:libjpeg.so.8 sobjs:libmng.so.1 sobjs:liblcms.so sobjs:libxml2.so.9 sobjs:libcurl.so.7 sobjs:librtmp.so.0 sobjs:libsvgtiny.so.0 sobjs:libz.so.1.2.5 sobjs:libwebp.so.0 sobjs:libssl.so.1.0.0 sobjs:libcrypto.so.1.0.0 sobjs:libcss.so.0 sobjs:libwapcaplet.so.0 sobjs:libpng12.so ram:NetSurf/SObjs clone
|
||||||
;sobjs:libhpdf-2.2.0.so.0.0
|
;sobjs:libhpdf-2.2.0.so.0.0
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
$(eval $(call pkg_config_find_and_add,PNG,libpng,PNG ))
|
$(eval $(call pkg_config_find_and_add,PNG,libpng,PNG ))
|
||||||
|
|
||||||
# no pkg-config for this library
|
# no pkg-config for this library
|
||||||
$(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp -lvpx,WebP (libwebp)))
|
$(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp,WebP (libwebp)))
|
||||||
|
|
||||||
GTKCFLAGS := -std=c99 -Dgtk -Dnsgtk \
|
GTKCFLAGS := -std=c99 -Dgtk -Dnsgtk \
|
||||||
-DGTK_DISABLE_DEPRECATED \
|
-DGTK_DISABLE_DEPRECATED \
|
||||||
|
45
image/webp.c
45
image/webp.c
@ -27,7 +27,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <webpimg.h>
|
#include <webp/decode.h>
|
||||||
#include "desktop/plotters.h"
|
#include "desktop/plotters.h"
|
||||||
#include "image/bitmap.h"
|
#include "image/bitmap.h"
|
||||||
#include "content/content_protected.h"
|
#include "content/content_protected.h"
|
||||||
@ -44,24 +44,21 @@
|
|||||||
bool webp_convert(struct content *c)
|
bool webp_convert(struct content *c)
|
||||||
{
|
{
|
||||||
union content_msg_data msg_data;
|
union content_msg_data msg_data;
|
||||||
const uint8 *data;
|
const uint8_t *data;
|
||||||
unsigned char *imagebuf = NULL;
|
unsigned char *imagebuf = NULL;
|
||||||
uint32 *imagebufptr = NULL;
|
uint32_t *imagebufptr = NULL;
|
||||||
unsigned long size;
|
unsigned long size;
|
||||||
uint8 *Y = NULL, *U = NULL, *V = NULL;
|
|
||||||
int width = 0, height = 0;
|
int width = 0, height = 0;
|
||||||
uint32 offset = 0;
|
|
||||||
uint8 r, g, b, a;
|
|
||||||
char title[100];
|
char title[100];
|
||||||
WebPResult res = webp_success;
|
int res = 0;
|
||||||
|
uint8_t *res_p = NULL;
|
||||||
|
|
||||||
data = (uint8 *)content__get_source_data(c, &size);
|
data = (uint8 *)content__get_source_data(c, &size);
|
||||||
|
|
||||||
res = WebPDecode(data, size, &Y, &U, &V, &width, &height);
|
res = WebPGetInfo(data, size, &width, &height);
|
||||||
if (res != webp_success) {
|
if (res == 0) {
|
||||||
msg_data.error = messages_get("NoMemory");
|
msg_data.error = messages_get("NoMemory");
|
||||||
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
|
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
|
||||||
if(Y) free(Y);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,35 +66,23 @@ bool webp_convert(struct content *c)
|
|||||||
if (!c->bitmap) {
|
if (!c->bitmap) {
|
||||||
msg_data.error = messages_get("NoMemory");
|
msg_data.error = messages_get("NoMemory");
|
||||||
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
|
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
|
||||||
if(Y) free(Y);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
imagebuf = bitmap_get_buffer(c->bitmap);
|
imagebuf = bitmap_get_buffer(c->bitmap);
|
||||||
if (!imagebuf) {
|
if (!imagebuf) {
|
||||||
msg_data.error = messages_get("NoMemory");
|
msg_data.error = messages_get("NoMemory");
|
||||||
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
|
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
|
||||||
if(Y) free(Y);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
unsigned int row_width = bitmap_get_rowstride(c->bitmap) / 4;
|
unsigned int row_width = bitmap_get_rowstride(c->bitmap);
|
||||||
|
|
||||||
YUV420toRGBA(Y, U, V, row_width, width, height, (uint32 *)imagebuf);
|
res_p = WebPDecodeRGBAInto(data, size, imagebuf,
|
||||||
|
row_width * height, row_width);
|
||||||
if(Y) free(Y);
|
if (res_p == NULL) {
|
||||||
|
msg_data.error = messages_get("NoMemory");
|
||||||
/* Decoded data is RGBA on both big- and little-endian platforms,
|
content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
|
||||||
* so ensure correct byte order. */
|
return false;
|
||||||
|
|
||||||
size = width * height * 4;
|
|
||||||
|
|
||||||
for (offset = 0; offset < size; offset += 4) {
|
|
||||||
a = imagebuf[offset+3];
|
|
||||||
b = imagebuf[offset+2];
|
|
||||||
g = imagebuf[offset+1];
|
|
||||||
r = imagebuf[offset];
|
|
||||||
|
|
||||||
imagebufptr = imagebuf + offset;
|
|
||||||
*imagebufptr = r << 24 | g << 16 | b << 8 | a;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
c->width = width;
|
c->width = width;
|
||||||
|
Loading…
Reference in New Issue
Block a user