diff --git a/SConstruct b/SConstruct index acc6c2e248a..3f2f1e5b234 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 3fd1bcd00df..27bd63dfed2 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 dfdb19402ee..00000000000 --- 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 89ec468442e..ca922da6f08 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 00000000000..409a8b52d0d --- /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 00000000000..368e97e152c --- /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 similarity index 99% rename from drivers/jpegd/image_loader_jpegd.cpp rename to modules/jpg/image_loader_jpegd.cpp index 496334605d4..03c3b19fc04 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 #include diff --git a/drivers/jpegd/image_loader_jpegd.h b/modules/jpg/image_loader_jpegd.h similarity index 100% rename from drivers/jpegd/image_loader_jpegd.h rename to 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 00000000000..a648423cdfb --- /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 00000000000..0e06c4ff810 --- /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 55d89810db9..0e512fb8678 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 similarity index 100% rename from drivers/jpegd/jpgd.cpp rename to thirdparty/jpeg-compressor/jpgd.cpp diff --git a/drivers/jpegd/jpgd.h b/thirdparty/jpeg-compressor/jpgd.h similarity index 100% rename from drivers/jpegd/jpgd.h rename to thirdparty/jpeg-compressor/jpgd.h