summaryrefslogtreecommitdiff
path: root/modules/webp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/webp')
-rw-r--r--modules/webp/SCsub2
-rw-r--r--modules/webp/image_loader_webp.cpp54
-rw-r--r--modules/webp/image_loader_webp.h2
-rw-r--r--modules/webp/register_types.cpp2
-rw-r--r--modules/webp/register_types.h2
5 files changed, 31 insertions, 31 deletions
diff --git a/modules/webp/SCsub b/modules/webp/SCsub
index ab60bfd6b2..92f34c4da1 100644
--- a/modules/webp/SCsub
+++ b/modules/webp/SCsub
@@ -6,7 +6,7 @@ Import('env_modules')
env_webp = env_modules.Clone()
# Thirdparty source files
-if (env["libwebp"] != "system"): # builtin
+if (env['builtin_libwebp'] != 'no'):
thirdparty_dir = "#thirdparty/libwebp/"
thirdparty_sources = [
"enc/webpenc.c",
diff --git a/modules/webp/image_loader_webp.cpp b/modules/webp/image_loader_webp.cpp
index 0fe2db3261..3508c6a663 100644
--- a/modules/webp/image_loader_webp.cpp
+++ b/modules/webp/image_loader_webp.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -36,48 +36,48 @@
#include <webp/decode.h>
#include <webp/encode.h>
-static DVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) {
+static PoolVector<uint8_t> _webp_lossy_pack(const Image& p_image,float p_quality) {
- ERR_FAIL_COND_V(p_image.empty(),DVector<uint8_t>());
+ ERR_FAIL_COND_V(p_image.empty(),PoolVector<uint8_t>());
Image img=p_image;
if (img.detect_alpha())
- img.convert(Image::FORMAT_RGBA);
+ img.convert(Image::FORMAT_RGBA8);
else
- img.convert(Image::FORMAT_RGB);
+ img.convert(Image::FORMAT_RGB8);
Size2 s(img.get_width(),img.get_height());
- DVector<uint8_t> data = img.get_data();
- DVector<uint8_t>::Read r = data.read();
+ PoolVector<uint8_t> data = img.get_data();
+ PoolVector<uint8_t>::Read r = data.read();
uint8_t *dst_buff=NULL;
size_t dst_size=0;
- if (img.get_format()==Image::FORMAT_RGB) {
+ if (img.get_format()==Image::FORMAT_RGB8) {
dst_size = WebPEncodeRGB(r.ptr(),s.width,s.height,3*s.width,CLAMP(p_quality*100.0,0,100.0),&dst_buff);
} else {
dst_size = WebPEncodeRGBA(r.ptr(),s.width,s.height,4*s.width,CLAMP(p_quality*100.0,0,100.0),&dst_buff);
}
- ERR_FAIL_COND_V(dst_size==0,DVector<uint8_t>());
- DVector<uint8_t> dst;
+ ERR_FAIL_COND_V(dst_size==0,PoolVector<uint8_t>());
+ PoolVector<uint8_t> dst;
dst.resize(4+dst_size);
- DVector<uint8_t>::Write w = dst.write();
+ PoolVector<uint8_t>::Write w = dst.write();
w[0]='W';
w[1]='E';
w[2]='B';
w[3]='P';
copymem(&w[4],dst_buff,dst_size);
free(dst_buff);
- w=DVector<uint8_t>::Write();
+ w=PoolVector<uint8_t>::Write();
return dst;
}
-static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) {
+static Image _webp_lossy_unpack(const PoolVector<uint8_t>& p_buffer) {
int size = p_buffer.size()-4;
ERR_FAIL_COND_V(size<=0,Image());
- DVector<uint8_t>::Read r = p_buffer.read();
+ PoolVector<uint8_t>::Read r = p_buffer.read();
ERR_FAIL_COND_V(r[0]!='W' || r[1]!='E' || r[2]!='B' || r[3]!='P',Image());
WebPBitstreamFeatures features;
@@ -90,11 +90,11 @@ static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) {
//print_line("height: "+itos(features.height));
//print_line("alpha: "+itos(features.has_alpha));
- DVector<uint8_t> dst_image;
+ PoolVector<uint8_t> dst_image;
int datasize = features.width*features.height*(features.has_alpha?4:3);
dst_image.resize(datasize);
- DVector<uint8_t>::Write dst_w = dst_image.write();
+ PoolVector<uint8_t>::Write dst_w = dst_image.write();
bool errdec=false;
if (features.has_alpha) {
@@ -107,9 +107,9 @@ static Image _webp_lossy_unpack(const DVector<uint8_t>& p_buffer) {
//ERR_EXPLAIN("Error decoding webp! - "+p_file);
ERR_FAIL_COND_V(errdec,Image());
- dst_w = DVector<uint8_t>::Write();
+ dst_w = PoolVector<uint8_t>::Write();
- return Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA:Image::FORMAT_RGB,dst_image);
+ return Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA8:Image::FORMAT_RGB8,dst_image);
}
@@ -118,12 +118,12 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) {
uint32_t size = f->get_len();
- DVector<uint8_t> src_image;
+ PoolVector<uint8_t> src_image;
src_image.resize(size);
WebPBitstreamFeatures features;
- DVector<uint8_t>::Write src_w = src_image.write();
+ PoolVector<uint8_t>::Write src_w = src_image.write();
f->get_buffer(src_w.ptr(),size);
ERR_FAIL_COND_V(f->eof_reached(), ERR_FILE_EOF);
@@ -137,14 +137,14 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) {
print_line("height: "+itos(features.height));
print_line("alpha: "+itos(features.has_alpha));
- src_w = DVector<uint8_t>::Write();
+ src_w = PoolVector<uint8_t>::Write();
- DVector<uint8_t> dst_image;
+ PoolVector<uint8_t> dst_image;
int datasize = features.width*features.height*(features.has_alpha?4:3);
dst_image.resize(datasize);
- DVector<uint8_t>::Read src_r = src_image.read();
- DVector<uint8_t>::Write dst_w = dst_image.write();
+ PoolVector<uint8_t>::Read src_r = src_image.read();
+ PoolVector<uint8_t>::Write dst_w = dst_image.write();
bool errdec=false;
@@ -158,10 +158,10 @@ Error ImageLoaderWEBP::load_image(Image *p_image,FileAccess *f) {
//ERR_EXPLAIN("Error decoding webp! - "+p_file);
ERR_FAIL_COND_V(errdec,ERR_FILE_CORRUPT);
- src_r = DVector<uint8_t>::Read();
- dst_w = DVector<uint8_t>::Write();
+ src_r = PoolVector<uint8_t>::Read();
+ dst_w = PoolVector<uint8_t>::Write();
- *p_image = Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA:Image::FORMAT_RGB,dst_image);
+ *p_image = Image(features.width,features.height,0,features.has_alpha?Image::FORMAT_RGBA8:Image::FORMAT_RGB8,dst_image);
return OK;
diff --git a/modules/webp/image_loader_webp.h b/modules/webp/image_loader_webp.h
index 24f79708db..eb1b32ac95 100644
--- a/modules/webp/image_loader_webp.h
+++ b/modules/webp/image_loader_webp.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/webp/register_types.cpp b/modules/webp/register_types.cpp
index 039876bbb9..7a4e35dc4c 100644
--- a/modules/webp/register_types.cpp
+++ b/modules/webp/register_types.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/modules/webp/register_types.h b/modules/webp/register_types.h
index a200188e47..ce1f29937b 100644
--- a/modules/webp/register_types.h
+++ b/modules/webp/register_types.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */