jpg: Make it a module and split jpgd thirdparty files
Similar rationale as in previous commit.
This commit is contained in:
parent
5fef84a135
commit
16ba665db6
13 changed files with 112 additions and 35 deletions
|
@ -128,7 +128,6 @@ opts.Add('theoralib','Theora Video (yes/no)','no')
|
||||||
opts.Add('freetype','Freetype support in editor','builtin')
|
opts.Add('freetype','Freetype support in editor','builtin')
|
||||||
opts.Add('xml','XML Save/Load support (yes/no)','yes')
|
opts.Add('xml','XML Save/Load support (yes/no)','yes')
|
||||||
opts.Add('libpng','libpng library for image loader support (system/builtin)','builtin')
|
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('webp','WEBP Image loader support (yes/no)','yes')
|
||||||
opts.Add('dds','DDS Texture 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')
|
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']);
|
env.Append(CPPFLAGS=['-DDDS_ENABLED']);
|
||||||
if (env['pvr']=='yes'):
|
if (env['pvr']=='yes'):
|
||||||
env.Append(CPPFLAGS=['-DPVR_ENABLED']);
|
env.Append(CPPFLAGS=['-DPVR_ENABLED']);
|
||||||
if (env['jpg']=='yes'):
|
|
||||||
env.Append(CPPFLAGS=['-DJPG_ENABLED']);
|
|
||||||
if (env['webp']=='yes'):
|
if (env['webp']=='yes'):
|
||||||
env.Append(CPPFLAGS=['-DWEBP_ENABLED']);
|
env.Append(CPPFLAGS=['-DWEBP_ENABLED']);
|
||||||
|
|
||||||
|
|
3
drivers/SCsub
vendored
3
drivers/SCsub
vendored
|
@ -27,9 +27,6 @@ if (env['openssl']!='no'):
|
||||||
|
|
||||||
|
|
||||||
SConscript("png/SCsub");
|
SConscript("png/SCsub");
|
||||||
if (env["jpg"]=="yes"):
|
|
||||||
#SConscript("jpg/SCsub");
|
|
||||||
SConscript("jpegd/SCsub");
|
|
||||||
if (env["webp"]=="yes"):
|
if (env["webp"]=="yes"):
|
||||||
SConscript("webp/SCsub");
|
SConscript("webp/SCsub");
|
||||||
SConscript("dds/SCsub");
|
SConscript("dds/SCsub");
|
||||||
|
|
|
@ -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)
|
|
17
drivers/register_driver_types.cpp
vendored
17
drivers/register_driver_types.cpp
vendored
|
@ -31,7 +31,6 @@
|
||||||
#include "png/image_loader_png.h"
|
#include "png/image_loader_png.h"
|
||||||
#include "png/resource_saver_png.h"
|
#include "png/resource_saver_png.h"
|
||||||
#include "webp/image_loader_webp.h"
|
#include "webp/image_loader_webp.h"
|
||||||
#include "jpegd/image_loader_jpegd.h"
|
|
||||||
#include "dds/texture_loader_dds.h"
|
#include "dds/texture_loader_dds.h"
|
||||||
#include "etc1/texture_loader_pkm.h"
|
#include "etc1/texture_loader_pkm.h"
|
||||||
#include "pvr/texture_loader_pvr.h"
|
#include "pvr/texture_loader_pvr.h"
|
||||||
|
@ -82,10 +81,6 @@ static ResourceSaverPNG *resource_saver_png=NULL;
|
||||||
static ImageLoaderWEBP *image_loader_webp=NULL;
|
static ImageLoaderWEBP *image_loader_webp=NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef JPG_ENABLED
|
|
||||||
static ImageLoaderJPG *image_loader_jpg=NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DDS_ENABLED
|
#ifdef DDS_ENABLED
|
||||||
static ResourceFormatDDS *resource_loader_dds=NULL;
|
static ResourceFormatDDS *resource_loader_dds=NULL;
|
||||||
#endif
|
#endif
|
||||||
|
@ -140,13 +135,6 @@ void register_core_driver_types() {
|
||||||
ImageLoader::add_image_format_loader( image_loader_webp );
|
ImageLoader::add_image_format_loader( image_loader_webp );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef JPG_ENABLED
|
|
||||||
|
|
||||||
image_loader_jpg = memnew( ImageLoaderJPG );
|
|
||||||
ImageLoader::add_image_format_loader( image_loader_jpg );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
pbm_loader = memnew( ResourceFormatPBM );
|
pbm_loader = memnew( ResourceFormatPBM );
|
||||||
ResourceLoader::add_resource_format_loader(pbm_loader);
|
ResourceLoader::add_resource_format_loader(pbm_loader);
|
||||||
|
|
||||||
|
@ -165,11 +153,6 @@ void unregister_core_driver_types() {
|
||||||
memdelete( image_loader_webp );
|
memdelete( image_loader_webp );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef JPG_ENABLED
|
|
||||||
if (image_loader_jpg)
|
|
||||||
memdelete( image_loader_jpg );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
memdelete( pbm_loader );
|
memdelete( pbm_loader );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
19
modules/jpg/SCsub
Normal file
19
modules/jpg/SCsub
Normal file
|
@ -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')
|
6
modules/jpg/config.py
Normal file
6
modules/jpg/config.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
|
||||||
|
def can_build(platform):
|
||||||
|
return True
|
||||||
|
|
||||||
|
def configure(env):
|
||||||
|
pass
|
|
@ -30,7 +30,8 @@
|
||||||
|
|
||||||
#include "print_string.h"
|
#include "print_string.h"
|
||||||
#include "os/os.h"
|
#include "os/os.h"
|
||||||
#include "jpgd.h"
|
|
||||||
|
#include <jpgd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
44
modules/jpg/register_types.cpp
Normal file
44
modules/jpg/register_types.cpp
Normal file
|
@ -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 );
|
||||||
|
}
|
30
modules/jpg/register_types.h
Normal file
30
modules/jpg/register_types.h
Normal file
|
@ -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();
|
11
thirdparty/README.md
vendored
11
thirdparty/README.md
vendored
|
@ -1,6 +1,17 @@
|
||||||
# Third party libraries
|
# 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
|
## libpng
|
||||||
|
|
||||||
- Upstream: http://libpng.org/pub/png/libpng.html
|
- Upstream: http://libpng.org/pub/png/libpng.html
|
||||||
|
|
Loading…
Reference in a new issue