diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2016-10-10 00:03:33 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2016-10-15 11:50:39 +0200 |
commit | 16ba665db6bbd7f15aadc35fda87d69d0b220bf7 (patch) | |
tree | d7773cd17d8677f66fb37e821edf28a7375c097b | |
parent | 5fef84a1358310304cb1114924525ec4df794b49 (diff) |
jpg: Make it a module and split jpgd thirdparty files
Similar rationale as in previous commit.
-rw-r--r-- | SConstruct | 3 | ||||
-rw-r--r-- | drivers/SCsub | 3 | ||||
-rw-r--r-- | drivers/jpegd/SCsub | 11 | ||||
-rw-r--r-- | drivers/register_driver_types.cpp | 17 | ||||
-rw-r--r-- | modules/jpg/SCsub | 19 | ||||
-rw-r--r-- | modules/jpg/config.py | 6 | ||||
-rw-r--r-- | modules/jpg/image_loader_jpegd.cpp (renamed from drivers/jpegd/image_loader_jpegd.cpp) | 3 | ||||
-rw-r--r-- | modules/jpg/image_loader_jpegd.h (renamed from drivers/jpegd/image_loader_jpegd.h) | 0 | ||||
-rw-r--r-- | modules/jpg/register_types.cpp | 44 | ||||
-rw-r--r-- | modules/jpg/register_types.h | 30 | ||||
-rw-r--r-- | thirdparty/README.md | 11 | ||||
-rw-r--r-- | thirdparty/jpeg-compressor/jpgd.cpp (renamed from drivers/jpegd/jpgd.cpp) | 0 | ||||
-rw-r--r-- | thirdparty/jpeg-compressor/jpgd.h (renamed from drivers/jpegd/jpgd.h) | 0 |
13 files changed, 112 insertions, 35 deletions
diff --git a/SConstruct b/SConstruct index acc6c2e248..3f2f1e5b23 100644 --- a/SConstruct +++ b/SConstruct @@ -128,7 +128,6 @@ opts.Add('theoralib','Theora Video (yes/no)','no') opts.Add('freetype','Freetype support in editor','builtin') opts.Add('xml','XML Save/Load support (yes/no)','yes') opts.Add('libpng','libpng library for image loader support (system/builtin)','builtin') -opts.Add('jpg','JPG Image loader support (yes/no)','yes') opts.Add('webp','WEBP Image loader support (yes/no)','yes') opts.Add('dds','DDS Texture loader support (yes/no)','yes') opts.Add('pvr','PVR (PowerVR) Texture loader support (yes/no)','yes') @@ -354,8 +353,6 @@ if selected_platform in platform_list: env.Append(CPPFLAGS=['-DDDS_ENABLED']); if (env['pvr']=='yes'): env.Append(CPPFLAGS=['-DPVR_ENABLED']); - if (env['jpg']=='yes'): - env.Append(CPPFLAGS=['-DJPG_ENABLED']); if (env['webp']=='yes'): env.Append(CPPFLAGS=['-DWEBP_ENABLED']); diff --git a/drivers/SCsub b/drivers/SCsub index 3fd1bcd00d..27bd63dfed 100644 --- a/drivers/SCsub +++ b/drivers/SCsub @@ -27,9 +27,6 @@ if (env['openssl']!='no'): SConscript("png/SCsub"); -if (env["jpg"]=="yes"): - #SConscript("jpg/SCsub"); - SConscript("jpegd/SCsub"); if (env["webp"]=="yes"): SConscript("webp/SCsub"); SConscript("dds/SCsub"); diff --git a/drivers/jpegd/SCsub b/drivers/jpegd/SCsub deleted file mode 100644 index dfdb19402e..0000000000 --- a/drivers/jpegd/SCsub +++ /dev/null @@ -1,11 +0,0 @@ -Import('env') - - -jpg_sources = [ - "jpegd/jpgd.cpp", - "jpegd/image_loader_jpegd.cpp" - ] - -env.drivers_sources+=jpg_sources - -#env.add_source_files(env.drivers_sources, jpg_sources) diff --git a/drivers/register_driver_types.cpp b/drivers/register_driver_types.cpp index 89ec468442..ca922da6f0 100644 --- a/drivers/register_driver_types.cpp +++ b/drivers/register_driver_types.cpp @@ -31,7 +31,6 @@ #include "png/image_loader_png.h" #include "png/resource_saver_png.h" #include "webp/image_loader_webp.h" -#include "jpegd/image_loader_jpegd.h" #include "dds/texture_loader_dds.h" #include "etc1/texture_loader_pkm.h" #include "pvr/texture_loader_pvr.h" @@ -82,10 +81,6 @@ static ResourceSaverPNG *resource_saver_png=NULL; static ImageLoaderWEBP *image_loader_webp=NULL; #endif -#ifdef JPG_ENABLED -static ImageLoaderJPG *image_loader_jpg=NULL; -#endif - #ifdef DDS_ENABLED static ResourceFormatDDS *resource_loader_dds=NULL; #endif @@ -140,13 +135,6 @@ void register_core_driver_types() { ImageLoader::add_image_format_loader( image_loader_webp ); #endif -#ifdef JPG_ENABLED - - image_loader_jpg = memnew( ImageLoaderJPG ); - ImageLoader::add_image_format_loader( image_loader_jpg ); -#endif - - pbm_loader = memnew( ResourceFormatPBM ); ResourceLoader::add_resource_format_loader(pbm_loader); @@ -165,11 +153,6 @@ void unregister_core_driver_types() { memdelete( image_loader_webp ); #endif -#ifdef JPG_ENABLED - if (image_loader_jpg) - memdelete( image_loader_jpg ); -#endif - memdelete( pbm_loader ); } diff --git a/modules/jpg/SCsub b/modules/jpg/SCsub new file mode 100644 index 0000000000..409a8b52d0 --- /dev/null +++ b/modules/jpg/SCsub @@ -0,0 +1,19 @@ +Import('env') +Import('env_modules') + +# Thirdparty source files +# Not unbundled for now as they are not commonly available as shared library +thirdparty_dir = "#thirdparty/jpeg-compressor/" +thirdparty_jpg_sources = [ + "jpgd.cpp", +] +thirdparty_jpg_sources = [thirdparty_dir + file for file in thirdparty_jpg_sources] + +env_modules.add_source_files(env.modules_sources, thirdparty_jpg_sources) +env_modules.Append(CPPPATH = [thirdparty_dir]) + +# Godot's own source files +env_modules.add_source_files(env.modules_sources, "*.cpp") + +Export('env_modules') +Export('env') diff --git a/modules/jpg/config.py b/modules/jpg/config.py new file mode 100644 index 0000000000..368e97e152 --- /dev/null +++ b/modules/jpg/config.py @@ -0,0 +1,6 @@ + +def can_build(platform): + return True + +def configure(env): + pass diff --git a/drivers/jpegd/image_loader_jpegd.cpp b/modules/jpg/image_loader_jpegd.cpp index 496334605d..03c3b19fc0 100644 --- a/drivers/jpegd/image_loader_jpegd.cpp +++ b/modules/jpg/image_loader_jpegd.cpp @@ -30,7 +30,8 @@ #include "print_string.h" #include "os/os.h" -#include "jpgd.h" + +#include <jpgd.h> #include <string.h> diff --git a/drivers/jpegd/image_loader_jpegd.h b/modules/jpg/image_loader_jpegd.h index 2c52309ab1..2c52309ab1 100644 --- a/drivers/jpegd/image_loader_jpegd.h +++ b/modules/jpg/image_loader_jpegd.h diff --git a/modules/jpg/register_types.cpp b/modules/jpg/register_types.cpp new file mode 100644 index 0000000000..a648423cdf --- /dev/null +++ b/modules/jpg/register_types.cpp @@ -0,0 +1,44 @@ +/*************************************************************************/ +/* register_types.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 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 */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "register_types.h" + +#include "image_loader_jpegd.h" + +static ImageLoaderJPG *image_loader_jpg = NULL; + +void register_jpg_types() { + + image_loader_jpg = memnew( ImageLoaderJPG ); + ImageLoader::add_image_format_loader(image_loader_jpg); +} + +void unregister_jpg_types() { + + memdelete( image_loader_jpg ); +} diff --git a/modules/jpg/register_types.h b/modules/jpg/register_types.h new file mode 100644 index 0000000000..0e06c4ff81 --- /dev/null +++ b/modules/jpg/register_types.h @@ -0,0 +1,30 @@ +/*************************************************************************/ +/* register_types.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2016 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 */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +void register_jpg_types(); +void unregister_jpg_types(); diff --git a/thirdparty/README.md b/thirdparty/README.md index 55d89810db..0e512fb867 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -1,6 +1,17 @@ # Third party libraries +## jpeg-compressor + +- Upstream: https://github.com/richgel999/jpeg-compressor +- Version: 1.04 +- License: Public domain + +Files extracted from upstream source: + +- jpgd.{c,h} + + ## libpng - Upstream: http://libpng.org/pub/png/libpng.html diff --git a/drivers/jpegd/jpgd.cpp b/thirdparty/jpeg-compressor/jpgd.cpp index fad9a37a9a..fad9a37a9a 100644 --- a/drivers/jpegd/jpgd.cpp +++ b/thirdparty/jpeg-compressor/jpgd.cpp diff --git a/drivers/jpegd/jpgd.h b/thirdparty/jpeg-compressor/jpgd.h index 150b9a0b26..150b9a0b26 100644 --- a/drivers/jpegd/jpgd.h +++ b/thirdparty/jpeg-compressor/jpgd.h |